rbreaves / kinto

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

Command Spacebar to open Ulauncher #840

Open seal308 opened 6 months ago

seal308 commented 6 months ago

Hello I just installed kinto and it works pretty well! My command button on my macbook air running lubuntu works like before when it was running mac OS. My brightness buttons work.

I use Ulauncher to open apps.

ulauncher eg

Ulauncher allows you to set up your own shortcut to open it

You set it up by entering the key combination (not typing it out):

setup ulauncher

The hotkey I currently set that is working is "Ctrl+Escape" which is my command button and the escape key.

However when I try to do command space bar ulauncher recognizes it and sets it to "Alt + Control R" If i do command with any other key like the enter or caps lock, ulauncher recognizes it as "Ctrl+keyName"

When it is set as "Alt + Control R", Command space bar works! The problem is command tab to shift between apps doesn't work and opens ulauncher.

I tried stopping kinto and setting ulauncher with "regular control button to set "Ctrl+Space" but when I restart kinto command space is not recognized to open ulauncher.

Right now I'm ok with using control escape but I'd really like to use command space to open ulauncher.

seal308 commented 6 months ago

I was able to get command space to open ulauncher using lubuntu's global shortcut setting.

global shortcut ulauncher

It still shows us as alt+f1 for some reason while other command combinations show control + keyname. But I no longer have the issue of pressing command tab and it opening ulauncher instead of switching apps.

RedBearAK commented 6 months ago

@seal308

Looks like you found the solution already, but the way it works is there is a remap in the Kinto config file for Cmd+Space. For different desktop environments it may map onto Alt+F1 or Ctrl+Esc or something else, and in some DEs you have to manually set the native shortcut to whatever the Kinto config is remapping the Cmd+Space shortcut onto, or nothing will be triggered by the Cmd+Space shortcut.

If you go looking for it, you will see the shortcut remap as a line with "RC-Space" in the config file, in the part on the left side of the colon ":" in keymaps. There may be more than one. The one being applied for Lubuntu/LXQt must remap to Alt+F1, that's why it works when you set the Ulauncher command to Alt+F1.

In some DEs this stuff around Cmd+Space and Alt+F1 never seems to work, and that Kinto remap has to be disabled and replaced by a native global shortcut, or just the shortcut binding in the app you're trying to trigger. Depends on the desktop environment and the app.

Ulauncher v6 may work a little differently with the keybinding, so you may not run into the "Alt + Control R" kind of problem with v6. But it will probably still depend on whether the desktop shell catches that shortcut before the Ulauncher app can see it.

seal308 commented 6 months ago

@RedBearAK

Yes in the config file I see:

K("RC-Space"): K("Alt-F1"),                   # Default SL - Launch Application Menu (gnome/kde)

I think I was confused because I thought the command key was mapped to the control key but I guess kinto maps certain combinations of keys instead of individual keys.

So I guess kinto takes precedence before system shortcuts and other apps and the system play with the resulting shortcut key combinations from kinto instead of the original combinations.

Another thing I wanted to do was have windows snapping split screen. Lubuntu uses open box and it has a config file called rc.xml.

To do left, right snapping and maximizing and unmaximizing windows without kinto using a Shift it's:

<keybind key="S-Left">
      <action name="UnmaximizeFull"/>
      <action name="MaximizeVert"/>
      <action name="MoveResizeTo">
        <width>50%</width>
      </action>
      <action name="MoveToEdge">
        <direction>west</direction>
      </action>
    </keybind>
    <keybind key="S-Right">
      <action name="UnmaximizeFull"/>
      <action name="MaximizeVert"/>
      <action name="MoveResizeTo">
        <width>50%</width>
      </action>
<action name="MoveToEdge">
        <direction>east</direction>
      </action>
    </keybind>
<keybind key="S-Down">
      <action name="Unmaximize"/>
    </keybind>
    <keybind key="S-Up">
      <action name="Maximize"/>
    </keybind>
  </keyboard>

