about summary refs log tree commit diff
path: root/configs/shared/misc/.config/i3/dmenu_timer.sh
blob: 9d62ead730916c9690ba6ab873df5d802e8daeea (plain) (blame)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/usr/bin/env bash

# Select common timer intervals with dmenu and play an alarm sound when
# finished. Useful if you bind a KBD in a window manager such as i3. Pass the
# path to the alarm mp3 as the only argument.
#
# Usage: ./dmenu_timer.sh path/to/alarm.mp3

times=$(cat <<EOF
1 minute
2 minutes
3 minutes
4 minutes
5 minutes
10 minutes
15 minutes
20 minutes
30 minutes
45 minutes
1 hour
2 hours
EOF
)
selection=$(echo "$times" | dmenu)

case $selection in
  '1 minute')
    notify-send 'Timer' 'Set for 1 minute' && \
      sleep 1m && \
      notify-send 'Timer' 'Finished.' && \
      mpg123 $1 && \
      exit 0
    ;;
  '2 minutes')
    notify-send 'Timer' 'Set for 2 minute' && \
      sleep 2m && \
      notify-send 'Timer' 'Finished.' && \
      mpg123 $1 && \
      exit 0
    ;;
  '3 minutes')
    notify-send 'Timer' 'Set for 3 minutes' && \
      sleep 3m && \
      notify-send 'Timer' 'Finished.' && \
      mpg123 $1 && \
      exit 0
    ;;
  '4 minutes')
    notify-send 'Timer' 'Set for 4 minutes' && \
      sleep 4m && \
      notify-send 'Timer' 'Finished.' && \
      mpg123 $1 && \
      exit 0
    ;;
  '5 minutes')
    notify-send 'Timer' 'Set for 5 minutes' && \
      sleep 5m && \
      notify-send 'Timer' 'Finished.' && \
      mpg123 $1 && \
      exit 0
    ;;
  '10 minutes')
    notify-send 'Timer' 'Set for 10 minutes' && \
      sleep 10m && \
      notify-send 'Timer' 'Finished.' && \
      mpg123 $1 && \
      exit 0
    ;;
  '15 minutes')
    notify-send 'Timer' 'Set for 15 minutes' && \
      sleep 15m && \
      notify-send 'Timer' 'Finished.' && \
      mpg123 $1 && \
      exit 0
    ;;
  '20 minutes')
    notify-send 'Timer' 'Set for 20 minutes' && \
      sleep 20m && \
      notify-send 'Timer' 'Finished.' && \
      mpg123 $1 && \
      exit 0
    ;;
  '30 minutes')
    notify-send 'Timer' 'Set for 30 minutes' && \
      sleep 30m && \
      notify-send 'Timer' 'Finished.' && \
      mpg123 $1 && \
      exit 0
    ;;
  '45 minutes')
    notify-send 'Timer' 'Set for 45 minutes' && \
      sleep 45m && \
      notify-send 'Timer' 'Finished.' && \
      mpg123 $1 && \
      exit 0
    ;;
  '1 hour')
    notify-send 'Timer' 'Set for 1 hour' && \
      sleep 1h && \
      notify-send 'Timer' 'Finished.' && \
      mpg123 $1 && \
      exit 0
    ;;
  '2 hours')
    notify-send 'Timer' 'Set for 2 hours' && \
      sleep 2h && \
      notify-send 'Timer' 'Finished.' && \
      mpg123 $1 && \
      exit 0
    ;;
  *)
    notify-send 'Timer' 'No supported time selected. Exiting...' && exit 1
esac