This guide will cover the best way to get MacOS keyboard shortcuts on KDE Plasma 6
You've probably been messing with your shortcuts already. I would recommend returning them to their defaults to ensure everything here works as intended.
- KDE System Settings -> Keyboard -> Shortcuts
- Click the Defaults button, then the Apply button
Keyd is a low level keyboard remapper that will work globally, intercepting your keystrokes before they get to Wayland/X11/KDE.
- Check if your distro has a keyd package available and use that if you want (confirm it's v2 or above)
- Check the keyd readme for installation instructions
- Compile it yourself (see below)
sudo dnf install git gcc make systemd-devel
git clone https://github.com/rvaiya/keyd
cd keyd
make
sudo make install
sudo touch /etc/keyd/default.conf
sudo systemctl enable keyd --now
Edit /etc/keyd/default.conf and paste the following # sudo nano /etc/keyd/default.conf
[ids]
*
[main]
# leave main empty for now, or add other stuff later
[alt]
c = macro(C-c)
v = macro(C-v)
a = macro(C-a)
x = macro(C-x)
s = macro(C-s)
z = macro(C-z)
f = macro(C-f)
grave = macro(C-grave)
[control]
# Ctrl+A -> Home (beginning of line)
# Ctrl+E -> End (end of line)
a = macro(home)
e = macro(end)
After editing /etc/keyd/default.conf you will want to run:
sudo systemctl restart keyd
To check for any errors run the following:
sudo systemctl status keyd
Look for lines like: WARNING: /etc/keyd/default.conf:14: Z is not a valid key or alias
WARNING - These will override text navigation shortcuts that you may use, I use different shortcuts personally.
- KDE System Settings -> Keyboard -> Shortcuts
- Click on Window Management
- Find "Switch one desktop to the left", set to ctrl+left arrow
- Find "Switch one desktop to the right", set to ctrl+right arrow
- Find "Toggle Overview", set to Ctrl+Up arrow
- Find "Toggle Present Windows (Window Class)", set to Ctrl+Down arrow
- Find "Maximize Window", set to Meta+Alt+F (meta is your Windows/Super key)
Yakuake shortcuts are confusing, but it can be configured to work in the most ideal way. To avoid confusion, when setting the below shortcuts, use your ctrl key, but the alt version will work because keyd has remapped it.
- Start Yakuake and hit F12 to bring it up (or your already configured shortcut)
- Click the middle button on the bottom right and click Configure Keyboard Shortcuts
- When searching for the following below, make sure you're under the Konsolepart section and NOT the Yakuake section. If you see copy and paste listed under the "Yakuake" section, unset them.
- Search for Paste in the search box, then set the Alternate to ctrl+v
- Search for Copy in the search box, if you see two that say "Copy", use the second one that probably isn't set at all. Set it to ctrl+c.
- I personally like the old school Quake shortcut for my drop down terminal, so I set the Open/Retract Yakuake shortcut to ctrl+` which then also will work with alt because we made alt send ctrl+grave with keyd.
- Split windows (item2 style shortcuts)
- Search for "split" and make sure you edit the Yakuake items NOT the Konsolepart items (this is the opposite of what we did above)
- WARNING: Be careful here, if you hit Alt+D while not setting the shortcuts then Alt+d will reset all Yakuake shortcuts back to defaults
- Set Split Left/Right to Alt+D
- Set Split Up/Down to Alt+Shift+D
Quit Yakuake and start it again to make sure everything works correctly. If setup correctly, you should be able to hit ctrl+c and it will send a ^C. IF you highlight some text and then press ctrl+c, it should copy that text instead of sending ^C. Now try the same using alt+c.
Firefox is fine with this setup by default, but Firefox shows the File/Edit/etc menu at the top when you press alt by itself. There doesn't seem to be a way for keyd to nullifiy a key AND still use it for macros, so the best thing to do is just disable it in Firefox.
- Goto about:config
- Search for ui.key.menuAccessKeyFocuses
- Set it to
false
VSCode has the same issues as Firefox when pressing alt by itself. If you want to disable this behavior, add the following to your settings.json:
"window.titleBarStyle": "custom",
"window.customMenuBarAltFocus": false,
"window.enableMenuBarMnemonics": false,
"window.menuBarVisibility": "visible"