#keybind #sway

bin+lib swaymode-exec

run commands when sway changes keybind mode

4 releases (2 stable)

1.0.1 May 29, 2025
0.1.1 Aug 30, 2024
0.1.0 Aug 30, 2024

#12 in #keybind

Download history

141 downloads per month

BSD-4-Clause

6KB
138 lines

swaymode-exec

Hi, this is a daemon for sway that runs commands on kekybind mode changes.
I like to use it to set screen timeouts or for custom keybinds for eww.

Configuring

# This should go into $HOME/${XDG_CONFIG_HOME:-.config}/swaymode-exec.toml
# All commands are run by sh; so if you need to run multiple commands use '&'

[mode-name-to-trigger-on]
start = "command-to-run-when-mode-is-activated"
end = "command-to-run-when-mode-is-deactivated"
kill_start = "command-to-run-when-mode-is-activated-and-to-kill-when-mode-is-deactivated"

ToDo:

  • specify custom config file
  • run commands via swayipc
  • warn if sway does not know the mode specified in the config file
  • handle shell commands that fail

Dependencies

~1–1.9MB
~41K SLoC