From 52af58e39af8ac006c62d1788b6672966b2a9f47 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Fri, 7 Apr 2023 12:46:42 +0800 Subject: Update --- X11/openbox/rc.xml | 5 +++++ X11/rofi/pass.get | 4 ++-- X11/show_timer.sh | 22 ++++++++++++++-------- 3 files changed, 21 insertions(+), 10 deletions(-) (limited to 'X11') 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 @@ -513,6 +513,11 @@ + + ~/helper/X11/show_timer.sh --context + + + ~/helper/X11/show_timer.sh 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 if [ -n "$RESULT" ]; then # Copy the given password into PRIMARY selection and kill it in 30s echo "$RESULT" | sed -n 1p | tr -d '\n' | xsel -i -t 30000 - # Copy the second line (most of the time, account name) into CLIPBOARD selection - echo "$RESULT" | sed -n 2p | tr -d '\n' | xsel -ib + # Copy the second non-empty line (most of the time, account name) into CLIPBOARD selection + echo "$RESULT" | sed -n '1d;/^./{p;q}' | tr -d '\n' | xsel -ib # And show extra message 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 @@ 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 @@ -11,13 +17,13 @@ xdotool search --name "TIMER" windowactivate && exit 0 # 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 "$HOME"/helper/bin/unix/timer.sh \ + -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" \ - '~/helper/bin/task/context_spend_time.sh $count' + "$COMMAND_EXIT" -- cgit v1.2.3-70-g09d2