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 "__i3_scratch"
#8: floating_con "foot" (xdg_shell, pid: 1061, app_id: "foot")
#3: output "DP-2"
#4: workspace "1"
#9: con "Mozilla Firefox" (xdg_shell, pid: 1122, app_id: "firefox")
#103: con "foot" (xdg_shell, pid: 156873, app_id: "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
