swaymsg
for sway-ipc
Discover a list of applications and their connection ids:
``` swaymsg -t get_tree
1: root "root"
#2147483647: output "i3" #2147483646: workspace "i3scratch" #8: floatingcon "foot" (xdgshell, pid: 1061, appid: "foot") #3: output "DP-2" #4: workspace "1" #9: con "Mozilla Firefox" (xdgshell, pid: 1122, appid: "firefox") #103: con "foot" (xdgshell, pid: 156873, appid: "foot") ```
Move firefox to workspace 4 with the connection id (con_id):
swaymsg '[con_id=9]' move window to workspace 4
Switch to workspace:
swaymsg workspace 4
Subscribe to a type of event, event types are listed in a JSON array:
swaymsg -t subscribe -m "['window']"
See these man pages for more detail:
man 5 sway
man 7 sway-ipc