scripts

various script and utils
git clone git://z3bra.org/scripts
Log | Files | Refs

commit ced7417566ef91c24c7634dc850516ee7520438a
parent 1d19c7bb79c98db394b919a3a01cf1bcbdc8dfd6
Author: z3bra <willy@mailoo.org>
Date:   Sun Feb 15 12:38:43 +0100

focus windows depending on their position

Diffstat:
focus | 36++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+), 0 deletions(-)
diff --git a/focus b/focus @@ -0,0 +1,36 @@ +#!/bin/sh +# +# z3bra - 2014 (c) wtfpl +# focus windows by positions +# depends on: vroum + +# get current window id +CUR=$(pfw) + +usage() { + echo "usage: $(basename $0) <east|west|north|south>" + exit 1 +} + +next_east() { + lsw | xargs wattr xi | sort -nr | sed "0,/$CUR/d" | sed "1s/^[0-9]* //p;d" +} + +next_west() { + lsw | xargs wattr xi | sort -n | sed "0,/$CUR/d" | sed "1s/^[0-9]* //p;d" +} + +next_north() { + lsw | xargs wattr yi | sort -nr | sed "0,/$CUR/d" | sed "1s/^[0-9]* //p;d" +} + +next_south() { + lsw | xargs wattr yi | sort -n | sed "0,/$CUR/d" | sed "1s/^[0-9]* //p;d" +} + +case $1 in + h|a|east|left) vroum $(next_east) 2>/dev/null ;; + j|s|south|down) vroum $(next_south) 2>/dev/null ;; + k|w|north|up) vroum $(next_north) 2>/dev/null ;; + l|d|west|right) vroum $(next_west) 2>/dev/null ;; +esac