Merge branch 'master' of github.com:LukeSmithxyz/voidrice

This commit is contained in:
Luke Smith 2024-05-23 13:03:55 -04:00
commit 28eff887e0
No known key found for this signature in database
GPG Key ID: 4C50B54A911F6252
34 changed files with 120 additions and 124 deletions

View File

@ -30,7 +30,7 @@ set autoquit true
cmd open ${{ cmd open ${{
case $(file --mime-type "$(readlink -f $f)" -b) in case $(file --mime-type "$(readlink -f $f)" -b) in
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) localc $fx ;; 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;; text/*|application/json|inode/x-empty|application/x-subrip) $EDITOR $fx;;
image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;; image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;;
image/svg+xml) display -- $f ;; image/svg+xml) display -- $f ;;
@ -45,12 +45,18 @@ cmd open ${{
video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;; 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/pdf|application/vnd.djvu|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;;
application/pgp-encrypted) $EDITOR $fx ;; 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 ;; 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;; *) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done;;
esac esac
}} }}
cmd mkdir $mkdir -p "$(echo $* | tr ' ' '\ ')" cmd mkdir $mkdir -p "$@"
cmd extract ${{ cmd extract ${{
clear; tput cup $(($(tput lines)/3)); tput bold clear; tput cup $(($(tput lines)/3)); tput bold
@ -133,13 +139,13 @@ cmd bulkrename ${{
# Bindings # Bindings
map <c-f> $lf -remote "send $id select \"$(fzf)\"" 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 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 g top
map D delete map D delete
map E extract map E extract
map C copyto map C copyto
map M moveto map M moveto
map <c-n> push :mkdir<space> map <c-n> push :mkdir<space>""<left>
map <c-r> reload map <c-r> reload
map <c-s> set hidden! map <c-s> set hidden!
map <enter> shell map <enter> shell
@ -162,7 +168,14 @@ map V push :!nvim<space>
map W $setsid -f $TERMINAL >/dev/null 2>&1 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 $sxiv -t "$(pwd)" # opens thumbnail mode
map <c-l> unselect
# Source Bookmarks # Source Bookmarks
source "~/.config/lf/shortcutrc" source "~/.config/lf/shortcutrc"

View File

@ -13,10 +13,6 @@ image() {
fi 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 # 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 # an image appears in multiple places across the machine, it will not have to
# be regenerated once seen. # be regenerated once seen.
@ -29,10 +25,15 @@ case "$(file --dereference --brief --mime-type -- "$1")" in
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)" 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' | convert -density 200 - "$CACHE.jpg" > /dev/null 2>&1
image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$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/*) image "$1" "$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/html) lynx -width="$4" -display_charset=utf-8 -dump "$1" ;;
text/troff) man ./ "$1" | col -b ;; 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 ;; audio/* | application/octet-stream) mediainfo "$1" || exit 1 ;;
video/* ) 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)" 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)"

View File

@ -35,7 +35,6 @@ colorscheme vim
" Some basics: " Some basics:
nnoremap c "_c nnoremap c "_c
set nocompatible
filetype plugin on filetype plugin on
syntax on syntax on
set encoding=utf-8 set encoding=utf-8
@ -56,18 +55,15 @@ colorscheme vim
" Nerd tree " Nerd tree
map <leader>n :NERDTreeToggle<CR> map <leader>n :NERDTreeToggle<CR>
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
if has('nvim')
let NERDTreeBookmarksFile = stdpath('data') . '/NERDTreeBookmarks' let NERDTreeBookmarksFile = stdpath('data') . '/NERDTreeBookmarks'
else
let NERDTreeBookmarksFile = '~/.vim' . '/NERDTreeBookmarks'
endif
" vimling: " vim-airline
nm <leader>d :call ToggleDeadKeys()<CR> if !exists('g:airline_symbols')
imap <leader>d <esc>:call ToggleDeadKeys()<CR>a let g:airline_symbols = {}
nm <leader>i :call ToggleIPA()<CR> endif
imap <leader>i <esc>:call ToggleIPA()<CR>a let g:airline_symbols.colnr = ' C:'
nm <leader>q :call ToggleProse()<CR> let g:airline_symbols.linenr = ' L:'
let g:airline_symbols.maxlinenr = '☰ '
" Shortcutting split navigation, saving a keypress: " Shortcutting split navigation, saving a keypress:
map <C-h> <C-w>h map <C-h> <C-w>h

View File

@ -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 # Add all directories in `~/.local/bin` to $PATH
# to clean up. export PATH="$PATH:$(find ~/.local/bin -type d | paste -sd ':' -)"
# Adds `~/.local/bin` to $PATH unsetopt PROMPT_SP 2>/dev/null
export PATH="$PATH:${$(find ~/.local/bin -type d -printf %p:)%%:}"
unsetopt PROMPT_SP
# Default programs: # Default programs:
export EDITOR="nvim" export EDITOR="nvim"
@ -52,7 +50,7 @@ export SQLITE_HISTORY="$XDG_DATA_HOME/sqlite_history"
export DICS="/usr/share/stardict/dic/" export DICS="/usr/share/stardict/dic/"
export SUDO_ASKPASS="$HOME/.local/bin/dmenupass" export SUDO_ASKPASS="$HOME/.local/bin/dmenupass"
export FZF_DEFAULT_OPTS="--layout=reverse --height 40%" export FZF_DEFAULT_OPTS="--layout=reverse --height 40%"
export LESS=-R export LESS="R"
export LESS_TERMCAP_mb="$(printf '%b' '')" export LESS_TERMCAP_mb="$(printf '%b' '')"
export LESS_TERMCAP_md="$(printf '%b' '')" export LESS_TERMCAP_md="$(printf '%b' '')"
export LESS_TERMCAP_me="$(printf '%b' '')" export LESS_TERMCAP_me="$(printf '%b' '')"
@ -62,14 +60,14 @@ export LESS_TERMCAP_us="$(printf '%b' '')"
export LESS_TERMCAP_ue="$(printf '%b' '')" export LESS_TERMCAP_ue="$(printf '%b' '')"
export LESSOPEN="| /usr/bin/highlight -O ansi %s 2>/dev/null" export LESSOPEN="| /usr/bin/highlight -O ansi %s 2>/dev/null"
export QT_QPA_PLATFORMTHEME="gtk2" # Have QT use gtk2 theme. export QT_QPA_PLATFORMTHEME="gtk2" # Have QT use gtk2 theme.
export MOZ_USE_XINPUT2="1" # Mozilla smooth scrolling/touchpads. export MOZ_USE_XINPUT2=1 # Mozilla smooth scrolling/touchpads.
export AWT_TOOLKIT="MToolkit wmname LG3D" # May have to install wmname 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. # 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" [ "$(tty)" = "/dev/tty1" ] && ! pidof -s Xorg >/dev/null 2>&1 && exec startx "$XINITRC"
# Switch escape and caps if tty and no passwd required: # 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

View File

@ -15,4 +15,4 @@ else
fi fi
# Activate dbus variables # Activate dbus variables
dbus-update-activation-environment --all dbus-update-activation-environment --all
ssh-agent dwm dbus-launch ssh-agent dwm

View File

@ -11,6 +11,7 @@ setopt interactive_comments
HISTSIZE=10000000 HISTSIZE=10000000
SAVEHIST=10000000 SAVEHIST=10000000
HISTFILE="${XDG_CACHE_HOME:-$HOME/.cache}/zsh/history" HISTFILE="${XDG_CACHE_HOME:-$HOME/.cache}/zsh/history"
setopt inc_append_history
# Load aliases and shortcuts if existent. # 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/shortcutrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc"

View File

@ -2,58 +2,51 @@
# This script will compile or run another finishing operation on a document. I # This script will compile or run another finishing operation on a document. I
# have this script run via vim. # have this script run via vim.
#
# Compiles .tex. groff (.mom, .ms), .rmd, .md, .org. Opens .sent files as sent # Compiles .tex. groff (.mom, .ms), .rmd, .md, .org. Opens .sent files as sent
# presentations. Runs scripts based on extension or shebang. # presentations. Runs scripts based on extension or shebang.
#
# Note that .tex files which you wish to compile with XeLaTeX should have the # 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. # string "xelatex" somewhere in a comment/command in the first 5 lines.
file=$(readlink -f "$1") file="${1}"
ext="${file##*.}"
dir=${file%/*} dir=${file%/*}
base="${file%.*}" base="${file%.*}"
ext="${file##*.}"
cd "$dir" || exit 1 cd "${dir}" || exit "1"
textype() { \ case "${ext}" in
textarget="$(getcomproot "$file" || echo "$file")" [0-9]) preconv "${file}" | refer -PS -e | groff -mandoc -T pdf > "${base}.pdf" ;;
echo "$textarget" mom|ms) preconv "${file}" | refer -PS -e | groff -T pdf -m"${ext}" > "${base}.pdf" ;;
command="pdflatex" c) cc "${file}" -o "${base}" && "./${base}" ;;
( head -n5 "$textarget" | grep -qi 'xelatex' ) && command="xelatex" cpp) g++ "${file}" -o "${base}" && "./${base}" ;;
$command --output-directory="${textarget%/*}" "${textarget%.*}" cs) mcs "${file}" && mono "${base}.exe" ;;
grep -qi addbibresource "$textarget" && go) go run "${file}" ;;
biber --input-directory "${textarget%/*}" "${textarget%.*}" &&
$command --output-directory="${textarget%/*}" "${textarget%.*}" &&
$command --output-directory="${textarget%/*}" "${textarget%.*}"
}
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 ;; h) sudo make install ;;
java) javac -d classes "$file" && java -cp classes "${1%.*}" ;; java) javac -d classes "${file}" && java -cp classes "${base}" ;;
m) octave "$file" ;; m) octave "${file}" ;;
md) if [ -x "$(command -v lowdown)" ]; then md) [ -x "$(command -v lowdown)" ] && \
lowdown --parse-no-intraemph "$file" -Tms | groff -mpdfmark -ms -kept -T pdf > "$base".pdf lowdown --parse-no-intraemph "${file}" -Tms | groff -mpdfmark -ms -kept -T pdf > "${base}.pdf" || \
elif [ -x "$(command -v groffdown)" ]; then [ -x "$(command -v groffdown)" ] && \
groffdown -i "$file" | groff -T pdf > "$base".pdf groffdown -i "${file}" | groff -T pdf > "${base}.pdf" || \
else pandoc -t ms --highlight-style="kate" -s -o "${base}.pdf" "${file}" ;;
pandoc -t ms --highlight-style=kate -s -o "$base".pdf "$file" org) emacs "${file}" --batch -u "${USER}" -f org-latex-export-to-pdf ;;
fi ; ;; py) python "${file}" ;;
mom) preconv "$file" | refer -PS -e | groff -mom -kept -T pdf > "$base".pdf ;; [rR]md) Rscript -e "rmarkdown::render('${file}', quiet=TRUE)" ;;
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 ;; rs) cargo build ;;
sass) sassc -a "$file" "$base".css ;; sass) sassc -a "${file}" "${base}.css" ;;
scad) openscad -o "$base".stl "$file" ;; scad) openscad -o "${base}.stl" "${file}" ;;
sent) setsid -f sent "$file" 2>/dev/null ;; sent) setsid -f sent "${file}" 2> "/dev/null" ;;
tex) textype "$file" ;; tex)
*) sed -n '/^#!/s/^#!//p; q' "$file" | xargs -r -I % "$file" ;; 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 esac

View File

@ -32,7 +32,7 @@ twoscreen() { # If multi-monitor is selected and there are two screens.
else else
primary=$(echo "$screens" | dmenu -i -p "Select primary display:") 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?") 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 xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction"-of "$primary" --auto --scale 1.0x1.0
fi 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. morescreen() { # If multi-monitor is selected and there are more than two screens.
primary=$(echo "$screens" | dmenu -i -p "Select primary display:") 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?") 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 xrandr --output "$primary" --auto --output "$secondary" --"$direction"-of "$primary" --auto --output "$tertiary" --"$(printf "left\\nright" | grep -v "$direction")"-of "$primary" --auto
} }

View File

@ -9,7 +9,7 @@
# #
# If there is already a running instance, user will be prompted to end it. # If there is already a running instance, user will be prompted to end it.
getdim() { xrandr | sed -n "s/\s*\([0-9]\+x[0-9]\+\).*\*.*/\1/p" ;} getdim() { xrandr | grep -oP '(?<=current ).*(?=,)' | tr -d ' ' ;}
updateicon() { \ updateicon() { \
echo "$1" > /tmp/recordingicon echo "$1" > /tmp/recordingicon

View File

@ -1,12 +1,9 @@
#!/bin/bash #!/bin/sh
# A helper script for LaTeX/groff files used by `compiler` and `opout`. # 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: # The user can add the root file of a larger project as a comment as below:
# % root = mainfile.tex # % root = mainfile.tex
# And the compiler script will run on that instead of the opened file. # And the compiler script will run on that instead of the opened file.
texroot="$(grep -i "^.\+\s*root\s*=\s*\S\+" "$1")" texroot="$(sed -n 's/^\s*%.*root\s*=\s*\(\S\+\).*/\1/p' "${1}")"
texroot="${texroot##*=}" [ -f "${texroot}" ] && readlink -f "${texroot}" || exit "1"
texroot="${texroot//[\"\' ]}"
[ -f "$texroot" ] && readlink -f "$texroot" || exit 1

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/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 # ueberzug. This works in concert with the lf configuration file and the
# lf-cleaner script. # lf-cleaner script.

View File

@ -10,7 +10,7 @@ xclip_cmd="xclip -sel clip -t image/png"
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)" | dmenu -l 6 -i -p "Screenshot which area?")" in
"a selected area") maim -u -s pic-selected-"${output}" ;; "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}" ;; "full screen") maim -q -d 0.2 pic-full-"${output}" ;;
"a selected area (copy)") maim -u -s | ${xclip_cmd} ;; "a selected area (copy)") maim -u -s | ${xclip_cmd} ;;
"current window (copy)") maim -q -d 0.2 -i "$(xdotool getactivewindow)" | ${xclip_cmd} ;; "current window (copy)") maim -q -d 0.2 -i "$(xdotool getactivewindow)" | ${xclip_cmd} ;;

