diff --git a/.config/i3/config b/.config/i3/config index 5553699c..5647389a 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -229,7 +229,7 @@ bindsym $mod+F4 exec --no-startup-id prompt "Hibernate computer?" "$hibernate" bindsym $mod+F5 exec --no-startup-id $netrefresh bindsym $mod+F6 exec --no-startup-id torwrap bindsym $mod+F7 exec --no-startup-id td-toggle -bindsym $mod+F8 exec --no-startup-id mailsync +bindsym $mod+F8 exec --no-startup-id mw sync bindsym $mod+F9 exec --no-startup-id dmenumount bindsym $mod+F10 exec --no-startup-id dmenuumount bindsym $mod+F11 exec --no-startup-id ducksearch diff --git a/.config/newsboat/config b/.config/newsboat/config index b5035b8d..e9179910 100644 --- a/.config/newsboat/config +++ b/.config/newsboat/config @@ -35,9 +35,11 @@ macro t set browser "qndl" ; open-in-browser ; set browser linkhandler macro a set browser "tsp youtube-dl --add-metadata -xic -f bestaudio/best" ; open-in-browser ; set browser linkhandler macro v set browser "setsid -f mpv" ; open-in-browser ; set browser linkhandler macro w set browser "lynx" ; open-in-browser ; set browser linkhandler -macro p set browser "dmenuhandler" ; open-in-browser ; set browser linkhandler +macro d set browser "dmenuhandler" ; open-in-browser ; set browser linkhandler macro c set browser "xsel -b <<<" ; open-in-browser ; set browser linkhandler macro C set browser "youtube-viewer --comments=%u" ; open-in-browser ; set browser linkhandler +macro p set browser "peertubetorrent %u 480" ; open-in-browser ; set browser linkhandler +macro P set browser "peertubetorrent %u 1080" ; open-in-browser ; set browser linkhandler highlight all "---.*---" yellow highlight feedlist ".*(0/0))" black diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index b3f40c99..b078a786 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -84,7 +84,7 @@ set clipboard+=unnamedplus nnoremap S :%s//g " Compile document, be it groff/LaTeX/markdown/etc. - map c :w! \| !compiler % + map c :w! \| !compiler "%" " Open corresponding .pdf/.html or preview map p :!opout % diff --git a/.config/ranger/luke_ranger_readme.md b/.config/ranger/README.MD similarity index 98% rename from .config/ranger/luke_ranger_readme.md rename to .config/ranger/README.MD index 45111514..a78ee5a5 100644 --- a/.config/ranger/luke_ranger_readme.md +++ b/.config/ranger/README.MD @@ -9,7 +9,7 @@ These are the basic key binds in ranger, even outside of my configs. Note that t + dd -- cut selected files + yy -- copy/yank selected files + pp -- paste/move cut/copied files -+ / -- search, when (n/N) next/previos result ++ / -- search, when (n/N) next/previous result + zh or CTRL-h -- show hidden files + Renaming files: + cw -- rename file from scratch diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc index 1b893724..6c7c2e4f 100644 --- a/.config/sxhkd/sxhkdrc +++ b/.config/sxhkd/sxhkdrc @@ -157,7 +157,7 @@ super + F7 td-toggle # sync email super + F8 - mailsync + mw sync # Mount a USB drive or Android device super + {F9,F10} {dmenumount,dmenuumount} diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index 6d85cc70..c74458e5 100644 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -12,6 +12,7 @@ setw -g automatic-rename set -g mouse on set -g history-limit 30000 set -g terminal-overrides 'xterm*:smcup@:rmcup@' +set -sg escape-time 20 # faster escape delay time set-option -g status-justify right set-option -g status-bg black # colour213 # pink set-option -g status-fg cyan @@ -26,7 +27,7 @@ unbind j unbind C-b # unbind default leader key unbind '"' # unbind horizontal split unbind % # unbind vertical split -bind-key r source-file ~/.tmux.conf +bind-key r source-file ~/.config/tmux/tmux.conf bind-key c split-window -v # split pane horizontally bind-key v split-window -h # split pane vertically bind-key Space list-panes diff --git a/.config/wal/templates/zathurarc b/.config/wal/templates/zathurarc index 53737238..242bf9a2 100644 --- a/.config/wal/templates/zathurarc +++ b/.config/wal/templates/zathurarc @@ -1,3 +1,4 @@ +set sandbox none set statusbar-h-padding 0 set statusbar-v-padding 0 set page-padding 1 diff --git a/.config/zathura/zathurarc b/.config/zathura/zathurarc index dc45337a..f1bae202 100644 --- a/.config/zathura/zathurarc +++ b/.config/zathura/zathurarc @@ -1,3 +1,4 @@ +set sandbox none set statusbar-h-padding 0 set statusbar-v-padding 0 set page-padding 1 diff --git a/.local/bin/compiler b/.local/bin/compiler index 1892d5fb..3c2d204a 100755 --- a/.local/bin/compiler +++ b/.local/bin/compiler @@ -3,8 +3,8 @@ # 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. Opens .sent files as sent -# presentations. Runs scripts based on extention or shebang +# Compiles .tex. groff (.mom, .ms), .rmd, .md, .org. Opens .sent files as sent +# presentations. Runs scripts based on extention 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. @@ -14,21 +14,23 @@ dir=${file%/*} base="${file%.*}" ext="${file##*.}" -cd "$dir" || exit +cd "$dir" || exit 1 textype() { \ command="pdflatex" - ( sed 5q "$file" | grep -i -q 'xelatex' ) && command="xelatex" + ( head -n5 "$file" | grep -qi 'xelatex' ) && command="xelatex" $command --output-directory="$dir" "$base" && - grep -i addbibresource "$file" >/dev/null && + grep -qi addbibresource "$file" && biber --input-directory "$dir" "$base" && $command --output-directory="$dir" "$base" && $command --output-directory="$dir" "$base" } 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" ;; go) go run "$file" ;; h) sudo make install ;; m) octave "$file" ;; @@ -41,12 +43,13 @@ case "$ext" in 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" ;; + sass) sassc -a "$file" "$base.css" ;; scad) openscad -o "$base".stl "$file" ;; sent) setsid -f sent "$file" 2>/dev/null ;; tex) textype "$file" ;; - *) sed 1q "$file" | grep "^#!/" | sed "s/^#!//" | xargs -r -I % "$file" ;; + *) head -n1 "$file" | grep "^#!/" | sed "s/^#!//" | xargs -r -I % "$file" ;; esac diff --git a/.local/bin/cron/IMPORTANT_NOTE.md b/.local/bin/cron/README.md similarity index 73% rename from .local/bin/cron/IMPORTANT_NOTE.md rename to .local/bin/cron/README.md index f5a130b9..fa0c3540 100644 --- a/.local/bin/cron/IMPORTANT_NOTE.md +++ b/.local/bin/cron/README.md @@ -5,7 +5,7 @@ These cronjobs have components that require information about your current displ When you add them as cronjobs, I recommend you precede the command with commands as those below: ``` -export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus; export DISPLAY=:0; . $HOME/.zprofile; then_command_goes_here +export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u $USER)/bus; export DISPLAY=:0; . $HOME/.zprofile; then_command_goes_here ``` This ensures that notifications will display, xdotool commands will function and environmental variables will work as well. diff --git a/.local/bin/cron/checkup b/.local/bin/cron/checkup index bf7f85d6..4cfb856a 100755 --- a/.local/bin/cron/checkup +++ b/.local/bin/cron/checkup @@ -2,7 +2,7 @@ # Syncs repositories and downloads updates, meant to be run as a cronjob. -ping -q -c example.org > /dev/null || exit +ping -q -c 1 example.org > /dev/null || exit notify-send "πŸ“¦ Repository Sync" "Checking for package updates..." diff --git a/.local/bin/cron/cronbat b/.local/bin/cron/cronbat index 2dc0950f..bd953c7a 100755 --- a/.local/bin/cron/cronbat +++ b/.local/bin/cron/cronbat @@ -5,5 +5,5 @@ [ "$(cat /sys/class/power_supply/BAT0/status)" = "Charging" ] && exit [ "$(cat /sys/class/power_supply/BAT0/capacity)" -lt 25 ] && -export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1001/bus && +export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u $USER)/bus && notify-send -u critical "Battery critically low." diff --git a/.local/bin/dmenuhandler b/.local/bin/dmenuhandler index 5bdd1314..e5de8ef9 100755 --- a/.local/bin/dmenuhandler +++ b/.local/bin/dmenuhandler @@ -2,15 +2,20 @@ # Feed this script a link and it will give dmenu # some choice programs to use to open it. +feed="${1:-$(printf "%s" | dmenu -p 'Paste URL or file path')}" -case "$(printf "copy url\\nmpv\\nmpv (loop)\\nqueue download\\n\\nqueue youtube-dl\\nfeh\\nbrowser\\nw3m\\nmpv (float)" | dmenu -i -p "Open link with what program?")" in - "copy url") echo "$1" | xclip -selection clipboard ;; - mpv) setsid -f mpv -quiet "$1" >/dev/null 2>&1 ;; - "mpv (loop)") setsid -f mpv -quiet --loop "$1" >/dev/null 2>&1 ;; - "queue download") tsp curl -LO "$1" >/dev/null 2>&1 ;; - "queue youtube-dl") tsp youtube-dl --write-metadata -ic "$1" >/dev/null 2>&1 ;; - browser) setsid -f "$BROWSER" "$1" >/dev/null 2>&1 ;; - feh) setsid -f feh "$1" >/dev/null 2>&1 ;; - w3m) w3m "$1" >/dev/null 2>&1 ;; - "mpv (float)") setsid -f mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$1" >/dev/null 2>&1 ;; +case "$(printf "Copy URL\\nsxiv\\nsetbg\\nPDF\\nbrowser\\nlynx\\nvim\\nmpv\\nmpv loop\\nmpv float\\nqueue download\\nqueue yt-dl\\nqueue yt-dl audio" | dmenu -i -p "Open it with?")" in + "copy url") echo "$feed" | xclip -selection clipboard ;; + mpv) setsid -f mpv -quiet "$feed" >/dev/null 2>&1 ;; + "mpv loop") setsid -f mpv -quiet --loop "$feed" >/dev/null 2>&1 ;; + "mpv float") setsid -f "$TERMINAL" -e mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$feed" >/dev/null 2>&1 ;; + "queue yt-dl") qndl "$feed" >/dev/null 2>&1 ;; + "queue yt-dl audio") qndl "$feed" 'youtube-dl --add-metadata -icx -f bestaudio/best' >/dev/null 2>&1 ;; + "queue download") qndl "$feed" 'curl -LO' >/dev/null 2>&1 ;; + PDF) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;; + sxiv) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;; + vim) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && setsid -f "$TERMINAL" -e "$EDITOR" "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;; + setbg) curl -L "$feed" > $XDG_CACHE_HOME/pic ; xwallpaper --zoom $XDG_CACHE_HOME/pic >/dev/null 2>&1 ;; + browser) setsid -f "$BROWSER" "$feed" >/dev/null 2>&1 ;; + lynx) lynx "$feed" >/dev/null 2>&1 ;; esac diff --git a/.local/bin/dmenumount b/.local/bin/dmenumount index 488522a6..b98b6a3a 100755 --- a/.local/bin/dmenumount +++ b/.local/bin/dmenumount @@ -25,6 +25,7 @@ mountusb() { \ partitiontype="$(lsblk -no "fstype" "$chosen")" case "$partitiontype" in "vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000;; + "exfat") sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)";; *) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" "$mp";; esac notify-send "πŸ’» USB mounting" "$chosen mounted to $mp." diff --git a/.local/bin/dmenurecord b/.local/bin/dmenurecord index 49a2fbf8..b1a034a3 100755 --- a/.local/bin/dmenurecord +++ b/.local/bin/dmenurecord @@ -80,11 +80,12 @@ audio() { \ } askrecording() { \ - choice=$(printf "screencast\\nvideo\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu -i -p "Select recording style:") + choice=$(printf "screencast\\nvideo\\nvideo selected\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu -i -p "Select recording style:") case "$choice" in screencast) screencast;; audio) audio;; video) video;; + *selected) videoselected;; webcam) webcam;; "webcam (hi-def)") webcamhidef;; esac @@ -95,11 +96,28 @@ asktoend() { \ [ "$response" = "Yes" ] && killrecording } +videoselected() +{ + slop -f "%x %y %w %h" > /tmp/slop + read -r X Y W H < /tmp/slop + rm /tmp/slop + + ffmpeg \ + -f x11grab \ + -framerate 60 \ + -video_size "$W"x"$H" \ + -i :0.0+"$X,$Y" \ + -c:v libx264 -qp 0 -r 30 \ + "$HOME/box-$(date '+%y%m%d-%H%M-%S').mkv" & + echo $! > /tmp/recordingpid + updateicon "⏺️" +} case "$1" in screencast) screencast;; audio) audio;; video) video;; + *selected) videoselected;; kill) killrecording;; *) ([ -f /tmp/recordingpid ] && asktoend && exit) || askrecording;; esac diff --git a/.local/bin/ext b/.local/bin/ext index c5f89c5d..806ce5e2 100755 --- a/.local/bin/ext +++ b/.local/bin/ext @@ -8,19 +8,19 @@ while getopts "hc" o; do case "${o}" in c) extracthere="True" ;; - *) printf "Options:\\n -c: Extract archive into current directory rather than a new one.\\n" && exit ;; + *) printf "Options:\\n -c: Extract archive into current directory rather than a new one.\\n" && exit 1 ;; esac done if [ -z "$extracthere" ]; then archive="$(readlink -f "$*")" && directory="$(echo "$archive" | sed 's/\.[^\/.]*$//')" && mkdir -p "$directory" && - cd "$directory" || exit + cd "$directory" || exit 1 else - archive="$(readlink -f "$(echo "$*" | cut -d' ' -f2)")" + archive="$(readlink -f "$(echo "$*" | cut -d' ' -f2)" 2>/dev/null)" fi -[ "$archive" = "" ] && printf "Give archive to extract as argument.\\n" && exit +[ -z "$archive" ] && printf "Give archive to extract as argument.\\n" && exit 1 if [ -f "$archive" ] ; then case "$archive" in diff --git a/.local/bin/linkhandler b/.local/bin/linkhandler index 7c7e96f7..04934e58 100755 --- a/.local/bin/linkhandler +++ b/.local/bin/linkhandler @@ -10,13 +10,14 @@ [ -z "$1" ] && { "$BROWSER"; exit; } case "$1" in - *mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*) + *mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*|*videos.lukesmith.xyz*) setsid -f mpv -quiet "$1" >/dev/null 2>&1 ;; *png|*jpg|*jpe|*jpeg|*gif) - curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///")" >/dev/null 2>&1 & ;; + curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;; + *pdf|*cbz|*cbr) + curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$1" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;; *mp3|*flac|*opus|*mp3?source*) - setsid -f tsp curl -LO "$1" >/dev/null 2>&1 ;; + qndl "$1" 'curl -LO' >/dev/null 2>&1 ;; *) - if [ -f "$1" ]; then "$TERMINAL" -e "$EDITOR" "$1" - else setsid -f "$BROWSER" "$1" >/dev/null 2>&1; fi ;; + [ -f "$1" ] && setsid -f "$TERMINAL" -e "$EDITOR" "$1" >/dev/null 2>&1 || setsid -f "$BROWSER" "$1" >/dev/null 2>&1 esac diff --git a/.local/bin/peertubetorrent b/.local/bin/peertubetorrent new file mode 100644 index 00000000..56f2476e --- /dev/null +++ b/.local/bin/peertubetorrent @@ -0,0 +1,7 @@ +#!/bin/sh +# torrent peertube videos, requires the transadd script +# first argument is the video link, second is the quality (480 or 1080) +# 13/07/20 - Arthur Bais + +link="$(echo "$1" | sed "s/videos\/watch/download\/torrents/")""-$2.torrent" +transadd "$link" diff --git a/.local/bin/qndl b/.local/bin/qndl index f5bd14f2..f6fbe87c 100755 --- a/.local/bin/qndl +++ b/.local/bin/qndl @@ -5,7 +5,7 @@ base="$(basename "$1")" notify-send "⏳ Queuing $base..." cmd="$2" -[ -z "$cmd" ] && cmd="youtube-dl --add-metadata" +[ -z "$cmd" ] && cmd="youtube-dl --add-metadata -ic" idnum="$(tsp $cmd "$1")" realname="$(echo "$base" | sed "s/?\(source\|dest\).*//;s/%20/ /g")" tsp -D "$idnum" mv "$base" "$realname" diff --git a/.local/bin/rotdir b/.local/bin/rotdir index 7313a424..86da6dbe 100755 --- a/.local/bin/rotdir +++ b/.local/bin/rotdir @@ -9,4 +9,4 @@ [ -z "$1" ] && echo "usage: rotdir regex 2>&1" && exit 1 base="$(basename "$1")" - ls "$PWD" | awk "BEGIN { lines = \"\"; m = 0; } /^$base$/ { m = 1; } { if (!m) { if (lines) { lines = lines\"\n\"; } lines = lines\"\"\$0; } else { print \$0; } } END { print lines; }" +ls "$PWD" | awk -v BASE="$base" 'BEGIN { lines = ""; m = 0; } { if ($0 == BASE) { m = 1; } } { if (!m) { if (lines) { lines = lines"\n"; } lines = lines""$0; } else { print $0; } } END { print lines; }' diff --git a/.local/bin/shortcuts b/.local/bin/shortcuts index ed4f89f9..ea463d72 100755 --- a/.local/bin/shortcuts +++ b/.local/bin/shortcuts @@ -15,17 +15,19 @@ printf "# vim: filetype=sh\\nalias " > "$shell_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 "${XDG_CONFIG_HOME:-$HOME/.config}/directories")\"" | \ awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\"); printf(\"%s=\42cd %s && ls -a\42 \\\\\n\",\$1,\$2) >> \"$shell_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\nmap t%s :cd %s\nmap M%s :cd %s:mo\nmap Y%s :cd %s:co \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\" }" "${XDG_CONFIG_HOME:-$HOME/.config}/directories" + 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\" }" # Format the `files` file in the correct syntax and sent it to both configs. +eval "echo \"$(cat "${XDG_CONFIG_HOME:-$HOME/.config}/files")\"" | \ awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\"); printf(\"%s=\42\$EDITOR %s\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ; printf(\"abbr %s \42\$EDITOR %s\42 \n\",\$1,\$2) >> \"$fish_shortcuts\" ; printf(\"map %s :e %s \n\",\$1,\$2) >> \"$vifm_shortcuts\" ; - printf(\"map %s shell \$EDITOR %s \n\",\$1,\$2) >> \"$ranger_shortcuts\" }" "${XDG_CONFIG_HOME:-$HOME/.config}/files" + printf(\"map %s shell \$EDITOR %s \n\",\$1,\$2) >> \"$ranger_shortcuts\" }" diff --git a/.local/bin/slider b/.local/bin/slider new file mode 100755 index 00000000..950b4967 --- /dev/null +++ b/.local/bin/slider @@ -0,0 +1,124 @@ +#!/bin/sh + +# Give a file with images and timecodes and creates a video slideshow of them. +# +# Timecodes must be in format 00:00:00. +# +# Imagemagick and ffmpeg required. + +# Application cache if not stated elsewhere. +cache="${XDG_CACHE_HOME:-$HOME/.cache}/slider" + +while getopts "hvrpi:c:a:o:d:f:t:e:x:" o; do case "${o}" in + c) bgc="$OPTARG" ;; + t) fgc="$OPTARG" ;; + i) file="$OPTARG" ;; + a) audio="$OPTARG" ;; + o) outfile="$OPTARG" ;; + d) prepdir="$OPTARG" ;; + r) redo="$OPTARG" ;; + s) ppt="$OPTARG" ;; + e) endtime="$OPTARG" ;; + x) res="$OPTARG" + echo "$res" | grep -qv "^[0-9]\+x[0-9]\+$" && + echo "Resolution must be dimensions separated by a 'x': 1280x720, etc." && + exit 1 ;; + p) echo "Purge old build files in $cache? [y/N]" + read -r confirm + echo "$confirm" | grep -iq "^y$" && rm -rf "$cache" && echo "Done." + exit ;; + v) verbose=True ;; + *) echo "$(basename "$0") usage: + -i input timecode list (required) + -a audio file + -c color of background (use html names, black is default) + -t text color for text slides (white is default) + -s text font size for text slides (150 is default) + -o output video file + -e if no audio given, the time in seconds that the last slide will be shown (5 is default) + -x resolution (1920x1080 is default) + -d tmp directory + -r rerun imagemagick commands even if done previously (in case files or background has changed) + -p purge old build files instead of running + -v be verbose" && exit 1 + +esac done + +# Check that the input file looks like it should. +{ head -n 1 "$file" 2>/dev/null | grep -q "^00:00:00 " ;} || { + echo "Give an input file with -i." && + echo "The file should look as this example: + +00:00:00 first_image.jpg +00:00:03 otherdirectory/next_image.jpg +00:00:09 this_image_starts_at_9_seconds.jpg +etc... + +Timecodes and filenames must be separated by Tabs." && + exit 1 + } + +if [ -n "${audio+x}" ]; then + # Check that the audio file looks like an actual audio file. + case "$(file --dereference --brief --mime-type -- "$audio")" in + audio/*) ;; + *) 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}" +outfile="${outfile:-$file.mp4}" +prepfile="$prepdir/$file.prep" + +[ -n "${verbose+x}" ] && echo "Preparing images... May take a while depending on the number of files." +mkdir -p "$prepdir" + +{ +while read -r x; +do + # Get the time from the first column. + time="${x%% *}" + seconds="$(date '+%s' -d "$time")" + # Duration is not used on the first looped item. + duration="$((seconds - prevseconds))" + + # Get the filename/text content from the rest. + content="${x#* }" + base="$(basename "$content")" + base="${base%.*}.jpg" + + if [ -f "$content" ]; then + # 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" + else + { [ ! -f "$prepdir/$base" ] || [ -n "${redo+x}" ] ;} && + convert -size "${res:-1920x1080}" -background "${bgc-black}" -fill "${fgc:-white}" -pointsize "${ppt:-150}" -gravity center label:"$content" "$prepdir/$base" + fi + + # If the first line, do not write yet. + [ "$time" = "00:00:00" ] || echo "file '$prevbase' +duration $duration" + + # Keep the information required for the next file. + prevbase="$base" + prevtime="$time" + prevseconds="$(date '+%s' -d "$prevtime")" +done < "$file" +# Do last file which must be given twice as follows +echo "file '$base' +duration ${endtime:-5} +file '$base'" +} > "$prepfile" +if [ -n "${audio+x}" ]; then + ffmpeg -hide_banner -y -f concat -safe 0 -i "$prepfile" -i "$audio" -c:a aac -vsync vfr -c:v libx264 -pix_fmt yuv420p "$outfile" +else + ffmpeg -hide_banner -y -f concat -safe 0 -i "$prepfile" -vsync vfr -c:v libx264 -pix_fmt yuv420p "$outfile" +fi + +# Might also try: +# -vf "fps=${fps:-24},format=yuv420p" "$outfile" +# but has given some problems. diff --git a/.local/bin/statusbar/weather b/.local/bin/statusbar/forecast similarity index 95% rename from .local/bin/statusbar/weather rename to .local/bin/statusbar/forecast index e04bac0b..6652edd2 100755 --- a/.local/bin/statusbar/weather +++ b/.local/bin/statusbar/forecast @@ -10,7 +10,7 @@ weatherreport="${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" getforecast() { curl -sf "wttr.in/$LOCATION" > "$weatherreport" || exit 1 ;} # Some very particular and terse stream manipulation. We get the maximum -# precipication chance and the daily high and low from the downloaded file and +# precipitation chance and the daily high and low from the downloaded file and # display them with coresponding emojis. showweather() { printf "%s" "$(sed '16q;d' "$weatherreport" | grep -wo "[0-9]*%" | sort -rn | sed "s/^/β˜”/g;1q" | tr -d '\n')" diff --git a/.local/bin/statusbar/internet b/.local/bin/statusbar/internet index d8bd8969..ee1a1607 100755 --- a/.local/bin/statusbar/internet +++ b/.local/bin/statusbar/internet @@ -2,6 +2,7 @@ # Show wifi πŸ“Ά and percent strength or πŸ“‘ if none. # Show 🌐 if connected to ethernet or ❎ if none. +# Show πŸ”’ if a vpn connection is active case $BLOCK_BUTTON in 1) "$TERMINAL" -e nmtui; pkill -RTMIN+4 dwmblocks ;; @@ -10,6 +11,7 @@ case $BLOCK_BUTTON in πŸ“Ά: wifi connection with quality ❎: no ethernet 🌐: ethernet working +πŸ”’: vpn is active " ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;; esac @@ -19,4 +21,4 @@ case "$(cat /sys/class/net/w*/operstate 2>/dev/null)" in up) wifiicon="$(awk '/^\s*w/ { print "πŸ“Ά", int($3 * 100 / 70) "% " }' /proc/net/wireless)" ;; esac -printf "%s%s\n" "$wifiicon" "$(sed "s/down/❎/;s/up/🌐/" /sys/class/net/e*/operstate 2>/dev/null)" +printf "%s%s%s\n" "$wifiicon" "$(sed "s/down/❎/;s/up/🌐/" /sys/class/net/e*/operstate 2>/dev/null)" "$(sed "s/.*/πŸ”’/" /sys/class/net/tun*/operstate 2>/dev/null)" diff --git a/.local/bin/statusbar/mailbox b/.local/bin/statusbar/mailbox index ca77f5ca..5a674287 100755 --- a/.local/bin/statusbar/mailbox +++ b/.local/bin/statusbar/mailbox @@ -5,7 +5,7 @@ case $BLOCK_BUTTON in 1) setsid -f "$TERMINAL" -e neomutt ;; - 2) setsid -f mailsync >/dev/null ;; + 2) setsid -f mw sync >/dev/null ;; 3) notify-send "πŸ“¬ Mail module" "\- Shows unread mail - Shows πŸ”ƒ if syncing mail - Left click opens neomutt diff --git a/.local/bin/statusbar/nettraf b/.local/bin/statusbar/nettraf index 71e6fe43..eb7a73b3 100755 --- a/.local/bin/statusbar/nettraf +++ b/.local/bin/statusbar/nettraf @@ -5,6 +5,7 @@ # second, gives network traffic per second. 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" ;; diff --git a/.local/bin/statusbar/torrent b/.local/bin/statusbar/torrent index 9e1da3a6..d2e08857 100755 --- a/.local/bin/statusbar/torrent +++ b/.local/bin/statusbar/torrent @@ -1,20 +1,14 @@ #!/bin/sh transmission-remote -l | grep % | - sed " # This first sed command is to ensure a desirable order with sort - s/.*Stopped.*/A/g; - s/.*Seeding.*/Z/g; - s/.*100%.*/N/g; - s/.*Idle.*/B/g; - s/.*Uploading.*/L/g; - s/.*%.*/M/g" | - sort -h | uniq -c | sed " # Now we replace the standin letters with icons. - s/A/πŸ›‘/g; - s/B/πŸ•°/g; - s/L/πŸ”Ό/g; - s/M/πŸ”½/g; - s/N/βœ…/g; - s/Z/🌱/g" | awk '{print $2 $1}' | paste -sd ' ' + sed " # The letters are for sorting and will not appear. + s/.*Stopped.*/A πŸ›‘/; + s/.*Seeding.*/Z 🌱/; + s/.*100%.*/N βœ…/; + s/.*Idle.*/B πŸ•°οΈ/; + s/.*Uploading.*/L ⬆️/; + s/.*%.*/M ⬇️/" | + sort -h | uniq -c | awk '{print $3 $1}' | paste -sd ' ' case $BLOCK_BUTTON in 1) setsid -f "$TERMINAL" -e tremc ;; diff --git a/.local/bin/sysact b/.local/bin/sysact index abea88d4..9dc398bd 100755 --- a/.local/bin/sysact +++ b/.local/bin/sysact @@ -10,8 +10,8 @@ esac cmds="\ πŸ”’ lock slock -πŸšͺ leave dwm kill -TERM $(pidof -s dwm) -β™» renew dwm kill -HUP $(pidof -s dwm) +πŸšͺ leave dwm kill -TERM $(pgrep -u $USER "\bdwm$") +β™» renew dwm kill -HUP $(pgrep -u $USER "\bdwm$") 🐻 hibernate slock ${hib:-systemctl suspend-then-hibernate -i} πŸ”ƒ reboot ${reb:-sudo -A reboot} πŸ–₯ shutdown ${shut:-sudo -A shutdown -h now}" diff --git a/.local/bin/tag b/.local/bin/tag index c23be4e6..8462b99a 100755 --- a/.local/bin/tag +++ b/.local/bin/tag @@ -55,5 +55,13 @@ Date=$date Genre=$genre Comment=$comment" | opustags -i -S "$file" ;; *.mp3) eyeD3 -Q --remove-all -a "$artist" -A "$album" -t "$title" -n "$track" -N "$total" -Y "$date" "$file" ;; + *.flac) echo "TITLE=$title +ARTIST=$artist +ALBUM=$album +TRACKNUMBER=$track +TOTALTRACKS=$total +DATE=$date +GENRE=$genre +DESCRIPTION=$comment" | metaflac --remove-all-tags --import-tags-from=- "$file" ;; *) echo "File type not implemented yet." ;; esac diff --git a/.local/share/larbs/readme.mom b/.local/share/larbs/readme.mom index fb8feb8b..392ba22f 100644 --- a/.local/share/larbs/readme.mom +++ b/.local/share/larbs/readme.mom @@ -241,7 +241,7 @@ previous recordings as their names are based on their exact times. .ITEM \f(CWMod+Delete\fP \(en Kills any recording started in the above way. .ITEM -\f(CWMod+Shift+c\fP \(en Toggles a webcam in the bottom right for screencasting. +\f(CWMod+F11\fP \(en Opens up a webcam window for screencasting. .ITEM \f(CWMod+ScrollLock\fP \(en Toggle screenkey (if installed) to show keypresses .LIST OFF @@ -276,7 +276,7 @@ In the Linux terminal, those binds have other more important purposes, so you ca Additionally, I've set vim to use the clipboard as the default buffer, which means when you copy or delete something in vim, it will be in your system clipboard as well, so you can \f(CWctrl-v\fP it into your browser instance, etc. You can also paste material copied from other programs into vim with the typical vim bindings. .HEADING 2 "How do I change the background/wallpaper?" .PP -The system will always read the file \f(CW~/.config/wall.png\fP as the wallpaper. +The system will always read the link \f(CW~/.local/share/bg\fP as the wallpaper. The script \f(CWsetbg\fP, if run on an image will set it as the persistent background. When using the file manager, you can simply hover over an image name and type \f(CWbg\fP and this will run \f(CWsetbg\fP. .HEADING 2 "How I change the colorscheme?" diff --git a/.zprofile b/.zprofile index 2d2f3674..92e7701d 100644 --- a/.zprofile +++ b/.zprofile @@ -36,6 +36,7 @@ export GOPATH="${XDG_DATA_HOME:-$HOME/.local/share}/go" export ANSIBLE_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/ansible/ansible.cfg" export UNISON="${XDG_DATA_HOME:-$HOME/.local/share}/unison" export HISTFILE="${XDG_DATA_HOME:-$HOME/.local/share}/history" +export WEECHAT_HOME="${XDG_CONFIG_HOME:-$HOME/.config}/weechat" # Other program settings: export DICS="/usr/share/stardict/dic/" @@ -131,12 +132,12 @@ ex=🎯:\ [ ! -f ${XDG_CONFIG_HOME:-$HOME/.config}/shortcutrc ] && shortcuts >/dev/null 2>&1 & if pacman -Qs libxft-bgra >/dev/null 2>&1; then - # Start graphical server on tty1 if not already running. - [ "$(tty)" = "/dev/tty1" ] && ! pidof Xorg >/dev/null 2>&1 && exec startx + # Start graphical server on user's current tty if not already running. + [[ -n "$(tty)" && -z $(pgrep -u $USER "\bXorg$") ]] && exec startx else echo "\033[31mIMPORTANT\033[0m: Note that \033[32m\`libxft-bgra\`\033[0m must be installed for this build of dwm. Please run: - \033[32myay -S libxft-bgra\033[0m + \033[32myay -S libxft-bgra-git\033[0m and replace \`libxft\`" fi