summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2016-01-12 22:17:53 +0100
committerDave Davenport <qball@gmpclient.org>2016-01-12 22:18:10 +0100
commitcc682f107b740a549e6526589854128f94d3bb46 (patch)
tree60c094d991107c10263ec802fd2ccce4a0b0b4b0
parent95dbbf6616b84426e40d1439b8a9b6dc9de7a485 (diff)
Update display value for modi (testing)
-rw-r--r--include/mode-private.h2
-rw-r--r--include/mode.h4
-rw-r--r--source/dialogs/combi.c3
-rw-r--r--source/dialogs/dmenu.c1
-rw-r--r--source/dialogs/drun.c1
-rw-r--r--source/dialogs/run.c1
-rw-r--r--source/dialogs/ssh.c1
-rw-r--r--source/dialogs/window.c2
-rw-r--r--source/mode.c15
-rw-r--r--source/rofi.c10
10 files changed, 39 insertions, 1 deletions
diff --git a/include/mode-private.h b/include/mode-private.h
index d52419e9..511f4e61 100644
--- a/include/mode-private.h
+++ b/include/mode-private.h
@@ -38,6 +38,8 @@ struct _Mode
{
/** Name (max 31 char long) */
char name[32];
+ char cfg_name_key[128];
+ char *display_name;
/** Keybindings (keysym and modmask) */
char * keycfg;
char * keystr;
diff --git a/include/mode.h b/include/mode.h
index d53475fc..9d00e0c2 100644
--- a/include/mode.h
+++ b/include/mode.h
@@ -206,5 +206,9 @@ void *mode_get_private_data ( const Mode *mode );
* Set the private data object.
*/
void mode_set_private_data ( Mode *mode, void *pd );
+
+const char *mode_get_display_name ( const Mode *mode );
+
+void mode_set_config ( Mode *mode );
/*@}*/
#endif
diff --git a/source/dialogs/combi.c b/source/dialogs/combi.c
index 52604c37..d9f2921b 100644
--- a/source/dialogs/combi.c
+++ b/source/dialogs/combi.c
@@ -222,7 +222,7 @@ static char * combi_mgrv ( const Mode *sw, unsigned int selected_line, int *stat
for ( unsigned i = 0; i < pd->num_switchers; i++ ) {
if ( selected_line >= pd->starts[i] && selected_line < ( pd->starts[i] + pd->lengths[i] ) ) {
char * str = mode_get_display_value ( pd->switchers[i], selected_line - pd->starts[i], state, TRUE );
- char * retv = g_strdup_printf ( "(%s) %s", mode_get_name ( pd->switchers[i] ), str );
+ char * retv = g_strdup_printf ( "%s %s", mode_get_display_name ( pd->switchers[i] ), str );
g_free ( str );
return retv;
}
@@ -257,6 +257,7 @@ static char * combi_get_completion ( const Mode *sw, unsigned int index )
Mode combi_mode =
{
.name = "combi",
+ .cfg_name_key = "display-combi",
.keycfg = NULL,
.keystr = NULL,
.modmask = AnyModifier,
diff --git a/source/dialogs/dmenu.c b/source/dialogs/dmenu.c
index bee4152f..1bd02c53 100644
--- a/source/dialogs/dmenu.c
+++ b/source/dialogs/dmenu.c
@@ -330,6 +330,7 @@ static int dmenu_is_not_ascii ( const Mode *sw, unsigned int index )
Mode dmenu_mode =
{
.name = "dmenu",
+ .cfg_name_key = "display-combi",
.keycfg = NULL,
.keystr = NULL,
.modmask = AnyModifier,
diff --git a/source/dialogs/drun.c b/source/dialogs/drun.c
index 1c029368..e472fa3a 100644
--- a/source/dialogs/drun.c
+++ b/source/dialogs/drun.c
@@ -363,6 +363,7 @@ static int drun_is_not_ascii ( const Mode *sw, unsigned int index )
Mode drun_mode =
{
.name = "drun",
+ .cfg_name_key = "display-drun",
.keycfg = NULL,
.keystr = NULL,
.modmask = AnyModifier,
diff --git a/source/dialogs/run.c b/source/dialogs/run.c
index 38ab2342..98fc000a 100644
--- a/source/dialogs/run.c
+++ b/source/dialogs/run.c
@@ -386,6 +386,7 @@ static int run_is_not_ascii ( const Mode *sw, unsigned int index )
Mode run_mode =
{
.name = "run",
+ .cfg_name_key = "display-run",
.keycfg = NULL,
.keystr = NULL,
.modmask = AnyModifier,
diff --git a/source/dialogs/ssh.c b/source/dialogs/ssh.c
index 49e99178..d503d0e3 100644
--- a/source/dialogs/ssh.c
+++ b/source/dialogs/ssh.c
@@ -492,6 +492,7 @@ static int ssh_is_not_ascii ( const Mode *sw, unsigned int index )
Mode ssh_mode =
{
.name = "ssh",
+ .cfg_name_key = "display-ssh",
.keycfg = NULL,
.keystr = NULL,
.modmask = AnyModifier,
diff --git a/source/dialogs/window.c b/source/dialogs/window.c
index 31d71a55..379f8005 100644
--- a/source/dialogs/window.c
+++ b/source/dialogs/window.c
@@ -591,6 +591,7 @@ static int window_is_not_ascii ( const Mode *sw, unsigned int index )
Mode window_mode =
{
.name = "window",
+ .cfg_name_key = "display-window",
.keycfg = NULL,
.keystr = NULL,
.modmask = AnyModifier,
@@ -608,6 +609,7 @@ Mode window_mode =
Mode window_mode_cd =
{
.name = "windowcd",
+ .cfg_name_key = "display-windowcd",
.keycfg = NULL,
.keystr = NULL,
.modmask = AnyModifier,
diff --git a/source/mode.c b/source/mode.c
index 3f229883..c637fbcd 100644
--- a/source/mode.c
+++ b/source/mode.c
@@ -165,4 +165,19 @@ void mode_set_private_data ( Mode *mode, void *pd )
}
mode->private_data = pd;
}
+
+const char *mode_get_display_name ( const Mode *mode )
+{
+ if ( mode->display_name != NULL ) {
+ return mode->display_name;
+ }
+ return mode->name;
+}
+
+void mode_set_config ( Mode *mode )
+{
+ snprintf ( mode->cfg_name_key, 128, "display-%s", mode->name );
+ mode->display_name = g_strdup_printf ( "(%s)", mode->name );
+ config_parser_add_option ( xrm_String, mode->cfg_name_key, (void * *) &( mode->display_name ), "The display name of this browser" );
+}
/*@}*/
diff --git a/source/rofi.c b/source/rofi.c
index a0ef91a2..6659661b 100644
--- a/source/rofi.c
+++ b/source/rofi.c
@@ -2056,6 +2056,7 @@ static void setup_modi ( void )
Mode *sw = script_switcher_parse_setup ( token );
if ( sw != NULL ) {
modi[num_modi].sw = sw;
+ mode_set_config ( sw );
num_modi++;
}
else{
@@ -2073,6 +2074,15 @@ static void setup_modi ( void )
for ( unsigned int i = 0; i < num_modi; i++ ) {
mode_setup_keybinding ( modi[i].sw );
}
+ mode_set_config ( &ssh_mode );
+ mode_set_config ( &run_mode );
+ mode_set_config ( &drun_mode );
+
+#ifdef WINDOW_MODE
+ mode_set_config ( &window_mode );
+ mode_set_config ( &window_mode_cd );
+#endif // WINDOW_MODE
+ mode_set_config ( &combi_mode );
}
/**