diff options
author | Hsieh Chin Fan <typebrook@gmail.com> | 2022-04-20 00:16:31 +0800 |
---|---|---|
committer | Hsieh Chin Fan <typebrook@gmail.com> | 2022-04-20 00:16:31 +0800 |
commit | 067029d83ed8a4c5590436da76e9afb780dcadc0 (patch) | |
tree | b634c504f72f836f3b9bcb22c57000672fabf168 | |
parent | a3922a45cf7e86fa80abaa40015f2ec081c9c9e7 (diff) |
Update
-rw-r--r-- | Makefile | 3 | ||||
-rwxr-xr-x | tools/desktop/takeshot | 78 | ||||
-rwxr-xr-x | tools/wiki/diary | 20 |
3 files changed, 101 insertions, 0 deletions
@@ -76,6 +76,9 @@ pass: | |||
76 | openbox: | 76 | openbox: |
77 | ln -sf `pwd`/misc/openbox/rc.xml ~/.config/openbox/ | 77 | ln -sf `pwd`/misc/openbox/rc.xml ~/.config/openbox/ |
78 | 78 | ||
79 | archcraft: | ||
80 | ls -sf `pwd`/tools/desktop/takeshot /usr/local/bin/takeshot | ||
81 | |||
79 | xkb: | 82 | xkb: |
80 | #sudo cat >/etc/profile.d/xkb.sh <<EOF | 83 | #sudo cat >/etc/profile.d/xkb.sh <<EOF |
81 | ##! /bin/env bash | 84 | ##! /bin/env bash |
diff --git a/tools/desktop/takeshot b/tools/desktop/takeshot new file mode 100755 index 0000000..3fefff0 --- /dev/null +++ b/tools/desktop/takeshot | |||
@@ -0,0 +1,78 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | |||
3 | ## Copyright (C) 2020-2022 Aditya Shakya <adi1090x@gmail.com> | ||
4 | ## Everyone is permitted to copy and distribute copies of this file under GNU-GPL3 | ||
5 | |||
6 | ## Script to take screenshots with maim | ||
7 | |||
8 | time=`date +%Y-%m-%d-%H-%M-%S` | ||
9 | geometry=`xrandr | head -n1 | cut -d',' -f2 | tr -d '[:blank:],current'` | ||
10 | dir="`xdg-user-dir PICTURES`/Screenshots" | ||
11 | file="Screenshot_${time}_${geometry}.png" | ||
12 | |||
13 | # notify and view screenshot | ||
14 | notify_view () { | ||
15 | dunstify -u low --replace=699 -i /usr/share/archcraft/icons/dunst/picture.png "Copied to clipboard." | ||
16 | viewnior ${dir}/"$file" | ||
17 | if [[ -e "$dir/$file" ]]; then | ||
18 | dunstify -u low --replace=699 -i /usr/share/archcraft/icons/dunst/picture.png "Screenshot Saved." | ||
19 | else | ||
20 | dunstify -u low --replace=699 -i /usr/share/archcraft/icons/dunst/picture.png "Screenshot Deleted." | ||
21 | fi | ||
22 | } | ||
23 | |||
24 | # countdown | ||
25 | countdown () { | ||
26 | for sec in `seq $1 -1 1`; do | ||
27 | dunstify -t 1000 --replace=699 -i /usr/share/archcraft/icons/dunst/timer.png "Taking shot in : $sec" | ||
28 | sleep 1 | ||
29 | done | ||
30 | } | ||
31 | |||
32 | # take shots | ||
33 | shotnow () { | ||
34 | cd ${dir} && maim -u -f png | tee "$file" | xclip -selection clipboard -t image/png | ||
35 | notify_view | ||
36 | } | ||
37 | |||
38 | shot5 () { | ||
39 | countdown '5' | ||
40 | sleep 1 && cd ${dir} && maim -u -f png | tee "$file" | xclip -selection clipboard -t image/png | ||
41 | notify_view | ||
42 | } | ||
43 | |||
44 | shot10 () { | ||
45 | countdown '10' | ||
46 | sleep 1 && cd ${dir} && maim -u -f png | tee "$file" | xclip -selection clipboard -t image/png | ||
47 | notify_view | ||
48 | } | ||
49 | |||
50 | shotwin () { | ||
51 | cd ${dir} && maim -u -f png -i `xdotool getactivewindow` | tee "$file" | xclip -selection clipboard -t image/png | ||
52 | notify_view | ||
53 | } | ||
54 | |||
55 | shotarea () { | ||
56 | cd ${dir} && maim -u -f png -s -b 2 -c 0.35,0.55,0.855 | tee "$file" | xclip -selection clipboard -t image/png | ||
57 | notify_view | ||
58 | } | ||
59 | |||
60 | if [[ ! -d "$dir" ]]; then | ||
61 | mkdir -p "$dir" | ||
62 | fi | ||
63 | |||
64 | if [[ "$1" == "--now" ]]; then | ||
65 | shotnow | ||
66 | elif [[ "$1" == "--in5" ]]; then | ||
67 | shot5 | ||
68 | elif [[ "$1" == "--in10" ]]; then | ||
69 | shot10 | ||
70 | elif [[ "$1" == "--win" ]]; then | ||
71 | shotwin | ||
72 | elif [[ "$1" == "--area" ]]; then | ||
73 | shotarea | ||
74 | else | ||
75 | echo -e "Available Options : --now --in5 --in10 --win --area" | ||
76 | fi | ||
77 | |||
78 | exit 0 | ||
diff --git a/tools/wiki/diary b/tools/wiki/diary new file mode 100755 index 0000000..924c99c --- /dev/null +++ b/tools/wiki/diary | |||
@@ -0,0 +1,20 @@ | |||
1 | #! /bin/bash | ||
2 | |||
3 | #read -p 'Year 20XX ? ' -r YEAR | ||
4 | #echo | ||
5 | YEAR=22 | ||
6 | |||
7 | read -p 'Month? ' -r MONTH | ||
8 | MONTH=$(printf "%02d" $MONTH) | ||
9 | |||
10 | while read -p 'Day? ' -r DAY; do | ||
11 | DAY=$(printf "%02d" $DAY) | ||
12 | FILE=~/vimwiki/diary/20$YEAR-$MONTH-$DAY.md | ||
13 | |||
14 | if [ -e $FILE ]; then | ||
15 | vim -c 'Goyo' $FILE | ||
16 | break | ||
17 | else | ||
18 | echo No diary at 20$YEAR-$MONTH-$DAY | ||
19 | fi | ||
20 | done | ||