aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYaroslav de la Peña Smirnov <yps@yaroslavps.com>2021-10-14 15:16:55 +0300
committerYaroslav de la Peña Smirnov <yps@yaroslavps.com>2021-10-14 15:16:55 +0300
commitf79b8c8ed3d34588d35134cc19e60b059a4064e7 (patch)
treebbb15cdeeaddfb870696f88e9fdcc7c471378628
parent75395bc792fe2cdd1f508f657ca289829b80c506 (diff)
downloadswayrice-f79b8c8ed3d34588d35134cc19e60b059a4064e7.tar.gz
swayrice-f79b8c8ed3d34588d35134cc19e60b059a4064e7.zip
swaygetcurrentwindow fixed
Made it into a python script because using shell for this one just makes it messier, even though this python version is slower by ~0.02s.
-rwxr-xr-xdotfiles/.local/bin/swaygetcurrentwindow10
1 files changed, 5 insertions, 5 deletions
diff --git a/dotfiles/.local/bin/swaygetcurrentwindow b/dotfiles/.local/bin/swaygetcurrentwindow
index 4489115..4feecbb 100755
--- a/dotfiles/.local/bin/swaygetcurrentwindow
+++ b/dotfiles/.local/bin/swaygetcurrentwindow
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/usr/bin/env python3
+import i3ipc
-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')"
+sway = i3ipc.Connection()
+win = sway.get_tree().find_focused().rect
+print("{},{} {}x{}".format(win.x, win.y, win.width, win.height))