summarylogtreecommitdiffstats
path: root/swaymsg-root.sh
blob: d1fff12cafeca31bc7b49a74d278a394e61d94d7 (plain)
1
2
3
4
5
6
7
8
#!/usr/bin/env sh

# it will get only the first instance of sway
SWAY_PID="$(pgrep "^sway$" | head -n1)"
USER_ID="$(stat -c "%u" "/proc/${SWAY_PID}/")"
USER="$(id -nu "${USER_ID}")"

SWAYSOCK="/run/user/${USER_ID}/sway-ipc.${USER_ID}.${SWAY_PID}.sock" su "${USER}" -c "swaymsg $*"