Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't trigger any switches if there is only one URL in the list #31

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions scripts/switcher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ export XDG_RUNTIME_DIR=/run/user/1000
# count the number of URLs, that are configured to cycle through
URLS=$(jq -r '.urls | length' ~/piosk/config.json)

# swich tabs each 10s, refresh tabs each 10th cycle & then reset
for ((TURN=1; TURN<=$((10*URLS)); TURN++)) do
if [ $TURN -le $((10*URLS)) ]; then
wtype -M ctrl -P Tab
if [ $TURN -gt $((9*URLS)) ]; then
wtype -M ctrl r
if [ $TURN -eq $((10*URLS)) ]; then
(( TURN=0 ))
if [ $URLS -gt 1 ]; then
# swich tabs each 10s, refresh tabs each 10th cycle & then reset
for ((TURN=1; TURN<=$((10*URLS)); TURN++)) do
if [ $TURN -le $((10*URLS)) ]; then
wtype -M ctrl -P Tab
if [ $TURN -gt $((9*URLS)) ]; then
wtype -M ctrl r
if [ $TURN -eq $((10*URLS)) ]; then
(( TURN=0 ))
fi
fi
fi
fi
sleep 10
done
sleep 10
done
fi