Merge branch 'master' into master

This commit is contained in:
Luke Smith 2020-11-14 15:16:03 -05:00 committed by GitHub
commit 51afa31c96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 236 additions and 64 deletions

View File

@ -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+F5 exec --no-startup-id $netrefresh
bindsym $mod+F6 exec --no-startup-id torwrap bindsym $mod+F6 exec --no-startup-id torwrap
bindsym $mod+F7 exec --no-startup-id td-toggle 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+F9 exec --no-startup-id dmenumount
bindsym $mod+F10 exec --no-startup-id dmenuumount bindsym $mod+F10 exec --no-startup-id dmenuumount
bindsym $mod+F11 exec --no-startup-id ducksearch bindsym $mod+F11 exec --no-startup-id ducksearch

View File

@ -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 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 v set browser "setsid -f mpv" ; open-in-browser ; set browser linkhandler
macro w set browser "lynx" ; 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 "xsel -b <<<" ; open-in-browser ; set browser linkhandler
macro C set browser "youtube-viewer --comments=%u" ; 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 all "---.*---" yellow
highlight feedlist ".*(0/0))" black highlight feedlist ".*(0/0))" black

View File

@ -84,7 +84,7 @@ set clipboard+=unnamedplus
nnoremap S :%s//g<Left><Left> nnoremap S :%s//g<Left><Left>
" Compile document, be it groff/LaTeX/markdown/etc. " Compile document, be it groff/LaTeX/markdown/etc.
map <leader>c :w! \| !compiler <c-r>%<CR> map <leader>c :w! \| !compiler "<c-r>%"<CR>
" Open corresponding .pdf/.html or preview " Open corresponding .pdf/.html or preview
map <leader>p :!opout <c-r>%<CR><CR> map <leader>p :!opout <c-r>%<CR><CR>

View File

@ -9,7 +9,7 @@ These are the basic key binds in ranger, even outside of my configs. Note that t
+ dd -- cut selected files + dd -- cut selected files
+ yy -- copy/yank selected files + yy -- copy/yank selected files
+ pp -- paste/move cut/copied 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 + zh or CTRL-h -- show hidden files
+ Renaming files: + Renaming files:
+ cw -- rename file from scratch + cw -- rename file from scratch

View File

@ -157,7 +157,7 @@ super + F7
td-toggle td-toggle
# sync email # sync email
super + F8 super + F8
mailsync mw sync
# Mount a USB drive or Android device # Mount a USB drive or Android device
super + {F9,F10} super + {F9,F10}
{dmenumount,dmenuumount} {dmenumount,dmenuumount}

View File

@ -12,6 +12,7 @@ setw -g automatic-rename
set -g mouse on set -g mouse on
set -g history-limit 30000 set -g history-limit 30000
set -g terminal-overrides 'xterm*:smcup@:rmcup@' 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-justify right
set-option -g status-bg black # colour213 # pink set-option -g status-bg black # colour213 # pink
set-option -g status-fg cyan set-option -g status-fg cyan
@ -26,7 +27,7 @@ unbind j
unbind C-b # unbind default leader key unbind C-b # unbind default leader key
unbind '"' # unbind horizontal split unbind '"' # unbind horizontal split
unbind % # unbind vertical 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 c split-window -v # split pane horizontally
bind-key v split-window -h # split pane vertically bind-key v split-window -h # split pane vertically
bind-key Space list-panes bind-key Space list-panes

View File

@ -1,3 +1,4 @@
set sandbox none
set statusbar-h-padding 0 set statusbar-h-padding 0
set statusbar-v-padding 0 set statusbar-v-padding 0
set page-padding 1 set page-padding 1

View File

@ -1,3 +1,4 @@
set sandbox none
set statusbar-h-padding 0 set statusbar-h-padding 0
set statusbar-v-padding 0 set statusbar-v-padding 0
set page-padding 1 set page-padding 1

View File

