commit 89b4f74842bed140fc9047d6c3d3b216067846c6 parent 02ed13afcae2b828b17029bb9536e4310c87b521 Author: Hayden Hamilton <hayden@haydenvh.com> Date: Fri, 3 Apr 2020 23:10:44 +0100 MY EYEEEES Diffstat:
37 files changed, 784 insertions(+), 121 deletions(-)
diff --git a/.config/alias b/.config/alias @@ -1,11 +1,13 @@ -ls \ls --color +ls nop l l \ls --color la \ls --color -A ll \ls --color -lh lla \ls --color -lAh -vim nvim -vi nvim +vim nop v +vi nop v v nvim +git nop g +g \git xi sudo xbps-install xiu sudo xbps-install -S; sudo xbps-install -yu xbps; sudo xbps-install -yu xq sudo xbps-query @@ -28,6 +30,7 @@ tmux tmux -f ~/.config/tmux/config nw newsboat nm neomutt maic sudo make all install clean +homesync rsync --port 222 --delete -azPe 'ssh -p 222' --exclude=general --exclude=.cache --exclude=.local/cache $HOME/ void@192.168.1.20:/home/void/homedir/ ~d cd ~/general/downloads; ls ~do cd ~/general/documents; ls ~iw cd ~/images/wallpapers; ls diff --git a/.config/galias b/.config/galias @@ -9,7 +9,5 @@ ........... ../../../../../../../../../.. ............ ../../../../../../../../../../.. om origin master -o origin gm github master -g github aic all install clean diff --git a/.config/neomutt/mailcap b/.config/neomutt/mailcap @@ -0,0 +1,6 @@ +text/html ; vimb '%s' +text/* ; nvim '%s' + +application/pdf ; zathura '%s' + +image/* ; sxiv '%s' diff --git a/.config/neomutt/neomuttrc b/.config/neomutt/neomuttrc @@ -2,6 +2,7 @@ set ssl_starttls = yes set ssl_force_tls = yes source user source pass +set mailcap_path = "~/.config/neomutt/mailcap" set smtp_authenticators = "plain" set folder = "~/general/mail/" @@ -10,7 +11,7 @@ set record = "~/general/mail/sent" set postponed = "~/general/mail/drafts" set trash = "~/general/mail/rubbish" #mailboxes =inbox =sent =drafts =rubbish # These are probably what you want -mailboxes =inbox =sent =drafts =rubbish =exmouth =exmouthsent =exmouthrubbish # These are my custom one +mailboxes =inbox =sent =drafts =rubbish =exmouth =exmouthsent =exmouthrubbish # Configured by my mkmailbox script set mbox_type = Maildir @@ -18,3 +19,8 @@ source colours source sidebar bind index D purge-message + +set sort=reverse-date +set sort_aux=last-date-received + +#source ~/.config/neomutt/gpg.rc diff --git a/.config/nvim/autoload/quick_scope.vim b/.config/nvim/autoload/quick_scope.vim @@ -0,0 +1,370 @@ +" Autoload interface functions ------------------------------------------------- + +function! quick_scope#Toggle() abort + if g:qs_enable + let g:qs_enable = 0 + call quick_scope#UnhighlightLine() + else + let g:qs_enable = 1 + doautocmd CursorMoved + endif +endfunction + +" The direction can be 0 (backward), 1 (forward) or 2 (both). Targets are the +" characters that can be highlighted. +function! quick_scope#HighlightLine(direction, targets) abort + if g:qs_enable && (!exists('b:qs_local_disable') || !b:qs_local_disable) && index(get(g:, 'qs_buftype_blacklist', []), &buftype) < 0 + let line = getline(line('.')) + let len = strlen(line) + let pos = col('.') + + if !empty(line) && len <= g:qs_max_chars + " Highlight after the cursor. + if a:direction != 0 + let [patt_p, patt_s] = s:get_highlight_patterns(line, pos, len, a:targets) + call s:apply_highlight_patterns([patt_p, patt_s]) + endif + + " Highlight before the cursor. + if a:direction != 1 + let [patt_p, patt_s] = s:get_highlight_patterns(line, pos, -1, a:targets) + call s:apply_highlight_patterns([patt_p, patt_s]) + endif + endif + endif +endfunction + +function! quick_scope#UnhighlightLine() abort + for m in filter(getmatches(), printf('v:val.group ==# "%s" || v:val.group ==# "%s"', g:qs_hi_group_primary, g:qs_hi_group_secondary)) + call matchdelete(m.id) + endfor +endfunction + +" Set or reset flags and state for highlighting on key press. +function! quick_scope#Ready() abort + " Direction of highlight search. 0 is backward, 1 is forward + let s:direction = 0 + + " The corresponding character to f,F,t or T + let s:target = '' + + " Position of where a dummy cursor should be placed. + let s:cursor = 0 + + " Characters with secondary highlights. Modified by get_highlight_patterns() + let s:chars_s = [] + + call s:handle_extra_highlight(2) + + " Intentionally return an empty string that will be concatenated with the + " return values from aim(), reload() and double_tap(). + return '' +endfunction + +" Returns {character motion}{captured char} (to map to a character motion) to +" emulate one as closely as possible. +function! quick_scope#Aim(motion) abort + if (a:motion ==# 'f' || a:motion ==# 't') + let s:direction = 1 + else + let s:direction = 0 + endif + + " Add a dummy cursor since calling getchar() places the actual cursor on + " the command line. + let s:cursor = matchadd(g:qs_hi_group_cursor, '\%#', g:qs_hi_priority + 1) + + " Silence 'Type :quit<Enter> to exit Vim' message on <c-c> during a + " character search. + " + " This line also causes getchar() to cleanly cancel on a <c-c>. + let b:qs_prev_ctrl_c_map = maparg('<c-c>', 'n', 0, 1) + if empty(b:qs_prev_ctrl_c_map) + unlet b:qs_prev_ctrl_c_map + endif + execute 'nnoremap <silent> <c-c> <c-c>' + + call quick_scope#HighlightLine(s:direction, g:qs_accepted_chars) + + redraw + + " Store and capture the target for the character motion. + let char = getchar() + let s:target = char ==# "\<S-lt>" ? '<' : nr2char(char) + + return a:motion . s:target +endfunction + +" Cleanup after a character motion is executed. +function! quick_scope#Reload() abort + " Remove dummy cursor + call matchdelete(s:cursor) + + " Restore previous or default <c-c> functionality + if exists('b:qs_prev_ctrl_c_map') + call quick_scope#mapping#Restore(b:qs_prev_ctrl_c_map) + unlet b:qs_prev_ctrl_c_map + else + execute 'nunmap <c-c>' + endif + + call quick_scope#UnhighlightLine() + + " Intentionally return an empty string. + return '' +endfunction + +" Trigger an extra highlight for a target character only if it originally had +" a secondary highlight. +function! quick_scope#DoubleTap() abort + if index(s:chars_s, s:target) != -1 + " Warning: slight hack below. Although the cursor has already moved by + " this point, col('.') won't return the updated cursor position until the + " invoking mapping completes. So when highlight_line() is called here, the + " first occurrence of the target will be under the cursor, and the second + " occurrence will be where the first occurence should have been. + call quick_scope#HighlightLine(s:direction, [expand(s:target)]) + + " Unhighlight only primary highlights (i.e., the character under the + " cursor). + for m in filter(getmatches(), printf('v:val.group ==# "%s"', g:qs_hi_group_primary)) + call matchdelete(m.id) + endfor + + " Temporarily change the second occurrence highlight color to a primary + " highlight color. + call s:save_secondary_highlight() + execute 'highlight! link ' . g:qs_hi_group_secondary . ' ' . g:qs_hi_group_primary + + " Set a temporary event to keep track of when to reset the extra + " highlight. + augroup quick_scope + autocmd CursorMoved * call s:handle_extra_highlight(1) + augroup END + + call s:handle_extra_highlight(0) + endif + + " Intentionally return an empty string. + return '' +endfunction + +" Helpers ---------------------------------------------------------------------- + +" Apply the highlights for each highlight group based on pattern strings. +" Arguments are expected to be lists of two items. +function! s:apply_highlight_patterns(patterns) abort + let [patt_p, patt_s] = a:patterns + if !empty(patt_p) + " Highlight columns corresponding to matched characters. + " + " Ignore the leading | in the primary highlights string. + call matchadd(g:qs_hi_group_primary, '\v%' . line('.') . 'l(' . patt_p[1:] . ')', g:qs_hi_priority) + endif + if !empty(patt_s) + call matchadd(g:qs_hi_group_secondary, '\v%' . line('.') . 'l(' . patt_s[1:] . ')', g:qs_hi_priority) + endif +endfunction + +" Keep track of which characters have a secondary highlight (but no primary +" highlight) and store them in :chars_s. Used when g:qs_highlight_on_keys is +" active to decide whether to trigger an extra highlight. +function! s:save_chars_with_secondary_highlights(chars) abort + let [char_p, char_s] = a:chars + + if !empty(char_p) + " Do nothing + elseif !empty(char_s) + call add(s:chars_s, char_s) + endif +endfunction + +" Set or append to the pattern strings for the highlights. +function! s:add_to_highlight_patterns(patterns, highlights) abort + let [patt_p, patt_s] = a:patterns + let [hi_p, hi_s] = a:highlights + + " If there is a primary highlight for the last word, add it to the primary + " highlight pattern. + if hi_p > 0 + let patt_p = printf('%s|%%%sc', patt_p, hi_p) + elseif hi_s > 0 + let patt_s = printf('%s|%%%sc', patt_s, hi_s) + endif + + return [patt_p, patt_s] +endfunction + +" Finds which characters to highlight and returns their column positions as a +" pattern string. +function! s:get_highlight_patterns(line, cursor, end, targets) abort + " Keeps track of the number of occurrences for each target + let occurrences = {} + + " Patterns to match the characters that will be marked with primary and + " secondary highlight groups, respectively + let [patt_p, patt_s] = ['', ''] + + " Indicates whether this is the first word under the cursor. We don't want + " to highlight any characters in it. + let is_first_word = 1 + + " We want to skip the first char as this is the char the cursor is at + let is_first_char = 1 + + " The position of a character in a word that will be given a highlight. A + " value of 0 indicates there is no character to highlight. + let [hi_p, hi_s] = [0, 0] + + " The (next) characters that will be given a highlight. Used by + " save_chars_with_secondary_highlights() to see whether an extra highlight + " should be triggered if g:qs_highlight_on_keys is active. + let [char_p, char_s] = ['', ''] + + " If 1, we're looping forwards from the cursor to the end of the line; + " otherwise, we're looping from the cursor to the beginning of the line. + let direction = a:cursor < a:end ? 1 : 0 + + " find the character index i and the byte index c + " of the current cursor position + let c = 1 + let i = 0 + let char = '' + while c != a:cursor + let char = matchstr(a:line, '.', byteidx(a:line, i)) + let c += len(char) + let i += 1 + endwhile + + " reposition cursor to end of the char's composing bytes + if !direction + let c += len(matchstr(a:line, '.', byteidx(a:line, i))) - 1 + endif + + " catch cases where multibyte chars may result in c not exactly equal to + " a:end + while (direction && c <= a:end || !direction && c >= a:end) + + let char = matchstr(a:line, '.', byteidx(a:line, i)) + + " Skips the first char as it is the char the cursor is at + if is_first_char + + let is_first_char = 0 + + " Don't consider the character for highlighting, but mark the position + " as the start of a new word. + " use '\k' to check agains keyword characters (see :help 'iskeyword' and + " :help /\k) + elseif char !~# '\k' || empty(char) + if !is_first_word + let [patt_p, patt_s] = s:add_to_highlight_patterns([patt_p, patt_s], [hi_p, hi_s]) + endif + + " We've reached a new word, so reset any highlights. + let [hi_p, hi_s] = [0, 0] + let [char_p, char_s] = ['', ''] + + let is_first_word = 0 + elseif index(a:targets, char) != -1 + if has_key(occurrences, char) + let occurrences[char] += 1 + else + let occurrences[char] = 1 + endif + + if !is_first_word + let char_occurrences = get(occurrences, char) + + " If the search is forward, we want to be greedy; otherwise, we + " want to be reluctant. This prioritizes highlighting for + " characters at the beginning of a word. + " + " If this is the first occurrence of the letter in the word, + " mark it for a highlight. + " If we are looking backwards, c will point to the end of the + " end of composing bytes so we adjust accordingly + " eg. with a multibyte char of length 3, c will point to the + " 3rd byte. Minus (len(char) - 1) to adjust to 1st byte + if char_occurrences == 1 && ((direction == 1 && hi_p == 0) || direction == 0) + let hi_p = c - (1 - direction) * (len(char) - 1) + let char_p = char + elseif char_occurrences == 2 && ((direction == 1 && hi_s == 0) || direction == 0) + let hi_s = c - (1 - direction) * (len(char)- 1) + let char_s = char + endif + endif + endif + + " update i to next character + " update c to next byteindex + if direction == 1 + let i += 1 + let c += strlen(char) + else + let i -= 1 + let c -= strlen(char) + endif + endwhile + + let [patt_p, patt_s] = s:add_to_highlight_patterns([patt_p, patt_s], [hi_p, hi_s]) + + if exists('g:qs_highlight_on_keys') + call s:save_chars_with_secondary_highlights([char_p, char_s]) + endif + + return [patt_p, patt_s] +endfunction + +" Save the value of g:qs_hi_group_secondary to preserve customization before +" changing it as a result of a double_tap +function! s:save_secondary_highlight() abort + if &verbose + let s:saved_verbose = &verbose + set verbose=0 + endif + + redir => s:saved_secondary_highlight + execute 'silent highlight ' . g:qs_hi_group_secondary + redir END + + if exists('s:saved_verbose') + execute 'set verbose=' . s:saved_verbose + endif + + let s:saved_secondary_highlight = substitute(s:saved_secondary_highlight, '^.*xxx ', '', '') +endfunction + +" Reset g:qs_hi_group_secondary to its saved value after it was changed as a result +" of a double_tap +function! s:reset_saved_secondary_highlight() abort + if s:saved_secondary_highlight =~# '^links to ' + let s:saved_secondary_hlgroup_only = substitute(s:saved_secondary_highlight, '^links to ', '', '') + execute 'highlight! link ' . g:qs_hi_group_secondary . ' ' . s:saved_secondary_hlgroup_only + else + execute 'highlight ' . g:qs_hi_group_secondary . ' ' . s:saved_secondary_highlight + endif +endfunction + +" Highlight on key press ----------------------------------------------------- +" Manage state for keeping or removing the extra highlight after triggering a +" highlight on key press. +" +" State can be 0 (extra highlight has just been triggered), 1 (the cursor has +" moved while an extra highlight is active), or 2 (cancel an active extra +" highlight). +function! s:handle_extra_highlight(state) abort + if a:state == 0 + let s:cursor_moved_count = 0 + elseif a:state == 1 + let s:cursor_moved_count = s:cursor_moved_count + 1 + endif + + " If the cursor has moved more than once since the extra highlight has been + " active (or the state is 2), reset the extra highlight. + if exists('s:cursor_moved_count') && (a:state == 2 || s:cursor_moved_count > 1) + call quick_scope#UnhighlightLine() + call s:reset_saved_secondary_highlight() + autocmd! quick_scope CursorMoved + endif +endfunction diff --git a/.config/nvim/autoload/quick_scope/lazy_print.vim b/.config/nvim/autoload/quick_scope/lazy_print.vim @@ -0,0 +1,11 @@ +" function to wait to print error messages +function! quick_scope#lazy_print#err(message) abort + augroup quick_scope_lazy_print + autocmd! + " clear the augroup so that these lazy loaded error messages only execute + " once after starting + augroup END + echohl ErrorMsg + echomsg 'quick_scope ' . a:message + echohl None +endfunction diff --git a/.config/nvim/autoload/quick_scope/mapping.vim b/.config/nvim/autoload/quick_scope/mapping.vim @@ -0,0 +1,11 @@ +" remap a key given a dictionary representing a saved mapping +function! quick_scope#mapping#Restore(mapping) abort + execute a:mapping.mode + \ . (a:mapping.noremap ? 'noremap ' : 'map ') + \ . (a:mapping.buffer ? '<buffer> ' : '') + \ . (a:mapping.expr ? '<expr> ' : '') + \ . (a:mapping.nowait ? '<nowait> ' : '') + \ . (a:mapping.silent ? '<silent> ' : '') + \ . a:mapping.lhs . ' ' + \ . substitute(a:mapping.rhs, '<SID>', '<SNR>' . a:mapping.sid . '_', 'g') +endfunction diff --git a/.config/nvim/colors/haydenh.vim b/.config/nvim/colors/haydenh.vim @@ -60,3 +60,5 @@ hi SpellRare ctermbg=1 ctermfg=none cterm=underline guifg=none guibg=#24283c gui hi SpellLocal ctermbg=1 ctermfg=255 cterm=bold guifg=#eeeeee gui=none,bold hi MatchParen ctermfg=30 cterm=reverse guifg=#003740 gui=reverse hi Underlined cterm=underline ctermfg=23 gui=underline guifg=#005f5f +hi QuickScopePrimary guifg=#892b2b gui=bold,reverse +hi QuickScopeSecondary guifg=#d750d7 gui=bold,reverse diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim @@ -13,7 +13,7 @@ " repeat - repeat things " vimling (ipa, deadkeys) - deadkeys " vimagit - git in vim -" vimwiki - wiki program (can view my wiki) +" quickscope - find stuff easer "Leader let mapleader=";" @@ -194,6 +194,9 @@ source ~/.config/nvim/modules/message.vim source ~/.config/nvim/modules/openc.vim source ~/.config/nvim/modules/filetype.vim +" quick-scope +let g:qs_highlight_on_keys = ['f', 'F', 't', 'T'] + "Automatic commands augroup autocmd "greet diff --git a/.config/nvim/plugin/quick_scope.vim b/.config/nvim/plugin/quick_scope.vim @@ -0,0 +1,144 @@ +" Initialize ----------------------------------------------------------------- +let s:plugin_name = 'quick-scope' + +if exists('g:loaded_quick_scope') + finish +endif + +let g:loaded_quick_scope = 1 + +if &compatible + echoerr s:plugin_name . " won't load in Vi-compatible mode." + finish +endif + +if v:version < 701 || (v:version == 701 && !has('patch040')) + echoerr s:plugin_name . ' requires Vim running in version 7.1.040 or later.' + finish +endif + +" Save cpoptions and reassign them later. See :h use-cpo-save. +let s:cpo_save = &cpo +set cpo&vim + +" Autocommands --------------------------------------------------------------- +augroup quick_scope + autocmd! + autocmd ColorScheme * call s:set_highlight_colors() +augroup END + +" Options -------------------------------------------------------------------- +if !exists('g:qs_enable') + let g:qs_enable = 1 +endif + +if !exists('g:qs_lazy_highlight') + let g:qs_lazy_highlight = 0 +endif + +if !exists('g:qs_max_chars') + " Disable on long lines for performance + let g:qs_max_chars = 1000 +endif + +if !exists('g:qs_accepted_chars') + let g:qs_accepted_chars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] +endif + +if !exists('g:qs_buftype_blacklist') + let g:qs_buftype_blacklist = [] +endif + +if !exists('g:qs_highlight_on_keys') + " Vanilla mode. Highlight on cursor movement. + augroup quick_scope + if g:qs_lazy_highlight + autocmd CursorHold,InsertLeave,ColorScheme,WinEnter,BufEnter,FocusGained * call quick_scope#UnhighlightLine() | call quick_scope#HighlightLine(2, g:qs_accepted_chars) + else + autocmd CursorMoved,InsertLeave,ColorScheme,WinEnter,BufEnter,FocusGained * call quick_scope#UnhighlightLine() | call quick_scope#HighlightLine(2, g:qs_accepted_chars) + endif + autocmd InsertEnter,BufLeave,TabLeave,WinLeave,FocusLost * call quick_scope#UnhighlightLine() + augroup END +else + " Highlight on key press. Set an 'augmented' mapping for each defined key. + for motion in filter(g:qs_highlight_on_keys, "v:val =~# '^[fFtT]$'") + for mapmode in ['nnoremap', 'onoremap', 'xnoremap'] + execute printf(mapmode . ' <unique> <silent> <expr> %s quick_scope#Ready() . quick_scope#Aim("%s") . quick_scope#Reload() . quick_scope#DoubleTap()', motion, motion) + endfor + endfor +endif + +" User commands -------------------------------------------------------------- +command! -nargs=0 QuickScopeToggle call quick_scope#Toggle() + +" Plug mappings -------------------------------------------------------------- +nnoremap <silent> <plug>(QuickScopeToggle) :call quick_scope#Toggle()<cr> +xnoremap <silent> <plug>(QuickScopeToggle) :<c-u>call quick_scope#Toggle()<cr> + +" Colors --------------------------------------------------------------------- +" Set the colors used for highlighting. +function! s:set_highlight_colors() + " Priority for overruling other highlight matches. + let g:qs_hi_priority = 1 + + " Highlight group marking first appearance of characters in a line. + let g:qs_hi_group_primary = 'QuickScopePrimary' + " Highlight group marking second appearance of characters in a line. + let g:qs_hi_group_secondary = 'QuickScopeSecondary' + " Highlight group marking dummy cursor when quick-scope is enabled on key + " press. + let g:qs_hi_group_cursor = 'QuickScopeCursor' + + if exists('g:qs_first_occurrence_highlight_color') + " backwards compatibility mode for old highlight configuration + augroup quick_scope_lazy_print + if has('vim_starting') + " register this as a lazy print error so as not to block Vim starting + autocmd CursorHold,CursorHoldI * call quick_scope#lazy_print#err('option g:qs_first_occurrence_highlight_color is deprecated!') + else + echohl ErrorMsg + echomsg s:plugin_name . ' option g:qs_first_occurrence_highlight_color is deprecated!' + echohl None + endif + augroup END + + let l:first_color = g:qs_first_occurrence_highlight_color + if l:first_color =~# '#' + execute 'highlight default ' . g:qs_hi_group_primary . ' gui=underline guifg=' . l:first_color + else + execute 'highlight default ' . g:qs_hi_group_primary . ' cterm=underline ctermfg=' . l:first_color + endif + else + execute 'highlight default link ' . g:qs_hi_group_primary . ' Function' + endif + + if exists('g:qs_second_occurrence_highlight_color') + " backwards compatibility mode for old highlight configuration + augroup quick_scope_lazy_print + if has('vim_starting') + " register this as a lazy print error so as not to block Vim starting + autocmd CursorHold,CursorHoldI * call quick_scope#lazy_print#err('option g:qs_second_occurrence_highlight_color is deprecated!') + else + echohl ErrorMsg + echomsg s:plugin_name . ' option g:qs_second_occurrence_highlight_color is deprecated!' + echohl None + endif + augroup END + + let l:second_color = g:qs_second_occurrence_highlight_color + if l:second_color =~# '#' + execute 'highlight default ' . g:qs_hi_group_secondary . ' gui=underline guifg=' . l:second_color + else + execute 'highlight default ' . g:qs_hi_group_secondary . ' cterm=underline ctermfg=' . l:second_color + endif + else + execute 'highlight default link ' . g:qs_hi_group_secondary . ' Define' + endif + + execute 'highlight default link ' . g:qs_hi_group_cursor . ' Cursor' +endfunction + +call s:set_highlight_colors() + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/.config/redshift/redshift.conf b/.config/redshift/redshift.conf @@ -0,0 +1,11 @@ +; My eyes hurt one night, so this found it's way in now + +[redshift] +temp-day=5700 +temp-night=2800 + +; Pozzy london time - I don't wanna be v& +location-provider=manual +[manual] +lat=51.509865 +lon=-0.118092 diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc @@ -47,10 +47,10 @@ super + alt + w fehffile ~/.cache/rfeh/prev super + ctrl + y - dmpv ~/general/videos/ /tmp/mpv-socket2 /tmp/mpv-socket --fs fuzz + dmpv general/videos/ /tmp/mpv-socket2 /tmp/mpv-socket --fs fuzz super + ctrl + u - dmpv ~/general/music/ /tmp/mpv-socket /tmp/mpv-socket2 --no-video fuzz + dmpv general/music/ /tmp/mpv-socket /tmp/mpv-socket2 --no-video fuzz super + alt + {y,u} rmpv ~/general/{videos,music}/ 50 diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc @@ -4,7 +4,7 @@ mkalias # Prompt precmd(){ prev="$?" - branch=$(git branch 2>/dev/null | grep "\*" | tr -d '\*') + branch=$(\git branch 2>/dev/null | grep "\*" | tr -d '\*') #dir=$(pwd | sed "s~$HOME~~") dir=$(pwd) prompt="%{$(tput setab 3)%0G%} %{$(tput sgr0)%0G%} " diff --git a/.config/zsh/alias.zsh b/.config/zsh/alias.zsh @@ -1,11 +1,26 @@ -alias ls=" \ls --color" +alias -g ...=" ../.." +alias -g ....=" ../../.." +alias -g .....=" ../../../.." +alias -g ......=" ../../../../.." +alias -g .......=" ../../../../../.." +alias -g ........=" ../../../../../../.." +alias -g .........=" ../../../../../../../.." +alias -g ..........=" ../../../../../../../../.." +alias -g ...........=" ../../../../../../../../../.." +alias -g ............=" ../../../../../../../../../../.." +alias -g om=" origin master" +alias -g gm=" github master" +alias -g aic=" all install clean" +alias ls=" nop l" alias l=" \ls --color" alias la=" \ls --color -A" alias ll=" \ls --color -lh" alias lla=" \ls --color -lAh" -alias vim=" nvim" -alias vi=" nvim" +alias vim=" nop v" +alias vi=" nop v" alias v=" nvim" +alias git=" nop g" +alias g=" \git" alias xi=" sudo xbps-install" alias xiu=" sudo xbps-install -S; sudo xbps-install -yu xbps; sudo xbps-install -yu" alias xq=" sudo xbps-query" @@ -28,6 +43,7 @@ alias tmux=" tmux -f ~/.config/tmux/config" alias nw=" newsboat" alias nm=" neomutt" alias maic=" sudo make all install clean" +alias homesync=" rsync --port 222 --delete -azPe 'ssh -p 222' --exclude=general --exclude=.cache --exclude=.local/cache $HOME/ void@192.168.1.20:/home/void/homedir/" alias ~d=" cd ~/general/downloads; ls" alias ~do=" cd ~/general/documents; ls" alias ~iw=" cd ~/images/wallpapers; ls" @@ -54,18 +70,3 @@ alias .........=" cd ../../../../../../../.." alias ..........=" cd ../../../../../../../../.." alias ...........=" cd ../../../../../../../../../.." alias ............=" cd ../../../../../../../../../../.." -alias -g ...=" ../.." -alias -g ....=" ../../.." -alias -g .....=" ../../../.." -alias -g ......=" ../../../../.." -alias -g .......=" ../../../../../.." -alias -g ........=" ../../../../../../.." -alias -g .........=" ../../../../../../../.." -alias -g ..........=" ../../../../../../../../.." -alias -g ...........=" ../../../../../../../../../.." -alias -g ............=" ../../../../../../../../../../.." -alias -g om=" origin master" -alias -g o=" origin" -alias -g gm=" github master" -alias -g g=" github" -alias -g aic=" all install clean" diff --git a/.config/zsh/functions.zsh b/.config/zsh/functions.zsh @@ -11,8 +11,7 @@ killprog(){ do name=$(curl -n -F "file=@$file" http://0x0.st) echo "$file : $name" - names="$names $name" - done + names="$names $name" done echo $names | xclip } @@ -61,3 +60,16 @@ colotable(){ tput sgr0 done } + +filesort(){ + find $1 -type f | sort +} + +nop(){ + echo "This already has an alias... use $1 instead!" +} + +encsign(){ + [ "$1" = "--help" ] && echo '$1=recipient $2=file' && exit 1 + gpg --encrypt --sign --armor -r $1 $2 +} diff --git a/.scripts/bin/README b/.scripts/bin/README @@ -2,4 +2,4 @@ Hey, thanks for downloading my path scripts. However, there are some things you To install the scripts, copy them to your PATH. If you are not sure how to setup a path, download my .profile from my dotfiles, and place it in your home directory. Now, place the scripts in .scripts/bin/ -Some of the scripts will simple be wrappers on each other, please make sure that scripts such as dmpv have access to dfm. +Some of the scripts will simply be wrappers on each other, please make sure that scripts such as dmpv have access to dfm. diff --git a/.scripts/bin/display/hlock b/.scripts/bin/display/hlock @@ -18,10 +18,10 @@ while getopts ":n:i:l:h:b:p:r" o; do case "${o}" in h) printf "Specify an image with -i, resolution with -r, imagemagick effects with -b, and the program used for locking with -p." ;; esac done -if [ "$convert" == "off" ] +if [ "$convert" = "off" ] then echo "All image manipulation off..." - if [ "$image" == "" ] + if [ "$image" = "" ] then echo "No image, please specify one..." exit 1 diff --git a/.scripts/bin/display/pexelgrab b/.scripts/bin/display/pexelgrab @@ -0,0 +1,56 @@ +#!/bin/sh + +[ -f $HOME/general/security/pexels ] && read API_KEY < $HOME/general/security/pexels || API_KEY="$1" +[ "$API_KEY" = "" ] && echo "No api key..." && exit 1 +download=$2 +[ "$download" = "" ] && echo "No download folder specified... using $HOME/general/downloads" && download=$HOME/general/downloads + +get(){ + curl -H "Authorization: $API_KEY" "https://api.pexels.com/v1/$*" +} + +apigrep(){ + grep '^"'"$1" < /tmp/pexels | sed 's/^"'"$1"'":"//g;s/"$//g' | nl +} + +grepout(){ + grep "^[[:space:]]*$1[[:space:]]" < /dev/stdin | tr '[[:space:]]' ' ' | awk '{print $2}' +} + +[ -f /tmp/pexels ] && old=$(printf "yes\nno" | dmenu -i -p "Use old request?") +[ "$old" != "yes" ] && { + query=$(echo | dmenu -i -p "Search query (required):") + [ "$query" = "" ] && echo "Query required" && exit 1 || request="search?query=$(echo "$query" | tr ' ' '+')" + perpage=$(echo "DEFAULT" | dmenu -i -p "Results per page:") + [ "$perpage" != "DEFAULT" ] && request="${request}&per_page=$perpage" || perpage="15" + page=$(echo "DEFAULT" | dmenu -i -p "Page number:") + [ "$page" != "DEFAULT" ] && request="${request}&page=$page" + echo '"search_query":"'"$query"'"' > /tmp/pexels + get "$request" | tr "{},[]" "\n" >> /tmp/pexels +} || perpage="15" + +url=$(apigrep "url") +width=$(apigrep "width") +height=$(apigrep "height") +original=$(apigrep "original") +basename=$(echo "$original" | sed 's~^.*/~~g' | nl) +small=$(apigrep "small") +id=$(apigrep "id") + + +for i in $(seq $perpage) +do + while true + do + action=$(printf "view\nview full\ndownload\ndownload landscape\nnext\nall done" | dmenu -i -p "$(echo "$url" | grepout "$i") $(echo "$width" | grepout "$i" | tr -d '"') $(echo "$height" | grepout "$i" | tr -d '"')" | tr ' ' '-') + case $action in + view) addr=$(echo "$small" | grepout "$i") ; curl "$addr" --output /tmp/pexels.png ; sxiv /tmp/pexels.png ;; + view-full) addr=$(echo "$original" | grepout "$i") ; curl "$addr" --output /tmp/pexels.png ; sxiv /tmp/pexels.png ;; + download) mkdir -p $download/pexelgrab ; ts curl "$(echo "$original" | grepout "$i")" --output $download/pexelgrab/$(echo "$basename" | grepout "$i" | tr -d '":\\') ; echo 'sent to `ts` (task spooler)' ; break ;; + download-landscape) mkdir -p $download/pexelgrab ; ts curl "$(echo "$original" | grepout "$i")?fit=crop&h=1080&w=1920" --output $download/pexelgrab/$(echo "$basename" | grepout "$i" | tr -d '":\\') ; echo 'sent to `ts` (task spooler)' ; break ;; + next) break ;; + all-done) exit 0 ;; + *) break ;; + esac + done +done diff --git a/.scripts/bin/display/rfeh b/.scripts/bin/display/rfeh @@ -22,10 +22,10 @@ getfiles() { } monitors=$2 -if [ "$2" == "" ] +if [ "$2" = "" ] then monitors=$(xrandr --listmonitors | awk '/Monitors/ {print $2}') -elif [ "$2" == "auto" ] +elif [ "$2" = "auto" ] then monitors=$(xrandr --listmonitors | awk '/Monitors/ {print $2}') fi @@ -37,7 +37,7 @@ allfiles() { do getfiles $filetype done - if [ "$files" == "" ] + if [ "$files" = "" ] then echo "No files found..." exit 1 diff --git a/.scripts/bin/display/rwall b/.scripts/bin/display/rwall @@ -36,14 +36,14 @@ randomizerM(){ echo "$output" } -[ "$doprev" == "1" ] && { - [ "$monitors" == "" ] && files=$(tail -2 < ~/.cache/rfeh/prev | head -1) && head -n -1 < ~/.cache/rfeh/prev | tee ~/.cache/rfeh/prev > /dev/null +[ "$doprev" = "1" ] && { + [ "$monitors" = "" ] && files=$(tail -2 < ~/.cache/rfeh/prev | head -1) && head -n -1 < ~/.cache/rfeh/prev | tee ~/.cache/rfeh/prev > /dev/null [ "$(echo "$monitors" | grep "left")" != "" ] && files="$(tail -2 < ~/.cache/rfeh/left | head -1) $(tail -1 < ~/.cache/rfeh/right)" && head -n -1 < ~/.cache/rfeh/left | tee ~/.cache/rfeh/left > /dev/null [ "$(echo "$monitors" | grep "right")" != "" ] && files="$(tail -1 < ~/.cache/rfeh/left) $(tail -2 < ~/.cache/rfeh/right | head -1)" && head -n -1 < ~/.cache/rfeh/right | tee ~/.cache/rfeh/right > /dev/null echo "$files" setwall "$files" } || { - [ "$monitors" == "" ] && files=$(randomizerM) + [ "$monitors" = "" ] && files=$(randomizerM) [ "$(echo "$monitors" | grep "left")" != "" ] && files="$(randomizer) $(tail -1 < ~/.cache/rfeh/right)" [ "$(echo "$monitors" | grep "right")" != "" ] && files="$(tail -1 < ~/.cache/rfeh/left) $(randomizer)" echo "$files" | awk '{print $1}' >> ~/.cache/rfeh/left diff --git a/.scripts/bin/dmenu/dfm b/.scripts/bin/dmenu/dfm @@ -27,7 +27,7 @@ Written by Hayden Hamilton <haydenvh.com>" fi forn1="$1" lsforce="$3" -if [ "$1" == "" ] +if [ "$1" = "" ] then export forn1="fm" fi @@ -40,17 +40,17 @@ getconf(){ DFM_CLIPBOARD_TYPE="PRIMARY" . $HOME/.dmenurc . $HOME/.config/dfm/config - if [ "$DFM_USE_HH_PATCH" == "1" ] + if [ "$DFM_USE_HH_PATCH" = "1" ] then dmenu="$dmenu -c -w 1000" fi - if [ "$DFM_CLIPBOARD_TYPE" == "PRIMARY" ] + if [ "$DFM_CLIPBOARD_TYPE" = "PRIMARY" ] then clipboard="xclip" - elif [ "$DFM_CLIPBOARD_TYPE" == "CLIPBOARD" ] + elif [ "$DFM_CLIPBOARD_TYPE" = "CLIPBOARD" ] then clipboard="xclip -selection clipboard" - elif [ "$DFM_CLIPBOARD_TYPE" == "CUSTOM" ] + elif [ "$DFM_CLIPBOARD_TYPE" = "CUSTOM" ] then clipboard="$DFM_CLIPBOARD_CUSTOM" else @@ -76,13 +76,13 @@ sendconf(){ } fmornorm(){ - if [ "$forn1" == "fm" ] + if [ "$forn1" = "fm" ] then output2=$(echo "$fmcmd2" | $dmenu -l 30 -i -p "Select command:") fmspecial else dooutput - if [ "$doarg" == "true" ] + if [ "$doarg" = "true" ] then echo $forn1 $forn1 $argu @@ -93,7 +93,7 @@ fmornorm(){ dooutput(){ [ "$DFM_DISABLE_ENQUEUE" != "1" ] && enqueue=$(echo "DO ENQUEUE" | tr " " "\n" | $dmenu -i -p "What do you want to do?") - if [ "$enqueue" == "ENQUEUE" ] + if [ "$enqueue" = "ENQUEUE" ] then argu+="$(pwd)/$output " doarg="false" @@ -107,10 +107,10 @@ getdot(){ if [ "$lsforce" != "" ] then lscommand="$lsforce" - elif [ "$DFM_DOT" == "1" ] + elif [ "$DFM_DOT" = "1" ] then lscommand="ls -A" - elif [ "$DFM_DOT" == "0" ] + elif [ "$DFM_DOT" = "0" ] then lscommand="ls" else @@ -126,7 +126,7 @@ getprog(){ send0x0(){ send=$(curl -F "file=@$output" https://0x0.st) send2=$(echo "$send" | awk '/http/') - [ "$send2" == "" ] && echo "Failed" | $dmenu -i -p "Hit enter to continue" + [ "$send2" = "" ] && echo "Failed" | $dmenu -i -p "Hit enter to continue" [ "$send2" != "" ] && echo $send | $dmenu -i -p "Hit enter to continue" | $clipboard } @@ -136,31 +136,31 @@ sendscrn0x0(){ } fmspecial(){ - if [ "$output2" == "AUTO - Check config for program to use" ] + if [ "$output2" = "AUTO - Check config for program to use" ] then getprog "$output" [ "$commandout" != "" ] && $commandout $output $argu - [ "$commandout" == "" ] && echo "No program set..." - elif [ "$output2" == "RM - Remove file" ] + [ "$commandout" = "" ] && echo "No program set..." + elif [ "$output2" = "RM - Remove file" ] then rm $output - elif [ "$output2" == "CMD - Specific command" ] + elif [ "$output2" = "CMD - Specific command" ] then output3=$(dmenu_path | $dmenu -i -p "Select program") $output3 $output $argu argu="" - elif [ "$output2" == "MV - Move file" ] + elif [ "$output2" = "MV - Move file" ] then output3=$(echo "" | $dmenu -i -p "Move to:") mv $output $output3 - elif [ "$output2" == "EDIT - Open with $EDITOR" ] + elif [ "$output2" = "EDIT - Open with $EDITOR" ] then $EDITOR $output $argu argu="" - elif [ "$output2" == "QUE - Enqueue" ] + elif [ "$output2" = "QUE - Enqueue" ] then argu+="$output " - elif [ "$output2" == "SND - Send to 0x0.st" ] + elif [ "$output2" = "SND - Send to 0x0.st" ] then send0x0 fi @@ -187,36 +187,36 @@ CMD - Specific command EDIT - Open with $EDITOR QUE - Enqueue SND - Send to 0x0.st" - if [ "$output" == "FM" ] + if [ "$output" = "FM" ] then output=$(echo "$fmcmd1" | $dmenu -l 30 -i -p "Select command:") - if [ "$output" == "MD - Make dir" ] + if [ "$output" = "MD - Make dir" ] then output2=$(echo "" | $dmenu -i -p "Name dir:") mkdir $output2 - elif [ "$output" == "MF - Make file" ] + elif [ "$output" = "MF - Make file" ] then output2=$(echo "" | $dmenu -i -p "Name file:") touch $output2 - elif [ "$output" == "BM - Bookmarks" ] + elif [ "$output" = "BM - Bookmarks" ] then touch ~/.config/dfm/bookmarks output=$(echo "MK DEL $(cat ~/.config/dfm/bookmarks | awk '// {print $1}')" | tr "\n" " " | tr " " "\n" | $dmenu -l 30 -i -p "Select file/directory:") - if [ "$output" == "MK" ] + if [ "$output" = "MK" ] then output=$(echo "" | $dmenu -i -p "Choose bookmark name(no spaces):") output2=$(echo "" | $dmenu -i -p "Choose bookmark path(absolute):") echo "$output $output2" >> ~/.config/dfm/bookmarks - elif [ "$output" == "DEL" ] + elif [ "$output" = "DEL" ] then output=$(echo "$(cat $confdir/bookmarks | awk '// {print $1}')" | $dmenu -l 30 -i -p "Select bookmark to delete:") - [ "$(cat $confdir/bookmarks | awk "/$output/ {print"' $1}')" == "$output" ] && sed -i "/$output/d" $confdir/bookmarks + [ "$(cat $confdir/bookmarks | awk "/$output/ {print"' $1}')" = "$output" ] && sed -i "/$output/d" $confdir/bookmarks else output=$(cat ~/.config/dfm/bookmarks | awk "/$output/"' {print $2}') output2=$(echo "$fmcmd2" | $dmenu -l 30 -i -p "Select command:") fmspecial fi - elif [ "$output" == "FND - Find" ] + elif [ "$output" = "FND - Find" ] then output=$(echo "" | $dmenu -i -p "Enter name of file:") output2=$(printf "ROOT (Takes a while)\nLOCALLY" | $dmenu -i -p "Find option") @@ -228,19 +228,19 @@ SND - Send to 0x0.st" output3="." fi output=$(echo "NONE $(find $output3 | grep -i "$output")" | tr " " "\n" | $dmenu -i -l 30 -p "Select file:") - if [ "$output" == "NONE" ] + if [ "$output" = "NONE" ] then echo > /dev/null else fmornorm fi - elif [ "$output" == "HIDE - Toggle Dotfiles" ] + elif [ "$output" = "HIDE - Toggle Dotfiles" ] then - if [ "$DFM_DOT" == "0" ] + if [ "$DFM_DOT" = "0" ] then export DFM_DOT="1" sendconf "DFM_DOT" "1" - elif [ "$DFM_DOT" == "1" ] + elif [ "$DFM_DOT" = "1" ] then export DFM_DOT="0" sendconf "DFM_DOT" "0" @@ -248,17 +248,17 @@ SND - Send to 0x0.st" export DFM_DOT="0" sendconf "DFM_DOT" "0" fi - elif [ "$output" == "SCRN - Host screenshot on 0x0.st" ] + elif [ "$output" = "SCRN - Host screenshot on 0x0.st" ] then sendscrn0x0 fi elif [ -d "$output" ] then cd $output - elif [ "$output" == "exit" ] + elif [ "$output" = "exit" ] then exit 1 - elif [ "$output" == "" ] + elif [ "$output" = "" ] then exit 1 else diff --git a/.scripts/bin/dmenu/dimg b/.scripts/bin/dmenu/dimg @@ -0,0 +1,18 @@ +#!/bin/sh + +printf '' > /tmp/dimg +[ ! -z $1 ] && dir="$1" || dir="$HOME/general/images/wallpapers" + +case $(printf 'wallpaper\nview' | dmenu -i -p 'Select option:') in + view) sxiv $(find $dir -type f | shuf | dmenu -i -p "Select image:") ;; + wallpaper) setwall ;; +esac + +monitors=$(xrandr --listmonitors | awk '/Monitors/{print $2}') +for i in $(seq $monitors) +do + files="$files $(find $dir -type f | shuf | dmenu -i -p "Select wallpaper $i:")" +done + +echo "$files" | sed 's/^[[:space:]]*//g;s/[[:space:]]*$//g' > /tmp/dimg +fehffile /tmp/dimg diff --git a/.scripts/bin/dmenu/dmon b/.scripts/bin/dmenu/dmon @@ -16,4 +16,5 @@ do choice2=$(xrandr -q | grep "[A-Z]* con" | dmenu -i -p "Select monitor:" | awk '//{print $1}') cmd="$cmd --output $choice2 --$direction $bchoice" setup=$(($setup+1)) + echo "$cmd" done diff --git a/.scripts/bin/dmenu/dpass b/.scripts/bin/dmenu/dpass @@ -23,17 +23,17 @@ dmenu="dmenu" [ ! -f $PASS ] && touch $PASS pass=$(printf "GENERATE\nEDIT\n$(cat $PASS | awk '// {print $1}')" | $dmenu -l 50 -i -p "Select a password/generate/edit:" | tr '[:upper:]' '[:lower:]') getpass=$(cat "$PASS" | awk "/$pass/ "'{print $0}') -if [ "$pass" == "" ] +if [ "$pass" = "" ] then exit 0 -elif [ "$pass" == "generate" ] +elif [ "$pass" = "generate" ] then password=$(head -c 500 /dev/urandom | tr -dc 'a-zA-Z0-9~!@#$%^&*_+=-' | fold -w 30 | head -n 1) passname=$(echo "" | $dmenu -l 50 -i -p "Name for password (only 1 word):") - [ "$passname" == "" ] && passname="pleaseeditthis" + [ "$passname" = "" ] && passname="pleaseeditthis" echo "$passname: $password" >> $PASS - [ "$(printf "No\nYes" | $dmenu -i -p "Edit the pasword file?")" == "Yes" ] && $TERMINAL "$1" vim $PASS -elif [ "$pass" == "edit" ] + [ "$(printf "No\nYes" | $dmenu -i -p "Edit the pasword file?")" = "Yes" ] && $TERMINAL "$1" vim $PASS +elif [ "$pass" = "edit" ] then $TERMINAL "$1" vim $PASS else diff --git a/.scripts/bin/genman/hvol b/.scripts/bin/genman/hvol @@ -1,5 +1,5 @@ #!/bin/bash -if [ "$1" == "toggle" ] +if [ "$1" = "toggle" ] then amixer set Master $1 volume=$(amixer sget Master | awk '/Mono/ {print $6}' | sed 's/\[//g' | sed 's/\]//g') diff --git a/.scripts/bin/genman/mpvlisten b/.scripts/bin/genman/mpvlisten @@ -7,16 +7,16 @@ while true do state=$(hmpv state $socket1) sleep 0.1 - if [ "$state" == "playing" ] + if [ "$state" = "playing" ] then - if [ "$aplay" == "false" ] + if [ "$aplay" = "false" ] then hmpv pause $socket2 2>/dev/null >/dev/null apause="false" aplay="true" fi else - if [ "$apause" == "false" ] + if [ "$apause" = "false" ] then hmpv unpause $socket2 2>/dev/null >/dev/null apause="true" diff --git a/.scripts/bin/genman/slock_mod b/.scripts/bin/genman/slock_mod @@ -13,10 +13,12 @@ echo "dmpvurl: $(hmpv state $socket2)" >> ~/.cache/socket sleep 0.2 hmpv pause $socket2 ) & -slock -m "Locked at $(date) by $USER - what? You thought I would let you in... Fool." +bat=$(head -n 1 < $HOME/.cache/blocks/bat | perl -pe 's/\^.*?\^//g;s/^\[B //g;s/\]$//g;s/$/ /g;s/ /% /g' | head -n 1) +weather=$(head -n 1 < $HOME/.cache/blocks/weather | perl -pe 's/\^.*?\^//g;s/^\[//g;s/\]$//g' | head -n 1) +slock -m "$(echo -e "Locked at $(date) | $USER@$hostname\nBatteries (time of screen-locking) | $bat\nWeather | $weather" | tr -s ' ')" state=$(cat ~/.cache/socket | awk '/:/') state1=$(echo "$state" | head -n -1 | awk '{print $2}') state2=$(echo "$state" | tail +2 | awk '{print $2}') -[ "$state1" == "playing" ] && hmpv unpause $socket1 -[ "$state2" == "playing" ] && hmpv unpause $socket2 +[ "$state1" = "playing" ] && hmpv unpause $socket1 +[ "$state2" = "playing" ] && hmpv unpause $socket2 diff --git a/.scripts/bin/misc/dotadd b/.scripts/bin/misc/dotadd @@ -2,7 +2,6 @@ git add ./LICENSE git add .config/sxhkd/ git add .local/xauth git add .local/xres -git add .mailcap git add .config/alias git add .config/tmux/config git add .zprofile @@ -33,7 +32,9 @@ git add .config/vimb/scripts.js git add .config/neomutt/neomuttrc git add .config/neomutt/colours git add .config/neomutt/sidebar +git add .config/neomutt/mailcap git add .config/nvim/ git rm --cache .config/nvim/.netrwhist git rm --cache .config/zsh/.zcompdump git add .config/galias +git add .config/redshift/ diff --git a/.scripts/bin/misc/hmpv b/.scripts/bin/misc/hmpv @@ -16,10 +16,10 @@ unpause() { } getstate() { stateraw=$(echo '{ "command": ["get_property", "pause"] }' | socat - $socket 2>/dev/null | tr '{":0,}' ' ' | awk '// {print $2}') - if [ "$stateraw" == "true" ] + if [ "$stateraw" = "true" ] then state="paused" - elif [ "$stateraw" == "false" ] + elif [ "$stateraw" = "false" ] then state="playing" else @@ -29,10 +29,10 @@ getstate() { } toggle() { getstate - if [ "$state" == "playing" ] + if [ "$state" = "playing" ] then pause - elif [ "$state" == "paused" ] + elif [ "$state" = "paused" ] then unpause else @@ -41,16 +41,16 @@ toggle() { fi } seek() { - if [ "$action" == "forward" ] + if [ "$action" = "forward" ] then echo '{ "command": ["seek", "10"] }' | socat - $socket > /dev/null - elif [ "$action" == "back" ] + elif [ "$action" = "back" ] then echo '{ "command": ["seek", "-10"] }' | socat - $socket > /dev/null - elif [ "$action" == "next" ] + elif [ "$action" = "next" ] then echo '{ "command": ["playlist-next"] }' | socat - $socket > /dev/null - elif [ "$action" == "prev" ] + elif [ "$action" = "prev" ] then echo '{ "command": ["playlist-prev"] }' | socat - $socket > /dev/null fi @@ -68,22 +68,22 @@ quit() { echo '{ "command": ["quit"] }' | socat - $socket > /dev/null } -if [ "$action" == "toggle" ] +if [ "$action" = "toggle" ] then toggle -elif [ "$action" == "quit" ] +elif [ "$action" = "quit" ] then quit -elif [ "$action" == "pause" ] +elif [ "$action" = "pause" ] then pause -elif [ "$action" == "unpause" ] +elif [ "$action" = "unpause" ] then unpause -elif [ "$action" == "state" ] +elif [ "$action" = "state" ] then getstate; echo "$state" -elif [ "$action" == "time" ] +elif [ "$action" = "time" ] then gettime else diff --git a/.scripts/bin/misc/mkalias b/.scripts/bin/misc/mkalias @@ -1,4 +1,4 @@ #!/bin/sh -awk '{printf "alias "$1"=\"";$1="";printf $0"\"\n"}' < ~/.config/alias > ~/.config/zsh/alias.zsh -awk '{printf "alias -g "$1"=\"";$1="";printf $0"\"\n"}' < ~/.config/galias >> ~/.config/zsh/alias.zsh +awk '{printf "alias -g "$1"=\"";$1="";printf $0"\"\n"}' < ~/.config/galias > ~/.config/zsh/alias.zsh +awk '{printf "alias "$1"=\"";$1="";printf $0"\"\n"}' < ~/.config/alias >> ~/.config/zsh/alias.zsh diff --git a/.scripts/bin/misc/mkmailbox b/.scripts/bin/misc/mkmailbox @@ -0,0 +1,5 @@ +#!/bin/sh + +mailboxes=$(find ~/general/mail -type d | sed "s~$HOME/~~g;/\/.*\/.*\//d;/mail\/main/d;s~general/mail/~~g;s~^~=~g" | tail -n +2 | tr '\n' ' ') +out=$(sed 's~^mailboxes.*$~mailboxes '"$mailboxes"'# Configured by my mkmailbox script~g' < $HOME/.config/neomutt/neomuttrc) +echo "$out" > $HOME/.config/neomutt/neomuttrc diff --git a/.scripts/bin/misc/rmpv b/.scripts/bin/misc/rmpv @@ -18,7 +18,7 @@ allfiles() { do getfiles $filetype done - if [ "$files" == "" ] + if [ "$files" = "" ] then echo "No files found..." exit 1 diff --git a/.scripts/custom/xrandr b/.scripts/custom/xrandr @@ -2,8 +2,8 @@ cmons=$(xrandr | grep "[A-Z]* con" | wc -l) -[ "$cmons" = "3" ] && xrandr --output LVDS1 --off --output VGA1 --primary --output HDMI2 --right-of || +[ "$cmons" = "3" ] && xrandr --output LVDS1 --off --output VGA1 --primary --output HDMI2 --right-of VGA1 || [ "$cmons" = "2" ] && { mon2=$(xrandr | grep "[A-Z]* con" | sed '/^LVDS/d' | awk '//{print $1}') - xrandr --output $mon2 --primary --output LVDS1 --left-of + xrandr --output $mon2 --primary --output LVDS1 --left-of $mon2 } || xrandr --output LVDS1 --primary diff --git a/.scripts/dwmblocks/cal b/.scripts/dwmblocks/cal @@ -10,7 +10,7 @@ get_cal() { calcurse -D $HOME/.config/calcurse $1 | awk "/$2/" | wc -l } todo=$(get_cal -t) -if [ "$todo" == "0" ] +if [ "$todo" = "0" ] then todo=$todo else diff --git a/.scripts/dwmblocks/mpv b/.scripts/dwmblocks/mpv @@ -12,6 +12,8 @@ state=$(echo '{ "command": ["get_property", "pause"] }' | socat - /tmp/mpv-socke state2=$(echo '{ "command": ["get_property", "pause"] }' | socat - /tmp/mpv-socket2 | tr '{":0,}' ' ' | awk '// {print $2}') artist=$(echo '{ "command": ["get_property", "metadata/artist"] }' | socat - /tmp/mpv-socket | tr '{":0,}' ' ' | sed 's/[[:space:]]*data[[:space:]]*//g;s/[[:space:]]*request_id.*$//g') artist2=$(echo '{ "command": ["get_property", "metadata/artist"] }' | socat - /tmp/mpv-socket2 | tr '{":0,}' ' ' | sed 's/[[:space:]]*data[[:space:]]*//g;s/[[:space:]]*request_id.*$//g') +[ "$artist" != "" ] && artist="$artist - " +[ "$artist2" != "" ] && artist2="$artist2 - " convertsecs() { ((h=${1}/3600)) ((m=(${1}%3600)/60)) @@ -21,44 +23,44 @@ convertsecs() { time=$(convertsecs $(echo '{ "command": ["get_property", "playback-time"] }' | socat - /tmp/mpv-socket | tr '{":,}' ' ' | awk '// {print $2}' | sed 's/\./ /g' | awk '// {print $1}')) time2=$(convertsecs $(echo '{ "command": ["get_property", "playback-time"] }' | socat - /tmp/mpv-socket2 | tr '{":,}' ' ' | awk '// {print $2}' | sed 's/\./ /g' | awk '// {print $1}')) -if [ "$state" == "false" ] +if [ "$state" = "false" ] then - out="$(echo "PLAY - MUSIC - $artist - $file2" | cut -zc-60) - $time" + out="$(echo "PLAY - MUSIC - $artist$file2" | cut -zc-60) - $time" color="true" -elif [ "$state" == "true" ] +elif [ "$state" = "true" ] then - if [ "$state2" == "false" ] + if [ "$state2" = "false" ] then - out="$(echo "PLAY - VIDEO - $artist2 - $vidtitle2" | cut -zc-60) - $time2" + out="$(echo "PLAY - VIDEO - $artist2$vidtitle2" | cut -zc-60) - $time2" else - out="$(echo "STOP - MUSIC - $artist - $file2" | cut -zc-60) - $time" + out="$(echo "STOP - MUSIC - $artist$file2" | cut -zc-60) - $time" fi color="true" -elif [ "$state2" == "false" ] +elif [ "$state2" = "false" ] then - out="$(echo "PLAY - VIDEO - $artist2 - $vidtitle2" | cut -zc-60) - $time2" + out="$(echo "PLAY - VIDEO - $artist2$vidtitle2" | cut -zc-60) - $time2" color="true" -elif [ "$state2" == "true" ] +elif [ "$state2" = "true" ] then - out="$(echo "STOP - VIDEO - $artist2 - $vidtitle2" | cut -zc-60) - $time2" + out="$(echo "STOP - VIDEO - $artist2$vidtitle2" | cut -zc-60) - $time2" color="true" else out=" NONE" color="true" fi -if [ "$color" == "true" ] +if [ "$color" = "true" ] then echo "[MPV $out]" echo echo \#666b1b -elif [ "$color" == "false" ] +elif [ "$color" = "false" ] then exit 0 else echo "Nothing set?... Exiting" exit 1 fi -if [ "$BLOCK_BUTTON" == "1" ] +if [ "$BLOCK_BUTTON" = "1" ] then dunstify "Currently playing" "$file\n$vidtitle" fi diff --git a/.scripts/dwmblocks/news b/.scripts/dwmblocks/news @@ -7,7 +7,7 @@ # Copyright (c) 2019 Hayden Hamilton. newsboat -x reload 2>/dev/null -unread=$(newsboat -x print-unread | sed 's/unread articles//g') +unread=$(newsboat -x print-unread | sed 's/ unread articles//g') echo "[NEWS $unread]" echo diff --git a/.scripts/dwmblocks/title b/.scripts/dwmblocks/title @@ -9,7 +9,7 @@ id=$(xprop -root _NET_ACTIVE_WINDOW | awk '// {print $5}') out1=$(xprop -id $id | awk '/WM_CLASS/ {print $3}' | sed 's/"//g' | sed 's/,//g') out2=$(xprop -id $id | awk '/_NET_WM_NAME/{ $1=""; $2=""; print}' | sed 's/"//g' | sed "s/^[ \t]*//") -if [ "$BLOCK_BUTTON" == "1" ] +if [ "$BLOCK_BUTTON" = "1" ] then dunstify "Current window title" "$out2" fi