diff options
Diffstat (limited to 'dotfiles')
-rwxr-xr-x | dotfiles/.local/bin/swaygetcurrentwindow | 10 |
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)) |