aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.local/bin/swaygetcurrentwindow
diff options
context:
space:
mode:
authorYaroslav de la Peña Smirnov <yps@yaroslavps.com>2021-05-04 03:39:39 +0300
committerYaroslav de la Peña Smirnov <yps@yaroslavps.com>2021-05-04 03:41:36 +0300
commit7b0f37451da08ad99c3ce10998d772c9603645ec (patch)
treef0e6e578910590032fcace21c7c2d3f86a2c355b /dotfiles/.local/bin/swaygetcurrentwindow
parent2dcdb880365f4ac3222e852986e285fdf8789a88 (diff)
downloadswayrice-7b0f37451da08ad99c3ce10998d772c9603645ec.tar.gz
swayrice-7b0f37451da08ad99c3ce10998d772c9603645ec.zip
Sway config and scripts changes
* Hide cursor while typing globally * Move cursor to focused container * Improve swaygetcurrentwindow script, used by other scripts
Diffstat (limited to 'dotfiles/.local/bin/swaygetcurrentwindow')
-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')"