RedBearAK / toshy

Keymapper config to make Linux work like a 'Tosh!
https://toshy.app
GNU General Public License v3.0
226 stars 15 forks source link

[BUG] CTRL+. (ctrl+dot) doesn't work for Quick Fix in VSCode (code-oss) #263

Closed visvital closed 2 months ago

visvital commented 2 months ago
Bare metal or virtual machine: Bare metal
(If in VM, which VM software): None

(Try running 'toshy-env' in a terminal to fill out the following fields...)

(EV) Toshy env module sees this environment:
         DISTRO_ID       = 'manjaro'
         DISTRO_VER      = 'notfound'
         VARIANT_ID      = 'notfound'
         SESSION_TYPE    = 'wayland'
         DESKTOP_ENV     = 'gnome'
         DE_MAJ_VER      = '45'

Keyboard type (IBM, Chromebook, Windows, Apple): Auto-adapt (windows)
Keyboard device name (try 'toshy-devices'): /dev/input/event17   XWayKeyz (virtual) Keyboard         py-evdev-uinput

Problem observed: When in the vscode (code-oss) the Quick Fix is activated by pressing ctrl+. (ctrl+dot), nothing happens. Unfortuntaly, it is not clear if this can be fixed without the remapping of the Quick Fix shortcut to something else (which is unwanted).

RedBearAK commented 2 months ago

@visvital

That's odd, the "Code - OSS" app I have here matches the VSCode keymap and Cmd+Dot does the Quick Fix thing, as far as I can tell. There's an override in the keymap to redirect the general shortcut to Ctrl+Dot.

keymap("VSCodes", {

    # C("Super-Space"):           C("C-Space"),                  # Basic code completion (conflicts with input switching)

    # Override the global Cmd+Dot (Escape/cancel) shortcut for QuickFix in VSCode(s)
    C("RC-Dot"):                C("C-Dot"),                     # QuickFix, overriding global shortcut

Can you check the app class with the diagnostic dialog? Use Shift+Opt+Cmd+I,I (double-tap the "I" key quickly).

Mine is literally 'Code - OSS', which is in the list of VSCode variants:

vscodes_lod = [
    {clas: "^code$"},
    {clas: "^vscodium$"},
    {clas: "^code - oss$"},
]

So I don't know why it wouldn't be working.

Oh, maybe I get what you're saying, you want the Linux shortcut to work on physical Ctrl+Dot? But the config uses Cmd+Dot, like macOS. In non-terminal apps the physical Ctrl key becomes the Meta/Super/Win key.

If you want it to work on physical Ctrl+Dot you'll need to make a custom keymap and put it in the "user_apps" editable slice like this:

###################################################################################################
###  SLICE_MARK_START: user_apps  ###  EDITS OUTSIDE THESE MARKS WILL BE LOST ON UPGRADE

keymap("User hardware keys", {

}, when = matchProps(not_lst=remotes_lod))

keymap("User override VSCodes", {
    C("Super-Dot"):    C("C-Dot"),        # Remap Super-Dot back to Ctrl-Dot for Quick Fix
}, when = matchProps(lst=vscodes_lod))

###  SLICE_MARK_END: user_apps  ###  EDITS OUTSIDE THESE MARKS WILL BE LOST ON UPGRADE
###################################################################################################

If you don't put it inside an editable slice like this, it will get lost when reinstalling Toshy. (To be clear, this editable slice already exists, just search for "user_apps" in the config file. You can open the config folder from the tray icon menu. The config file is toshy_config.py.)

I hope this will solve your issue. If not please clarify what the problem is by specifying which physical keys you are trying to use.

visvital commented 2 months ago

No, what I needed is accurately the ability to use "cmd+." for Quick Fixes. For some other reason, the code-oss app is not defined though:

Class: 'code-oss' 
Title: '● dsasdfasdf • Untitled-1 - Vitaly - Code - OSS' 

Input keyboard name: 'AT Translated Set 2 keyboard' 
Device seen as type: 'Windows' 

Toshy config file sees this environment:  
 • DISTRO_ID ____________ 'manjaro' 
 • DISTRO_VER ___________ 'notfound' 
 • VARIANT_ID ___________ 'notfound' 
 • SESSION_TYPE _________ 'wayland' 
 • DESKTOP_ENV __________ 'gnome' 
 • DE_MAJ_VER ___________ '45' 

Do any app class groups match on this window?:  
 • Terminals ____________ 'False' 
 • Remotes/VMs __________ 'False' 
 • File Managers ________ 'False' 
 • Web Browsers _________ 'False' 
 • VSCode(s) ____________ 'False' 
 • Dialogs ______________ 'False' 
RedBearAK commented 2 months ago

@visvital

Looks like your problem is just that the app class doesn't have spaces, unlike the "Code - OSS" app I have on my system. Hopefully someone told them spaces in the app class were not a good idea.

As you can see here, the app is not matching on the VSCodes group, so the whole VSCodes keymap(s) won't be activating.

 • VSCode(s) ____________ 'False' 

If you find this list in your toshy_config.py and update it to look like this, it should fix your problem.

vscodes_lod = [
    {clas: "^code$"},
    {clas: "^vscodium$"},
    {clas: "^code - oss$|^code-oss$"},
]

You can open the Toshy config folder from the tray icon menu.

I'll be making this update to the default Toshy config file, so if you were to reinstall Toshy sometime later, you shouldn't lose this new tweak to the list of VSCode variant app classes.

visvital commented 2 months ago

Perfect, it worked :) Thank you!

RedBearAK commented 2 months ago

@visvital

Perfect, it worked :)

Great. Thanks for reporting the issue so I can fix it.

RedBearAK commented 2 months ago

@visvital

Updated the default Toshy config by merging PR #265 .