View File

@ -8,13 +8,12 @@ shell_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc"
zsh_named_dirs="${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" zsh_named_dirs="${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc"
lf_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/lf/shortcutrc" lf_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/lf/shortcutrc"
vim_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/nvim/shortcuts.vim" vim_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/nvim/shortcuts.vim"
ranger_shortcuts="/dev/null"
qute_shortcuts="/dev/null" qute_shortcuts="/dev/null"
fish_shortcuts="/dev/null" fish_shortcuts="/dev/null"
vifm_shortcuts="/dev/null" vifm_shortcuts="/dev/null"
# Remove, prepare files # 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\\n" > "$fish_shortcuts"
printf "# vim: filetype=sh\\nalias " > "$shell_shortcuts" printf "# vim: filetype=sh\\nalias " > "$shell_shortcuts"
printf "\" vim: filetype=vim\\n" > "$vifm_shortcuts" printf "\" vim: filetype=vim\\n" > "$vifm_shortcuts"
@ -27,7 +26,6 @@ awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\");
printf(\"abbr %s \42cd %s; and ls -A\42\n\",\$1,\$2) >> \"$fish_shortcuts\" ; 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(\"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(\"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(\"map C%s cd \42%s\42 \n\",\$1,\$2) >> \"$lf_shortcuts\" ;
printf(\"cmap ;%s %s\n\",\$1,\$2) >> \"$vim_shortcuts\" }" printf(\"cmap ;%s %s\n\",\$1,\$2) >> \"$vim_shortcuts\" }"
@ -38,6 +36,5 @@ awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\");
printf(\"hash -d %s=%s \n\",\$1,\$2) >> \"$zsh_named_dirs\" ; printf(\"hash -d %s=%s \n\",\$1,\$2) >> \"$zsh_named_dirs\" ;
printf(\"abbr %s \42\$EDITOR %s\42 \n\",\$1,\$2) >> \"$fish_shortcuts\" ; 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 :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(\"map E%s \$\$EDITOR \42%s\42 \n\",\$1,\$2) >> \"$lf_shortcuts\" ;
printf(\"cmap ;%s %s\n\",\$1,\$2) >> \"$vim_shortcuts\" }" printf(\"cmap ;%s %s\n\",\$1,\$2) >> \"$vim_shortcuts\" }"

View File

@ -13,7 +13,7 @@ case $BLOCK_BUTTON in
- Scroll to change adjust xbacklight." ;; - Scroll to change adjust xbacklight." ;;
4) xbacklight -inc 10 ;; 4) xbacklight -inc 10 ;;
5) xbacklight -dec 10 ;; 5) xbacklight -dec 10 ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac
# Loop through all attached batteries and format the info # Loop through all attached batteries and format the info

View File

@ -19,11 +19,11 @@ case "$clock" in
esac esac
case $BLOCK_BUTTON in 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'|sed 's/ //g')\>/<b><span color='red'>&<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -d3)" ;;
2) setsid -f "$TERMINAL" -e calcurse ;; 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\` 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" ;; - Middle click opens calcurse if installed" ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac
date "+%Y %b %d (%a) $icon%I:%M%p" date "+%Y %b %d (%a) $icon%I:%M%p"

View File

@ -6,7 +6,7 @@ case $BLOCK_BUTTON in
3) notify-send "🖥 CPU module " "\- Shows CPU temperature. 3) notify-send "🖥 CPU module " "\- Shows CPU temperature.
- Click to show intensive processes. - Click to show intensive processes.
- Middle click to open htop." ;; - Middle click to open htop." ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac
sensors | awk '/Core 0/ {print "🌡" $3}' sensors | awk '/Core 0/ {print "🌡" $3}'

View File

@ -12,7 +12,7 @@ case $BLOCK_BUTTON in
2) setsid -f "$TERMINAL" -e htop ;; 2) setsid -f "$TERMINAL" -e htop ;;
3) notify-send "🪨 CPU load module" "Each bar represents 3) notify-send "🪨 CPU load module" "Each bar represents
one CPU core";; one CPU core";;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac
# id total idle # id total idle

View File

@ -11,7 +11,7 @@ case $BLOCK_BUTTON in
1) notify-send "💽 Disk space" "$(df -h --output=target,used,size)" ;; 1) notify-send "💽 Disk space" "$(df -h --output=target,used,size)" ;;
3) notify-send "💽 Disk module" "\- Shows used hard drive space. 3) notify-send "💽 Disk module" "\- Shows used hard drive space.
- Click to show all disk info." ;; - Click to show all disk info." ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac
case "$location" in case "$location" in

View File

@ -274,7 +274,7 @@ case $BLOCK_BUTTON in
3) notify-send "🗺️ Doppler RADAR module" "\- Left click for local Doppler RADAR. 3) notify-send "🗺️ Doppler RADAR module" "\- Left click for local Doppler RADAR.
- Middle click to update RADAR location. - Middle click to update RADAR location.
After $secs seconds, new clicks will also automatically update the doppler RADAR." ;; 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 esac
echo 🌅 echo 🌅

View File

@ -45,7 +45,7 @@ case $BLOCK_BUTTON in
☔: Chance of rain/snow ☔: Chance of rain/snow
🥶: Daily low 🥶: Daily low
🌞: Daily high" ;; 🌞: Daily high" ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac
checkforecast || getforecast checkforecast || getforecast

View File

@ -13,5 +13,5 @@ case $BLOCK_BUTTON in
2) restartwm ;; 2) restartwm ;;
3) notify-send "❓ Help module" "\- Left click to open LARBS guide. 3) notify-send "❓ Help module" "\- Left click to open LARBS guide.
- Middle click to refresh window manager." ;; - Middle click to refresh window manager." ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
esac; echo "❓" esac; echo "❓"

View File

@ -14,7 +14,7 @@ case $BLOCK_BUTTON in
🌐: ethernet working 🌐: ethernet working
🔒: vpn is active 🔒: vpn is active
" ;; " ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac
# Wifi # Wifi

View File

@ -11,7 +11,7 @@ case $BLOCK_BUTTON in
pkill -RTMIN+30 "${STATUSBAR:-dwmblocks}";; pkill -RTMIN+30 "${STATUSBAR:-dwmblocks}";;
3) notify-send "⌨ Keyboard/language module" "$(printf "%s" "\- Current layout: $(setxkbmap -query | grep -oP 'layout:\s*\K\w+')") 3) notify-send "⌨ Keyboard/language module" "$(printf "%s" "\- Current layout: $(setxkbmap -query | grep -oP 'layout:\s*\K\w+')")
- Left click to change keyboard.";; - Left click to change keyboard.";;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac
echo "$kb" echo "$kb"

View File

@ -10,7 +10,7 @@ case $BLOCK_BUTTON in
- Shows 🔃 if syncing mail - Shows 🔃 if syncing mail
- Left click opens neomutt - Left click opens neomutt
- Middle click syncs mail" ;; - Middle click syncs mail" ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac
unread="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f | wc -l 2>/dev/null)" unread="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f | wc -l 2>/dev/null)"

View File

@ -6,7 +6,7 @@ case $BLOCK_BUTTON in
3) notify-send "🧠 Memory module" "\- Shows Memory Used/Total. 3) notify-send "🧠 Memory module" "\- Shows Memory Used/Total.
- Click to show memory hogs. - Click to show memory hogs.
- Middle click to open htop." ;; - Middle click to open htop." ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac
free --mebi | sed -n '2{p;q}' | awk '{printf ("🧠%2.2fGiB/%2.2fGiB\n", ( $3 / 1024), ($2 / 1024))}' free --mebi | sed -n '2{p;q}' | awk '{printf ("🧠%2.2fGiB/%2.2fGiB\n", ( $3 / 1024), ($2 / 1024))}'

View File

@ -33,5 +33,5 @@ case $BLOCK_BUTTON in
- 🌖: Waning Gibbous - 🌖: Waning Gibbous
- 🌗: Last Quarter - 🌗: Last Quarter
- 🌘: Waning Crescent" ;; - 🌘: Waning Crescent" ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
filter() { sed "/^volume:/d;s/\\&/&amp;/g;s/\\[paused\\].*/⏸/g;/\\[playing\\].*/d;/^ERROR/Q" | paste -sd ' ' -;} filter() { sed "/^volume:/d;s/\\[paused\\].*/⏸/g;/\\[playing\\].*/d;/^ERROR/Q" | paste -sd ' ' -;}
pidof -x sb-mpdup >/dev/null 2>&1 || sb-mpdup >/dev/null 2>&1 & pidof -x sb-mpdup >/dev/null 2>&1 || sb-mpdup >/dev/null 2>&1 &
@ -14,6 +14,6 @@ case $BLOCK_BUTTON in
- Scroll changes track.";; # right click, pause/unpause - Scroll changes track.";; # right click, pause/unpause
4) mpc prev | filter ;; # scroll up, previous 4) mpc prev | filter ;; # scroll up, previous
5) mpc next | filter ;; # scroll down, next 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 ;; *) mpc status | filter ;;
esac esac

View File

@ -8,7 +8,7 @@ case $BLOCK_BUTTON in
1) setsid -f "$TERMINAL" -e bmon ;; 1) setsid -f "$TERMINAL" -e bmon ;;
3) notify-send "🌐 Network traffic module" "🔻: Traffic received 3) notify-send "🌐 Network traffic module" "🔻: Traffic received
🔺: Traffic transmitted" ;; 🔺: Traffic transmitted" ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac
update() { update() {

View File

@ -5,13 +5,13 @@
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) setsid "$TERMINAL" -e newsboat ;; 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 3) notify-send "📰 News module" "\- Shows unread news items
- Shows 🔃 if updating with \`newsup\` - Shows 🔃 if updating with \`newsup\`
- Left click opens newsboat - Left click opens newsboat
- Middle click syncs RSS feeds - Middle click syncs RSS feeds
<b>Note:</b> Only one instance of newsboat (including updates) may be running at a time." ;; <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 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)" 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)"

View File

@ -23,7 +23,7 @@ case $BLOCK_BUTTON in
3) notify-send "🎁 Upgrade module" "📦: number of upgradable packages 3) notify-send "🎁 Upgrade module" "📦: number of upgradable packages
- Left click to upgrade packages - Left click to upgrade packages
- Middle click to show upgradable packages" ;; - Middle click to show upgradable packages" ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac
pacman -Qu | grep -Fcv "[ignored]" | sed "s/^/📦/;s/^📦0$//g" pacman -Qu | grep -Fcv "[ignored]" | sed "s/^/📦/;s/^📦0$//g"

View File

@ -44,7 +44,7 @@ case $BLOCK_BUTTON in
- Shows 🔃 if updating prices. - Shows 🔃 if updating prices.
- <b>Last updated: - <b>Last updated:
$uptime</b>" ;; $uptime</b>" ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac
[ -n "$updateme" ] && [ -n "$updateme" ] &&

View File

@ -13,7 +13,7 @@ case $BLOCK_BUTTON in
1) setsid -f "$TERMINAL" -e tsp -l ;; 1) setsid -f "$TERMINAL" -e tsp -l ;;
3) notify-send "Tasks module" "🤖: number of running/queued background tasks 3) notify-send "Tasks module" "🤖: number of running/queued background tasks
- Left click opens tsp" ;; # Right click - Left click opens tsp" ;; # Right click
2) $EDITOR "$0" ;; # Middle click 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac
[ "$num" != "0(0)" ] && [ "$num" != "0(0)" ] &&

View File

@ -23,5 +23,5 @@ Module shows number of torrents:
🔽: downloading 🔽: downloading
✅: done ✅: done
🌱: done and seeding" ;; 🌱: done and seeding" ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac

View File

@ -10,7 +10,7 @@ case $BLOCK_BUTTON in
3) notify-send "📢 Volume module" "\- Shows volume 🔊, 🔇 if muted. 3) notify-send "📢 Volume module" "\- Shows volume 🔊, 🔇 if muted.
- Middle click to mute. - Middle click to mute.
- Scroll to change." ;; - Scroll to change." ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac
vol="$(wpctl get-volume @DEFAULT_AUDIO_SINK@)" vol="$(wpctl get-volume @DEFAULT_AUDIO_SINK@)"