diff options
| -rw-r--r-- | ar/.config/TheSiahxyz/lua/thesiahxyz/core/autocmds.lua | 6 | ||||
| -rw-r--r-- | ar/.config/dunst/dunstrc | 2 | ||||
| -rw-r--r-- | ar/.config/lf/lfrc | 7 | ||||
| -rw-r--r-- | ar/.config/mpv/input.conf | 6 | ||||
| -rwxr-xr-x | ar/.config/nsxiv/exec/key-handler | 94 | ||||
| -rw-r--r-- | ar/.config/shell/aliasrc | 12 | ||||
| -rw-r--r-- | ar/.config/vim/init.vim | 3 | ||||
| -rw-r--r-- | ar/.config/zsh/scripts.zsh | 5 | ||||
| -rwxr-xr-x | ar/.local/bin/compiler | 13 | ||||
| -rwxr-xr-x | ar/.local/bin/getbib | 83 | ||||
| -rwxr-xr-x | ar/.local/bin/rssget | 115 | ||||
| -rwxr-xr-x | ar/.local/bin/statusbar/sb-cpu | 2 | ||||
| -rwxr-xr-x | ar/.local/bin/statusbar/sb-forecast | 71 | ||||
| -rwxr-xr-x | ar/.local/bin/statusbar/sb-memory | 6 | ||||
| -rwxr-xr-x | ar/.local/bin/sysact | 12 | ||||
| -rwxr-xr-x | ar/.local/bin/texclear | 8 |
16 files changed, 285 insertions, 160 deletions
diff --git a/ar/.config/TheSiahxyz/lua/thesiahxyz/core/autocmds.lua b/ar/.config/TheSiahxyz/lua/thesiahxyz/core/autocmds.lua index 139b0a7..5ff20f9 100644 --- a/ar/.config/TheSiahxyz/lua/thesiahxyz/core/autocmds.lua +++ b/ar/.config/TheSiahxyz/lua/thesiahxyz/core/autocmds.lua @@ -256,9 +256,9 @@ vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { }) -- TeX for .tex files -vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { - pattern = { "*.tex" }, - command = "set filetype=tex", +vim.api.nvim_create_autocmd("VimLeavePre", { + pattern = "*.tex", + command = "!latexmk -c %", }) -- When shortcut files are updated, renew bash and lf configs with new material: diff --git a/ar/.config/dunst/dunstrc b/ar/.config/dunst/dunstrc index 84d9cc5..9f1330e 100644 --- a/ar/.config/dunst/dunstrc +++ b/ar/.config/dunst/dunstrc @@ -4,7 +4,7 @@ width = (350, 600) height = (0, 300) origin = top-right - offset = 5x20 + offset = (0,19) scale = 0 progress_bar = true diff --git a/ar/.config/lf/lfrc b/ar/.config/lf/lfrc index 207da85..64b2c5f 100644 --- a/ar/.config/lf/lfrc +++ b/ar/.config/lf/lfrc @@ -80,7 +80,8 @@ cmd compress ${{ # Copy cmd copyto ${{ set -f - dest=$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' "${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs" | fzf --prompt 'Copy to where? ' | sed 's|~|$HOME|') + clear; tput cup $(($(tput lines)/3)) + dest=$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' "${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs" | fzf --layout=reverse --height 40% --prompt 'Copy to where? ' | sed 's|~|$HOME|') [ -z "$dest" ] && exit destpath=$(eval printf '%s' \"$dest\") clear; tput cup $(($(tput lines)/3)); tput bold @@ -235,7 +236,9 @@ cmd create-ipynb ${{ # Move cmd moveto ${{ - dest=$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' "${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs" | fzf --prompt 'Move to where? ' | sed 's|~|$HOME|') + set -f + clear; tput cup $(($(tput lines)/3)) + dest=$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' "${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs" | fzf --layout=reverse --height 40% --prompt 'Move to where? ' | sed 's|~|$HOME|') [ -z "$dest" ] && exit destpath=$(eval printf '%s' \"$dest\") clear; tput cup $(($(tput lines)/3)); tput bold diff --git a/ar/.config/mpv/input.conf b/ar/.config/mpv/input.conf index a2cb715..87e7fe3 100644 --- a/ar/.config/mpv/input.conf +++ b/ar/.config/mpv/input.conf @@ -104,12 +104,14 @@ TAB script-binding visibility 7 seek 70 absolute-percent # Seek 70% of a video 8 seek 80 absolute-percent # Seek 80% of a video 9 seek 90 absolute-percent # Seek 90% of a video +( seek 99 absolute-percent # Seek 99% of a video 0 seek 0 absolute-percent # Seek 0% of a video +) seek 99.9 absolute-percent # Seek 99.9% of a video alt+1 set current-window-scale 0.5 # Halve the window size alt+2 set current-window-scale 1.0 # Reset the window size alt+3 set current-window-scale 2.0 # Double the window size -- seek 99 absolute-percent # Seek 99% of a video -+ seek 99.9 absolute-percent # Seek 99.9% of a video +- add video-zoom -0.1 # Zoom out ++ add video-zoom 0.1 # Zoom in [ script-binding UndoRedo/undo # Jump to previous position { script-binding UndoRedo/undoCaps # Jump to previous position ] script-binding UndoRedo/redo # Jump to undo position diff --git a/ar/.config/nsxiv/exec/key-handler b/ar/.config/nsxiv/exec/key-handler index fc48110..a315b02 100755 --- a/ar/.config/nsxiv/exec/key-handler +++ b/ar/.config/nsxiv/exec/key-handler @@ -1,9 +1,9 @@ #!/bin/sh while read -r file; do - case "$1" in - "h") - notify-send "Macro <C-x> key bindings:" "\- b: Set as wallpaper + case "$1" in + "h") + notify-send "Macro <C-x> key bindings:" "\- b: Set as wallpaper - c: Copy file - d: Delete file - h: Help key bindings @@ -17,51 +17,45 @@ while read -r file; do - S: Change resolution - y: Copy file name to clipboard - Y: Copy file path to clipboard" & - ;; - "b") setbg "$file" & ;; - "c") - [ -z "$destdir" ] && destdir="$(sed "s/#.*$//;/^\s*$/d" ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | awk '{print $2}' | dmenu -l 20 -i -p "Copy file(s) to where?" | sed "s|~|$HOME|g")" - [ ! -d "$destdir" ] && notify-send "$destdir is not a directory, cancelled." && exit - cp "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file copied to $destdir." & - ;; - "d") - [ "$(printf "No\\nYes" | dmenu -i -p "Really delete $file?")" = "Yes" ] && rm "$file" && notify-send "$file deleted." - ;; - "f") - magick "$file" -flop "$file" - ;; - "g") ifinstalled gimp && setsid -f gimp "$file" ;; - "i") notify-send "File information" "$(mediainfo "$file" | sed "s/[ ]\+:/:/g;s/: /: <b>/;s/$/<\/b>/" | grep "<b>")" ;; - "m") - [ -z "$destdir" ] && destdir="$(sed "s/#.*$//;/^\s*$/d" ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | awk '{print $2}' | dmenu -l 20 -i -p "Move file(s) to where?" | sed "s|~|$HOME|g")" - [ ! -d "$destdir" ] && notify-send "$destdir is not a directory, cancelled." && exit - mv "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file moved to $destdir." & - ;; - "r") - magick "$file" -rotate 90 "$file" - ;; - "R") - magick "$file" -rotate -90 "$file" - ;; - "s") - size="$(echo "" | dmenu -i -p "Enter a size to resize $file ($(identify -format "%wx%h" $file)): ")" - magick "$file" -resize "$size" "$file" && notify-send "$file size has changed to $size." - ;; - "S") - resolution="$(printf low\\nmedium\\nhigh | dmenu -i -p "Choose a resolution: ")" - case "$resolution" in - low) magick "$file" -resample 72 "$file" ;; - medium) magick "$file" -resample 150 "$file" ;; - high) magick "$file" -resample 300 "$file" ;; - esac && notify-send "Changed $file resolution to $resolution." - ;; - "y") - printf "%s" "$file" | tr -d '\n' | xclip -selection clipboard && - notify-send "$file copied to clipboard" & - ;; - "Y") - readlink -f "$file" | tr -d '\n' | xclip -selection clipboard && - notify-send "$(readlink -f "$file") copied to clipboard" & - ;; - esac + ;; + "b") setbg "$file" & ;; + "c") + [ -z "$destdir" ] && destdir="$(sed "s/#.*$//;/^\s*$/d" ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | awk '{print $2}' | dmenu -l 20 -i -p "Copy file(s) to where?" | sed "s|~|$HOME|g")" + [ ! -d "$destdir" ] && notify-send "$destdir is not a directory, cancelled." && exit + cp "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file copied to $destdir." & + ;; + "d") + [ "$(printf "No\\nYes" | dmenu -i -p "Really delete $file?")" = "Yes" ] && rm "$file" && notify-send "$file deleted." + ;; + "f") magick "$file" -flop "$file" ;; + "g") ifinstalled gimp && setsid -f gimp "$file" ;; + "i") notify-send "File information" "$(mediainfo "$file" | sed "s/[ ]\+:/:/g;s/: /: <b>/;s/$/<\/b>/" | grep "<b>")" ;; + "m") + [ -z "$destdir" ] && destdir="$(sed "s/#.*$//;/^\s*$/d" ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | awk '{print $2}' | dmenu -l 20 -i -p "Move file(s) to where?" | sed "s|~|$HOME|g")" + [ ! -d "$destdir" ] && notify-send "$destdir is not a directory, cancelled." && exit + mv "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file moved to $destdir." & + ;; + "r") magick "$file" -rotate 90 "$file" ;; + "R") magick "$file" -rotate -90 "$file" ;; + "s") + size="$(echo "" | dmenu -i -p "Enter a size to resize $file ($(identify -format "%wx%h" $file)): ")" + magick "$file" -resize "$size" "$file" && notify-send "$file size has changed to $size." + ;; + "S") + resolution="$(printf low\\nmedium\\nhigh | dmenu -i -p "Choose a resolution: ")" + case "$resolution" in + low) magick "$file" -resample 72 "$file" ;; + medium) magick "$file" -resample 150 "$file" ;; + high) magick "$file" -resample 300 "$file" ;; + esac && notify-send "Changed $file resolution to $resolution." + ;; + "y") + printf "%s" "$file" | tr -d '\n' | xclip -selection clipboard && + notify-send "$file copied to clipboard" & + ;; + "Y") + readlink -f "$file" | tr -d '\n' | xclip -selection clipboard && + notify-send "$(readlink -f "$file") copied to clipboard" & + ;; + esac done diff --git a/ar/.config/shell/aliasrc b/ar/.config/shell/aliasrc index 0aee138..a862e3c 100644 --- a/ar/.config/shell/aliasrc +++ b/ar/.config/shell/aliasrc @@ -6,10 +6,10 @@ [ -x "$(command -v nvim)" ] && alias vimdiff="nvim -d" # Use $XINITRC variable if file exists. -[ -f "$XINITRC" ] && alias startx="startx $XINITRC" +[ -f "$XINITRC" ] && alias startx='startx $XINITRC' # Use $MBSYNCRC variable if file exists to sync mailbox. -[ -f "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC" +[ -f "$MBSYNCRC" ] && alias mbsync='mbsync -c $MBSYNCRC' # sudo not required for some system commands for command in blkid lsblk mount umount pacman poweroff reboot shutdown su sv updatedb; do @@ -277,9 +277,9 @@ alias p8='ping 8.8.8.8' alias p9='ping 9.9.9.9' # nvim -alias v="$EDITOR" -alias v.="$EDITOR ." -alias ve="$EDITOR -c enew" +alias v'"$EDITOR' +alias v.='$EDITOR .' +alias ve='$EDITOR -c enew' alias nv.='nvim .' alias nve='nvim -c enew' alias nts='NVIM_APPNAME=TheSiahxyz nvim' @@ -369,7 +369,7 @@ alias tofish="sudo chsh $USER -s /bin/fish && 'Now log out.'" alias shck='shellcheck --color=always' # shortcut -alias 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" +alias 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' # skype alias skype='skypeforlinux' diff --git a/ar/.config/vim/init.vim b/ar/.config/vim/init.vim index 384f7b7..78350b7 100644 --- a/ar/.config/vim/init.vim +++ b/ar/.config/vim/init.vim @@ -243,7 +243,8 @@ if !exists('g:airline_symbols') endif let g:airline_symbols.colnr = ' C:' let g:airline_symbols.linenr = ' L:' -let g:airline_symbols.maxlinenr = 'โฐ ' +let g:airline_symbols.maxlinenr = ' ' +let g:airline#extensions#whitespace#symbol = '!' " colorscheme if isdirectory(expand("~/.config/vim/plugged/catppuccin")) diff --git a/ar/.config/zsh/scripts.zsh b/ar/.config/zsh/scripts.zsh index 8a45ae5..05561d7 100644 --- a/ar/.config/zsh/scripts.zsh +++ b/ar/.config/zsh/scripts.zsh @@ -293,8 +293,9 @@ function fzf_directory() { # search scripts in ~/.local/bin alias sscs=search_scripts function search_scripts() { - choice="$(find ~/.local/bin -mindepth 1 \( -type f -o -type l \) -not -name '*.md' -not -path '*/zsh/*' -printf '%P\n' | fzf --cycle)" - ([ -n "$choice" ] && [ -f "$HOME/.local/bin/$choice" ]) && ${EDITOR:-nvim} "$HOME/.local/bin/$choice" + scripts=("${HOME}/.local/bin/"**/*(.)) + choice="$(print -lnr ${scripts:t:r} | fzf)" + [[ "${choice}" ]] && "${EDITOR}" ${${(M)scripts:#*/${choice}*}[1]} } # check git status by directories in specific path diff --git a/ar/.local/bin/compiler b/ar/.local/bin/compiler index 1342b68..bcfb319 100755 --- a/ar/.local/bin/compiler +++ b/ar/.local/bin/compiler @@ -36,6 +36,7 @@ case "${ext}" in [0-9]) preconv "$file" | refer -PS -e | groff -mandoc -T pdf >"$base".pdf ;; apl) apl -f "$file" ;; c) compilec ;; +cob) cobc -x -o "$base" "$file" && "$base" ;; config.h) make && sudo make install ;; cpp) g++ "$file" -o "$base" && "$base" ;; cs) mcs "$file" && mono "$base".exe ;; @@ -68,21 +69,13 @@ ps) ps2pdf "$file" ;; py) python "$file" ;; [rR]md) Rscript -e "rmarkdown::render('$file', quiet=TRUE)" ;; r) R -f "$file" ;; +rink) rink -f "${file}" ;; rkt) racket "$file" ;; 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%.*}" - ;; +tex) latexmk ;; tcl) tclsh "$file" ;; vim*) vint "$file" ;; *) chmod +x "$file" && sed 1q "$file" | grep "^#!/" | sed "s/^#!//" | xargs -r -I % "$file" ;; diff --git a/ar/.local/bin/getbib b/ar/.local/bin/getbib index 121dd6e..c90d864 100755 --- a/ar/.local/bin/getbib +++ b/ar/.local/bin/getbib @@ -1,14 +1,71 @@ #!/bin/sh -[ -z "$1" ] && echo "Give either a pdf file or a DOI as an argument." && exit - -if [ -f "$1" ]; then - # Try to get DOI from pdfinfo or pdftotext output. - doi=$(pdfinfo "$1" | grep -io "doi:.*") || - doi=$(pdftotext "$1" 2>/dev/null - | sed -n '/[dD][oO][iI]:/{s/.*[dD][oO][iI]:\s*\(\S\+[[:alnum:]]\).*/\1/p;q}') || - exit 1 -else - doi="$1" -fi - -# Check crossref.org for the bib citation. -curl -s "https://api.crossref.org/works/$doi/transform/application/x-bibtex" -w "\\n" + +BIB_FILE="${HOME}/latex/uni.bib" +[ -f "${BIB_FILE}" ] || BIB_FILE="${2:-$(find "${HOME}" -path "${HOME}/.*" \ + -prune -o -type "f" -name "*.bib" -print -quit)}" + +{ [ -f "${BIB_FILE}" ] || [ "${2}" ]; } || { + printf "%s\n" "Create a .bib file or provide as \$2." && exit "1" +} + +filter() { + sed -n -E 's/.*((DOI|doi)((\.(org))?\/?|:? *))([^: ]+[^ .]).*/\6/p; T; q' +} + +fpdf() { + pdf="${1}" + doi="$(pdfinfo "${pdf}" 2>"/dev/null" | filter)" + + [ "${doi}" ] || doi="$(pdftotext -q -l "2" "${pdf}" - 2>"/dev/null" | filter)" + + [ "${doi}" ] || printf "%s\n" "No DOI found for PDF: ${pdf}" >&2 + + printf "%s\n" "${doi}" +} + +arrange() { + sed 's/\}, /\},\n /g + s/, /,\n / + s/ }/\n}/ + s/,\s*pages=/,\n\tpages=/' | + sed '1s/^ *// + 1s/[0-9]*\([0-9]\{2\}\)/\1/ + 1s/_// + 1s/.*/\L&/ + s/.*=/\L&/ + s/=/ = /' +} + +doi2bib() { + doi="${1#doi:}" + url="https://api.crossref.org/works/${doi}/transform/application/x-bibtex" + entry="$(curl -kLsS --no-fail "${url}" | arrange)" + red='\033[0;31m' + reset='\033[0m' + + printf "${red}%s${reset}\n" "${entry}" + + [ "${entry%"${entry#?}"}" != "@" ] && { + printf "%s\n" "Failed to fetch bibtex entry for DOI: ${doi}" + return "1" + } + + grep -iFq "doi = {${doi}}" "${BIB_FILE}" 2>"/dev/null" && { + printf "%s\n" "Bibtex entry for DOI: ${doi} already exists in the file." + } || { + [ -s "${BIB_FILE}" ] && printf "\n" >>"${BIB_FILE}" + printf "%s\n" "${entry}" >>"${BIB_FILE}" + printf "%s\n" "Added bibtex entry for DOI: ${doi}" + } +} + +[ "${1}" ] || { + printf "%s\n" "Give either a pdf file or a DOI or a directory path that has PDFs as an argument." + exit "1" +} + +[ -f "${1}" ] && doi="$(fpdf "${1}")" && doi2bib "${doi}" && exit "0" + +[ -d "${1}" ] && for i in "${1}"/*.pdf; do doi="$(fpdf "${i}")" && doi2bib "${doi}"; done && exit "0" + +doi="$(printf "%s\n" "${1}" | filter)" && doi2bib "${doi}" diff --git a/ar/.local/bin/rssget b/ar/.local/bin/rssget new file mode 100755 index 0000000..5d470b4 --- /dev/null +++ b/ar/.local/bin/rssget @@ -0,0 +1,115 @@ +#!/bin/bash + +# Searches the website for RSS feeds and adds them to newsboat url list. Can +# also find hidden RSS feeds on various websites, namely Youtube, Reddit, +# Vimeo, Github, Gitlab and Medium. Gets site url as $1 or (if not present) +# from X clipboard. Gets tags as $2. If it finds more than one feed, calls +# dmenu for the user to choose which one to add. I have bound it to a keyboard +# shortcut so i copy a site link and easily add its feed to the reader. + +# Inspired by and based on the logic of this extension: +# https://github.com/shevabam/get-rss-feed-url-extension + +# This script requires rssadd to add feeds to the list. + +getlink () { + local url="$1" + feeds="$(curl -s "$url" | grep -Ex '.*type=.*(rss|rdf|atom).*' | sed 's/ //g')" + url="$(echo $url | sed 's|^\(https://[^/]*/\).*|\1|')" + + for rsspath in $feeds; do + rsspath="$(echo $rsspath | sed -n "s|.*href=['\"]\([^'\"]*\)['\"].*|\1|p")" + if echo "$rsspath" | grep "http" > /dev/null; then + link="$rsspath" + elif echo "$rsspath" | grep -E "^/" > /dev/null; then + link="$url$(echo $rsspath | sed 's|^/||')" + else + link="$url$rsspath" + fi + echo $link + done +} + +getRedditRss() { + echo "${1%/}.rss" +} + +getYoutubeRss() { + local url="$1" + path=$(echo "$url" | sed -e 's|^http[s]*://||') + case "$path" in + *"/channel/"*) channel_id="$(echo $path | sed -r 's|.*channel/([^/]*).*|\1|')" && feed="https://www.youtube.com/feeds/videos.xml?channel_id=${channel_id}" ;; + *"/c/"*|*"/user/"*) + feed=$(wget -q "$url" -O tmp_rssget_yt \ + && sed -n 's|.*\("rssUrl":"[^"]*\).*|\1|; p' tmp_rssget_yt \ + | grep rssUrl \ + | sed 's|"rssUrl":"||') ;; + esac + echo "$feed" +} + +getVimeoRss() { + local url="$1" + if echo "$url" | grep -q "/videos$"; then + feed_url=$(echo "$url" | sed 's/\/videos$//' | sed 's/\/$/\/rss/') + else + feed_url="${url}/videos/rss" + fi + echo "$feed_url" +} + +getGithubRss () { + local url="${1%/}" + if echo $url | grep -E "github.com/[^/]*/[a-zA-Z0-9].*" >/dev/null ; then + echo "${url}/commits.atom" + echo "${url}/releases.atom" + echo "${url}/tags.atom" + elif echo $url | grep -E "github.com/[^/]*(/)" >/dev/null ; then + echo "${url}.atom" + fi +} + +getGitlabRss () { + local url="${1%/}" + echo "${url}.atom" +} + +getMediumRss () { + echo $1 | sed 's|/tag/|/feed/|' +} + + +if [ -n "$1" ] ; then + url="$1" +else + url="$(xclip -selection clipboard -o)" + [ -z "$url" ] && echo "usage: $0 url 'tag1 tag2 tag3'" && exit 1 +fi + +declare -a list=() + +yt_regex="^(http(s)?://)?((w){3}\.)?(youtube\.com|invidio\.us|invidious\.flokinet\.to|invidious\.materialio\.us|iv\.datura\.network|invidious\.perennialte\.ch|invidious\.fdn\.fr|invidious\.private\.coffee|invidious\.protokolla\.fi|invidious\.privacyredirect\.com|yt\.artemislena\.eu|yt\.drgnz\.club|invidious\.incogniweb\.net|yewtu\.be|inv\.tux\.pizza|invidious\.reallyaweso\.me|iv\.melmac\.space|inv\.us\.projectsegfau\.lt|inv\.nadeko\.net|invidious\.darkness\.services|invidious\.jing\.rocks|invidious\.privacydev\.net|inv\.in\.projectsegfau\.lt|invidious\.drgns\.space)/(channel|user|c).+" +reddit_regex="^(http(s)?://)?((w){3}\.)?reddit\.com.*" +vimeo_regex="^(http(s)?://)?((w){3}.)?vimeo\.com.*" +if echo $url | grep -Ex "$yt_regex" >/dev/null ; then + list="$(getYoutubeRss "$url")" +elif echo $url | grep -Ex "$reddit_regex" >/dev/null ; then + list="$(getRedditRss "$url")" +# vimeo actually works with getlink +elif echo $url | grep -E "$vimeo_regex" >/dev/null ; then + list="$(getVimeoRss "$url")" +elif echo $url | grep -E "github.com" >/dev/null ; then + list="$(getGithubRss "$url")" +# gitlab also works with getlink +elif echo $url | grep -E "gitlab.com/[a-zA-Z0-9].*" >/dev/null ; then + list="$(getGitlabRss "$url")" +elif echo $url | grep -E "medium.com/tag" >/dev/null ; then + list="$(getMediumRss "$url")" +else + list="$(getlink "$url")" +fi + +[ "$(echo "$list" | wc -l)" -eq 1 ] && chosen_link="$list" || chosen_link=$(printf '%s\n' "${list[@]}" | dmenu -p "Choose a feed:") +tags="$2" +ifinstalled rssadd && rssadd "$chosen_link" "$tags" +echo "$chosen_link" "$tags" diff --git a/ar/.local/bin/statusbar/sb-cpu b/ar/.local/bin/statusbar/sb-cpu index 8579c44..565ca26 100755 --- a/ar/.local/bin/statusbar/sb-cpu +++ b/ar/.local/bin/statusbar/sb-cpu @@ -1,7 +1,7 @@ #!/bin/sh case $BLOCK_BUTTON in -1) notify-send "๐ฅ CPU hogs" "$(ps axch -o cmd:15,%cpu --sort=-%cpu | head)\\n(100% per core)" ;; +1) notify-send "๐ฅ CPU hogs" "$(ps axch -o cmd,%cpu | awk '{cmd[$1]+=$2} END {for (i in cmd) print i, cmd[i]}' | sort -nrk2 | head)\\n(100% per core)" ;; 2) setsid -f "$TERMINAL" -e htop ;; 3) notify-send "๐ฅ CPU module " "\- Shows CPU temperature - Left click to show intensive processes diff --git a/ar/.local/bin/statusbar/sb-forecast b/ar/.local/bin/statusbar/sb-forecast index 64d68c0..bed3a9d 100755 --- a/ar/.local/bin/statusbar/sb-forecast +++ b/ar/.local/bin/statusbar/sb-forecast @@ -266,48 +266,6 @@ US: KVAX: Jacksonville, FL US: KJGX: Peachtree City/atlanta, GA US: KVNX: Norman, OK US: KVBX: Vandenberg Afb: Orcutt, CA -EU: Europe -EU: GB: Great Brittain -EU: SCAN: Scandinavia. Norway, Sweden And Denmark -EU: ALPS: The Alps -EU: NL: The Netherlands -EU: DE: Germany -EU: SP: Spain -EU: FR: France -EU: IT: Italy -EU: PL: Poland -EU: GR: Greece -EU: TU: Turkey -EU: RU: Russia -EU: BA: Bahrain -EU: BC: Botswana -EU: SE: Republic of Seychelles -EU: HU: Hungary -EU: UK: Ukraine -AF: AF: Africa -AF: WA: West Africa -AF: ZA: South Africa -AF: DZ: Algeria -AF: CE: Canary Islands -AF: NG: Nigeria -AF: TD: Chad -AF: CG: Democratic Republic of Congo -AF: EG: Egypt -AF: ET: Ethiopia -AF: CM: Cameroon -AF: IS: Israel -AF: LY: Libya -AF: MG: Madagascar -AF: MO: Morocco -AF: BW: Namibia -AF: SA: Saudi Arabia -AF: SO: Somalia -AF: SD: Sudan -AF: TZ: Tanzania -AF: TN: Tunisia -AF: ZM: Zambia -AF: KE: Kenya -AF: AO: Angola DE: BAW: Baden-Wรผrttemberg DE: BAY: Bavaria DE: BBB: Berlin @@ -323,31 +281,34 @@ DE: SAC: Saxony DE: SAA: Saxony-Anhalt DE: SHH: Schleswig-Holstein DE: SHH: Hamburg -DE: THU: Thuringia" | dmenu -r -i -l 50 -p "Select a radar to use as default:" | tr "[:lower:]" "[:upper:]")" +DE: THU: Thuringia +NL: The Netherlands" | dmenu -r -i -l 50 -p "Select a radar to use as default:")" # Ensure user did not escape. [ -z "$chosen" ] && exit 1 - # Set continent code and radar code. - continentcode=${chosen%%:*} + # Set country code and radar code. + countrycode=${chosen%%:*} radarcode=${chosen#* } radarcode=${radarcode%:*} # Print codes to $radarloc file. - printf "%s,%s\\n" "$continentcode" "$radarcode" >"$radarloc" + printf "%s,%s\\n" "$countrycode" "$radarcode" >"$radarloc" } getdoppler() { - cont=$(cut -c -2 "$radarloc") - loc=$(cut -c 4- "$radarloc") - notify-send "๐ฆ๏ธ Doppler RADAR" "Pulling most recent Doppler RADAR for $loc." - case "$cont" in - "US") curl -sL "https://radar.weather.gov/ridge/standard/${loc}_loop.gif" >"$doppler" ;; - "EU") curl -sL "https://api.sat24.com/animated/${loc}/rainTMC/2/" >"$doppler" ;; - "AF") curl -sL "https://api.sat24.com/animated/${loc}/rain/2/" >"$doppler" ;; + country=$(cut -c -2 "$radarloc") + province=$(cut -c 4- "$radarloc") + notify-send "๐ฆ๏ธ Doppler RADAR" "Pulling most recent Doppler RADAR for $province." + case "$country" in + "US") + province="$(echo "$province" | tr "[:lower:]" "[:upper:]")" + curl -sL "https://radar.weather.gov/ridge/standard/${province}_loop.gif" >"$doppler" + ;; "DE") - loc="$(echo "$loc" | tr "[:upper:]" "[:lower:]")" - curl -sL "https://www.dwd.de/DWD/wetter/radar/radfilm_${loc}_akt.gif" >"$doppler" + province="$(echo "$province" | tr "[:upper:]" "[:lower:]")" + curl -sL "https://www.dwd.de/DWD/wetter/radar/radfilm_${province}_akt.gif" >"$doppler" ;; + "NL") curl -sL "https://cdn.knmi.nl/knmi/map/general/weather-map.gif" >"$doppler" ;; esac } diff --git a/ar/.local/bin/statusbar/sb-memory b/ar/.local/bin/statusbar/sb-memory index 804fd91..5b06d29 100755 --- a/ar/.local/bin/statusbar/sb-memory +++ b/ar/.local/bin/statusbar/sb-memory @@ -1,11 +1,7 @@ #!/bin/sh case $BLOCK_BUTTON in -1) notify-send "๐ Memory hogs" "$( - ps axch -o cmd:15,%mem --sort=-%mem | head - echo - free --mebi | sed -n '2{p;q}' | awk '{printf ("๐%2.2fGB/%2.2fGB\n", ( $3 / 1024), ($2 / 1024))}' -)" ;; +1) notify-send "๐ Memory hogs" "$(ps axch -o cmd,%mem | awk '{cmd[$1]+=$2} END {for (i in cmd) print i, cmd[i]}' | sort -nrk2 | head)" ;; 2) setsid -f "$TERMINAL" -e htop ;; 3) notify-send "๐ Memory module" "\- Shows Memory used/total - Left click to show memory hogs diff --git a/ar/.local/bin/sysact b/ar/.local/bin/sysact index 3706d2b..d4f3653 100755 --- a/ar/.local/bin/sysact +++ b/ar/.local/bin/sysact @@ -7,6 +7,16 @@ case "$(readlink -f /sbin/init)" in *) ctl='loginctl' ;; esac +lock() { + mpc pause + pauseallmpv + wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle + kill -39 "$(pidof dwmblocks)" + slock + wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle + kill -39 "$(pidof dwmblocks)" +} + wmpid() { # This function is needed if there are multiple instances of the window manager. tree="$(pstree -ps $$)" tree="${tree#*$WM(}" @@ -14,7 +24,7 @@ wmpid() { # This function is needed if there are multiple instances of the windo } case "$(printf "๐ lock\n๐ช leave $WM\nโป๏ธ renew $WM\n๐ป hibernate\n๐ reboot\n๐ฅ๏ธshutdown\n๐ค sleep\n๐บ display off" | dmenu -i -p 'Action: ')" in -'๐ lock') slock ;; +'๐ lock') lock ;; "๐ช leave $WM") kill -TERM "$(wmpid)" ;; "โป๏ธ renew $WM") kill -HUP "$(wmpid)" ;; '๐ป hibernate') slock $ctl hibernate -i ;; diff --git a/ar/.local/bin/texclear b/ar/.local/bin/texclear deleted file mode 100755 index 58f4439..0000000 --- a/ar/.local/bin/texclear +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -# Clears the build files of a LaTeX/XeLaTeX build. -# I have vim run this file whenever I exit a .tex file. - -[ "${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" |