I wanted to use the left alt key to the left of the mac's command key which itself is left of the space bar. To get this done with kinto it was:

<keybind key="C-Left"> //set to left windows snap
...
<keybind key="C-Right"> //set to right windows snap
...
<keybind key="A-Down"> //set to unmaximize
...
<keybind key="A-Up"> //set to maximize

And looking at the kinto config file that makes sense because alt left is mapped to control left:

K("Alt-Left"): K("C-Left"), 

For Alt up (maximize) I see:

K("Alt-Up"): K("C-w"),      

So I guess my question is, for my openbox config file why isn't it?:

<keybind key="C-w"> //set to maximize

Instead of what i had working above:

<keybind key="A-Up"> //set to maximize
RedBearAK commented 6 months ago

@seal308

I'm not the Kinto dev, BTW, but I've used it a long time and made my own spin-off project that does a few things like adding some Wayland support (which is irrelevant to Lubuntu, for now).

I think I was confused because I thought the command key was mapped to the control key but I guess kinto maps certain combinations of keys instead of individual keys.

It is indeed modmapped to RIGHT_CTRL on both sides of the Space bar. Cmd key if you are on an Apple keyboard, or Alt keys if you are on a PC keyboard. So everywhere you see "RC" in the config, that's the Cmd key, or at least whatever is at the physical position of the Cmd key on an Apple keyboard.

So I guess kinto takes precedence before system shortcuts and other apps and the system play with the resulting shortcut key combinations from kinto instead of the original combinations.

Yeah, it kind of operates "under" most other things. Which causes some problems with non-US keyboard layouts.

Another thing I wanted to do was have windows snapping split screen.

Window snapping shortcuts are not a thing in macOS, and they are different on most Linux desktop environments, so that's something you'll just have to figure out, if it will fit into Kinto's existing remaps. Often they will conflict with the navigation/selection shortcuts. Like, Cmd+Left/Right in macOS is Home/End while editing text, and Option+Left/Right are to jump one word to the left/right.

You seem to have deleted the question about Super, but Super/Win/Meta/Cmd are all the same key code, just different names in different operating systems and desktop environments. Very annoying. And the keymapper Kinto uses (xkeysnail) incorrectly uses "Meta" to refer to the Alt key, but the Linux kernel uses "Meta" to refer to the same key code as the common "Windows" key, which is the same as the Mac "Command" key. GNOME calls it Super.

It's also important to understand that when in a terminal app with Kinto, there is no Super/Meta/Win key available, the physical Ctrl keys become Ctrl keys again, so that terminal-based apps mostly act the same way when Kinto is enabled. So you can base a general shortcut remap on that physical key position, but you may also need a separate remap in the terminals keymap to remap "LC+Key" (LEFT_CTRL) rather than Super+Key. There are a few instances of this in the Kinto config already.

So I guess my question is, for my openbox config file why isn't it?:

I think you're looking at a remap that is only for a specific app (JetBrains). That would not be active unless you are using some kind of JetBrains app.

define_keymap(re.compile("^jetbrains-(?!.*toolbox).*$", re.IGNORECASE),{
...
    K("Alt-Up"): K("C-w"),                        # Extend selection
...

There doesn't seem to be any general remap for Alt+Up, so it should just work as Alt+Up. But there are remaps for Alt+Left/Right shortcuts to do "wordwise" stuff, which will now no longer work if you use those as global shortcuts.

define_keymap(lambda wm_class: wm_class.casefold() not in mscodes,{
    # Wordwise remaining - for Everything but VS Code
    K("Alt-Left"): K("C-Left"),               # Left of Word
    K("Alt-Shift-Left"): K("C-Shift-Left"),   # Select Left of Word
    K("Alt-Right"): K("C-Right"),             # Right of Word
    K("Alt-Shift-Right"): K("C-Shift-Right"), # Select Right of Word