Skip to content

Instantly share code, notes, and snippets.

@zax4r0
Last active June 24, 2024 11:07
Show Gist options
  • Save zax4r0/ff818396b8fcca92ade4174606608995 to your computer and use it in GitHub Desktop.
Save zax4r0/ff818396b8fcca92ade4174606608995 to your computer and use it in GitHub Desktop.
scripts
#!/bin/sh
###############
# Cycle windows
# (C) 2024 zax4r0 <zax4r0@gmail.com>
# GNU General Public License v3.0
###############
timer_file=$(dirname $(realpath "$0"))"/alt_tab_timer.txt"
if [[ $(( $(date +%s%N | cut -b1-13 ) - $(cat "$timer_file") )) -ge 1000 ]]
then
xdotool keydown alt
fi
date +%s%N | cut -b1-13 > "$timer_file"
case "$@" in
shift)
xdotool key Shift+Tab
;;
*)
xdotool key Tab
;;
esac
sleep 1
if [[ $(( $(date +%s%N | cut -b1-13) - $(cat "$timer_file") )) -ge 1000 ]]
then
xdotool keyup alt
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment