mirror of
https://github.com/lbonn/rofi
synced 2024-11-27 14:21:07 +00:00
Do some filtering on the keybinding, to get the right keycombo for alt+shift+s.
This commit is contained in:
parent
bd04e90d9e
commit
21bce63e79
2 changed files with 20 additions and 3 deletions
|
@ -111,7 +111,8 @@ void parse_keys_abe ( void )
|
||||||
abe[iter].num_bindings = 0;
|
abe[iter].num_bindings = 0;
|
||||||
|
|
||||||
// Iter over bindings.
|
// Iter over bindings.
|
||||||
for ( char *entry = strtok_r ( keystr, ",", &sp ); entry != NULL; entry = strtok_r ( NULL, ",", &sp ) ) {
|
for ( char *entry = strtok_r ( keystr, ",", &sp ); entry != NULL; entry = strtok_r ( NULL, ",", &sp ) )
|
||||||
|
{
|
||||||
abe[iter].kb = g_realloc ( abe[iter].kb, ( abe[iter].num_bindings + 1 ) * sizeof ( KeyBinding ) );
|
abe[iter].kb = g_realloc ( abe[iter].kb, ( abe[iter].num_bindings + 1 ) * sizeof ( KeyBinding ) );
|
||||||
KeyBinding *kb = &( abe[iter].kb[abe[iter].num_bindings] );
|
KeyBinding *kb = &( abe[iter].kb[abe[iter].num_bindings] );
|
||||||
x11_parse_key ( entry, &( kb->modmask ), &( kb->keysym ) );
|
x11_parse_key ( entry, &( kb->modmask ), &( kb->keysym ) );
|
||||||
|
|
|
@ -437,8 +437,24 @@ void x11_parse_key ( char *combo, unsigned int *mod, xkb_keysym_t *key )
|
||||||
while ( i > 0 && !strchr ( "-+", combo[i - 1] ) ) {
|
while ( i > 0 && !strchr ( "-+", combo[i - 1] ) ) {
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
|
xkb_keysym_t sym = XKB_KEY_NoSymbol;
|
||||||
xkb_keysym_t sym = xkb_keysym_from_name ( combo + i, XKB_KEYSYM_NO_FLAGS );
|
if ( ( modmask&x11_mod_masks[X11MOD_SHIFT] ) != 0 ){
|
||||||
|
gchar * str = g_utf8_next_char ( combo + i );
|
||||||
|
// If it is a single char, we make a capital out of it.
|
||||||
|
if ( str != NULL && *str == '\0'){
|
||||||
|
int l = 0;
|
||||||
|
char buff[8];
|
||||||
|
gunichar v = g_utf8_get_char ( combo + i );
|
||||||
|
gunichar u = g_unichar_toupper ( v );
|
||||||
|
if ( ( l = g_unichar_to_utf8 ( u, buff ) ) ) {
|
||||||
|
buff[l] = '\0';
|
||||||
|
sym = xkb_keysym_from_name ( buff, XKB_KEYSYM_NO_FLAGS );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( sym == XKB_KEY_NoSymbol ) {
|
||||||
|
sym = xkb_keysym_from_name ( combo + i, XKB_KEYSYM_NO_FLAGS );
|
||||||
|
}
|
||||||
|
|
||||||
if ( sym == XKB_KEY_NoSymbol || ( !modmask && ( strchr ( combo, '-' ) || strchr ( combo, '+' ) ) ) ) {
|
if ( sym == XKB_KEY_NoSymbol || ( !modmask && ( strchr ( combo, '-' ) || strchr ( combo, '+' ) ) ) ) {
|
||||||
g_string_append_printf ( str, "Sorry, rofi cannot understand the key combination: <i>%s</i>\n", combo );
|
g_string_append_printf ( str, "Sorry, rofi cannot understand the key combination: <i>%s</i>\n", combo );
|
||||||
|
|
Loading…
Reference in a new issue