diff options
author | Hsieh Chin Fan <pham@topo.tw> | 2023-04-07 12:46:42 +0800 |
---|---|---|
committer | Hsieh Chin Fan <pham@topo.tw> | 2023-04-07 12:46:42 +0800 |
commit | 52af58e39af8ac006c62d1788b6672966b2a9f47 (patch) | |
tree | a07e147eb4d3c2af1e3da5e5fc32ca1f04e9e5b0 /X11 | |
parent | 204f6a6a7024a2744fe948b1014494ebc2fd3a56 (diff) |
Update
Diffstat (limited to 'X11')
-rw-r--r-- | X11/openbox/rc.xml | 5 | ||||
-rwxr-xr-x | X11/rofi/pass.get | 4 | ||||
-rwxr-xr-x | X11/show_timer.sh | 22 |
3 files changed, 21 insertions, 10 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" |