mirror of
https://github.com/elenapan/dotfiles.git
synced 2025-12-26 15:14:58 +08:00
11 lines
385 B
Bash
Executable file
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"
|
|
|