From f79b8c8ed3d34588d35134cc19e60b059a4064e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yaroslav=20de=20la=20Pe=C3=B1a=20Smirnov?= Date: Thu, 14 Oct 2021 15:16:55 +0300 Subject: 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. --- dotfiles/.local/bin/swaygetcurrentwindow | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'dotfiles/.local/bin') 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)) -- cgit v1.2.3