mirror of
https://github.com/davatorium/rofi.git
synced 2025-07-31 21:59:25 -04:00
Keys via xresources, dump config.
This commit is contained in:
parent
3157358c63
commit
85172743ee
4 changed files with 65 additions and 5 deletions
|
@ -99,7 +99,7 @@ void config_sanity_check( void )
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !( config.location >= WL_CENTER && config.location <= WL_WEST ) )
|
if ( !( config.location >= WL_CENTER && config.location <= WL_WEST ) )
|
||||||
{
|
{
|
||||||
fprintf(stderr, "config.location is invalid. ( %d >= %d >= %d) does not hold.\n",
|
fprintf(stderr, "config.location is invalid. ( %d >= %d >= %d) does not hold.\n",
|
||||||
WL_WEST, config.location, WL_CENTER);
|
WL_WEST, config.location, WL_CENTER);
|
||||||
|
@ -112,3 +112,51 @@ void config_sanity_check( void )
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print out the current configuration.
|
||||||
|
*/
|
||||||
|
void config_print( void )
|
||||||
|
{
|
||||||
|
printf("Windows opacity: %3d%%\n", config.window_opacity);
|
||||||
|
printf("Border width: %3d\n", config.menu_bw);
|
||||||
|
printf("Padding: %3d\n", config.padding);
|
||||||
|
printf("Width: %4d%s\n", config.menu_width,
|
||||||
|
config.menu_width > 100? "px":"%");
|
||||||
|
printf("offset (x,y): (%2d,%2d)px\n", config.x_offset, config.y_offset);
|
||||||
|
printf("Location: ");
|
||||||
|
switch(config.location)
|
||||||
|
{
|
||||||
|
case WL_CENTER: printf(" Center\n"); break;
|
||||||
|
case WL_NORTH_WEST: printf("North West\n"); break;
|
||||||
|
case WL_NORTH: printf(" North\n"); break;
|
||||||
|
case WL_NORTH_EAST: printf("North East\n"); break;
|
||||||
|
case WL_EAST: printf(" East\n"); break;
|
||||||
|
case WL_EAST_SOUTH: printf("East South\n"); break;
|
||||||
|
case WL_SOUTH: printf(" South\n"); break;
|
||||||
|
case WL_SOUTH_WEST: printf("South West\n"); break;
|
||||||
|
case WL_WEST: printf(" West\n"); break;
|
||||||
|
default: printf(" Invalid\n"); break;
|
||||||
|
}
|
||||||
|
printf("# Lines: %3d\n", config.menu_lines);
|
||||||
|
printf("# Columns: %3d\n", config.menu_columns);
|
||||||
|
printf("Fixed number of lines: %5s\n", config.fixed_num_lines?"true":"false");
|
||||||
|
printf("Drawing mode: %10s\n",
|
||||||
|
config.hmode == VERTICAL?"Vertical":"Horizontal");
|
||||||
|
|
||||||
|
|
||||||
|
printf("Font: %35s\n", config.menu_font);
|
||||||
|
/* Colors */
|
||||||
|
printf("FG Color: %7s\n", config.menu_fg);
|
||||||
|
printf("BG Color: %7s\n", config.menu_bg);
|
||||||
|
printf("Highlight FG Color: %7s\n", config.menu_hlfg);
|
||||||
|
printf("Highlight BG Color: %7s\n", config.menu_hlbg);
|
||||||
|
printf("Border color: %7s\n", config.menu_bc);
|
||||||
|
|
||||||
|
/* Terminal */
|
||||||
|
printf("Terminal emulator: %22s\n", config.terminal_emulator);
|
||||||
|
/* Keybindings. */
|
||||||
|
printf("Window switcher key: %7s\n", config.window_key);
|
||||||
|
printf("Run dialog key: %7s\n", config.run_key);
|
||||||
|
printf("SSH dialog key: %7s\n", config.ssh_key);
|
||||||
|
}
|
||||||
|
|
|
@ -109,4 +109,5 @@ int token_match ( char **tokens, const char *input,
|
||||||
__attribute__( ( unused ) ) void *data );
|
__attribute__( ( unused ) ) void *data );
|
||||||
|
|
||||||
void config_sanity_check ( void );
|
void config_sanity_check ( void );
|
||||||
|
void config_print ( void );
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1903,6 +1903,11 @@ static void parse_cmd_options ( int argc, char ** argv )
|
||||||
{
|
{
|
||||||
config.hmode = HORIZONTAL;
|
config.hmode = HORIZONTAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Keybindings
|
||||||
|
find_arg_str ( argc, argv, "-key", &( config.window_key ) );
|
||||||
|
find_arg_str ( argc, argv, "-rkey", &( config.run_key ) );
|
||||||
|
find_arg_str ( argc, argv, "-skey", &( config.ssh_key ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cleanup ()
|
static void cleanup ()
|
||||||
|
@ -2028,6 +2033,12 @@ int main ( int argc, char *argv[] )
|
||||||
// Parse command line for settings.
|
// Parse command line for settings.
|
||||||
parse_cmd_options ( argc, argv );
|
parse_cmd_options ( argc, argv );
|
||||||
|
|
||||||
|
if ( find_arg ( argc, argv, "-dump" ) >= 0 )
|
||||||
|
{
|
||||||
|
config_print();
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
// Sanity check
|
// Sanity check
|
||||||
config_sanity_check ();
|
config_sanity_check ();
|
||||||
|
|
||||||
|
@ -2052,16 +2063,12 @@ int main ( int argc, char *argv[] )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Daemon mode, Listen to key presses..
|
// Daemon mode, Listen to key presses..
|
||||||
|
|
||||||
find_arg_str ( argc, argv, "-key", &( config.window_key ) );
|
|
||||||
parse_key ( config.window_key, &windows_modmask, &windows_keysym );
|
parse_key ( config.window_key, &windows_modmask, &windows_keysym );
|
||||||
grab_key ( windows_modmask, windows_keysym );
|
grab_key ( windows_modmask, windows_keysym );
|
||||||
|
|
||||||
find_arg_str ( argc, argv, "-rkey", &( config.run_key ) );
|
|
||||||
parse_key ( config.run_key, &rundialog_modmask, &rundialog_keysym );
|
parse_key ( config.run_key, &rundialog_modmask, &rundialog_keysym );
|
||||||
grab_key ( rundialog_modmask, rundialog_keysym );
|
grab_key ( rundialog_modmask, rundialog_keysym );
|
||||||
|
|
||||||
find_arg_str ( argc, argv, "-skey", &( config.ssh_key ) );
|
|
||||||
parse_key ( config.ssh_key, &sshdialog_modmask, &sshdialog_keysym );
|
parse_key ( config.ssh_key, &sshdialog_modmask, &sshdialog_keysym );
|
||||||
grab_key ( sshdialog_modmask, sshdialog_keysym );
|
grab_key ( sshdialog_modmask, sshdialog_keysym );
|
||||||
|
|
||||||
|
|
|
@ -75,6 +75,10 @@ static XrmOption xrmOptions[] = {
|
||||||
{ xrm_Number, "fixed_num_lines", { .num = &config.fixed_num_lines }, NULL },
|
{ xrm_Number, "fixed_num_lines", { .num = &config.fixed_num_lines }, NULL },
|
||||||
{ xrm_Number, "columns", { .num = &config.menu_columns }, NULL },
|
{ xrm_Number, "columns", { .num = &config.menu_columns }, NULL },
|
||||||
{ xrm_Number, "hmode", { .num = &config.hmode }, NULL },
|
{ xrm_Number, "hmode", { .num = &config.hmode }, NULL },
|
||||||
|
/* Key bindings */
|
||||||
|
{ xrm_String, "key", { .str = &config.window_key }, NULL },
|
||||||
|
{ xrm_String, "rkey", { .str = &config.run_key }, NULL },
|
||||||
|
{ xrm_String, "skey", { .str = &config.ssh_key }, NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue