Skip to content

Instantly share code, notes, and snippets.

@mintyleaf
Created March 28, 2021 10:39
Show Gist options
  • Save mintyleaf/065e28f705c51f1a2323ff18bf0bd26e to your computer and use it in GitHub Desktop.
Save mintyleaf/065e28f705c51f1a2323ff18bf0bd26e to your computer and use it in GitHub Desktop.
brysendtomon.sh
#!/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