Skip to content

Commit

Permalink
pomodoro: Add WSL support
Browse files Browse the repository at this point in the history
Disable notifications there until
microsoft/WSL#2466 is resolved.

Also use `(( ))` as opposed to `-eq 1`.
  • Loading branch information
polyzen committed Jun 6, 2024
1 parent 0f26b36 commit bc04241
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions workstation/.local/bin/pomodoro
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,30 @@ timer() {
tmux rename-window -t "$PANE_ID" "$1"
fi

toastify send "$1" "$interval_msg" 45
if [[ -z $WSLENV ]]; then
toastify send "$1" "$interval_msg" 45
fi

args=("${ARGS[@]}" "-T $1")
termdown "${args[@]}" "$2"

if [[ $BEEP -eq 1 ]]; then
beep -f 5000 -l 50 -r 2
if (( BEEP )); then
if [[ -n $WSLENV ]]; then
powershell.exe '[console]::beep(5000,50) + [console]::beep(5000,50)'
else
beep -f 5000 -l 50 -r 2
fi
fi
}

pomodoro() {
local break_msg break_time interval_msg

for ((i = 1; i <= ${#INTERVALS[*]}; i++)); do
for (( i = 1; i <= ${#INTERVALS[*]}; i++ )); do
# Highlight (in bold) intervals as they pass
interval_msg="<b>${INTERVALS[*]:0:i}</b> ${INTERVALS[*]:i}"

if ((i < ${#INTERVALS[*]})); then
if (( i < ${#INTERVALS[*]} )); then
break_msg="$SHORT_BREAK_MSG"
break_time="$SHORT_BREAK_TIME"
else
Expand All @@ -81,7 +87,7 @@ pomodoro() {
done
}

if [[ $LOOP -eq 1 ]]; then
if (( LOOP )); then
while true; do
pomodoro
done
Expand Down

0 comments on commit bc04241

Please sign in to comment.