diff options
author | Yigit Sever | 2021-11-07 23:42:15 +0300 |
---|---|---|
committer | Yigit Sever | 2021-11-07 23:42:15 +0300 |
commit | 9fa9973c2d2f91cef7bdd26cb52064c13f4d682e (patch) | |
tree | 13aa64b09bc91e16f3dd3217bf3d647559af2cf9 | |
parent | 9382166b5522a5d9e2d62e93e702b4d0886cedb4 (diff) | |
parent | fcb2237c01bcd2b7982bb844cea4cf9447f20d03 (diff) | |
download | dotfiles-9fa9973c2d2f91cef7bdd26cb52064c13f4d682e.tar.gz dotfiles-9fa9973c2d2f91cef7bdd26cb52064c13f4d682e.tar.bz2 dotfiles-9fa9973c2d2f91cef7bdd26cb52064c13f4d682e.zip |
Merge remote-tracking branch 'origin/main'
30 files changed, 359 insertions, 81 deletions
diff --git a/.config/efm-langserver/config.yaml b/.config/efm-langserver/config.yaml new file mode 100644 index 0000000..40031b0 --- /dev/null +++ b/.config/efm-langserver/config.yaml | |||
@@ -0,0 +1,19 @@ | |||
1 | version: 2 | ||
2 | root-markers: | ||
3 | - .git/ | ||
4 | lint-debounce: 1s | ||
5 | tools: | ||
6 | sh-shellcheck: &sh-shellcheck | ||
7 | lint-command: 'shellcheck -f gcc -x' | ||
8 | lint-source: 'shellcheck' | ||
9 | lint-formats: | ||
10 | - '%f:%l:%c: %trror: %m' | ||
11 | - '%f:%l:%c: %tarning: %m' | ||
12 | - '%f:%l:%c: %tote: %m' | ||
13 | sh-shfmt: &sh-shfmt | ||
14 | format-command: 'shfmt -ci -s -bn -i 4 -sr' | ||
15 | format-stdin: true | ||
16 | languages: | ||
17 | sh: | ||
18 | - <<: *sh-shellcheck | ||
19 | - <<: *sh-shfmt | ||
diff --git a/.config/nvim/after/ftplugin/c.vim b/.config/nvim/after/ftplugin/c.vim index 49b3953..73fdd4b 100644 --- a/.config/nvim/after/ftplugin/c.vim +++ b/.config/nvim/after/ftplugin/c.vim | |||
@@ -1,4 +1,3 @@ | |||
1 | setlocal shiftwidth=8 | 1 | setlocal shiftwidth=8 |
2 | setlocal tabstop=8 | 2 | setlocal tabstop=8 |
3 | setlocal expandtab | 3 | setlocal expandtab |
4 | let b:ale_fixers = ['clang-format'] | ||
diff --git a/.config/nvim/after/ftplugin/java.vim b/.config/nvim/after/ftplugin/java.vim index 243baeb..5441d82 100644 --- a/.config/nvim/after/ftplugin/java.vim +++ b/.config/nvim/after/ftplugin/java.vim | |||
@@ -1,2 +1 @@ | |||
1 | let b:ale_linters = ['javac'] | ||
2 | let b:dispatch = 'javac %' | let b:dispatch = 'javac %' | |
diff --git a/.config/nvim/after/ftplugin/lua.vim b/.config/nvim/after/ftplugin/lua.vim deleted file mode 100644 index 5611ba5..0000000 --- a/.config/nvim/after/ftplugin/lua.vim +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | let b:ale_fixers = ['lua-format'] | ||
diff --git a/.config/nvim/after/ftplugin/markdown.vim b/.config/nvim/after/ftplugin/markdown.vim deleted file mode 100644 index 656bff4..0000000 --- a/.config/nvim/after/ftplugin/markdown.vim +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | let b:ale_linters = ['languagetool', 'proselint'] | ||
diff --git a/.config/nvim/after/ftplugin/python.vim b/.config/nvim/after/ftplugin/python.vim deleted file mode 100644 index 6bdca5e..0000000 --- a/.config/nvim/after/ftplugin/python.vim +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | let b:ale_fixers = ['black', 'isort'] | ||
2 | let b:ale_linters = ['flake8', 'bandit'] | ||
3 | let g:ale_python_flake8_options = '--max-line-length=88' | ||
4 | |||
diff --git a/.config/nvim/after/ftplugin/rust.vim b/.config/nvim/after/ftplugin/rust.vim index 40d2549..fb601d1 100644 --- a/.config/nvim/after/ftplugin/rust.vim +++ b/.config/nvim/after/ftplugin/rust.vim | |||
@@ -1,6 +1,3 @@ | |||
1 | let b:ale_fixers = ['rustfmt'] | ||
2 | let b:ale_linters = ['rls'] | ||
3 | |||
4 | setlocal tags=./rusty-tags.vi;/ | 1 | setlocal tags=./rusty-tags.vi;/ |
5 | 2 | ||
6 | autocmd BufWritePost *.rs :silent! exec "!rusty-tags vi --quiet --start-dir=" . expand('%:p:h') . "&" | redraw! | 3 | autocmd BufWritePost *.rs :silent! exec "!rusty-tags vi --quiet --start-dir=" . expand('%:p:h') . "&" | redraw! |
diff --git a/.config/nvim/after/ftplugin/sh.vim b/.config/nvim/after/ftplugin/sh.vim deleted file mode 100644 index 70f6252..0000000 --- a/.config/nvim/after/ftplugin/sh.vim +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | let b:ale_fixers = ['shfmt'] | ||
diff --git a/.config/nvim/after/ftplugin/tex.vim b/.config/nvim/after/ftplugin/tex.vim index 04307e4..27b002a 100644 --- a/.config/nvim/after/ftplugin/tex.vim +++ b/.config/nvim/after/ftplugin/tex.vim | |||
@@ -17,6 +17,3 @@ call sandwich#util#addlocal([{ | |||
17 | \ 'buns': ['\enquote{', '}'], | 17 | \ 'buns': ['\enquote{', '}'], |
18 | \ 'input': ['"'], | 18 | \ 'input': ['"'], |
19 | \ }]) | 19 | \ }]) |
20 | |||
21 | let b:ale_linters = ['chktex', 'texlab', 'proselint'] | ||
22 | let b:ale_fixers = ['latexindent'] | ||
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 4644f60..cd20fc3 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua | |||
@@ -11,10 +11,6 @@ | |||
11 | -- │ ▘▝▀▘▝▀▘│ | 11 | -- │ ▘▝▀▘▝▀▘│ |
12 | -- └────────┘ | 12 | -- └────────┘ |
13 | 13 | ||
14 | -- do not source the default filetype.vim | ||
15 | -- needed for filetype.nvim | ||
16 | vim.g.did_load_filetypes = 1 | ||
17 | |||
18 | require('plugins') | 14 | require('plugins') |
19 | require('settings') | 15 | require('settings') |
20 | require('plugin_settings') | 16 | require('plugin_settings') |
diff --git a/.config/nvim/lua/plugin_settings.lua b/.config/nvim/lua/plugin_settings.lua index ddc7371..277e196 100644 --- a/.config/nvim/lua/plugin_settings.lua +++ b/.config/nvim/lua/plugin_settings.lua | |||
@@ -353,6 +353,12 @@ for _, lsp in ipairs(servers) do | |||
353 | } | 353 | } |
354 | end | 354 | end |
355 | 355 | ||
356 | nvim_lsp['efm'].setup{ | ||
357 | on_attach = on_attach, | ||
358 | filetypes = { 'sh' }, | ||
359 | capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) | ||
360 | } | ||
361 | |||
356 | -- }}} nvim-lsp -- | 362 | -- }}} nvim-lsp -- |
357 | 363 | ||
358 | -- vista {{{ -- | 364 | -- vista {{{ -- |
diff --git a/.config/polybar/config##h.lowe b/.config/polybar/config##h.lowe index 8dd08f7..0dfb1b5 100644 --- a/.config/polybar/config##h.lowe +++ b/.config/polybar/config##h.lowe | |||
@@ -30,6 +30,7 @@ offset-x = 0 | |||
30 | offset-y = 0 | 30 | offset-y = 0 |
31 | radius = 0 | 31 | radius = 0 |
32 | fixed-center = true | 32 | fixed-center = true |
33 | enable-ipc = true | ||
33 | 34 | ||
34 | background = ${colors.background} | 35 | background = ${colors.background} |
35 | foreground = ${colors.foreground} | 36 | foreground = ${colors.foreground} |
diff --git a/.gitconfig##h.lowe b/.gitconfig##h.lowe index d0026b7..4e44bee 100644 --- a/.gitconfig##h.lowe +++ b/.gitconfig##h.lowe | |||
@@ -5,7 +5,6 @@ | |||
5 | [core] | 5 | [core] |
6 | autocrlf = input | 6 | autocrlf = input |
7 | safecrlf = true | 7 | safecrlf = true |
8 | pager = diff-so-fancy | less --tabs=4 -RFX | ||
9 | excludesfile = ~/.cvsignore | 8 | excludesfile = ~/.cvsignore |
10 | [alias] | 9 | [alias] |
11 | co = checkout | 10 | co = checkout |
@@ -23,18 +22,6 @@ | |||
23 | helper = cache --timeout=3600 | 22 | helper = cache --timeout=3600 |
24 | [color] | 23 | [color] |
25 | ui = true | 24 | ui = true |
26 | [color "diff-highlight"] | ||
27 | oldNormal = red bold | ||
28 | oldHighlight = red bold 52 | ||
29 | newNormal = green bold | ||
30 | newHighlight = green bold 22 | ||
31 | [color "diff"] | ||
32 | meta = yellow | ||
33 | frag = magenta bold | ||
34 | commit = yellow bold | ||
35 | old = red bold | ||
36 | new = green bold | ||
37 | whitespace = red reverse | ||
38 | [commit] | 25 | [commit] |
39 | gpgsign = true | 26 | gpgsign = true |
40 | [sendemail] | 27 | [sendemail] |
@@ -45,3 +32,24 @@ | |||
45 | ff = only | 32 | ff = only |
46 | [init] | 33 | [init] |
47 | defaultBranch = main | 34 | defaultBranch = main |
35 | [pager] | ||
36 | diff = delta | ||
37 | log = delta | ||
38 | reflog = delta | ||
39 | show = delta | ||
40 | [interactive] | ||
41 | diffFilter = delta --color-only | ||
42 | [delta] | ||
43 | features = line-numbers decorations side-by-side | ||
44 | plus-style = syntax "#003800" | ||
45 | minus-style = syntax "#3f0001" | ||
46 | [delta "decorations"] | ||
47 | commit-decoration-style = bold yellow box ul | ||
48 | file-style = bold yellow ul | ||
49 | file-decoration-style = none | ||
50 | hunk-header-decoration-style = cyan box ul | ||
51 | [delta "line-numbers"] | ||
52 | line-numbers-left-style = cyan | ||
53 | line-numbers-right-style = cyan | ||
54 | line-numbers-minus-style = 124 | ||
55 | line-numbers-plus-style = 28 | ||
diff --git a/.local/bin/bukuadd_c b/.local/bin/bukuadd_c index 925022a..86f705d 100755 --- a/.local/bin/bukuadd_c +++ b/.local/bin/bukuadd_c | |||
@@ -10,7 +10,7 @@ fi | |||
10 | 10 | ||
11 | FOO=$(buku --nostdin --np --nc -p -1) | 11 | FOO=$(buku --nostdin --np --nc -p -1) |
12 | OUT="$(buku --nostdin --np --nc -a "$url" "$tags" 2>&1)" | 12 | OUT="$(buku --nostdin --np --nc -a "$url" "$tags" 2>&1)" |
13 | if [[ $OUT =~ "ERROR" ]] ; then | 13 | if [[ $OUT =~ "ERROR" ]]; then |
14 | notify-send "Bookmarking Failed" "$OUT" --app-name="buku" --icon="dialog-error" | 14 | notify-send "Bookmarking Failed" "$OUT" --app-name="buku" --icon="dialog-error" |
15 | exit 1 | 15 | exit 1 |
16 | fi | 16 | fi |
@@ -20,7 +20,7 @@ BAR=$FOO | |||
20 | while [[ $BAR == "$FOO" ]]; do | 20 | while [[ $BAR == "$FOO" ]]; do |
21 | sleep 1 | 21 | sleep 1 |
22 | BAR=$(buku --nostdin --np --nc -p -1) | 22 | BAR=$(buku --nostdin --np --nc -p -1) |
23 | done; | 23 | done |
24 | 24 | ||
25 | notify-send "Success" "$BAR" --app-name="buku" --icon="checkmark" | 25 | notify-send "Success" "$BAR" --app-name="buku" --icon="checkmark" |
26 | 26 | ||
diff --git a/.local/bin/done b/.local/bin/done index 8bb0a3d..ae76287 100755 --- a/.local/bin/done +++ b/.local/bin/done | |||
@@ -27,9 +27,9 @@ if ACTIVE_TASK=$(task active); then | |||
27 | timew "@1" annotate "${annot:0:1}" | 27 | timew "@1" annotate "${annot:0:1}" |
28 | else | 28 | else |
29 | if maybe_delete=$(printf "no no\nyea" | rofi -dmenu -p "should we delete the tracking?" -lines 2 -no-custom); then | 29 | if maybe_delete=$(printf "no no\nyea" | rofi -dmenu -p "should we delete the tracking?" -lines 2 -no-custom); then |
30 | if [[ "${maybe_delete}" == "no no" ]]; then | 30 | if [[ ${maybe_delete} == "no no" ]]; then |
31 | notify-send "tracking unannotated, not deleted" "nobody will know how that went" --app-name="done" --icon="itmages-question" | 31 | notify-send "tracking unannotated, not deleted" "nobody will know how that went" --app-name="done" --icon="itmages-question" |
32 | elif [[ "${maybe_delete}" == "yea" ]]; then | 32 | elif [[ ${maybe_delete} == "yea" ]]; then |
33 | timew delete "@1" | 33 | timew delete "@1" |
34 | notify-send "tracking deleted" "like you never worked on that" --app-name="done" --icon="pack-more" | 34 | notify-send "tracking deleted" "like you never worked on that" --app-name="done" --icon="pack-more" |
35 | fi | 35 | fi |
diff --git a/.local/bin/dups b/.local/bin/dups new file mode 100755 index 0000000..eb450f5 --- /dev/null +++ b/.local/bin/dups | |||
@@ -0,0 +1,54 @@ | |||
1 | #!/usr/bin/env perl | ||
2 | |||
3 | # Finds duplicate adjacent words. | ||
4 | |||
5 | use strict ; | ||
6 | |||
7 | my $DupCount = 0 ; | ||
8 | |||
9 | if (!@ARGV) { | ||
10 | print "usage: dups <file> ...\n" ; | ||
11 | exit ; | ||
12 | } | ||
13 | |||
14 | while (1) { | ||
15 | my $FileName = shift @ARGV ; | ||
16 | |||
17 | # Exit code = number of duplicates found. | ||
18 | exit $DupCount if (!$FileName) ; | ||
19 | |||
20 | open FILE, $FileName or die $!; | ||
21 | |||
22 | my $LastWord = "" ; | ||
23 | my $LineNum = 0 ; | ||
24 | |||
25 | while (<FILE>) { | ||
26 | chomp ; | ||
27 | |||
28 | $LineNum ++ ; | ||
29 | |||
30 | my @words = split (/(\W+)/) ; | ||
31 | |||
32 | foreach my $word (@words) { | ||
33 | # Skip spaces: | ||
34 | next if $word =~ /^\s*$/ ; | ||
35 | |||
36 | # Skip punctuation: | ||
37 | if ($word =~ /^\W+$/) { | ||
38 | $LastWord = "" ; | ||
39 | next ; | ||
40 | } | ||
41 | |||
42 | # Found a dup? | ||
43 | if (lc($word) eq lc($LastWord)) { | ||
44 | print "$FileName:$LineNum $word\n" ; | ||
45 | $DupCount ++ ; | ||
46 | } # Thanks to Sean Cronin for tip on case. | ||
47 | |||
48 | # Mark this as the last word: | ||
49 | $LastWord = $word ; | ||
50 | } | ||
51 | } | ||
52 | |||
53 | close FILE ; | ||
54 | } | ||
diff --git a/.local/bin/epub_lander b/.local/bin/epub_lander index 801381a..19e0a1c 100755 --- a/.local/bin/epub_lander +++ b/.local/bin/epub_lander | |||
@@ -15,4 +15,3 @@ mv $HOME/down/*.pdf $HOME/docs/pdf_landing/ | |||
15 | if [[ $? -ne 1 ]]; then | 15 | if [[ $? -ne 1 ]]; then |
16 | notify-send "Moved some pdfs" "" --app-name="epub_lander" --icon="emblem_success" | 16 | notify-send "Moved some pdfs" "" --app-name="epub_lander" --icon="emblem_success" |
17 | fi | 17 | fi |
18 | |||
diff --git a/.local/bin/i3-get-window-criteria b/.local/bin/i3-get-window-criteria index f46f65e..6d6ea1b 100755 --- a/.local/bin/i3-get-window-criteria +++ b/.local/bin/i3-get-window-criteria | |||
@@ -9,7 +9,7 @@ | |||
9 | # quotes in "<string>" are not escaped properly. This is a problem with the output of `xprop`, | 9 | # quotes in "<string>" are not escaped properly. This is a problem with the output of `xprop`, |
10 | # reported upstream: https://bugs.freedesktop.org/show_bug.cgi?id=66807 | 10 | # reported upstream: https://bugs.freedesktop.org/show_bug.cgi?id=66807 |
11 | 11 | ||
12 | PROGNAME=`basename "$0"` | 12 | PROGNAME=$(basename "$0") |
13 | 13 | ||
14 | # Check for xwininfo and xprop | 14 | # Check for xwininfo and xprop |
15 | for cmd in xwininfo xprop; do | 15 | for cmd in xwininfo xprop; do |
@@ -25,13 +25,13 @@ match_qstring='"[^"\\]*(\\.[^"\\]*)*"' # NOTE: Adds 1 backreference | |||
25 | 25 | ||
26 | { | 26 | { |
27 | # Run xwininfo, get window id | 27 | # Run xwininfo, get window id |
28 | window_id=`xwininfo -int | sed -nre "s/^xwininfo: Window id: ($match_int) .*$/\1/p"` | 28 | window_id=$(xwininfo -int | sed -nre "s/^xwininfo: Window id: ($match_int) .*$/\1/p") |
29 | echo "id=$window_id" | 29 | echo "id=$window_id" |
30 | 30 | ||
31 | # Run xprop, transform its output into i3 criteria. Handle fallback to | 31 | # Run xprop, transform its output into i3 criteria. Handle fallback to |
32 | # WM_NAME when _NET_WM_NAME isn't set | 32 | # WM_NAME when _NET_WM_NAME isn't set |
33 | xprop -id $window_id | | 33 | xprop -id $window_id \ |
34 | sed -nr \ | 34 | | sed -nr \ |
35 | -e "s/^WM_CLASS\(STRING\) = ($match_qstring), ($match_qstring)$/instance=\1\nclass=\3/p" \ | 35 | -e "s/^WM_CLASS\(STRING\) = ($match_qstring), ($match_qstring)$/instance=\1\nclass=\3/p" \ |
36 | -e "s/^WM_WINDOW_ROLE\(STRING\) = ($match_qstring)$/window_role=\1/p" \ | 36 | -e "s/^WM_WINDOW_ROLE\(STRING\) = ($match_qstring)$/window_role=\1/p" \ |
37 | -e "/^WM_NAME\(STRING\) = ($match_string)$/{s//title=\1/; h}" \ | 37 | -e "/^WM_NAME\(STRING\) = ($match_string)$/{s//title=\1/; h}" \ |
diff --git a/.local/bin/letsread b/.local/bin/letsread index 5e3cf5a..d5f1e0c 100755 --- a/.local/bin/letsread +++ b/.local/bin/letsread | |||
@@ -1,4 +1,4 @@ | |||
1 | #!/usr/bin/env bash | 1 | #!/usr/bin/env bash |
2 | 2 | ||
3 | firefox $(buku --stag toread -f 10 | shuf -n 1) | 3 | firefox "$(buku --stag toread -f 10 | shuf -n 1)" |
4 | dunstify "Time to read" "Don't forget to remove 'toread' from that when you're done" | 4 | dunstify "Time to read" "Don't forget to remove 'toread' from that when you're done" |
diff --git a/.local/bin/mailsync b/.local/bin/mailsync index ae0801c..cc7010b 100755 --- a/.local/bin/mailsync +++ b/.local/bin/mailsync | |||
@@ -3,9 +3,15 @@ | |||
3 | # Sync mail and give notification if there is new mail. | 3 | # Sync mail and give notification if there is new mail. |
4 | 4 | ||
5 | # Run only if user logged in (prevent cron errors) | 5 | # Run only if user logged in (prevent cron errors) |
6 | pgrep -u "${USER:=$LOGNAME}" >/dev/null || { echo "$USER not logged in; sync will not run."; exit ;} | 6 | pgrep -u "${USER:=$LOGNAME}" > /dev/null || { |
7 | echo "$USER not logged in; sync will not run." | ||
8 | exit | ||
9 | } | ||
7 | # Run only if not already running in other instance | 10 | # Run only if not already running in other instance |
8 | pgrep -x mbsync >/dev/null && { notify-send --app-name="mailsync" "mbsync is already running" "you should fix this" ; exit ;} | 11 | pgrep -x mbsync > /dev/null && { |
12 | notify-send --app-name="mailsync" "mbsync is already running" "you should fix this" | ||
13 | exit | ||
14 | } | ||
9 | 15 | ||
10 | if [[ -f "$HOME/.local/share/.dnd" ]]; then | 16 | if [[ -f "$HOME/.local/share/.dnd" ]]; then |
11 | echo "do not disturb is on" | 17 | echo "do not disturb is on" |
@@ -13,8 +19,11 @@ if [[ -f "$HOME/.local/share/.dnd" ]]; then | |||
13 | fi | 19 | fi |
14 | 20 | ||
15 | # Checks for internet connection and set notification script. | 21 | # Checks for internet connection and set notification script. |
16 | ping -q -c 1 1.1.1.1 > /dev/null || ping -q -c 1 1.0.0.1 > /dev/null || ping -q -c 1 example.org || { echo "No internet connection detected."; exit ;} | 22 | ping -q -c 1 1.1.1.1 > /dev/null || ping -q -c 1 1.0.0.1 > /dev/null || ping -q -c 1 example.org || { |
17 | command -v notify-send >/dev/null || echo "Note that \`libnotify\` or \`libnotify-send\` should be installed for pop-up mail notifications with this script." | 23 | echo "No internet connection detected." |
24 | exit | ||
25 | } | ||
26 | command -v notify-send > /dev/null || echo 'Note that `libnotify` or `libnotify-send` should be installed for pop-up mail notifications with this script.' | ||
18 | 27 | ||
19 | # Required to display notifications if run as a cronjob: | 28 | # Required to display notifications if run as a cronjob: |
20 | export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus | 29 | export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus |
@@ -25,11 +34,11 @@ export DISPLAY=:0.0 | |||
25 | 34 | ||
26 | # Settings are different for MacOS (Darwin) systems. | 35 | # Settings are different for MacOS (Darwin) systems. |
27 | if [ "$(uname)" = "Darwin" ]; then | 36 | if [ "$(uname)" = "Darwin" ]; then |
28 | notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;} | 37 | notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2; } |
29 | messageinfo() { osascript -e "display notification with title \"📧 $from\" subtitle \"$subject\"" ;} | 38 | messageinfo() { osascript -e "display notification with title \"📧 $from\" subtitle \"$subject\""; } |
30 | else | 39 | else |
31 | notify() { notify-send --icon="mail_new" --app-name="excerpt" "\`$1\`" "📬 $2 new mail(s)" ;} | 40 | notify() { notify-send --icon="mail_new" --app-name="excerpt" "\`$1\`" "📬 $2 new mail(s)"; } |
32 | messageinfo() { notify-send --icon="mail-mark-unread" --app-name="mutt" "📧 $from" "$subject" ;} | 41 | messageinfo() { notify-send --icon="mail-mark-unread" --app-name="mutt" "📧 $from" "$subject"; } |
33 | fi | 42 | fi |
34 | 43 | ||
35 | # Check account for new mail. Notify if there is new content. | 44 | # Check account for new mail. Notify if there is new content. |
@@ -44,7 +53,7 @@ syncandnotify() { | |||
44 | # Extract subject and sender from mail. | 53 | # Extract subject and sender from mail. |
45 | from=$(awk '/^From: / && ++n ==1,/^\<.*\>:/' "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | awk '{ $1=""; if (NF>=3)$NF=""; print $0 }' | sed 's/^[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//') | 54 | from=$(awk '/^From: / && ++n ==1,/^\<.*\>:/' "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | awk '{ $1=""; if (NF>=3)$NF=""; print $0 }' | sed 's/^[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//') |
46 | subject=$(awk '/^Subject: / && ++n == 1,/^\<.*\>: / && ++i == 2' "$file" | head -n 1 | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | sed 's/^Subject: //' | sed 's/^{[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//' | tr -d '\n') | 55 | subject=$(awk '/^Subject: / && ++n == 1,/^\<.*\>: / && ++i == 2' "$file" | head -n 1 | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | sed 's/^Subject: //' | sed 's/^{[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//' | tr -d '\n') |
47 | messageinfo & | 56 | messageinfo & |
48 | done | 57 | done |
49 | fi | 58 | fi |
50 | } | 59 | } |
@@ -62,15 +71,14 @@ fi | |||
62 | # ( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null | 71 | # ( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null |
63 | 72 | ||
64 | # Parallelize multiple accounts | 73 | # Parallelize multiple accounts |
65 | for account in $accounts | 74 | for account in $accounts; do |
66 | do | ||
67 | syncandnotify & | 75 | syncandnotify & |
68 | done | 76 | done |
69 | 77 | ||
70 | wait | 78 | wait |
71 | # ( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null | 79 | # ( kill -46 "$(pidof "${STATUSBAR:-dwmblocks}")" >/dev/null 2>&1 ) 2>/dev/null |
72 | 80 | ||
73 | notmuch new 2>/dev/null | 81 | notmuch new 2> /dev/null |
74 | 82 | ||
75 | #Create a touch file that indicates the time of the last run of mailsync | 83 | #Create a touch file that indicates the time of the last run of mailsync |
76 | touch "$HOME/.config/mutt/.mailsynclastrun" | 84 | touch "$HOME/.config/mutt/.mailsynclastrun" |
diff --git a/.local/bin/mailto_handler b/.local/bin/mailto_handler index 9493558..36c38bd 100755 --- a/.local/bin/mailto_handler +++ b/.local/bin/mailto_handler | |||
@@ -21,6 +21,6 @@ for account in "${ACCOUNTSDIR}"/*.muttrc; do | |||
21 | 21 | ||
22 | done | 22 | done |
23 | 23 | ||
24 | picked=$(printf "${choices}" | rofi -dmenu) | 24 | picked=$(printf '%s' "${choices}" | rofi -dmenu) |
25 | 25 | ||
26 | exec kitty -e neomutt -F "$HOME/.config/mutt/muttrc" -e "source /home/yigit/.config/mutt/accounts/${picked}.muttrc" -- "$@" | 26 | exec kitty -e neomutt -F "$HOME/.config/mutt/muttrc" -e "source /home/yigit/.config/mutt/accounts/${picked}.muttrc" -- "$@" |
diff --git a/.local/bin/openfile b/.local/bin/openfile index cf3c6c3..742b9c0 100755 --- a/.local/bin/openfile +++ b/.local/bin/openfile | |||
@@ -1,10 +1,10 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | # Helps open a file with xdg-open from mutt in a external program without weird side effects. | 3 | # Helps open a file with xdg-open from mutt in a external program without weird side effects. |
4 | tempdir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard/files" | 4 | tempdir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt/files" |
5 | file="$tempdir/$(basename "$1")" | 5 | file="$tempdir/$(basename "$1")" |
6 | [ "$(uname)" = "Darwin" ] && opener="open" || opener="setsid -f xdg-open" | 6 | [ "$(uname)" = "Darwin" ] && opener="open" || opener="setsid -f xdg-open" |
7 | mkdir -p "$tempdir" | 7 | mkdir -p "$tempdir" |
8 | cp -f "$1" "$file" | 8 | cp -f "$1" "$file" |
9 | $opener "$file" >/dev/null 2>&1 | 9 | $opener "$file" > /dev/null 2>&1 |
10 | find "${tempdir:?}" -mtime +1 -type f -delete | 10 | find "${tempdir:?}" -mtime +1 -type f -delete |
diff --git a/.local/bin/passive b/.local/bin/passive new file mode 100755 index 0000000..276d61b --- /dev/null +++ b/.local/bin/passive | |||
@@ -0,0 +1,65 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | |||
3 | irregulars="awoken|\ | ||
4 | been|born|beat|\ | ||
5 | become|begun|bent|\ | ||
6 | beset|bet|bid|\ | ||
7 | bidden|bound|bitten|\ | ||
8 | bled|blown|broken|\ | ||
9 | bred|brought|broadcast|\ | ||
10 | built|burnt|burst|\ | ||
11 | bought|cast|caught|\ | ||
12 | chosen|clung|come|\ | ||
13 | cost|crept|cut|\ | ||
14 | dealt|dug|dived|\ | ||
15 | done|drawn|dreamt|\ | ||
16 | driven|drunk|eaten|fallen|\ | ||
17 | fed|felt|fought|found|\ | ||
18 | fit|fled|flung|flown|\ | ||
19 | forbidden|forgotten|\ | ||
20 | foregone|forgiven|\ | ||
21 | forsaken|frozen|\ | ||
22 | gotten|given|gone|\ | ||
23 | ground|grown|hung|\ | ||
24 | heard|hidden|hit|\ | ||
25 | held|hurt|kept|knelt|\ | ||
26 | knit|known|laid|led|\ | ||
27 | leapt|learnt|left|\ | ||
28 | lent|let|lain|lighted|\ | ||
29 | lost|made|meant|met|\ | ||
30 | misspelt|mistaken|mown|\ | ||
31 | overcome|overdone|overtaken|\ | ||
32 | overthrown|paid|pled|proven|\ | ||
33 | put|quit|read|rid|ridden|\ | ||
34 | rung|risen|run|sawn|said|\ | ||
35 | seen|sought|sold|sent|\ | ||
36 | set|sewn|shaken|shaven|\ | ||
37 | shorn|shed|shone|shod|\ | ||
38 | shot|shown|shrunk|shut|\ | ||
39 | sung|sunk|sat|slept|\ | ||
40 | slain|slid|slung|slit|\ | ||
41 | smitten|sown|spoken|sped|\ | ||
42 | spent|spilt|spun|spit|\ | ||
43 | split|spread|sprung|stood|\ | ||
44 | stolen|stuck|stung|stunk|\ | ||
45 | stridden|struck|strung|\ | ||
46 | striven|sworn|swept|\ | ||
47 | swollen|swum|swung|taken|\ | ||
48 | taught|torn|told|thought|\ | ||
49 | thrived|thrown|thrust|\ | ||
50 | trodden|understood|upheld|\ | ||
51 | upset|woken|worn|woven|\ | ||
52 | wed|wept|wound|won|\ | ||
53 | withheld|withstood|wrung|\ | ||
54 | written" | ||
55 | |||
56 | if [ "$1" = "" ]; then | ||
57 | echo "usage: $(basename "$0") <file> ..." | ||
58 | exit | ||
59 | fi | ||
60 | |||
61 | grep -E -n -i --color \ | ||
62 | "\\b(am|are|were|being|is|been|was|be)\ | ||
63 | \\b[ ]*(\w+ed|($irregulars))\\b" "$*" | ||
64 | |||
65 | exit $? | ||
diff --git a/.local/bin/power.sh b/.local/bin/power.sh index f794211..2dd7e5d 100755 --- a/.local/bin/power.sh +++ b/.local/bin/power.sh | |||
@@ -15,10 +15,10 @@ chosen=$(echo -e "lock\nshutdown\nrestart" | rofi -dmenu -i) | |||
15 | # Info about some states are available here: | 15 | # Info about some states are available here: |
16 | # https://www.freedesktop.org/software/systemd/man/systemd-sleep.conf.html#Description | 16 | # https://www.freedesktop.org/software/systemd/man/systemd-sleep.conf.html#Description |
17 | 17 | ||
18 | if [[ $chosen = "lock" ]]; then | 18 | if [[ $chosen == "lock" ]]; then |
19 | $HOME/.local/bin/lock | 19 | "$HOME"/.local/bin/lock |
20 | elif [[ $chosen = "shutdown" ]]; then | 20 | elif [[ $chosen == "shutdown" ]]; then |
21 | systemctl poweroff | 21 | systemctl poweroff |
22 | elif [[ $chosen = "restart" ]]; then | 22 | elif [[ $chosen == "restart" ]]; then |
23 | systemctl reboot | 23 | systemctl reboot |
24 | fi | 24 | fi |
diff --git a/.local/bin/rfv b/.local/bin/rfv index 4c9a632..a178e67 100755 --- a/.local/bin/rfv +++ b/.local/bin/rfv | |||
@@ -4,11 +4,11 @@ | |||
4 | # 2. Interactively narrow down the list using fzf | 4 | # 2. Interactively narrow down the list using fzf |
5 | # 3. Open the file in Vim | 5 | # 3. Open the file in Vim |
6 | IFS=: read -ra selected < <( | 6 | IFS=: read -ra selected < <( |
7 | rg --color=always --line-number --no-heading --smart-case "${*:-}" | | 7 | rg --color=always --line-number --no-heading --smart-case "${*:-}" \ |
8 | fzf --ansi \ | 8 | | fzf --ansi \ |
9 | --color "hl:-1:underline,hl+:-1:underline:reverse" \ | 9 | --color "hl:-1:underline,hl+:-1:underline:reverse" \ |
10 | --delimiter : \ | 10 | --delimiter : \ |
11 | --preview 'bat --color=always {1} --highlight-line {2}' \ | 11 | --preview 'bat --color=always {1} --highlight-line {2}' \ |
12 | --preview-window='up:60%:+{2}+3/3:~3' | 12 | --preview-window='up:60%:+{2}+3/3:~3' |
13 | ) | 13 | ) |
14 | [ -n "${selected[0]}" ] && nvim "${selected[0]}" "+${selected[1]}" | 14 | [ -n "${selected[0]}" ] && nvim "${selected[0]}" "+${selected[1]}" |
diff --git a/.local/bin/spark b/.local/bin/spark new file mode 100755 index 0000000..53a38be --- /dev/null +++ b/.local/bin/spark | |||
@@ -0,0 +1,103 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | # | ||
3 | # spark | ||
4 | # https://github.com/holman/spark | ||
5 | # | ||
6 | # Generates sparklines for a set of data. | ||
7 | # | ||
8 | # Here's a good web-based sparkline generator that was a bit of inspiration | ||
9 | # for spark: | ||
10 | # | ||
11 | # https://datacollective.org/sparkblocks | ||
12 | # | ||
13 | # spark takes a comma-separated or space-separated list of data and then prints | ||
14 | # a sparkline out of it. | ||
15 | # | ||
16 | # Examples: | ||
17 | # | ||
18 | # spark 1 5 22 13 53 | ||
19 | # # => ▁▁▃▂▇ | ||
20 | # | ||
21 | # spark 0 30 55 80 33 150 | ||
22 | # # => ▁▂▃▅▂▇ | ||
23 | # | ||
24 | # spark -h | ||
25 | # # => Prints the spark help text. | ||
26 | |||
27 | # Generates sparklines. | ||
28 | # | ||
29 | # $1 - The data we'd like to graph. | ||
30 | _echo() | ||
31 | { | ||
32 | if [ "X$1" = "X-n" ]; then | ||
33 | shift | ||
34 | printf "%s" "$*" | ||
35 | else | ||
36 | printf "%s\n" "$*" | ||
37 | fi | ||
38 | } | ||
39 | |||
40 | spark() | ||
41 | { | ||
42 | local n numbers= | ||
43 | |||
44 | # find min/max values | ||
45 | local min=0xffffffff max=0 | ||
46 | |||
47 | for n in ${@//,/ } | ||
48 | do | ||
49 | # on Linux (or with bash4) we could use `printf %.0f $n` here to | ||
50 | # round the number but that doesn't work on OS X (bash3) nor does | ||
51 | # `awk '{printf "%.0f",$1}' <<< $n` work, so just cut it off | ||
52 | n=${n%.*} | ||
53 | (( n < min )) && min=$n | ||
54 | (( n > max )) && max=$n | ||
55 | numbers=$numbers${numbers:+ }$n | ||
56 | done | ||
57 | |||
58 | # print ticks | ||
59 | local ticks=(▁ ▂ ▃ ▄ ▅ ▆ ▇ █) | ||
60 | |||
61 | # use a high tick if data is constant | ||
62 | (( min == max )) && ticks=(▅ ▆) | ||
63 | |||
64 | local f=$(( (($max-$min)<<8)/(${#ticks[@]}-1) )) | ||
65 | (( f < 1 )) && f=1 | ||
66 | |||
67 | for n in $numbers | ||
68 | do | ||
69 | _echo -n ${ticks[$(( ((($n-$min)<<8)/$f) ))]} | ||
70 | done | ||
71 | _echo | ||
72 | } | ||
73 | |||
74 | # If we're being sourced, don't worry about such things | ||
75 | if [ "$BASH_SOURCE" == "$0" ]; then | ||
76 | # Prints the help text for spark. | ||
77 | help() | ||
78 | { | ||
79 | local spark=$(basename $0) | ||
80 | cat <<EOF | ||
81 | |||
82 | USAGE: | ||
83 | $spark [-h|--help] VALUE,... | ||
84 | |||
85 | EXAMPLES: | ||
86 | $spark 1 5 22 13 53 | ||
87 | ▁▁▃▂█ | ||
88 | $spark 0,30,55,80,33,150 | ||
89 | ▁▂▃▄▂█ | ||
90 | echo 9 13 5 17 1 | $spark | ||
91 | ▄▆▂█▁ | ||
92 | EOF | ||
93 | } | ||
94 | |||
95 | # show help for no arguments if stdin is a terminal | ||
96 | if { [ -z "$1" ] && [ -t 0 ] ; } || [ "$1" == '-h' ] || [ "$1" == '--help' ] | ||
97 | then | ||
98 | help | ||
99 | exit 0 | ||
100 | fi | ||
101 | |||
102 | spark ${@:-`cat`} | ||
103 | fi | ||
diff --git a/.local/bin/texclear b/.local/bin/texclear index 9a32d70..1fb280a 100755 --- a/.local/bin/texclear +++ b/.local/bin/texclear | |||
@@ -8,7 +8,7 @@ case "$1" in | |||
8 | file=$(readlink -f "$1") | 8 | file=$(readlink -f "$1") |
9 | dir=$(dirname "$file") | 9 | dir=$(dirname "$file") |
10 | base="${file%.*}" | 10 | base="${file%.*}" |
11 | find "$dir" -maxdepth 1 -type f -regextype gnu-awk -regex "^$base\\.(4tc|xref|tmp|pyc|pyo|fls|vrb|fdb_latexmk|bak|swp|aux|log|synctex\\(busy\\)|lof|lot|maf|idx|mtc|mtc0|nav|out|snm|toc|bcf|run\\.xml|synctex\\.gz|blg|bbl)" -delete ;; | 11 | find "$dir" -maxdepth 1 -type f -regextype gnu-awk -regex "^$base\\.(4tc|xref|tmp|pyc|pyo|fls|vrb|fdb_latexmk|bak|swp|aux|log|synctex\\(busy\\)|lof|lot|maf|idx|mtc|mtc0|nav|out|snm|toc|bcf|run\\.xml|synctex\\.gz|blg|bbl)" -delete |
12 | *) printf "Give .tex file as argument.\\n" ;; | 12 | ;; |
13 | *) printf 'Give .tex file as argument.\n' ;; | ||
13 | esac | 14 | esac |
14 | |||
diff --git a/.local/bin/type.sh b/.local/bin/type.sh index b9dbcd7..2d563f3 100755 --- a/.local/bin/type.sh +++ b/.local/bin/type.sh | |||
@@ -1,15 +1,13 @@ | |||
1 | #!/usr/bin/env bash | 1 | #!/usr/bin/env bash |
2 | sleep 1 | 2 | sleep 1 |
3 | while read line | 3 | while read -r line; do |
4 | do | 4 | grep -o . <<< "$line" | while read -r a; do |
5 | grep -o . <<<$line | while read a | 5 | sleep 0.$((RANDOM % 3)) |
6 | do | ||
7 | sleep 0.$((RANDOM%3)) | ||
8 | #2>&1 echo -n "${a:- }" | tee /dev/tty | 6 | #2>&1 echo -n "${a:- }" | tee /dev/tty |
9 | echo -n "${a:- }" | tee /dev/tty | 7 | echo -n "${a:- }" | tee /dev/tty |
10 | done | 8 | done |
11 | sleep 0.$((RANDOM%7)) | 9 | sleep 0.$((RANDOM % 7)) |
12 | 1>&2 echo -ne $"\n" | 10 | echo 1>&2 -ne $"\n" |
13 | echo | 11 | echo |
14 | sleep 1.0 | 12 | sleep 1.0 |
15 | done | 13 | done |
diff --git a/.local/bin/weasel b/.local/bin/weasel new file mode 100755 index 0000000..ce82ce3 --- /dev/null +++ b/.local/bin/weasel | |||
@@ -0,0 +1,38 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | |||
3 | weasels="many|various|very|fairly|several|extremely\ | ||
4 | |exceedingly|quite|remarkably|few|surprisingly\ | ||
5 | |mostly|largely|huge|tiny|((are|is) a number)\ | ||
6 | |excellent|interestingly|significantly\ | ||
7 | |substantially|clearly|vast|relatively|completely" | ||
8 | |||
9 | wordfile="" | ||
10 | |||
11 | # Check for an alternate weasel file | ||
12 | if [ -f "$HOME"/etc/words/weasels ]; then | ||
13 | wordfile="$HOME/etc/words/weasels" | ||
14 | fi | ||
15 | |||
16 | if [ -f "$WORDSDIR"/weasels ]; then | ||
17 | wordfile="$WORDSDIR/weasels" | ||
18 | fi | ||
19 | |||
20 | if [ -f words/weasels ]; then | ||
21 | wordfile="words/weasels" | ||
22 | fi | ||
23 | |||
24 | if [ ! "$wordfile" = "" ]; then | ||
25 | weasels="xyzabc123" | ||
26 | for w in $(cat $wordfile); do | ||
27 | weasels="$weasels|$w" | ||
28 | done | ||
29 | fi | ||
30 | |||
31 | if [ "$1" = "" ]; then | ||
32 | echo "usage: $(basename "$0") <file> ..." | ||
33 | exit | ||
34 | fi | ||
35 | |||
36 | grep -E -i -n --color "\\b($weasels)\\b" "$*" | ||
37 | |||
38 | exit $? | ||
@@ -1,12 +1,10 @@ | |||
1 | cowsay $(fortune) | lolcat | 1 | cowsay $(fortune) | lolcat |
2 | hostname=$(uname -n) | 2 | hostname=$(uname -n) |
3 | 3 | ||
4 | # If you come from bash you might have to change your $PATH. | 4 | export PATH="$PATH:$HOME/.local/bin:$HOME/.cargo/bin" |
5 | export PATH=/usr/local/bin:$PATH | ||
6 | export PATH="$PATH:/home/yigit/.local/bin:$HOME/.cargo/bin" | ||
7 | 5 | ||
8 | # Path to your oh-my-zsh installation. | 6 | # Path to your oh-my-zsh installation. |
9 | export ZSH=/home/yigit/.oh-my-zsh | 7 | export ZSH=$HOME/.oh-my-zsh |
10 | 8 | ||
11 | ZSH_THEME="spaceship" | 9 | ZSH_THEME="spaceship" |
12 | SPACESHIP_CHAR_SYMBOL="δ" | 10 | SPACESHIP_CHAR_SYMBOL="δ" |