438. Shortcuts and window rules
Every desktop-wide key chord on KDOS is a KDE global shortcut, held by kglobalaccel inside KWin, and every per-window setting is a KWin window rule. This page covers both as tasks: finding which shortcuts exist, the chords KDOS adds to KDE’s, changing and removing a chord, the touchpad and the mouse, virtual desktops, window rules and the rule each box gets, the KDOS KWin scripts, and what to check when a chord does nothing. The full table of shipped chords is in Keyboard shortcuts, and how KWin is set up on KDOS is in KWin.
Installation
| Port | Provides |
|---|---|
| kwin | The compositor, window rules, virtual desktops and the scripting and effect interfaces |
| kglobalacceld | The global shortcut daemon KWin loads |
| systemsettings with plasma-desktop | The Shortcuts, Window Rules, Virtual Desktops, KWin Scripts, Mouse and Touchpad pages |
| kwin-effect-kdos-keys | The key card on Meta+F1 and Meta+/: every global shortcut the session holds, searchable |
| kwin-script-kdos-runraise | One key per KDOS terminal program, which raises its window or opens one in Konsole |
| kwin-script-kdos-window-memory | A program’s window opens where its last one closed |
| krohnkite | The auto-tiling script, installed and off |
| kdos-appbox | Writes one window rule per box |
The KDOS defaults are in /usr/share/kdos/xdg/, the last of the configuration directories (see Session and environment). Nothing here is enabled by hand.
Configuration
The KDOS shortcuts
KDE’s defaults keep the window-management chords. KDOS rebinds two and adds the chords KDE leaves free, from fs/usr/share/kdos/xdg/kglobalshortcutsrc:
[kwin]
_k_friendly_name=KWin
# Meta+Q closes the window, beside Alt+F4; KDE gives it to the activity
# switcher, and KDOS ships no activity interface.
Window Close=Alt+F4\tMeta+Q,Alt+F4,Close Window
# Meta+F1 is the key card's; desktop 1 keeps Ctrl+F1.
Switch to Desktop 1=Ctrl+F1,Meta+F1\tCtrl+F1,Switch to Desktop 1
# The key card, the kdos_keys effect, registers Meta+F1 itself; Meta+/ is
# the same action's second key, so the Shortcuts page shows one row.
KDOS Key Card=Meta+F1\tMeta+/,Meta+F1,Show Key Card
# The bundled auto-tiler, Krohnkite, asks for eight chords the session
# already holds: Meta+L (lock), Meta+D (show desktop), Meta+T (tile editor),
# Meta+. (emoji), Meta+I (System Settings), Meta+R and Meta+Shift+R
# (Spectacle's recordings) and Meta+Return (Konsole). kglobalaccel gives a
# chord to whichever component registers it first, and a script turned on by
# `kdos tiling on` can come first, so these entries settle it in advance: the
# eight stay unbound until a person binds them. They are not moved to other
# chords: each would be one more chord held back from everything else for a
# script that is off by default, and testing/chordcheck.py holds every chord
# here against the rest.
KrohnkiteFocusNext=none,Meta+.,Krohnkite: Focus Next
KrohnkiteFocusRight=none,Meta+L,Krohnkite: Focus Right
KrohnkiteDecrease=none,Meta+D,Krohnkite: Decrease
KrohnkiteIncrease=none,Meta+I,Krohnkite: Increase
KrohnkiteRotate=none,Meta+R,Krohnkite: Rotate
KrohnkiteRotatePart=none,Meta+Shift+R,Krohnkite: Rotate Part
KrohnkiteSetMaster=none,Meta+Return,Krohnkite: Set master
KrohnkiteTileLayout=none,Meta+T,Krohnkite: Select Layout - Tile
[plasmashell]
_k_friendly_name=plasmashell
manage activities=none,Meta+Q,Show Activity Switcher
# Meta+Space opens KRunner, the KDOS command palette, beside KDE's three.
[services][org.kde.krunner.desktop]
_launch=Alt+Space\tAlt+F2\tSearch\tMeta+Space
# Meta+Return opens a terminal, beside Ctrl+Alt+T.
[services][org.kde.konsole.desktop]
_launch=Ctrl+Alt+T\tMeta+Return
# The KDOS capture keys: Print the whole screen (spectaclerc makes that
# Spectacle's launch action), Shift+Print a rectangle, Alt+Print a recording
# of a rectangle. Spectacle's own Shift+Print (the whole desktop) moves to
# Print. Meta+Shift+S, which KDE puts on the launch action and so on a
# rectangle, follows the rectangle rather than the launch action, and
# Meta+Shift+Print and Meta+Shift+R stay.
[services][org.kde.spectacle.desktop]
_launch=Print
FullScreenScreenShot=none
RectangularRegionScreenShot=Shift+Print\tMeta+Shift+Print\tMeta+Shift+S
RecordRegion=Meta+Shift+R\tMeta+R\tAlt+Print
fs/usr/share/kdos/xdg/kglobalshortcutsrc, lines 30–81
kglobalaccel reads ~/.config/kglobalshortcutsrc alone, never a file in a configuration directory. So plasma-workspace/env/kdos-shortcuts.sh copies each entry above into a person’s file before KWin starts, once: only an entry the person’s file has no value for, and only one it has not copied before. The copies are recorded in $XDG_STATE_HOME/kdos/kglobalshortcutsrc.seeded, so a chord a person resets to KDE’s default stays reset. A kglobalshortcutsrc in /etc/xdg is a layer above KDOS’s, read the same way.
No KDOS chord collides with KDE’s own defaults, with a chord an installed program declares in its X-KDE-Shortcuts, or with fcitx5’s hotkeys, and none is one the auto-tiler would take once it is switched on. testing/chordcheck.py, which testing/preflight.sh and make check run, checks all four.
Meta+Shift+T and Meta+Ctrl+Shift+N are not in that file: they are the desktop entries org.kdos.tiling.desktop and org.kdos.nightlight.desktop in /usr/share/kglobalaccel/, from kdos-tools, running kdos tiling toggle and kdos toggle night-light.
A new account runs every kconf_update step at its first login, with KWin already up, and KWin’s kwin-6.1-remove-gridview-expose-shortcuts would then delete the Present Windows keys (Meta+F9, Meta+F10, Meta+F7) the Window View effect has just registered. fs/usr/share/kdos/xdg/kconf_updaterc records that step as done, and kconf_update reads its record along the configuration directories. The same file records plasma-workspace’s migrate-calendar-plugins as done, which would otherwise rewrite the panels file under the desk’s first layout; see How a desk is laid out:
[kwin.upd]
done=kwin-6.1-remove-gridview-expose-shortcuts
[migrate-calendar-to-plugin-id.upd]
done=migrate-calendar-plugins
fs/usr/share/kdos/xdg/kconf_updaterc, lines 36–40
Virtual desktops
Four desktops in one row, named main, www, hack and misc, from fs/usr/share/kdos/xdg/kwinrc:
[Desktops]
Number=4
Rows=1
Id_1=5318b75b-7c55-447d-9c18-981db2306e7d
Id_2=e48a0f08-c8c6-4943-b478-4272b506a27f
Id_3=5261bdfd-b82a-4347-a0e6-a56e0e079cbd
Id_4=589fb33e-a92a-46f2-900a-20224832d1d0
Name_1=main
Name_2=www
Name_3=hack
Name_4=misc
fs/usr/share/kdos/xdg/kwinrc, lines 21–31
Ctrl+F1 to Ctrl+F4 switch to them; the Virtual Desktops page adds, removes and renames them.
Window rules
KWin keeps window rules in ~/.config/kwinrulesrc. A rule matches windows by class, title, role or type and sets or forces any window property: position, size, desktop, layer, decoration, colour scheme, focus. KDOS ships no rule of its own; kdos-appbox writes one per box, a group named kdos-box-<box> matching the box’s windows by class ^<box>(\.[^.]+)?$, which forces the title bar’s colour scheme to the box’s accent, or KDOSBox for a box with none. It rewrites only its own groups and keeps every other rule where it was. A window that draws its own title bar takes no decoration colour.
The KDOS KWin scripts
The run-or-raise keys of kwin-script-kdos-runraise:
| Key | Program |
|---|---|
Meta+Shift+M |
mc, files |
Meta+Shift+E |
aerc, mail |
Meta+Shift+B |
lynx, the web |
Meta+Shift+U |
rmpc, music |
Meta+Shift+C |
ikhal, the calendar |
Meta+Shift+G |
iamb, chat |
Meta+Shift+W |
micro, the editor |
Pressed again from one of the program’s windows, the key moves to the next. The window memory script keeps one place per program, by application id, in $XDG_STATE_HOME/kdos/window-memory. Both are on by default; the KWin Scripts page turns either off.
Usage
Finding the chords that exist
Meta+F1orMeta+/opens the key card, grouped into Windows, Desktops, Launch, KDOS, Accessibility and System, with a search field. It asks kglobalacceld each time it opens, so it shows the chords in force now.- System Settings → Shortcuts lists every component’s actions and lets you search by key.
- From a terminal:
qdbus6 org.kde.kglobalaccel /kglobalaccel allMainComponents.
Changing a shipped binding
- System Settings → Shortcuts.
- Find the action, for example KWin → Close Window.
- Click the key field and press the new chord, or Add a second one. A chord another action holds is reported, with the choice to take it.
- Apply. It applies at once and is saved in
~/.config/kglobalshortcutsrc.
Use Default puts KDE’s chord back; a KDOS chord reset that way is not copied in again at the next login.
Removing a binding
On the Shortcuts page, select the action and clear its key field (the cross beside it), then Apply.
Binding a command
- System Settings → Shortcuts → Add New → Command or Script.
- Give the command, for example
kdos theme amber, and a chord. - Apply. The entry is a desktop file in
~/.local/share/applications/with the chord recorded against it.
Adding a window rule
- Right-click a window’s title bar → More Actions → Configure Special Window Settings. The rule starts filled in with that window’s class and title.
- Add a property, for example Virtual Desktop, set it to Force and the value, and Apply.
System Settings → Window Rules lists every rule, a box’s among them, and imports and exports them as files.
Turning on auto-tiling
kdos tiling on # or off, or toggle
or turn Krohnkite on on the KWin Scripts page. While it is on, windows tile by themselves; the eight chords it would ask for that the session already holds stay unbound until you bind them.
Setting the touchpad and the mouse
System Settings → Touchpad and Mouse: tap to click, natural scrolling, speed and acceleration, per device. KWin applies them at once and keeps them in ~/.config/kcminputrc.
Tips
- A chord that a program grabs itself, such as a terminal’s
Ctrl+Shift+C, reaches the program only when no global shortcut holds it. kdos tiling on --only www,hacktiles only the virtual desktops named, by their names in the running session; Krohnkite leaves every other desktop floating.- The key card is an effect: System Settings → Desktop Effects → KDOS Key Card turns it off, and its chords go with it.
Troubleshooting
A chord does nothing.
- Open the key card and search for the chord. A chord listed under another action is held by it.
- Check that no application grabbed the keyboard: a virtual machine viewer or a game in full screen keeps chords from KWin while it has focus.
qdbus6 org.kde.kglobalaccel /component/kwin shortcutNameslists KWin’s own actions; an action missing there belongs to a script or effect that is off.
A KDOS chord is missing after an account was copied from another machine. The copy brought a kglobalshortcutsrc.seeded record that says the chord was already given. Delete ~/.local/state/kdos/kglobalshortcutsrc.seeded and log in again; only entries your file has no value for are copied.
A boxed window’s title bar is not tinted. The window draws its own title bar, or its box has no rule: grep -A6 kdos-box- ~/.config/kwinrulesrc. kdos-appbox writes the rule when it generates the box’s launchers.
Known gaps
- Known gaps: the desktop’s open items
See also
- Keyboard shortcuts: every shipped chord
- KWin: KWin as KDOS configures it, its scripts and effects
- The window model: placement, tiling and snapping
- Session and environment, Accessibility, Input methods