Window-manager helpers for Regolith, for both i3 and sway: one resident daemon plus subcommands.
It replaces the separate resident helper scripts with a single program that keeps one IPC connection to the window manager. Each helper is a module that stays off until a drop-in configuration file enables it.
The scope is window-manager helpers for now. The project may grow into a more general Regolith command-line tool later.
rwm daemon [--verbose]runs the resident process for the window manager named byI3SOCKorSWAYSOCK(or, under i3, by the X root window). One daemon runs per window-manager socket; a second one exits at once. It exits when no module is enabled and when the window manager exits, and it survives an in-place i3 restart.rwm focusasks the daemon to focus the previously focused window. It fails when no daemon with thefocusmodule enabled serves the window manager.rwm gestures [--variable NAME=VALUE]... 'swipe:<fingers>:<direction>=<command>'...hands touchpad swipe bindings to the daemon, whether it runs already or starts later.rwm clipboard pick|delete|clear [ILIA-ARGS...]andrwm clipboard copy, andrwm emoji [ILIA-ARGS...]: see Clipboard history and emoji picker.
Start the daemon from the window-manager configuration, with exec so that no shell stays behind:
exec --no-startup-id exec rwm daemon
Modules are switched on by TOML drop-ins named *.toml in, from lowest to highest precedence:
/usr/share/regolith/rwm/conf.d(packages)/etc/regolith/rwm/conf.d(the administrator)$XDG_CONFIG_HOME/regolith/rwm/conf.d,~/.config/regolith/rwm/conf.dby default (the user)
A file replaces the file of the same name in a lower directory. The remaining files are applied in name order, so a value set in a later file wins. The daemon reads them again on every window-manager reload and switches modules on and off without restarting. Problems are logged with the file they come from, and the rest of the configuration still applies.
[focus]
enabled = true
stay_in_workspace = false
[workspace-memory]
enabled = true
[gestures]
enabled = true
[clipboard]
enabled = true
history_size = 100Log lines go to stderr as rwm: <component>: <message>. Only warnings and errors are logged unless the daemon runs with --verbose.
Toggles between the two most recently focused windows, skipping windows marked ignore_focus; with stay_in_workspace, only windows on the focused workspace qualify. A toggle is requested by a binding whose command is nop rwm focus (no process starts per key press), by rwm focus, or by SIGUSR1 to the process named in $XDG_RUNTIME_DIR/swap_focus.pid, which the daemon writes while the module is on:
bindsym $mod+period nop rwm focus
Moves workspaces back to their monitor when it returns after sleep, undocking or suspend, as sway does. Monitors are identified by their EDID (connector name as a fallback), so two monitors of the same model are told apart and a monitor that returns on another connector is recognised. Workspaces assigned to outputs in the i3 configuration are left to i3. Under sway the module stays off; sway does this itself.
Runs window-manager commands for three- and four-finger (and more) touchpad swipes, as sway's bindgesture does, from XInput 2.4 gesture events. The bindings come from rwm gestures, typically run from the i3 configuration with exec_always:
exec_always --no-startup-id rwm gestures \
'swipe:3:left=workspace next_on_output' \
'swipe:3:right=workspace prev_on_output'
The direction is the axis the fingers moved furthest along; cancelled swipes are ignored. Commands go to i3 over the daemon's IPC connection. Under sway the module stays off; sway has bindgesture.
Records copies to the clipboard in a history, and keeps the clipboard content when the application that copied it exits. See below.
Nothing turns these on unless you do: the clipboard module is off until a drop-in enables it, and the pickers only run from keybindings you add.
To use them, install ilia (the picker) and unicode-data (the emoji list); the package only suggests them. Then switch the module on with a drop-in such as ~/.config/regolith/rwm/conf.d/50-clipboard.toml:
[clipboard]
enabled = true
# How many entries the history keeps (100 by default).
history_size = 100and add bindings for the pickers to your i3 or sway configuration, passing the look's ilia stylesheet (the ilia.stylesheet resource) with -t, as the other ilia keys do:
bindsym $mod+Ctrl+v exec --no-startup-id rwm clipboard pick -t <stylesheet>
bindsym $mod+Ctrl+Shift+v exec --no-startup-id rwm clipboard delete -t <stylesheet>
bindsym $mod+Ctrl+Shift+Delete exec --no-startup-id rwm clipboard clear -t <stylesheet>
bindsym $mod+Ctrl+e exec --no-startup-id rwm emoji -t <stylesheet>
With the module on, the daemon records every copy to the clipboard: text as UTF-8 (Latin-1 STRING copies are converted) and images offered as image/png. The primary selection, empty copies, other types and copies from password managers (marked x-kde-passwordManagerHint) are not recorded, and the latter are never written anywhere. When the application behind a copy goes away, the daemon takes the clipboard over and serves the same content. It works on the daemon's X connection under i3, and on a Wayland connection of its own with the data-control protocol under sway; it reacts to clipboard events and never polls. Changing the drop-in and reloading the window manager switches it on or off and applies a new history_size.
The history has the layout of the regolith-clipboard script proposed in regolith-wm-config#118, so either program reads and updates the other's history: $XDG_STATE_HOME/regolith/clipboard/ (~/.local/state/regolith/clipboard/ by default), one file per entry named by the SHA-256 of its content, and an index listing them, newest first. Deleting, clearing and trimming remove the entry files.
rwm clipboard pickchooses an entry and puts it back on the clipboard, at the top of the history.rwm clipboard deletechooses an entry and removes it.rwm clipboard clearremoves every entry, after a confirmation row.rwm clipboard copyputs standard input (UTF-8 text) on the clipboard.rwm emojichooses among every fully-qualified emoji of/usr/share/unicode/emoji/emoji-test.txt, those picked recently first (kept in$XDG_STATE_HOME/regolith/emoji-recent), and puts the emoji on the clipboard.
The arguments after the action go to ilia, which runs as ilia -p textlist -l <label> -i <icon> <ILIA-ARGS...>. Content put back goes to the daemon when its clipboard module is on, and is recorded as a copy; otherwise one detached rwm clipboard serve process serves it until another application takes the clipboard, and the history is left alone.
cargo build --release --locked
debian/ builds the rwm package with dpkg-buildpackage -b.
GPL-2.0-or-later (see LICENSE). The focus module is a port of i3-swap-focus (MIT, © 2021 Olivier Le Moal), and the workspace-memory and gestures modules are ports of regolith-i3-workspace-memory and regolith-i3-touchpad-gestures from regolith-wm-config (MIT); see debian/copyright.