@ -3,8 +3,8 @@
# 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. Opens .sent files as sent # Compiles .tex. groff (.mom, .ms), .rmd, .md, .org. Opens .sent files as sent
# presentations. Runs scripts based on extention or shebang # presentations. Runs scripts based on extention 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.
@ -14,21 +14,23 @@ dir=${file%/*}
base="${file%.*}" base="${file%.*}"
ext="${file##*.}" ext="${file##*.}"
cd "$dir" || exit cd "$dir" || exit 1
textype() { \ textype() { \
command="pdflatex" command="pdflatex"
( sed 5q "$file" | grep -i -q 'xelatex' ) && command="xelatex" ( head -n5 "$file" | grep -qi 'xelatex' ) && command="xelatex"
$command --output-directory="$dir" "$base" && $command --output-directory="$dir" "$base" &&
grep -i addbibresource "$file" >/dev/null && grep -qi addbibresource "$file" &&
biber --input-directory "$dir" "$base" && biber --input-directory "$dir" "$base" &&
$command --output-directory="$dir" "$base" && $command --output-directory="$dir" "$base" &&
$command --output-directory="$dir" "$base" $command --output-directory="$dir" "$base"
} }
case "$ext" in case "$ext" in
# Try to keep these cases in alphabetical order.
[0-9]) preconv "$file" | refer -PS -e | groff -mandoc -T pdf > "$base".pdf ;; [0-9]) preconv "$file" | refer -PS -e | groff -mandoc -T pdf > "$base".pdf ;;
c) cc "$file" -o "$base" && "$base" ;; c) cc "$file" -o "$base" && "$base" ;;
cpp) g++ "$file" -o "$base" && "$base" ;;
go) go run "$file" ;; go) go run "$file" ;;
h) sudo make install ;; h) sudo make install ;;
m) octave "$file" ;; m) octave "$file" ;;
@ -41,12 +43,13 @@ case "$ext" in
fi ; ;; fi ; ;;
mom) preconv "$file" | refer -PS -e | groff -mom -kept -T pdf > "$base".pdf ;; 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 ;; 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" ;; py) python "$file" ;;
[rR]md) Rscript -e "rmarkdown::render('$file', quiet=TRUE)" ;; [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) textype "$file" ;;
*) sed 1q "$file" | grep "^#!/" | sed "s/^#!//" | xargs -r -I % "$file" ;; *) head -n1 "$file" | grep "^#!/" | sed "s/^#!//" | xargs -r -I % "$file" ;;
esac esac

View File

@ -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: 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. This ensures that notifications will display, xdotool commands will function and environmental variables will work as well.

View File

@ -2,7 +2,7 @@
# Syncs repositories and downloads updates, meant to be run as a cronjob. # 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..." notify-send "📦 Repository Sync" "Checking for package updates..."

View File

@ -5,5 +5,5 @@
[ "$(cat /sys/class/power_supply/BAT0/status)" = "Charging" ] && exit [ "$(cat /sys/class/power_supply/BAT0/status)" = "Charging" ] && exit
[ "$(cat /sys/class/power_supply/BAT0/capacity)" -lt 25 ] && [ "$(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." notify-send -u critical "Battery critically low."

View File

@ -2,15 +2,20 @@
# Feed this script a link and it will give dmenu # Feed this script a link and it will give dmenu
# some choice programs to use to open it. # 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 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 "$1" | xclip -selection clipboard ;; "copy url") echo "$feed" | xclip -selection clipboard ;;
mpv) setsid -f mpv -quiet "$1" >/dev/null 2>&1 ;; mpv) setsid -f mpv -quiet "$feed" >/dev/null 2>&1 ;;
"mpv (loop)") setsid -f mpv -quiet --loop "$1" >/dev/null 2>&1 ;; "mpv loop") setsid -f mpv -quiet --loop "$feed" >/dev/null 2>&1 ;;
"queue download") tsp curl -LO "$1" >/dev/null 2>&1 ;; "mpv float") setsid -f "$TERMINAL" -e mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$feed" >/dev/null 2>&1 ;;
"queue youtube-dl") tsp youtube-dl --write-metadata -ic "$1" >/dev/null 2>&1 ;; "queue yt-dl") qndl "$feed" >/dev/null 2>&1 ;;
browser) setsid -f "$BROWSER" "$1" >/dev/null 2>&1 ;; "queue yt-dl audio") qndl "$feed" 'youtube-dl --add-metadata -icx -f bestaudio/best' >/dev/null 2>&1 ;;
feh) setsid -f feh "$1" >/dev/null 2>&1 ;; "queue download") qndl "$feed" 'curl -LO' >/dev/null 2>&1 ;;
w3m) w3m "$1" >/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 ;;
"mpv (float)") setsid -f mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$1" >/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 esac

View File

@ -25,6 +25,7 @@ mountusb() { \
partitiontype="$(lsblk -no "fstype" "$chosen")" partitiontype="$(lsblk -no "fstype" "$chosen")"
case "$partitiontype" in case "$partitiontype" in
"vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000;; "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";; *) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" "$mp";;
esac esac
notify-send "💻 USB mounting" "$chosen mounted to $mp." notify-send "💻 USB mounting" "$chosen mounted to $mp."

View File

@ -80,11 +80,12 @@ audio() { \
} }
askrecording() { \ 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 case "$choice" in
screencast) screencast;; screencast) screencast;;
audio) audio;; audio) audio;;
video) video;; video) video;;
*selected) videoselected;;
webcam) webcam;; webcam) webcam;;
"webcam (hi-def)") webcamhidef;; "webcam (hi-def)") webcamhidef;;
esac esac
@ -95,11 +96,28 @@ asktoend() { \
[ "$response" = "Yes" ] && killrecording [ "$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 case "$1" in
screencast) screencast;; screencast) screencast;;
audio) audio;; audio) audio;;
video) video;; video) video;;
*selected) videoselected;;
kill) killrecording;; kill) killrecording;;
*) ([ -f /tmp/recordingpid ] && asktoend && exit) || askrecording;; *) ([ -f /tmp/recordingpid ] && asktoend && exit) || askrecording;;
esac esac

View File

@ -8,19 +8,19 @@
while getopts "hc" o; do case "${o}" in while getopts "hc" o; do case "${o}" in
c) extracthere="True" ;; 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 esac done
if [ -z "$extracthere" ]; then if [ -z "$extracthere" ]; then
archive="$(readlink -f "$*")" && archive="$(readlink -f "$*")" &&
directory="$(echo "$archive" | sed 's/\.[^\/.]*$//')" && directory="$(echo "$archive" | sed 's/\.[^\/.]*$//')" &&
mkdir -p "$directory" && mkdir -p "$directory" &&
cd "$directory" || exit cd "$directory" || exit 1
else else
archive="$(readlink -f "$(echo "$*" | cut -d' ' -f2)")" archive="$(readlink -f "$(echo "$*" | cut -d' ' -f2)" 2>/dev/null)"
fi 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 if [ -f "$archive" ] ; then
case "$archive" in case "$archive" in

View File

@ -10,13 +10,14 @@
[ -z "$1" ] && { "$BROWSER"; exit; } [ -z "$1" ] && { "$BROWSER"; exit; }
case "$1" in 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 ;; setsid -f mpv -quiet "$1" >/dev/null 2>&1 ;;
*png|*jpg|*jpe|*jpeg|*gif) *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*) *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" [ -f "$1" ] && setsid -f "$TERMINAL" -e "$EDITOR" "$1" >/dev/null 2>&1 || setsid -f "$BROWSER" "$1" >/dev/null 2>&1
else setsid -f "$BROWSER" "$1" >/dev/null 2>&1; fi ;;
esac esac

View File

@ -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"

View File

@ -5,7 +5,7 @@
base="$(basename "$1")" base="$(basename "$1")"
notify-send "⏳ Queuing $base..." notify-send "⏳ Queuing $base..."
cmd="$2" cmd="$2"
[ -z "$cmd" ] && cmd="youtube-dl --add-metadata" [ -z "$cmd" ] && cmd="youtube-dl --add-metadata -ic"
idnum="$(tsp $cmd "$1")" idnum="$(tsp $cmd "$1")"
realname="$(echo "$base" | sed "s/?\(source\|dest\).*//;s/%20/ /g")" realname="$(echo "$base" | sed "s/?\(source\|dest\).*//;s/%20/ /g")"
tsp -D "$idnum" mv "$base" "$realname" tsp -D "$idnum" mv "$base" "$realname"

View File

@ -9,4 +9,4 @@
[ -z "$1" ] && echo "usage: rotdir regex 2>&1" && exit 1 [ -z "$1" ] && echo "usage: rotdir regex 2>&1" && exit 1
base="$(basename "$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; }'

