diff options
| -rw-r--r-- | X11/openbox/rc.xml | 5 | ||||
| -rwxr-xr-x | X11/rofi/pass.get | 4 | ||||
| -rwxr-xr-x | X11/show_timer.sh | 22 | ||||
| -rwxr-xr-x | bin/task/context | 2 | ||||
| -rwxr-xr-x | bin/unix/timer.sh | 2 |
5 files changed, 24 insertions, 11 deletions
diff --git a/X11/openbox/rc.xml b/X11/openbox/rc.xml index 7b923cd..14ab723 100644 --- a/X11/openbox/rc.xml +++ b/X11/openbox/rc.xml | |||
| @@ -514,6 +514,11 @@ | |||
| 514 | </keybind> | 514 | </keybind> |
| 515 | <keybind key="W-t"> | 515 | <keybind key="W-t"> |
| 516 | <action name="Execute"> | 516 | <action name="Execute"> |
| 517 | <command>~/helper/X11/show_timer.sh --context</command> | ||
| 518 | </action> | ||
| 519 | </keybind> | ||
| 520 | <keybind key="W-S-t"> | ||
| 521 | <action name="Execute"> | ||
| 517 | <command>~/helper/X11/show_timer.sh</command> | 522 | <command>~/helper/X11/show_timer.sh</command> |
| 518 | </action> | 523 | </action> |
| 519 | </keybind> | 524 | </keybind> |
diff --git a/X11/rofi/pass.get b/X11/rofi/pass.get index 18230fe..425cd62 100755 --- a/X11/rofi/pass.get +++ b/X11/rofi/pass.get | |||
| @@ -40,8 +40,8 @@ set -x | |||
| 40 | if [ -n "$RESULT" ]; then | 40 | if [ -n "$RESULT" ]; then |
| 41 | # Copy the given password into PRIMARY selection and kill it in 30s | 41 | # Copy the given password into PRIMARY selection and kill it in 30s |
| 42 | echo "$RESULT" | sed -n 1p | tr -d '\n' | xsel -i -t 30000 | 42 | echo "$RESULT" | sed -n 1p | tr -d '\n' | xsel -i -t 30000 |
| 43 | # Copy the second line (most of the time, account name) into CLIPBOARD selection | 43 | # Copy the second non-empty line (most of the time, account name) into CLIPBOARD selection |
| 44 | echo "$RESULT" | sed -n 2p | tr -d '\n' | xsel -ib | 44 | echo "$RESULT" | sed -n '1d;/^./{p;q}' | tr -d '\n' | xsel -ib |
| 45 | 45 | ||
| 46 | # And show extra message | 46 | # And show extra message |
| 47 | EXTRA="$(echo; echo; echo "$RESULT" | sed '1d' | sed '1{/^$/d}')" | 47 | EXTRA="$(echo; echo; echo "$RESULT" | sed '1d' | sed '1{/^$/d}')" |
diff --git a/X11/show_timer.sh b/X11/show_timer.sh index dd6d877..149b11a 100755 --- a/X11/show_timer.sh +++ b/X11/show_timer.sh | |||
| @@ -3,6 +3,12 @@ | |||
| 3 | origin="$(xdotool getactivewindow)" | 3 | origin="$(xdotool getactivewindow)" |
| 4 | export origin | 4 | export origin |
| 5 | 5 | ||
| 6 | # If --context is set, apply exit command and different color | ||
| 7 | if echo "$@" | grep -qs '\--context'; then | ||
| 8 | COMMAND_EXIT='~/helper/bin/task/context $count' | ||
| 9 | export COLOR=33 | ||
| 10 | fi | ||
| 11 | |||
| 6 | # If timer is set, focus to it and exit | 12 | # If timer is set, focus to it and exit |
| 7 | xdotool search --name "TIMER" windowactivate && exit 0 | 13 | xdotool search --name "TIMER" windowactivate && exit 0 |
| 8 | 14 | ||
| @@ -11,13 +17,13 @@ xdotool search --name "TIMER" windowactivate && exit 0 | |||
| 11 | # Use xdotool to reactivate original window user focus | 17 | # Use xdotool to reactivate original window user focus |
| 12 | # After timer is closed or finished, append time into context file | 18 | # After timer is closed or finished, append time into context file |
| 13 | alacritty --title TIMER --hold \ | 19 | alacritty --title TIMER --hold \ |
| 14 | -o "window.dimensions.columns=8" \ | 20 | -o window.dimensions.columns=8 \ |
| 15 | -o "window.dimensions.lines=1" \ | 21 | -o window.dimensions.lines=1 \ |
| 16 | -o "window.position.x=-0" \ | 22 | -o window.position.x=-0 \ |
| 17 | -o "window.position.y=0" \ | 23 | -o window.position.y=0 \ |
| 18 | -o "window.opacity=0.6" \ | 24 | -o window.opacity=0.6 \ |
| 19 | -o "font.size=40" \ | 25 | -o font.size=40 \ |
| 20 | -e "$HOME"/helper/bin/unix/timer.sh \ | 26 | -e ~/helper/bin/unix/timer.sh \ |
| 21 | SIGINT \ | 27 | SIGINT \ |
| 22 | "xdotool windowactivate $origin" \ | 28 | "xdotool windowactivate $origin" \ |
| 23 | '~/helper/bin/task/context_spend_time.sh $count' | 29 | "$COMMAND_EXIT" |
diff --git a/bin/task/context b/bin/task/context index 76e1984..75597b3 100755 --- a/bin/task/context +++ b/bin/task/context | |||
| @@ -18,7 +18,7 @@ if [ -n "$1" ]; then | |||
| 18 | fi | 18 | fi |
| 19 | done <$LOG_FILE | 19 | done <$LOG_FILE |
| 20 | if [ "$update" = true ]; then | 20 | if [ "$update" = true ]; then |
| 21 | sed -i -E "s/^$context.*/$context\t$summary" $LOG_FILE | 21 | sed -i -E "s/^$context.*/$context\t$summary/" $LOG_FILE |
| 22 | else | 22 | else |
| 23 | echo -e "$context\t$count" >>$LOG_FILE | 23 | echo -e "$context\t$count" >>$LOG_FILE |
| 24 | fi | 24 | fi |
diff --git a/bin/unix/timer.sh b/bin/unix/timer.sh index b4f48c5..b7f941e 100755 --- a/bin/unix/timer.sh +++ b/bin/unix/timer.sh | |||
| @@ -8,6 +8,8 @@ SIGNAL=${1:-SIGTERM} | |||
| 8 | COMMAND_START="$2" | 8 | COMMAND_START="$2" |
| 9 | COMMAND_EXIT="$3" | 9 | COMMAND_EXIT="$3" |
| 10 | 10 | ||
| 11 | [ -n "$COLOR" ] && echo -en "\e[${COLOR}m" | ||
| 12 | |||
| 11 | # If SIGNAL is received, switch to next display | 13 | # If SIGNAL is received, switch to next display |
| 12 | trap 'next_display' "$SIGNAL" | 14 | trap 'next_display' "$SIGNAL" |
| 13 | # Use SIGTSTP (Ctrl-Z in most of the cases) to stop/restart timer | 15 | # Use SIGTSTP (Ctrl-Z in most of the cases) to stop/restart timer |