Created
March 28, 2021 10:39
-
-
Save mintyleaf/065e28f705c51f1a2323ff18bf0bd26e to your computer and use it in GitHub Desktop.
brysendtomon.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
mon() { | |
for i in $(lsd); do | |
echo $(dattr x $i)\;$i | |
done | |
} | |
CMON=$(pfd || eDP1) | |
MONS=$(mon | sort) | |
s=0 | |
e=$(echo $MONS | wc -w) | |
while [ "$s" -lt "$e" ]; do | |
[ "$CMON" = "$(echo $MONS | cut -d' ' -f$(($s+1)) | cut -d\; -f2)" ] && \ | |
break | |
s=$((s+1)) | |
done | |
[ "$1" = "next" ] && s=$((s+1)) | |
[ "$1" = "prev" ] && s=$((s-1)) | |
[ "$s" -lt "0" ] && s=$((e-1)) | |
[ "$s" -ge "$e" ] && s=0 | |
TM=$(echo $MONS | cut -d' ' -f$((s+1)) | cut -d\; -f2) | |
DATTR=$(dattr xy $TM) | |
DX=$(echo $DATTR | cut -d' ' -f1) | |
DY=$(echo $DATTR | cut -d' ' -f2) | |
berryc window_move_absolute $DX $DY | |
berryc window_center |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment