elenapan/config/sway/scripts/window-do
2024-12-14 01:41:23 +02:00

11 lines
385 B
Bash
Executable file

#!/usr/bin/env bash
# Accepts:
# 1. a window condition and a sway command to be applied to the window if it exists
# 2. a command to be run if the window does not exist
# i3 example
# [ "$(i3-msg '[class=Emacs] focus')" = '[{"success":true}]' ] || i3-msg exec "Emacs"
# swaymsg does not return a string (by default), but we can use the return code
swaymsg "$1" || swaymsg exec "$2"