View File

@ -15,17 +15,19 @@ printf "# vim: filetype=sh\\nalias " > "$shell_shortcuts"
printf "\" vim: filetype=vim\\n" > "$vifm_shortcuts" printf "\" vim: filetype=vim\\n" > "$vifm_shortcuts"
# Format the `directories` file in the correct syntax and sent it to all three configs. # 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*#.*$\",\"\"); awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\");
printf(\"%s=\42cd %s && ls -a\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ; printf(\"%s=\42cd %s && ls -a\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ;
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 \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\" }" "${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. # 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*#.*$\",\"\"); awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\");
printf(\"%s=\42\$EDITOR %s\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ; printf(\"%s=\42\$EDITOR %s\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ;
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\" }" "${XDG_CONFIG_HOME:-$HOME/.config}/files" printf(\"map %s shell \$EDITOR %s \n\",\$1,\$2) >> \"$ranger_shortcuts\" }"

124
.local/bin/slider Executable file
View File

@ -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.

View File

@ -10,7 +10,7 @@ weatherreport="${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport"
getforecast() { curl -sf "wttr.in/$LOCATION" > "$weatherreport" || exit 1 ;} getforecast() { curl -sf "wttr.in/$LOCATION" > "$weatherreport" || exit 1 ;}
# Some very particular and terse stream manipulation. We get the maximum # 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. # display them with coresponding emojis.
showweather() { printf "%s" "$(sed '16q;d' "$weatherreport" | showweather() { printf "%s" "$(sed '16q;d' "$weatherreport" |
grep -wo "[0-9]*%" | sort -rn | sed "s/^/☔/g;1q" | tr -d '\n')" grep -wo "[0-9]*%" | sort -rn | sed "s/^/☔/g;1q" | tr -d '\n')"

View File

@ -2,6 +2,7 @@
# Show wifi 📶 and percent strength or 📡 if none. # Show wifi 📶 and percent strength or 📡 if none.
# Show 🌐 if connected to ethernet or ❎ if none. # Show 🌐 if connected to ethernet or ❎ if none.
# Show 🔒 if a vpn connection is active
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) "$TERMINAL" -e nmtui; pkill -RTMIN+4 dwmblocks ;; 1) "$TERMINAL" -e nmtui; pkill -RTMIN+4 dwmblocks ;;
@ -10,6 +11,7 @@ case $BLOCK_BUTTON in
📶: wifi connection with quality 📶: wifi connection with quality
❎: no ethernet ❎: no ethernet
🌐: ethernet working 🌐: ethernet working
🔒: vpn is active
" ;; " ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac 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)" ;; up) wifiicon="$(awk '/^\s*w/ { print "📶", int($3 * 100 / 70) "% " }' /proc/net/wireless)" ;;
esac 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)"

