diff options
44 files changed, 227 insertions, 166 deletions
diff --git a/.config/lf/lfrc b/.config/lf/lfrc index e104591..dad917d 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -30,7 +30,7 @@ set autoquit true cmd open ${{ case $(file --mime-type "$(readlink -f $f)" -b) in application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) localc $fx ;; - image/vnd.djvu|application/pdf|application/octet-stream|application/postscript) setsid -f zathura $fx >/dev/null 2>&1 ;; + image/vnd.djvu|application/pdf|application/postscript) setsid -f zathura $fx >/dev/null 2>&1 ;; text/*|application/json|inode/x-empty|application/x-subrip) $EDITOR $fx;; image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;; image/svg+xml) display -- $f ;; @@ -45,12 +45,18 @@ cmd open ${{ video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;; application/pdf|application/vnd.djvu|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;; application/pgp-encrypted) $EDITOR $fx ;; - application/vnd.openxmlformats-officedocument.wordprocessingml.document|application/vnd.oasis.opendocument.text|application/vnd.openxmlformats-officedocument.spreadsheetml.sheet|application/octet-stream|application/vnd.oasis.opendocument.spreadsheet|application/vnd.oasis.opendocument.spreadsheet-template|application/vnd.openxmlformats-officedocument.presentationml.presentation|application/vnd.oasis.opendocument.presentation-template|application/vnd.oasis.opendocument.presentation|application/vnd.ms-powerpoint|application/vnd.oasis.opendocument.graphics|application/vnd.oasis.opendocument.graphics-template|application/vnd.oasis.opendocument.formula|application/vnd.oasis.opendocument.database) setsid -f libreoffice $fx >/dev/null 2>&1 ;; - *) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done;; + application/vnd.openxmlformats-officedocument.wordprocessingml.document|application/vnd.oasis.opendocument.text|application/vnd.openxmlformats-officedocument.spreadsheetml.sheet|application/vnd.oasis.opendocument.spreadsheet|application/vnd.oasis.opendocument.spreadsheet-template|application/vnd.openxmlformats-officedocument.presentationml.presentation|application/vnd.oasis.opendocument.presentation-template|application/vnd.oasis.opendocument.presentation|application/vnd.ms-powerpoint|application/vnd.oasis.opendocument.graphics|application/vnd.oasis.opendocument.graphics-template|application/vnd.oasis.opendocument.formula|application/vnd.oasis.opendocument.database) setsid -f libreoffice $fx >/dev/null 2>&1 ;; + application/octet-stream) case ${f##*.} in + doc|docx|xls|xlsx|odt|ppt|pptx) setsid -f libreoffice $fx >/dev/null 2>&1 ;; + ghw) setsid -f gtkwave $f >/dev/null 2>&1 ;; + ts) setsid -f mpv $f -quiet >/dev/null 2>&1 ;; + *) setsid -f zathura $fx >/dev/null 2>&1 ;; + esac ;; + *) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done;; esac }} -cmd mkdir $mkdir -p "$(echo $* | tr ' ' '\ ')" +cmd mkdir $mkdir -p "$@" cmd extract ${{ clear; tput cup $(($(tput lines)/3)); tput bold @@ -133,13 +139,13 @@ cmd bulkrename ${{ # Bindings map <c-f> $lf -remote "send $id select \"$(fzf)\"" map J $lf -remote "send $id cd $(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf)" -map gh +map H cd ~ map g top map D delete map E extract map C copyto map M moveto -map <c-n> push :mkdir<space> +map <c-n> push :mkdir<space>""<left> map <c-r> reload map <c-s> set hidden! map <enter> shell @@ -162,7 +168,14 @@ map V push :!nvim<space> map W $setsid -f $TERMINAL >/dev/null 2>&1 -map Y $printf "%s" "$fx" | xclip -selection clipboard +map U $printf "%s" "$fx" | xclip -selection clipboard +map u $printf "%s" "$fx" | sed 's/.*\///' | xclip -selection clipboard +map . $printf "%s" "$fx" | sed -E 's/^.+\[/https:\/\/www.youtube.com\/watch?v=/' | sed -E 's/\]\..+//' | xclip -selection clipboard +map <gt> $printf "%s" "$fx" | sed -E 's/^.+\[/https:\/\/piped.video\/watch?v=/' | sed -E 's/\]\..+//' | xclip -selection clipboard +map T $nsxiv -t "$(pwd)" # opens thumbnail mode +map <c-l> unselect + + # Source Bookmarks source "~/.config/lf/shortcutrc" diff --git a/.config/lf/scope b/.config/lf/scope index cc55669..332b07e 100755 --- a/.config/lf/scope +++ b/.config/lf/scope @@ -13,26 +13,32 @@ image() { fi } -ifub() { - [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && command -V ueberzug >/dev/null 2>&1 -} - # Note that the cache file name is a function of file information, meaning if # an image appears in multiple places across the machine, it will not have to # be regenerated once seen. case "$(file --dereference --brief --mime-type -- "$1")" in image/avif) CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" - [ ! -f "$CACHE" ] && convert "$1" "$CACHE.jpg" + [ ! -f "$CACHE" ] && magick "$1" "$CACHE.jpg" image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" ;; image/vnd.djvu) CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" - [ ! -f "$CACHE" ] && djvused "$1" -e 'select 1; save-page-with /dev/stdout' | convert -density 200 - "$CACHE.jpg" > /dev/null 2>&1 + [ ! -f "$CACHE" ] && djvused "$1" -e 'select 1; save-page-with /dev/stdout' | magick -density 200 - "$CACHE.jpg" > /dev/null 2>&1 image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" ;; +image/svg+xml) + CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" + [ ! -f "$CACHE" ] && inkscape --convert-dpi-method=none -o "$CACHE.png" --export-overwrite -D --export-png-color-mode=RGBA_16 "$1" + image "$CACHE.png" "$2" "$3" "$4" "$5" "$1" + ;; + image/x-xcf) + CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | awk '{print $1}')" + [ ! -f "$CACHE.jpg" ] && magick "$1[0]" "$CACHE.jpg" + image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" + ;; image/*) image "$1" "$2" "$3" "$4" "$5" "$1" ;; text/html) lynx -width="$4" -display_charset=utf-8 -dump "$1" ;; text/troff) man ./ "$1" | col -b ;; - text/* | */xml | application/json | application/x-ndjson) bat --terminal-width "$(($4-2))" -f "$1" ;; + text/* | */xml | application/json | application/x-ndjson) bat -p --theme ansi --terminal-width "$(($4-2))" -f "$1" ;; audio/* | application/octet-stream) mediainfo "$1" || exit 1 ;; video/* ) CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" diff --git a/.config/mpd/mpd.conf b/.config/mpd/mpd.conf index bf329d6..1cc2cc8 100644 --- a/.config/mpd/mpd.conf +++ b/.config/mpd/mpd.conf @@ -7,10 +7,8 @@ restore_paused "yes" max_output_buffer_size "16384" audio_output { - type "pulse" - name "pulse" - #type "alsa" - #name "ALSA" + type "pipewire" + name "PipeWire Sound Server" } audio_output { diff --git a/.config/newsboat/urls b/.config/newsboat/urls deleted file mode 100644 index 497e494..0000000 --- a/.config/newsboat/urls +++ /dev/null @@ -1,10 +0,0 @@ -https://lukesmith.xyz/rss.xml -https://videos.lukesmith.xyz/feeds/videos.xml?videoChannelId=2 "~Luke Smith (Videos)" -https://www.youtube.com/feeds/videos.xml?channel_id=UC2eYFnH61tmytImy1mTYvhA "~Luke Smith (YouTube)" -https://lindypress.net/rss -https://notrelated.xyz/rss -https://landchad.net/rss.xml -https://based.cooking/index.xml -https://artixlinux.org/feed.php "tech" -https://www.archlinux.org/feeds/news/ "tech" -https://github.com/LukeSmithxyz/voidrice/commits/master.atom "~LARBS dotfiles" diff --git a/.config/nsxiv/exec/key-handler b/.config/nsxiv/exec/key-handler index 4c78f18..c743be4 100755 --- a/.config/nsxiv/exec/key-handler +++ b/.config/nsxiv/exec/key-handler @@ -14,11 +14,11 @@ do mv "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file moved to $destdir." & ;; "r") - convert -rotate 90 "$file" "$file" ;; + magick -rotate 90 "$file" "$file" ;; "R") - convert -rotate -90 "$file" "$file" ;; + magick -rotate -90 "$file" "$file" ;; "f") - convert -flop "$file" "$file" ;; + magick -flop "$file" "$file" ;; "y") printf "%s" "$file" | tr -d '\n' | xclip -selection clipboard && notify-send "$file copied to clipboard" & ;; diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 255ca27..5859d61 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -35,10 +35,10 @@ set noruler set laststatus=0 set noshowcmd " colorscheme wal +colorscheme vim " Some basics: nnoremap c "_c - set nocompatible filetype plugin on syntax on set encoding=utf-8 @@ -59,18 +59,15 @@ set noshowcmd " Nerd tree map <leader>n :NERDTreeToggle<CR> autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif - if has('nvim') - let NERDTreeBookmarksFile = stdpath('data') . '/NERDTreeBookmarks' - else - let NERDTreeBookmarksFile = '~/.vim' . '/NERDTreeBookmarks' - endif + let NERDTreeBookmarksFile = stdpath('data') . '/NERDTreeBookmarks' -" vimling: - nm <leader>d :call ToggleDeadKeys()<CR> - imap <leader>d <esc>:call ToggleDeadKeys()<CR>a - nm <leader>i :call ToggleIPA()<CR> - imap <leader>i <esc>:call ToggleIPA()<CR>a - nm <leader>q :call ToggleProse()<CR> +" vim-airline + if !exists('g:airline_symbols') + let g:airline_symbols = {} + endif + let g:airline_symbols.colnr = ' C:' + let g:airline_symbols.linenr = ' L:' + let g:airline_symbols.maxlinenr = 'β° ' " Shortcutting split navigation, saving a keypress: map <C-h> <C-w>h @@ -112,10 +109,9 @@ set noshowcmd cabbrev w!! execute 'silent! write !sudo tee % >/dev/null' <bar> edit! " Enable Goyo by default for mutt writing - autocmd BufRead,BufNewFile /tmp/neomutt* let g:goyo_width=80 - autocmd BufRead,BufNewFile /tmp/neomutt* :Goyo | set bg=light - autocmd BufRead,BufNewFile /tmp/neomutt* map ZZ :Goyo\|x!<CR> - autocmd BufRead,BufNewFile /tmp/neomutt* map ZQ :Goyo\|q!<CR> + autocmd BufRead,BufNewFile /tmp/neomutt* :Goyo 80 | call feedkeys("jk") + autocmd BufRead,BufNewFile /tmp/neomutt* map ZZ :Goyo!\|x!<CR> + autocmd BufRead,BufNewFile /tmp/neomutt* map ZQ :Goyo!\|q!<CR> " Automatically deletes all trailing whitespace and newlines at end of file on save. & reset cursor position autocmd BufWritePre * let currPos = getpos(".") diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc index 1225fc5..92df898 100644 --- a/.config/shell/aliasrc +++ b/.config/shell/aliasrc @@ -16,7 +16,7 @@ done; unset command se() { choice="$(find ~/.local/bin -mindepth 1 -printf '%P\n' | fzf)" [ -f "$HOME/.local/bin/$choice" ] && $EDITOR "$HOME/.local/bin/$choice" - ;} + } # Verbosity and settings that you pretty much just always are going to want. alias \ @@ -79,5 +79,4 @@ alias \ alias \ lf="lfub" \ magit="nvim -c MagitOnly" \ - ref="shortcuts >/dev/null; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" \ - weath="less -S ${XDG_CACHE_HOME:-$HOME/.cache}/weatherreport" \ + ref="shortcuts >/dev/null; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutenvrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" diff --git a/.config/shell/profile b/.config/shell/profile index 1eae7d7..93c2e4f 100644 --- a/.config/shell/profile +++ b/.config/shell/profile @@ -1,14 +1,12 @@ -#!/bin/zsh +#!/bin/sh +# shellcheck disable=SC2155 -# profile file. Runs on login. Environmental variables are set here. +# Profile file, runs on login. Environmental variables are set here. -# If you don't plan on reverting to bash, you can remove the link in ~/.profile -# to clean up. +# Add all directories in `~/.local/bin` to $PATH +export PATH="$PATH:$(find ~/.local/bin -type d | paste -sd ':' -)" -# Adds `~/.local/bin` to $PATH -export PATH="$PATH:${$(find ~/.local/bin -type d -printf %p:)%%:}" - -unsetopt PROMPT_SP +unsetopt PROMPT_SP 2>/dev/null # Default programs: export EDITOR="nvim" @@ -52,7 +50,7 @@ export SQLITE_HISTORY="$XDG_DATA_HOME/sqlite_history" export DICS="/usr/share/stardict/dic/" export SUDO_ASKPASS="$HOME/.local/bin/dmenupass" export FZF_DEFAULT_OPTS="--layout=reverse --height 40%" -export LESS=-R +export LESS="R" export LESS_TERMCAP_mb="$(printf '%b' '[1;31m')" export LESS_TERMCAP_md="$(printf '%b' '[1;36m')" export LESS_TERMCAP_me="$(printf '%b' '[0m')" @@ -61,15 +59,15 @@ export LESS_TERMCAP_se="$(printf '%b' '[0m')" export LESS_TERMCAP_us="$(printf '%b' '[1;32m')" export LESS_TERMCAP_ue="$(printf '%b' '[0m')" export LESSOPEN="| /usr/bin/highlight -O ansi %s 2>/dev/null" -export QT_QPA_PLATFORMTHEME="gtk2" # Have QT use gtk2 theme. -export MOZ_USE_XINPUT2="1" # Mozilla smooth scrolling/touchpads. +export QT_QPA_PLATFORMTHEME="gtk2" # Have QT use gtk2 theme. +export MOZ_USE_XINPUT2=1 # Mozilla smooth scrolling/touchpads. export AWT_TOOLKIT="MToolkit wmname LG3D" # May have to install wmname -export _JAVA_AWT_WM_NONREPARENTING=1 # Fix for Java applications in dwm +export _JAVA_AWT_WM_NONREPARENTING=1 # Fix for Java applications in dwm -[ ! -f ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ] && setsid shortcuts >/dev/null 2>&1 +[ ! -f "$XDG_CONFIG_HOME/shell/shortcutrc" ] && setsid -f shortcuts >/dev/null 2>&1 # Start graphical server on user's current tty if not already running. #[ "$(tty)" = "/dev/tty1" ] && ! pidof -s Xorg >/dev/null 2>&1 && exec startx "$XINITRC" # Switch escape and caps if tty and no passwd required: -sudo -n loadkeys ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/ttymaps.kmap 2>/dev/null +sudo -n loadkeys "$XDG_DATA_HOME/larbs/ttymaps.kmap" 2>/dev/null diff --git a/.config/wal/templates/zathurarc b/.config/wal/templates/zathurarc index 8f0b16f..66527a8 100644 --- a/.config/wal/templates/zathurarc +++ b/.config/wal/templates/zathurarc @@ -13,6 +13,16 @@ map J zoom out map i recolor map p print map g goto top +map [fullscreen] u scroll half-up +map [fullscreen] d scroll half-down +map [fullscreen] D toggle_page_mode +map [fullscreen] r reload +map [fullscreen] R rotate +map [fullscreen] K zoom in +map [fullscreen] J zoom out +map [fullscreen] i recolor +map [fullscreen] p print +map [fullscreen] g goto top set default-bg "{background}" set default-fg "{foreground}" diff --git a/.config/x11/xinitrc b/.config/x11/xinitrc index e99da8c..b183f25 100755 --- a/.config/x11/xinitrc +++ b/.config/x11/xinitrc @@ -15,4 +15,4 @@ else fi # Activate dbus variables dbus-update-activation-environment --all -ssh-agent dwm +dbus-launch ssh-agent dwm diff --git a/.config/zathura/zathurarc b/.config/zathura/zathurarc index ad87093..3d8e3aa 100644 --- a/.config/zathura/zathurarc +++ b/.config/zathura/zathurarc @@ -14,3 +14,13 @@ map J zoom out map i recolor map p print map g goto top +map [fullscreen] u scroll half-up +map [fullscreen] d scroll half-down +map [fullscreen] D toggle_page_mode +map [fullscreen] r reload +map [fullscreen] R rotate +map [fullscreen] K zoom in +map [fullscreen] J zoom out +map [fullscreen] i recolor +map [fullscreen] p print +map [fullscreen] g goto top diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index c46f51d..ff7d4ae 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -11,9 +11,11 @@ setopt interactive_comments HISTSIZE=10000000 SAVEHIST=10000000 HISTFILE="${XDG_CACHE_HOME:-$HOME/.cache}/zsh/history" +setopt inc_append_history # Load aliases and shortcuts if existent. [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc" +[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutenvrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutenvrc" [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" diff --git a/.local/bin/compiler b/.local/bin/compiler index 8420e25..5713590 100755 --- a/.local/bin/compiler +++ b/.local/bin/compiler @@ -2,58 +2,51 @@ # This script will compile or run another finishing operation on a document. I # have this script run via vim. -# + # Compiles .tex. groff (.mom, .ms), .rmd, .md, .org. Opens .sent files as sent # presentations. Runs scripts based on extension or shebang. -# + # Note that .tex files which you wish to compile with XeLaTeX should have the # string "xelatex" somewhere in a comment/command in the first 5 lines. -file=$(readlink -f "$1") +file="${1}" +ext="${file##*.}" dir=${file%/*} base="${file%.*}" -ext="${file##*.}" - -cd "$dir" || exit 1 -textype() { \ - textarget="$(getcomproot "$file" || echo "$file")" - echo "$textarget" - command="pdflatex" - ( head -n5 "$textarget" | grep -qi 'xelatex' ) && command="xelatex" - $command --output-directory="${textarget%/*}" "${textarget%.*}" - grep -qi addbibresource "$textarget" && - biber --input-directory "${textarget%/*}" "${textarget%.*}" && - $command --output-directory="${textarget%/*}" "${textarget%.*}" && - $command --output-directory="${textarget%/*}" "${textarget%.*}" -} +cd "${dir}" || exit "1" -case "$ext" in - # Try to keep these cases in alphabetical order. - [0-9]) preconv "$file" | refer -PS -e | groff -mandoc -T pdf > "$base".pdf ;; - c) cc "$file" -o "$base" && "$base" ;; - cpp) g++ "$file" -o "$base" && "$base" ;; - cs) mcs "$file" && mono "$base".exe ;; - go) go run "$file" ;; - h) sudo make install ;; - java) javac -d classes "$file" && java -cp classes "${1%.*}" ;; - m) octave "$file" ;; - md) if [ -x "$(command -v lowdown)" ]; then - lowdown --parse-no-intraemph "$file" -Tms | groff -mpdfmark -ms -kept -T pdf > "$base".pdf - elif [ -x "$(command -v groffdown)" ]; then - groffdown -i "$file" | groff -T pdf > "$base".pdf - else - pandoc -t ms --highlight-style=kate -s -o "$base".pdf "$file" - fi ; ;; - mom) preconv "$file" | refer -PS -e | groff -mom -kept -T pdf > "$base".pdf ;; - ms) preconv "$file" | refer -PS -e | groff -me -ms -kept -T pdf > "$base".pdf ;; - org) emacs "$file" --batch -u "$USER" -f org-latex-export-to-pdf ;; - py) python "$file" ;; - [rR]md) Rscript -e "rmarkdown::render('$file', quiet=TRUE)" ;; - rs) cargo build ;; - sass) sassc -a "$file" "$base".css ;; - scad) openscad -o "$base".stl "$file" ;; - sent) setsid -f sent "$file" 2>/dev/null ;; - tex) textype "$file" ;; - *) sed -n '/^#!/s/^#!//p; q' "$file" | xargs -r -I % "$file" ;; +case "${ext}" in + [0-9]) preconv "${file}" | refer -PS -e | groff -mandoc -T pdf > "${base}.pdf" ;; + mom|ms) preconv "${file}" | refer -PS -e | groff -T pdf -m"${ext}" > "${base}.pdf" ;; + c) cc "${file}" -o "${base}" && "./${base}" ;; + cpp) g++ "${file}" -o "${base}" && "./${base}" ;; + cs) mcs "${file}" && mono "${base}.exe" ;; + go) go run "${file}" ;; + h) sudo make install ;; + java) javac -d classes "${file}" && java -cp classes "${base}" ;; + m) octave "${file}" ;; + md) [ -x "$(command -v lowdown)" ] && \ + lowdown --parse-no-intraemph "${file}" -Tms | groff -mpdfmark -ms -kept -T pdf > "${base}.pdf" || \ + [ -x "$(command -v groffdown)" ] && \ + groffdown -i "${file}" | groff -T pdf > "${base}.pdf" || \ + pandoc -t ms --highlight-style="kate" -s -o "${base}.pdf" "${file}" ;; + org) emacs "${file}" --batch -u "${USER}" -f org-latex-export-to-pdf ;; + py) python "${file}" ;; + [rR]md) Rscript -e "rmarkdown::render('${file}', quiet=TRUE)" ;; + rs) cargo build ;; + sass) sassc -a "${file}" "${base}.css" ;; + scad) openscad -o "${base}.stl" "${file}" ;; + sent) setsid -f sent "${file}" 2> "/dev/null" ;; + tex) + textarget="$(getcomproot "${file}" || echo "${file}")" + command="pdflatex" + head -n5 "${textarget}" | grep -qi "xelatex" && command="xelatex" + ${command} --output-directory="${textarget%/*}" "${textarget%.*}" && + grep -qi addbibresource "${textarget}" && + biber --input-directory "${textarget%/*}" "${textarget%.*}" && + ${command} --output-directory="${textarget%/*}" "${textarget%.*}" && + ${command} --output-directory="${textarget%/*}" "${textarget%.*}" + ;; + *) sed -n '/^#!/s/^#!//p; q' "${file}" | xargs -r -I % "${file}" ;; esac diff --git a/.local/bin/displayselect b/.local/bin/displayselect index 0227a32..51dd468 100755 --- a/.local/bin/displayselect +++ b/.local/bin/displayselect @@ -32,7 +32,7 @@ twoscreen() { # If multi-monitor is selected and there are two screens. else primary=$(echo "$screens" | dmenu -i -p "Select primary display:") - secondary=$(echo "$screens" | grep -v "$primary") + secondary=$(echo "$screens" | grep -v ^"$primary"$) direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?") xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction"-of "$primary" --auto --scale 1.0x1.0 fi @@ -40,9 +40,9 @@ twoscreen() { # If multi-monitor is selected and there are two screens. morescreen() { # If multi-monitor is selected and there are more than two screens. primary=$(echo "$screens" | dmenu -i -p "Select primary display:") - secondary=$(echo "$screens" | grep -v "$primary" | dmenu -i -p "Select secondary display:") + secondary=$(echo "$screens" | grep -v ^"$primary"$ | dmenu -i -p "Select secondary display:") direction=$(printf "left\\nright" | dmenu -i -p "What side of $primary should $secondary be on?") - tertiary=$(echo "$screens" | grep -v "$primary" | grep -v "$secondary" | dmenu -i -p "Select third display:") + tertiary=$(echo "$screens" | grep -v ^"$primary"$ | grep -v ^"$secondary"$ | dmenu -i -p "Select third display:") xrandr --output "$primary" --auto --output "$secondary" --"$direction"-of "$primary" --auto --output "$tertiary" --"$(printf "left\\nright" | grep -v "$direction")"-of "$primary" --auto } diff --git a/.local/bin/getcomproot b/.local/bin/getcomproot index d34a2e4..dbee348 100755 --- a/.local/bin/getcomproot +++ b/.local/bin/getcomproot @@ -1,12 +1,9 @@ -#!/bin/bash +#!/bin/sh # A helper script for LaTeX/groff files used by `compiler` and `opout`. # The user can add the root file of a larger project as a comment as below: # % root = mainfile.tex # And the compiler script will run on that instead of the opened file. -texroot="$(grep -i "^.\+\s*root\s*=\s*\S\+" "$1")" -texroot="${texroot##*=}" -texroot="${texroot//[\"\' ]}" - -[ -f "$texroot" ] && readlink -f "$texroot" || exit 1 +texroot="$(sed -n 's/^\s*%.*root\s*=\s*\(\S\+\).*/\1/p' "${1}")" +[ -f "${texroot}" ] && readlink -f "${texroot}" || exit "1" diff --git a/.local/bin/lfub b/.local/bin/lfub index 9012f50..f9bb2df 100755 --- a/.local/bin/lfub +++ b/.local/bin/lfub @@ -1,6 +1,6 @@ #!/bin/sh -# This is a wrapper script for lb that allows it to create image previews with +# This is a wrapper script for lf that allows it to create image previews with # ueberzug. This works in concert with the lf configuration file and the # lf-cleaner script. diff --git a/.local/bin/maimpick b/.local/bin/maimpick index 5de26c1..67b9983 100755 --- a/.local/bin/maimpick +++ b/.local/bin/maimpick @@ -7,12 +7,14 @@ # variables output="$(date '+%y%m%d-%H%M-%S').png" xclip_cmd="xclip -sel clip -t image/png" +ocr_cmd="xclip -sel clip" -case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (copy)\\ncurrent window (copy)\\nfull screen (copy)" | dmenu -l 6 -i -p "Screenshot which area?")" in +case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (copy)\\ncurrent window (copy)\\nfull screen (copy)\\ncopy selected image to text" | dmenu -l 7 -i -p "Screenshot which area?")" in "a selected area") maim -u -s pic-selected-"${output}" ;; - "current window") maim -q -d 0.2 -i "$(xdotool getactivewindow)" pic-window-"${output}" ;; + "current window") maim -B -q -d 0.2 -i "$(xdotool getactivewindow)" pic-window-"${output}" ;; "full screen") maim -q -d 0.2 pic-full-"${output}" ;; "a selected area (copy)") maim -u -s | ${xclip_cmd} ;; "current window (copy)") maim -q -d 0.2 -i "$(xdotool getactivewindow)" | ${xclip_cmd} ;; "full screen (copy)") maim -q -d 0.2 | ${xclip_cmd} ;; + "copy selected image to text") tmpfile=$(mktemp /tmp/ocr-XXXXXX.png) && maim -u -s > "$tmpfile" && tesseract "$tmpfile" - -l eng | ${ocr_cmd} && rm "$tmpfile" ;; esac diff --git a/.local/bin/mounter b/.local/bin/mounter index 756d04d..389f2d3 100755 --- a/.local/bin/mounter +++ b/.local/bin/mounter @@ -79,8 +79,13 @@ case "$chosen" in πΎ*) chosen="${chosen%% *}" chosen="${chosen:1}" # This is a bashism. + parttype="$(echo "$lsblkoutput" | grep "$chosen")" attemptmount || getmount - sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)" + case "${parttype##* }" in + vfat) sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000 ;; + btrfs) sudo -A mount "$chosen" "$mp" ;; + *) sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)" ;; + esac notify-send "πΎDrive Mounted." "$chosen mounted to $mp." ;; diff --git a/.local/bin/shortcuts b/.local/bin/shortcuts index 7d7a190..08a2f57 100755 --- a/.local/bin/shortcuts +++ b/.local/bin/shortcuts @@ -5,29 +5,30 @@ bmfiles="${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-files" # Output locations. Unactivated progs should go to /dev/null. shell_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc" +shell_env_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutenvrc" zsh_named_dirs="${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" lf_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/lf/shortcutrc" vim_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/nvim/shortcuts.vim" -ranger_shortcuts="/dev/null" qute_shortcuts="/dev/null" fish_shortcuts="/dev/null" vifm_shortcuts="/dev/null" # Remove, prepare files -rm -f "$lf_shortcuts" "$ranger_shortcuts" "$qute_shortcuts" "$zsh_named_dirs" "$vim_shortcuts" 2>/dev/null +rm -f "$lf_shortcuts" "$qute_shortcuts" "$zsh_named_dirs" "$vim_shortcuts" 2>/dev/null printf "# vim: filetype=sh\\n" > "$fish_shortcuts" printf "# vim: filetype=sh\\nalias " > "$shell_shortcuts" +printf "# vim: filetype=sh\\n" > "$shell_env_shortcuts" printf "\" vim: filetype=vim\\n" > "$vifm_shortcuts" # Format the `directories` file in the correct syntax and sent it to all three configs. eval "echo \"$(cat "$bmdirs")\"" | \ awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\"); printf(\"%s=\42cd %s && ls -A\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ; + printf(\"[ -n \42%s\42 ] && export %s=\42%s\42 \n\",\$1,\$1,\$2) >> \"$shell_env_shortcuts\" ; printf(\"hash -d %s=%s \n\",\$1,\$2) >> \"$zsh_named_dirs\" ; printf(\"abbr %s \42cd %s; and ls -A\42\n\",\$1,\$2) >> \"$fish_shortcuts\" ; printf(\"map g%s :cd %s<CR>\nmap t%s <tab>:cd %s<CR><tab>\nmap M%s <tab>:cd %s<CR><tab>:mo<CR>\nmap Y%s <tab>:cd %s<CR><tab>:co<CR> \n\",\$1,\$2, \$1, \$2, \$1, \$2, \$1, \$2) >> \"$vifm_shortcuts\" ; printf(\"config.bind(';%s', \42set downloads.location.directory %s ;; hint links download\42) \n\",\$1,\$2) >> \"$qute_shortcuts\" ; - printf(\"map g%s cd %s\nmap t%s tab_new %s\nmap m%s shell mv -v %%s %s\nmap Y%s shell cp -rv %%s %s \n\",\$1,\$2,\$1,\$2, \$1, \$2, \$1, \$2) >> \"$ranger_shortcuts\" ; printf(\"map C%s cd \42%s\42 \n\",\$1,\$2) >> \"$lf_shortcuts\" ; printf(\"cmap ;%s %s\n\",\$1,\$2) >> \"$vim_shortcuts\" }" @@ -35,9 +36,9 @@ awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\"); eval "echo \"$(cat "$bmfiles")\"" | \ awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\"); printf(\"%s=\42\$EDITOR %s\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ; + printf(\"[ -n \42%s\42 ] && export %s=\42%s\42 \n\",\$1,\$1,\$2) >> \"$shell_env_shortcuts\" ; printf(\"hash -d %s=%s \n\",\$1,\$2) >> \"$zsh_named_dirs\" ; printf(\"abbr %s \42\$EDITOR %s\42 \n\",\$1,\$2) >> \"$fish_shortcuts\" ; printf(\"map %s :e %s<CR> \n\",\$1,\$2) >> \"$vifm_shortcuts\" ; - printf(\"map %s shell \$EDITOR %s \n\",\$1,\$2) >> \"$ranger_shortcuts\" ; printf(\"map E%s \$\$EDITOR \42%s\42 \n\",\$1,\$2) >> \"$lf_shortcuts\" ; printf(\"cmap ;%s %s\n\",\$1,\$2) >> \"$vim_shortcuts\" }" diff --git a/.local/bin/slider b/.local/bin/slider index 3460c77..b412e95 100755 --- a/.local/bin/slider +++ b/.local/bin/slider @@ -67,7 +67,6 @@ if [ -n "${audio+x}" ]; then *) echo "That doesn't look like an audio file."; exit 1 ;; esac totseconds="$(date '+%s' -d $(ffmpeg -i "$audio" 2>&1 | awk '/Duration/ {print $2}' | sed s/,//))" - endtime="$((totseconds-seconds))" fi prepdir="${prepdir:-$cache/$file}" @@ -95,10 +94,10 @@ do # If images have already been made in a previous run, do not recreate # them unless -r was given. { [ ! -f "$prepdir/$base" ] || [ -n "${redo+x}" ] ;} && - convert -size "${res:-1920x1080}" canvas:"${bgc:-black}" -gravity center "$content" -resize 1920x1080 -composite "$prepdir/$base" + magick -size "${res:-1920x1080}" canvas:"${bgc:-black}" -gravity center "$content" -resize 1920x1080 -composite "$prepdir/$base" else { [ ! -f "$prepdir/$base" ] || [ -n "${redo+x}" ] ;} && - convert -size "${res:-1920x1080}" -background "${bgc:-black}" -fill "${fgc:-white}" -font "${font:-Sans}" -pointsize "${ppt:-150}" -gravity center label:"$content" "$prepdir/$base" + magick -size "${res:-1920x1080}" -background "${bgc:-black}" -fill "${fgc:-white}" -font "${font:-Sans}" -pointsize "${ppt:-150}" -gravity center label:"$content" "$prepdir/$base" fi # If the first line, do not write yet. @@ -111,6 +110,7 @@ duration $duration" prevseconds="$(date '+%s' -d "$prevtime")" done < "$file" # Do last file which must be given twice as follows +endtime="$((totseconds-seconds))" echo "file '$base' duration ${endtime:-5} file '$base'" diff --git a/.local/bin/statusbar/sb-battery b/.local/bin/statusbar/sb-battery index 93cbe08..79030bc 100755 --- a/.local/bin/statusbar/sb-battery +++ b/.local/bin/statusbar/sb-battery @@ -13,7 +13,7 @@ case $BLOCK_BUTTON in - Scroll to change adjust xbacklight." ;; 4) xbacklight -inc 10 ;; 5) xbacklight -dec 10 ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; + 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac # Loop through all attached batteries and format the info diff --git a/.local/bin/statusbar/sb-brightness b/.local/bin/statusbar/sb-brightness new file mode 100755 index 0000000..913387b --- /dev/null +++ b/.local/bin/statusbar/sb-brightness @@ -0,0 +1,23 @@ +#!/bin/sh + +# current brightness +curr_brightness=$(cat /sys/class/backlight/*/brightness) + +# max_brightness +max_brightness=$(cat /sys/class/backlight/*/max_brightness) + +# brightness percentage +brightness_per=$((100 * curr_brightness / max_brightness)) + +case $BLOCK_BUTTON in + 1) + ;; + 3) + notify-send "π‘ Brightness module" "\- Shows current brightness level βοΈ." + ;; + 6) + setsid -f "$TERMINAL" -e "$EDITOR" "$0" + ;; +esac + +echo "π‘ ${brightness_per}%" diff --git a/.local/bin/statusbar/sb-clock b/.local/bin/statusbar/sb-clock index 940fefc..2e0f7a2 100755 --- a/.local/bin/statusbar/sb-clock +++ b/.local/bin/statusbar/sb-clock @@ -19,11 +19,11 @@ case "$clock" in esac case $BLOCK_BUTTON in - 1) notify-send "This Month" "$(cal | sed "s/\<$(date +'%e')\>/<b><span color='red'>&<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -d3)" ;; + 1) notify-send "This Month" "$(cal | sed "s/\<$(date +'%e'|tr -d ' ')\>/<b><span color='red'>&<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -d3)" ;; 2) setsid -f "$TERMINAL" -e calcurse ;; 3) notify-send "π
Time/date module" "\- Left click to show upcoming appointments for the next three days via \`calcurse -d3\` and show the month via \`cal\` - Middle click opens calcurse if installed" ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; + 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac date "+%g/%m/%d (%a) $icon%I:%M%p" diff --git a/.local/bin/statusbar/sb-cpu b/.local/bin/statusbar/sb-cpu index 382901c..6a5a5c7 100755 --- a/.local/bin/statusbar/sb-cpu +++ b/.local/bin/statusbar/sb-cpu @@ -6,7 +6,7 @@ case $BLOCK_BUTTON in 3) notify-send "π₯ CPU module " "\- Shows CPU temperature. - Click to show intensive processes. - Middle click to open htop." ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; + 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac sensors -f | awk '/Core 0/ {print "π‘" $3}' diff --git a/.local/bin/statusbar/sb-cpubars b/.local/bin/statusbar/sb-cpubars index 297424e..4015893 100755 --- a/.local/bin/statusbar/sb-cpubars +++ b/.local/bin/statusbar/sb-cpubars @@ -12,7 +12,7 @@ case $BLOCK_BUTTON in 2) setsid -f "$TERMINAL" -e htop ;; 3) notify-send "πͺ¨ CPU load module" "Each bar represents one CPU core";; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; + 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac # id total idle diff --git a/.local/bin/statusbar/sb-disk b/.local/bin/statusbar/sb-disk index e947509..7f3ff79 100755 --- a/.local/bin/statusbar/sb-disk +++ b/.local/bin/statusbar/sb-disk @@ -11,7 +11,7 @@ case $BLOCK_BUTTON in 1) notify-send "π½ Disk space" "$(df -h --output=target,used,size)" ;; 3) notify-send "π½ Disk module" "\- Shows used hard drive space. - Click to show all disk info." ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; + 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac case "$location" in diff --git a/.local/bin/statusbar/sb-doppler b/.local/bin/statusbar/sb-doppler index 5a28361..2dcdd24 100755 --- a/.local/bin/statusbar/sb-doppler +++ b/.local/bin/statusbar/sb-doppler @@ -274,7 +274,7 @@ case $BLOCK_BUTTON in 3) notify-send "πΊοΈ Doppler RADAR module" "\- Left click for local Doppler RADAR. - Middle click to update RADAR location. After $secs seconds, new clicks will also automatically update the doppler RADAR." ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; + 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac echo π
diff --git a/.local/bin/statusbar/sb-forecast b/.local/bin/statusbar/sb-forecast index d8a16aa..5225601 100755 --- a/.local/bin/statusbar/sb-forecast +++ b/.local/bin/statusbar/sb-forecast @@ -45,7 +45,7 @@ case $BLOCK_BUTTON in β: Chance of rain/snow π₯Ά: Daily low π: Daily high" ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; + 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac checkforecast || getforecast diff --git a/.local/bin/statusbar/sb-help-icon b/.local/bin/statusbar/sb-help-icon index 8fa4a52..8372e6f 100755 --- a/.local/bin/statusbar/sb-help-icon +++ b/.local/bin/statusbar/sb-help-icon @@ -13,5 +13,5 @@ case $BLOCK_BUTTON in 2) restartwm ;; 3) notify-send "β Help module" "\- Left click to open LARBS guide. - Middle click to refresh window manager." ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; + 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac; echo "β" diff --git a/.local/bin/statusbar/sb-internet b/.local/bin/statusbar/sb-internet index 5440a52..6d0c513 100755 --- a/.local/bin/statusbar/sb-internet +++ b/.local/bin/statusbar/sb-internet @@ -14,7 +14,7 @@ case $BLOCK_BUTTON in π: ethernet working π: vpn is active " ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; + 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac # Wifi diff --git a/.local/bin/statusbar/sb-kbselect b/.local/bin/statusbar/sb-kbselect index ab2140c..df455c1 100755 --- a/.local/bin/statusbar/sb-kbselect +++ b/.local/bin/statusbar/sb-kbselect @@ -11,7 +11,7 @@ case $BLOCK_BUTTON in pkill -RTMIN+30 "${STATUSBAR:-dwmblocks}";; 3) notify-send "β¨ Keyboard/language module" "$(printf "%s" "\- Current layout: $(setxkbmap -query | grep -oP 'layout:\s*\K\w+')") - Left click to change keyboard.";; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; + 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac echo "$kb" diff --git a/.local/bin/statusbar/sb-mailbox b/.local/bin/statusbar/sb-mailbox index 88522f2..7483aa4 100755 --- a/.local/bin/statusbar/sb-mailbox +++ b/.local/bin/statusbar/sb-mailbox @@ -10,7 +10,7 @@ case $BLOCK_BUTTON in - Shows π if syncing mail - Left click opens neomutt - Middle click syncs mail" ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; + 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac unread="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f | wc -l 2>/dev/null)" diff --git a/.local/bin/statusbar/sb-memory b/.local/bin/statusbar/sb-memory index 01d3daf..8178b10 100755 --- a/.local/bin/statusbar/sb-memory +++ b/.local/bin/statusbar/sb-memory @@ -6,7 +6,7 @@ case $BLOCK_BUTTON in 3) notify-send "π§ Memory module" "\- Shows Memory Used/Total. - Click to show memory hogs. - Middle click to open htop." ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; + 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac free --mebi | sed -n '2{p;q}' | awk '{printf ("π§ %2.2fGiB/%2.2fGiB\n", ( $3 / 1024), ($2 / 1024))}' diff --git a/.local/bin/statusbar/sb-moonphase b/.local/bin/statusbar/sb-moonphase index 99adaee..d496ae2 100755 --- a/.local/bin/statusbar/sb-moonphase +++ b/.local/bin/statusbar/sb-moonphase @@ -33,5 +33,5 @@ case $BLOCK_BUTTON in - π: Waning Gibbous - π: Last Quarter - π: Waning Crescent" ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; + 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac diff --git a/.local/bin/statusbar/sb-music b/.local/bin/statusbar/sb-music index 266b916..6734eeb 100755 --- a/.local/bin/statusbar/sb-music +++ b/.local/bin/statusbar/sb-music @@ -14,6 +14,6 @@ case $BLOCK_BUTTON in - Scroll changes track.";; # right click, pause/unpause 4) mpc prev | filter ;; # scroll up, previous 5) mpc next | filter ;; # scroll down, next - 6) mpc status | filter ; "$TERMINAL" -e "$EDITOR" "$0" ;; + 6) mpc status | filter ; setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; *) mpc status | filter ;; esac diff --git a/.local/bin/statusbar/sb-nettraf b/.local/bin/statusbar/sb-nettraf index 178f677..08cb829 100755 --- a/.local/bin/statusbar/sb-nettraf +++ b/.local/bin/statusbar/sb-nettraf @@ -8,7 +8,7 @@ case $BLOCK_BUTTON in 1) setsid -f "$TERMINAL" -e bmon ;; 3) notify-send "π Network traffic module" "π»: Traffic received πΊ: Traffic transmitted" ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; + 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac update() { diff --git a/.local/bin/statusbar/sb-news b/.local/bin/statusbar/sb-news index fe701db..cc481e1 100755 --- a/.local/bin/statusbar/sb-news +++ b/.local/bin/statusbar/sb-news @@ -5,13 +5,13 @@ case $BLOCK_BUTTON in 1) setsid "$TERMINAL" -e newsboat ;; - 2) setsid -f newsup >/dev/null exit ;; + 2) setsid -f newsup >/dev/null && exit ;; 3) notify-send "π° News module" "\- Shows unread news items - Shows π if updating with \`newsup\` - Left click opens newsboat - Middle click syncs RSS feeds <b>Note:</b> Only one instance of newsboat (including updates) may be running at a time." ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; + 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac cat /tmp/newsupdate 2>/dev/null || echo "$(newsboat -x print-unread | awk '{ if($1>0) print "π°" $1}')$(cat "${XDG_CONFIG_HOME:-$HOME/.config}"/newsboat/.update 2>/dev/null)" diff --git a/.local/bin/statusbar/sb-pacpackages b/.local/bin/statusbar/sb-pacpackages index 37ebed3..6acdce6 100755 --- a/.local/bin/statusbar/sb-pacpackages +++ b/.local/bin/statusbar/sb-pacpackages @@ -23,7 +23,7 @@ case $BLOCK_BUTTON in 3) notify-send "π Upgrade module" "π¦: number of upgradable packages - Left click to upgrade packages - Middle click to show upgradable packages" ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; + 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac pacman -Qu | grep -Fcv "[ignored]" | sed "s/^/π¦/;s/^π¦0$//g" diff --git a/.local/bin/statusbar/sb-price b/.local/bin/statusbar/sb-price index f95c815..611ec36 100755 --- a/.local/bin/statusbar/sb-price +++ b/.local/bin/statusbar/sb-price @@ -44,7 +44,7 @@ case $BLOCK_BUTTON in - Shows π if updating prices. - <b>Last updated: $uptime</b>" ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; + 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac [ -n "$updateme" ] && diff --git a/.local/bin/statusbar/sb-tasks b/.local/bin/statusbar/sb-tasks index 586300e..4beb2d0 100755 --- a/.local/bin/statusbar/sb-tasks +++ b/.local/bin/statusbar/sb-tasks @@ -13,7 +13,7 @@ case $BLOCK_BUTTON in 1) setsid -f "$TERMINAL" -e tsp -l ;; 3) notify-send "Tasks module" "π€: number of running/queued background tasks - Left click opens tsp" ;; # Right click - 2) $EDITOR "$0" ;; # Middle click + 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac [ "$num" != "0(0)" ] && diff --git a/.local/bin/statusbar/sb-torrent b/.local/bin/statusbar/sb-torrent index 08c9173..493631b 100755 --- a/.local/bin/statusbar/sb-torrent +++ b/.local/bin/statusbar/sb-torrent @@ -23,5 +23,5 @@ Module shows number of torrents: π½: downloading β
: done π±: done and seeding" ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; + 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac diff --git a/.local/bin/statusbar/sb-volume b/.local/bin/statusbar/sb-volume index fa0abcd..f9d406b 100755 --- a/.local/bin/statusbar/sb-volume +++ b/.local/bin/statusbar/sb-volume @@ -4,13 +4,13 @@ case $BLOCK_BUTTON in 1) setsid -w -f "$TERMINAL" -e pulsemixer; pkill -RTMIN+10 "${STATUSBAR:-dwmblocks}" ;; - 2) wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle ;; - 4) wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%+ ;; - 5) wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%- ;; + 2) wpctl set-mute @DEFAULT_SINK@ toggle ;; + 4) wpctl set-volume @DEFAULT_SINK@ 1%+ ;; + 5) wpctl set-volume @DEFAULT_SINK@ 1%- ;; 3) notify-send "π’ Volume module" "\- Shows volume π, π if muted. - Middle click to mute. - Scroll to change." ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; + 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac vol="$(wpctl get-volume @DEFAULT_AUDIO_SINK@)" diff --git a/.local/bin/texclear b/.local/bin/texclear index 4cdb02e..6ad3c12 100755 --- a/.local/bin/texclear +++ b/.local/bin/texclear @@ -3,14 +3,7 @@ # Clears the build files of a LaTeX/XeLaTeX build. # I have vim run this file whenever I exit a .tex file. -case "$1" in - *.tex) - file=$(readlink -f "$1") - dir=$(dirname "$file") - base="${file%.*}" - find "$dir" -maxdepth 1 -type f -regextype gnu-awk -regex "^$base\\.(4tc|xref|tmp|pyc|pyg|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 - rm -rdf "$dir/_minted-$(basename -- "$base")" - ;; - *) printf "Give .tex file as argument.\\n" ;; -esac +[ "${1##*.}" = "tex" ] && { + find "$(dirname "${1}")" -regex '.*\(_minted.*\|.*\.\(4tc\|xref\|tmp\|pyc\|pyg\|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 +} || printf "Provide a .tex file.\n" diff --git a/.local/bin/weath b/.local/bin/weath new file mode 100644 index 0000000..a526411 --- /dev/null +++ b/.local/bin/weath @@ -0,0 +1,25 @@ +#!/bin/sh +# +# Get the weather on the terminal. You can pass an alternative location as a parameter, +# and/or use the 'cp' option to copy the forecast as plaintext to the clipboard. + +report="${XDG_CACHE_HOME:-$HOME/.cache}/weatherreport" + +if [ "$1" = 'cp' ]; then + # shellcheck disable=SC2015 + [ -z "$2" ] && sed 's/\x1b\[[^m]*m//g' "$report" | xclip -selection clipboard && + notify-send "Weather forecast for '${LOCATION:-$(head -n 1 "$report" | cut -d' ' -f3-)}' copied to clipboard." || + { data="$(curl -sfm 5 "${WTTRURL:-wttr.in}/$2?T")" && + notify-send "Weather forecast for '$2' copied to clipboard." && + echo "$data" | xclip -selection clipboard || + notify-send 'Failed to get weather forecast!' 'Check your internet connection and the supplied location.'; } +else + [ -n "$2" ] && + notify-send "Invalid option '$1'! The only valid option is 'cp'." && + exit 1 + + # shellcheck disable=SC2015 + [ -z "$1" ] && less -S "$report" || + data="$(curl -sfm 5 "${WTTRURL:-wttr.in}/$1")" && echo "$data" | less -S || + notify-send 'Failed to get weather forecast!' 'Check your internet connection and the supplied location.' +fi |