nixos-config/home/sway/scripts/terminal.sh

15 lines
519 B
Bash
Raw Permalink Normal View History

2024-11-21 19:46:30 -05:00
#!/usr/bin/env bash
2024-10-22 11:53:19 -04:00
focused_workspace=$(swaymsg -t get_workspaces | jq '.[] | select(.focused == true) | .num')
foot_window_count=$(swaymsg -t get_tree | jq --argjson workspace "$focused_workspace" '[recurse(.nodes[]?) | select(.type == "workspace" and .num == $workspace) | recurse(.nodes[]?) | select(.app_id == "foot")] | length')
2024-10-22 11:53:19 -04:00
next_session=$((focused_workspace * 10))
if [ "$foot_window_count" -gt 0 ]
2024-10-22 11:53:19 -04:00
then
2024-12-04 22:53:37 -05:00
next_session=$((next_session + foot_window_count))
2024-10-22 11:53:19 -04:00
fi
2024-12-04 22:53:37 -05:00
foot tmux new-session -A -s ${next_session}