aboutsummaryrefslogtreecommitdiffhomepage
path: root/X11/show_timer.sh
blob: 149b11a633d3243c96445dc3241d043ec9b3fc71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#! /bin/sh

origin="$(xdotool getactivewindow)"
export origin

# If --context is set, apply exit command and different color
if echo "$@" | grep -qs '\--context'; then
  COMMAND_EXIT='~/helper/bin/task/context $count'
  export COLOR=33
fi

# If timer is set, focus to it and exit
xdotool search --name "TIMER" windowactivate && exit 0

# Add new window for a timer
# Use SIGINT to toggle each mode
# Use xdotool to reactivate original window user focus
# After timer is closed or finished, append time into context file
alacritty --title TIMER --hold      \
  -o window.dimensions.columns=8 	\
  -o window.dimensions.lines=1 	    \
  -o window.position.x=-0		    \
  -o window.position.y=0		    \
  -o window.opacity=0.6		        \
  -o font.size=40 	                \
  -e ~/helper/bin/unix/timer.sh \
        SIGINT \
        "xdotool windowactivate $origin" \
        "$COMMAND_EXIT"