[BUG] Cmd+Braces (brackets) combos not working on ABNT2 (Brazilian Portuguese) layout
Bare metal or virtual machine:
(If in VM, which VM software): Bare metal
(Try running 'toshy-env' in a terminal.)
Linux distro name:
Distro version: Pop!_OS 22;04
X11/Xorg or Wayland: X11/Xorg
Desktop environment(s): Gnome 42.9
Any DE(s) tried with Wayland?: No
Keyboard type (IBM, Chromebook, Windows, Apple): Windows
Keyboard device name (try 'toshy-devices'): Dell KB216 Wired Keyboard
These terminal commands may provide helpful info:
- toshy-services-log
- toshy-services-status
- toshy-config-start-verbose
- toshy-devices
- toshy-env
Problem observed:
Command–Left Bracket ([): Go to the previous folder/page.
Command–Right Bracket (]): Go to the next folder/page.
Don't seem to be working for me. Are they supported?
You're trying to use the bracket keys in web browsers? File managers? Something else?
Many shortcuts in Toshy are specific to groups of applications (like browsers, or terminals) or an individual app.
The app info will show up in a dialog if you do this:
Shift+Option+Cmd+I,I (double-tap the "I" key quickly)
File manager (Gnome Files) and web broswer (Chromium — Flatpak).
Just checked and it works in Firefox :thinking:
Works for me in Pop, in the Files app. You should see Org.gnome.Nautilus as the app class in the info dialog.
You have to have a history of locations or it won't do anything, of course.
Chromium should definitely work. I have it installed as a Flatpak. Works here. Check the window context info.
The tab navigation shortcuts should also work: Shift+Cmd+Braces (bracket keys)
Ok, I'll check and see if I can figure out what's going on.
Shift+Cmd+Left Braces, both in Chromium and Files works backwards (switches to next tab) and Shift+Cmd+Right Braces doesn't work.
Are you on a non-US keyboard layout?
And this is a good time to do the toshy-config-verbose-start in a terminal to see the debugging output and get a better idea what's happening.
What you're describing is pretty odd. Unless you're on a non-US layout.
What would be interesting is just seeing the log output when you press the left bracket key, and when you press the right bracket key.
Non-US layout (ABNT2, Brazilian Portuguese). But the odd thing is that the previous / next page (Cmd + [ and Cmd + ]) work in Firefox (but Cmd + Shift + [ or ] don't).
Running toshy-config-verbose-start and...
Pressing [
(II) in RIGHT_BRACE (press)
(DD) on_key RIGHT_BRACE press
(DD) KBTYPE: 'Windows' | (CACHED) Default type for dev: 'Dell KB216 Wired Keyboard'
(OO) press RIGHT_BRACE 1694587376.27232
(II) in RIGHT_BRACE (release)
(DD) on_key RIGHT_BRACE release
(OO) release RIGHT_BRACE 1694587376.276198
Pressing ]
(II) in BACKSLASH (press)
(DD) on_key BACKSLASH press
(DD) KBTYPE: 'Windows' | (CACHED) Default type for dev: 'Dell KB216 Wired Keyboard'
(OO) press BACKSLASH 1694587404.3499663
(II) in BACKSLASH (release)
(DD) on_key BACKSLASH release
(OO) release BACKSLASH 1694587404.35456
Pressing Cmd + [
(II) in LEFT_ALT (press)
(DD) KBTYPE: 'Windows' | (CACHED) Default type for dev: 'Dell KB216 Wired Keyboard'
(DD) MODMAP: LEFT_ALT => RIGHT_CTRL [Cond modmap - GUI - Win kbd]
(DD) on_key RIGHT_CTRL press
(DD) suspending keys: [RCtrl<Key.RIGHT_CTRL>]
(DD) resuming keys: [<Key.RIGHT_CTRL: 97>]
(OO) press RIGHT_CTRL 1694586587.603299
(II) in RIGHT_BRACE (press)
(DD) on_key RIGHT_BRACE press
(DD) KBTYPE: 'Windows' | (CACHED) Default type for dev: 'Dell KB216 Wired Keyboard'
(DD) WM_CLASS: 'Chromium-browser' | WM_NAME: '[BUG] Command + Left Bracket ([) and Command + Right Bracket (]) not working · Issue #90 · RedBearAK/toshy - Chromium'
(DD) DEVICE: 'Dell KB216 Wired Keyboard' | CAPS_LOCK: 'False' | NUM_LOCK: 'False'
(DD) ACTIVE KEYMAPS:
'OptSpecialChars - US', 'User hardware keys', 'Chrome Browsers Overrides',
'General Web Browsers', 'Wordwise - not vscode', 'Cmd+Dot not in
… terminals', 'GenGUI overrides: not Chromebook', 'GenGUI overrides:
… Pop!_OS', 'GenGUI overrides: GNOME', 'General GUI', 'Diagnostics'
(DD) COMBO: RCtrl-RIGHT_BRACE => Alt-RIGHT in KMAP: 'Chrome Browsers Overrides'
(DD) spent modifiers []
(OO) release RIGHT_CTRL 1694586587.7636037
(OO) press LEFT_ALT 1694586587.7638245
(OO) press RIGHT 1694586587.7761526
(OO) release RIGHT 1694586587.7763486
(OO) release LEFT_ALT 1694586587.794703
(OO) press RIGHT_CTRL 1694586587.7950299
(II) in RIGHT_BRACE (release)
(DD) on_key RIGHT_BRACE release
(II) in LEFT_ALT (release)
(DD) on_key RIGHT_CTRL release
(DD) resume because of mod release
(OO) release RIGHT_CTRL 1694586587.863822
Pressing Cmd + ]
(II) in LEFT_ALT (repeat)
(DD) on_key RIGHT_CTRL repeat
(OO) repeat RIGHT_CTRL 1694586867.962301
(II) in BACKSLASH (press)
(DD) on_key BACKSLASH press
(DD) KBTYPE: 'Windows' | (CACHED) Default type for dev: 'Dell KB216 Wired Keyboard'
(OO) press BACKSLASH 1694586868.0756917
Pressing Cmd + Shift + [
(II) in LEFT_ALT (press)
(DD) KBTYPE: 'Windows' | (CACHED) Default type for dev: 'Dell KB216 Wired Keyboard'
(DD) MODMAP: LEFT_ALT => RIGHT_CTRL [Cond modmap - GUI - Win kbd]
(DD) on_key RIGHT_CTRL press
(DD) suspending keys: [RCtrl<Key.RIGHT_CTRL>]
(II) in LEFT_SHIFT (press)
(DD) KBTYPE: 'Windows' | (CACHED) Default type for dev: 'Dell KB216 Wired Keyboard'
(DD) on_key LEFT_SHIFT press
(DD) resuspending keys
(DD) suspending keys: [RCtrl<Key.RIGHT_CTRL>, LShift<Key.LEFT_SHIFT>]
(DD) resuming keys: [<Key.RIGHT_CTRL: 97>, <Key.LEFT_SHIFT: 42>]
(OO) press RIGHT_CTRL 1694587113.7893238
(OO) press LEFT_SHIFT 1694587113.7894917
(II) in RIGHT_BRACE (press)
(DD) on_key RIGHT_BRACE press
(DD) KBTYPE: 'Windows' | (CACHED) Default type for dev: 'Dell KB216 Wired Keyboard'
(DD) WM_CLASS: 'Chromium-browser' | WM_NAME: '(1) [BUG] Command + Left Bracket ([) and Command + Right Bracket (]) not working · Issue #90 · RedBearAK/toshy - Chromium'
(DD) DEVICE: 'Dell KB216 Wired Keyboard' | CAPS_LOCK: 'False' | NUM_LOCK: 'False'
(DD) ACTIVE KEYMAPS:
'OptSpecialChars - US', 'User hardware keys', 'Chrome Browsers Overrides',
'General Web Browsers', 'Wordwise - not vscode', 'Cmd+Dot not in
… terminals', 'GenGUI overrides: not Chromebook', 'GenGUI overrides:
… Pop!_OS', 'GenGUI overrides: GNOME', 'General GUI', 'Diagnostics'
(DD) COMBO: RCtrl-LShift-RIGHT_BRACE => Ctrl-PAGE_DOWN in KMAP: 'General GUI'
(DD) spent modifiers []
(OO) release LEFT_SHIFT 1694587113.9349852
(OO) press PAGE_DOWN 1694587113.9473584
(OO) release PAGE_DOWN 1694587113.9476254
(OO) press LEFT_SHIFT 1694587113.9660268
(II) in RIGHT_BRACE (release)
(DD) on_key RIGHT_BRACE release
(II) in LEFT_ALT (release)
(DD) on_key RIGHT_CTRL release
(DD) resume because of mod release
(OO) release RIGHT_CTRL 1694587114.141639
Pressing Cmd + Shift + ]
(II) in LEFT_ALT (press)
(DD) KBTYPE: 'Windows' | (CACHED) Default type for dev: 'Dell KB216 Wired Keyboard'
(DD) MODMAP: LEFT_ALT => RIGHT_CTRL [Cond modmap - GUI - Win kbd]
(DD) on_key RIGHT_CTRL press
(DD) suspending keys: [RCtrl<Key.RIGHT_CTRL>]
(II) in LEFT_SHIFT (press)
(DD) KBTYPE: 'Windows' | (CACHED) Default type for dev: 'Dell KB216 Wired Keyboard'
(DD) on_key LEFT_SHIFT press
(DD) resuspending keys
(DD) suspending keys: [RCtrl<Key.RIGHT_CTRL>, LShift<Key.LEFT_SHIFT>]
(II) in BACKSLASH (press)
(DD) on_key BACKSLASH press
(DD) KBTYPE: 'Windows' | (CACHED) Default type for dev: 'Dell KB216 Wired Keyboard'
(DD) resuming keys: [<Key.RIGHT_CTRL: 97>, <Key.LEFT_SHIFT: 42>]
(OO) press RIGHT_CTRL 1694587275.3499005
(OO) press LEFT_SHIFT 1694587275.3500626
(OO) press BACKSLASH 1694587275.3501554
(II) in BACKSLASH (release)
(DD) on_key BACKSLASH release
(OO) release BACKSLASH 1694587275.3568249
(II) in LEFT_SHIFT (release)
(DD) on_key LEFT_SHIFT release
(DD) resume because of mod release
(OO) release LEFT_SHIFT 1694587275.4713576
(II) in LEFT_ALT (release)
(DD) on_key RIGHT_CTRL release
(DD) resume because of mod release
(OO) release RIGHT_CTRL 1694587275.4870374
Correction: The previous / next page (Cmd + [ and Cmd + ]) work in Firefox (but Cmd + Shift + [ or ] don't).
Unfortunately you may need to make some adjustments, either to the way you use the keyboard or to the config file, or even to the key definition file that determines how key codes are translated into key symbols by the virtual keyboard the keymapper creates.
Take a look at an image of the standard US layout. You should find that if you treat the two keys to the right of the "P" key as Left_Brace, Right_Brace, everything should work more like you expect.
I'll explain in the next comment what the problem is.
Here's my understanding of the issue with non-US layouts with this keymapper (xkeysnail/keyszer). It uses the Python evdev module, and operates closer to the hardware than the displays server or Wayland compositor. The keymapper has no idea what the keyboard layout is. It has a key definition file that was made for the standard US layout.
For all the keys that match the US layout, everything will seem to work fine. Even if the keys are getting remapped as part of an input combo.
But for keys that don't match and are getting remapped, the keymapper will send an unexpected key, from the US layout. Which is why your Left_Brace acts like Right_Brace. That's where Right_Brace is on the US layout. (That's what the keys are called in the key definition file.)
So you will find that many shortcuts will work like you think they should, but some won't. And maybe you can adjust the config file to fix some of them, but the best way to fix everything is to try and translate the key definitions in the key.py file.
It's kind of complicated, and I've been looking for a good solution for a long time, with no success.
Oh, I see. Now it makes perfect sense. Indeed, using Cmd with the key immediately to the left of my [ acts as Cmd + [.
I'll see if I can mess with the files you mentioned and figure it out. Thank you again!
Should I close the issue, or change the title and leave it open?
Go ahead and leave it, maybe add the keyboard layout name to the title.
You'll find the key.py file somewhere like this:
~/.config/toshy/.venv/lib64/python3.10/site-packages/keyszer/models/key.py
That's where I see it on Pop.
In theory, if you get in there and just change where it says something like RIGHT_BRACE to LEFT_BRACE and where it says APOSTROPHE to RIGHT_BRACE, you could get those keys to work after restarting Toshy.
Let me know how it goes.
Perfect! Will do that. Thanks for the instructions.
And if you need to get to those extra symbols, you want to engage the "Alt_Gr on Right Cmd" option in the Preferences submenu on the tray icon menu. Then you should be in relatively decent shape with your layout. 👍🏽
Restarting Toshy is not necessary when changing options in the tray icon menu, or the GUI app. Only when editing the config file.
Here's another FYI, if you do edit the key.py file. If you ever run the Toshy installer again, that whole .venv folder will get erased. The installer script creates a new .venv each time to make sure it has all the right stuff inside.
So, make sure you keep a backup of your changes to that file.
If you can make a complete fix for all issues on your keyboard layout, we might be able to include your alternate key.py in the branch of ``keyszer` that Toshy installs, so it would be easier to switch it out with the original file.
Someday I'd like to have a way to switch between different key definition files easily, to work better with international layouts.
Good to know!
If you can make a complete fix for all issues on your keyboard layout, we might be able to include your alternate key.py in the branch of ``keyszer` that Toshy installs, so it would be easier to switch it out with the original file.
Nice! I'll mess around and see how far I manage to get.
Built-in support for other layouts would be really nice indeed.