View File

@ -5,7 +5,7 @@
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) setsid -f "$TERMINAL" -e neomutt ;; 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 3) notify-send "📬 Mail module" "\- Shows unread mail
- Shows 🔃 if syncing mail - Shows 🔃 if syncing mail
- Left click opens neomutt - Left click opens neomutt

View File

@ -5,6 +5,7 @@
# second, gives network traffic per second. # second, gives network traffic per second.
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
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) "$TERMINAL" -e "$EDITOR" "$0" ;;

View File

@ -1,20 +1,14 @@
#!/bin/sh #!/bin/sh
transmission-remote -l | grep % | transmission-remote -l | grep % |
sed " # This first sed command is to ensure a desirable order with sort sed " # The letters are for sorting and will not appear.
s/.*Stopped.*/A/g; s/.*Stopped.*/A 🛑/;
s/.*Seeding.*/Z/g; s/.*Seeding.*/Z 🌱/;
s/.*100%.*/N/g; s/.*100%.*/N ✅/;
s/.*Idle.*/B/g; s/.*Idle.*/B 🕰️/;
s/.*Uploading.*/L/g; s/.*Uploading.*/L ⬆️/;
s/.*%.*/M/g" | s/.*%.*/M ⬇️/" |
sort -h | uniq -c | sed " # Now we replace the standin letters with icons. sort -h | uniq -c | awk '{print $3 $1}' | paste -sd ' '
s/A/🛑/g;
s/B/🕰/g;
s/L/🔼/g;
s/M/🔽/g;
s/N/✅/g;
s/Z/🌱/g" | awk '{print $2 $1}' | paste -sd ' '
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) setsid -f "$TERMINAL" -e tremc ;; 1) setsid -f "$TERMINAL" -e tremc ;;

