aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.local
diff options
context:
space:
mode:
Diffstat (limited to 'dotfiles/.local')
-rwxr-xr-xdotfiles/.local/bin/swaygetcurrentwindow7
1 files changed, 4 insertions, 3 deletions
diff --git a/dotfiles/.local/bin/swaygetcurrentwindow b/dotfiles/.local/bin/swaygetcurrentwindow
index e6403a6..4489115 100755
--- a/dotfiles/.local/bin/swaygetcurrentwindow
+++ b/dotfiles/.local/bin/swaygetcurrentwindow
@@ -1,5 +1,6 @@
#!/bin/sh
-xydata=$(swaymsg -t get_tree | grep -B 5 '"focused": true' | head -n 4 | tr -d '\n\r' | sed -e 's/[^0-9,]//g' -e 's/,/ /2' -e 's/,/x/2')
-
-echo $xydata
+echo "$(swaymsg -t get_tree |\
+ jq 'recurse(.nodes[]) | if .focused then .rect else empty end' |\
+ tr -d '\n\r' |\
+ sed -e 's/[^0-9,]//g' -e 's/,/ /2' -e 's/,/x/2')"