rbreaves / kinto

Mac-style shortcut keys for Linux & Windows.
http://kinto.sh
GNU General Public License v2.0
4.43k stars 213 forks source link

Clear Terminal shortcut is not working #606

Open neerajjain92 opened 2 years ago

neerajjain92 commented 2 years ago

Describe the bug Clear terminal shortcut isn't working

What it does: Clear the terminal Mac hotkey: CMD+L Linux hotkey: Ctr+L

But isn't working

Expected behavior It should clean up the terminal

Install Type: Bare Metal Distro: Ubuntu 20.04.3 LTS DE: Gnome, XFCE, KDE Branch: master, dev Commit: git rev-parse --short HEAD

RedBearAK commented 2 years ago

@neerajjain92

You don't mention which terminal application you're using. The Cmd+L shortcut works fine for me here with gnome-terminal, but I notice that with Kinto disabled my GNOME Terminal app is responding to both Ctrl+L and Ctrl+Shift+L by clearing the screen. So it is therefore working for me both with the physical Ctrl key (which will send Ctrl+L in terminals) and with the physical Alt key (which will send Ctrl+Shift+L in terminals).

There is only one line in the ~/.config/kinto/kinto.py config file which deals with Cmd+L remapping in terminals:

    K("RC-L"): K("C-Shift-L"),

This line is remapping the "RC" or Control_R (right control) keycode with "L" to Ctrl+Shift+L. This is done because most shortcuts in terminals (like cut/copy/paste) require the Shift key to be added. Under Kinto remapping this "RC+L" shortcut comes from using the physical Alt+L keys. If your terminal application isn't set up to respond to Ctrl+Shift+L but only responds to Ctrl+L without the Shift key code added, you may want to change that line to the one below, restart Kinto, and see if it works:

    K("RC-L"): K("C-L"),

Alternately, if you are using the physical Alt key on a PC keyboard to try to perform this function, you should actually be able to use the physical Ctrl key position instead, which would issue a key code of "LC-L" or Control_L (left control) and "L". Which should still work in the same way it does without Kinto enabled. But if you want it to work by using the "Cmd" key (the physical Alt key that is being remapped logically to Ctrl) then you will need to try the line change shown above. Just remove the "Shift-" part.

Please let us know exactly which terminal application you're using and whether this works for you. That specific application may need an override added to the config file for that function.

rbreaves commented 2 years ago

Good catch, we will need to know the specific terminal app involved before action can be taken.

felipealvesgnu commented 1 year ago

@RedBearAK and @rbreaves I'm having the same problem. The shortcut is intercepted by SO and triggers Win+L that locks desktop. 😢

I'm using this configuration: SO: Windows 10 Terminal: WindowsTerminal

RedBearAK commented 1 year ago

@felipealvesgnu

In Windows you can't disable the Win+L shortcut without editing the registry, and if you disable it in the registry you can't lock the desktop anymore 🤯 . Without modifying the AutoHotkey script to be constantly changing the relevant registry key (which seems inadvisable) there's no way around this.

But, Win+L is the equivalent (under Kinto's modifier remapping) of Option+L, not Cmd+L. So you shouldn't run into that problem unless you're trying to use the Option-key special character entry shortcut to make the ¬ character. What you would normally be using on a PC keyboard is the physical Alt+L keys, which should send "clear" into the terminal emulator window. So I'm a little bit confused why you're having the problem in the first place. Unless you're using an Apple keyboard with Windows. In which case Windows will see the Command key as the Windows/Super key, and that will trigger the Win+L shortcut issue, because Windows completely ignores the modifier remapping when those physical keys are pressed.

        ^l::Send clear{Enter}
        ; #l::return
        ; Clear Terminal and Scroll Buffer
        ^k::Send clear && printf '\e[3J'{Enter}

This shouldn't be an issue when using a PC keyboard.

felipealvesgnu commented 1 year ago

@RedBearAK I'm using an apple layout keyboard. As you said, I disabled in the registry. But my previous problem was when I was using WindowsTerminal with WSL2 running an Ubuntu image. Because there is a shortcut ctrl+L that cleans the terminal (POSIX standard) and kinto.sh was ignoring it, until I modify the kinto.ahk file on this line link to: <^l::Send ^l

that’s all. If you have any recommendation, let me know. thank you 😊

RedBearAK commented 1 year ago

I don't know how to fix issues like that, unless you can examine the window properties with the tool that comes with AutoHotkey (I think it's called Window Spy) and see if there is a way to identify some property of the window that tells you that the terminal is a WSL2 terminal. I don't spend much time in Windows and don't really know how that stuff works.