View File

@ -10,8 +10,8 @@ esac
cmds="\ cmds="\
🔒 lock slock 🔒 lock slock
🚪 leave dwm kill -TERM $(pidof -s dwm) 🚪 leave dwm kill -TERM $(pgrep -u $USER "\bdwm$")
♻ renew dwm kill -HUP $(pidof -s dwm) ♻ renew dwm kill -HUP $(pgrep -u $USER "\bdwm$")
🐻 hibernate slock ${hib:-systemctl suspend-then-hibernate -i} 🐻 hibernate slock ${hib:-systemctl suspend-then-hibernate -i}
🔃 reboot ${reb:-sudo -A reboot} 🔃 reboot ${reb:-sudo -A reboot}
🖥 shutdown ${shut:-sudo -A shutdown -h now}" 🖥 shutdown ${shut:-sudo -A shutdown -h now}"

View File

@ -55,5 +55,13 @@ Date=$date
Genre=$genre Genre=$genre
Comment=$comment" | opustags -i -S "$file" ;; Comment=$comment" | opustags -i -S "$file" ;;
*.mp3) eyeD3 -Q --remove-all -a "$artist" -A "$album" -t "$title" -n "$track" -N "$total" -Y "$date" "$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." ;; *) echo "File type not implemented yet." ;;
esac esac

View File

@ -241,7 +241,7 @@ previous recordings as their names are based on their exact times.
.ITEM .ITEM
\f(CWMod+Delete\fP \(en Kills any recording started in the above way. \f(CWMod+Delete\fP \(en Kills any recording started in the above way.
.ITEM .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 .ITEM
\f(CWMod+ScrollLock\fP \(en Toggle screenkey (if installed) to show keypresses \f(CWMod+ScrollLock\fP \(en Toggle screenkey (if installed) to show keypresses
.LIST OFF .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. 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?" .HEADING 2 "How do I change the background/wallpaper?"
.PP .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. 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. 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?" .HEADING 2 "How I change the colorscheme?"

View File

@ -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 ANSIBLE_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/ansible/ansible.cfg"
export UNISON="${XDG_DATA_HOME:-$HOME/.local/share}/unison" export UNISON="${XDG_DATA_HOME:-$HOME/.local/share}/unison"
export HISTFILE="${XDG_DATA_HOME:-$HOME/.local/share}/history" export HISTFILE="${XDG_DATA_HOME:-$HOME/.local/share}/history"
export WEECHAT_HOME="${XDG_CONFIG_HOME:-$HOME/.config}/weechat"
# Other program settings: # Other program settings:
export DICS="/usr/share/stardict/dic/" export DICS="/usr/share/stardict/dic/"
@ -131,12 +132,12 @@ ex=🎯:\
[ ! -f ${XDG_CONFIG_HOME:-$HOME/.config}/shortcutrc ] && shortcuts >/dev/null 2>&1 & [ ! -f ${XDG_CONFIG_HOME:-$HOME/.config}/shortcutrc ] && shortcuts >/dev/null 2>&1 &
if pacman -Qs libxft-bgra >/dev/null 2>&1; then if pacman -Qs libxft-bgra >/dev/null 2>&1; then
# Start graphical server on tty1 if not already running. # Start graphical server on user's current tty if not already running.
[ "$(tty)" = "/dev/tty1" ] && ! pidof Xorg >/dev/null 2>&1 && exec startx [[ -n "$(tty)" && -z $(pgrep -u $USER "\bXorg$") ]] && exec startx
else else
echo "\033[31mIMPORTANT\033[0m: Note that \033[32m\`libxft-bgra\`\033[0m must be installed for this build of dwm. echo "\033[31mIMPORTANT\033[0m: Note that \033[32m\`libxft-bgra\`\033[0m must be installed for this build of dwm.
Please run: Please run:
\033[32myay -S libxft-bgra\033[0m \033[32myay -S libxft-bgra-git\033[0m
and replace \`libxft\`" and replace \`libxft\`"
fi fi