mirror of
https://github.com/tiyn/dotfiles.git
synced 2025-10-09 19:11:15 +02:00
adding all important config files
This commit is contained in:
11
.local/bin/cron/IMPORTANT_NOTE.md
Normal file
11
.local/bin/cron/IMPORTANT_NOTE.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# Important Note
|
||||
|
||||
These cronjobs have components that require information about your current display to display notifications correctly.
|
||||
|
||||
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/.profile; then_command_goes_here
|
||||
```
|
||||
|
||||
This ensures that notifications will display, xdotool commands will function and environmental varialbes will work as well.
|
18
.local/bin/cron/checkup
Executable file
18
.local/bin/cron/checkup
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
# Syncs repositories and downloads updates, meant to be run as a cronjob.
|
||||
|
||||
ping -q -c 1 1.1.1.1 > /dev/null || exit
|
||||
|
||||
notify-send "📦 Repository Sync" "Checking for package updates..."
|
||||
|
||||
sudo pacman -Syyuw --noconfirm || notify-send "Error downloading updates.
|
||||
|
||||
Check your internet connection, if pacman is already running, or run update manually to see errors."
|
||||
pkill -RTMIN+8 i3blocks
|
||||
|
||||
if pacman -Qu | grep -v "\[ignored\]"
|
||||
then
|
||||
notify-send "🎁 Repository Sync" "Updates available. Click statusbar icon (📦) for update."
|
||||
else
|
||||
notify-send "📦 Repository Sync" "Sync complete. No new packages for update."
|
||||
fi
|
8
.local/bin/cron/cronbat
Executable file
8
.local/bin/cron/cronbat
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
# Notify me with notify-send if my battery is below 25%.
|
||||
# You can set this to run via cron.
|
||||
|
||||
[ "$(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 &&
|
||||
notify-send -u critical "Battery critically low."
|
5
.local/bin/cron/crontog
Executable file
5
.local/bin/cron/crontog
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
# Toggles all cronjobs off/on.
|
||||
# Stores disabled crontabs in ~/.consaved until restored.
|
||||
|
||||
([ -f ~/.config/cronsaved ] && crontab - < ~/.config/cronsaved && rm ~/.config/cronsaved && notify-send "🕓 Cronjobs re-enabled.") || ( crontab -l > ~/.config/cronsaved && crontab -r && notify-send "🕓 Cronjobs saved and disabled.")
|
16
.local/bin/cron/newsup
Executable file
16
.local/bin/cron/newsup
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
# Set as a cron job to check for new RSS entries for newsboat.
|
||||
# If newsboat is open, sends it an "R" key to refresh.
|
||||
|
||||
ping -q -c 1 1.1.1.1 > /dev/null || exit
|
||||
|
||||
/usr/bin/notify-send "📰 Updating RSS feeds..."
|
||||
|
||||
pgrep -x newsboat >/dev/null && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name newsboat)" R && exit
|
||||
|
||||
echo 🔃 > /tmp/newsupdate
|
||||
pkill -RTMIN+6 i3blocks
|
||||
/usr/bin/newsboat -x reload
|
||||
rm -f /tmp/newsupdate
|
||||
pkill -RTMIN+6 i3blocks
|
||||
/usr/bin/notify-send "📰 RSS feed update complete."
|
38
.local/bin/tools/compiler
Executable file
38
.local/bin/tools/compiler
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/bin/sh
|
||||
|
||||
# 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
|
||||
|
||||
file=$(readlink -f "$1")
|
||||
dir=$(dirname "$file")
|
||||
base="${file%.*}"
|
||||
|
||||
cd "$dir" || exit
|
||||
|
||||
textype() { \
|
||||
command="pdflatex"
|
||||
( sed 5q "$file" | grep -i -q 'xelatex' ) && command="xelatex"
|
||||
$command --output-directory="$dir" "$base" &&
|
||||
grep -i addbibresource "$file" >/dev/null &&
|
||||
biber --input-directory "$dir" "$base" &&
|
||||
$command --output-directory="$dir" "$base" &&
|
||||
$command --output-directory="$dir" "$base"
|
||||
}
|
||||
|
||||
case "$file" in
|
||||
*\.ms) refer -PS -e "$file" | groff -me -ms -kept -T pdf > "$base".pdf ;;
|
||||
*\.mom) refer -PS -e "$file" | groff -mom -kept -T pdf > "$base".pdf ;;
|
||||
*\.[0-9]) refer -PS -e "$file" | groff -mandoc -T pdf > "$base".pdf ;;
|
||||
*\.rmd) echo "require(rmarkdown); render('$file')" | R -q --vanilla ;;
|
||||
*\.tex) textype "$file" ;;
|
||||
*\.md) pandoc "$file" --pdf-engine=xelatex -o "$base".pdf ;;
|
||||
*config.h) sudo make install ;;
|
||||
*\.c) cc "$file" -o "$base" && "$base" ;;
|
||||
*\.py) python "$file" ;;
|
||||
*\.go) go run "$file" ;;
|
||||
*\.sent) setsid sent "$file" 2>/dev/null & ;;
|
||||
*) sed 1q "$file" | grep "^#!/" | sed "s/^#!//" | xargs -r -I % "$file" ;;
|
||||
esac
|
15
.local/bin/tools/dmenuhandler
Executable file
15
.local/bin/tools/dmenuhandler
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
# Feed this script a link and it will give dmenu
|
||||
# some choice programs to use to open it.
|
||||
|
||||
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 mpv -quiet "$1" >/dev/null 2>&1 & ;;
|
||||
"mpv (loop)") setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -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 "$BROWSER" "$1" >/dev/null 2>&1 & ;;
|
||||
feh) setsid feh "$1" >/dev/null 2>&1 & ;;
|
||||
w3m) w3m "$1" >/dev/null 2>&1 ;;
|
||||
"mpv (float)") setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) --geometry=+0-0 --autofit=30% --title="mpvfloat" "$1" >/dev/null 2>&1 & ;;
|
||||
esac
|
2
.local/bin/tools/dmenupass
Executable file
2
.local/bin/tools/dmenupass
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
dmenu -fn Monospace-18 -sb "#d79921" -sf "#1d2021" -nf "#000000" -nb "#000000" -p "$1" <&- && echo
|
1
.local/bin/tools/ext
Symbolic link
1
.local/bin/tools/ext
Symbolic link
@@ -0,0 +1 @@
|
||||
extract
|
41
.local/bin/tools/extract
Executable file
41
.local/bin/tools/extract
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
# A general, all-purpose extraction script.
|
||||
#
|
||||
# Default behavior: Extract archive into new directory
|
||||
# Behavior with `-c` option: Extract contents into current directory
|
||||
|
||||
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 ;;
|
||||
esac done
|
||||
|
||||
if [ -z "$extracthere" ]; then
|
||||
archive="$(readlink -f "$*")" &&
|
||||
directory="$(echo "$archive" | sed 's/\.[^\/.]*$//')" &&
|
||||
mkdir -p "$directory" &&
|
||||
cd "$directory" || exit
|
||||
else
|
||||
archive="$(readlink -f "$(echo "$*" | cut -d' ' -f2)")"
|
||||
fi
|
||||
|
||||
[ "$archive" = "" ] && printf "Give archive to extract as argument.\\n" && exit
|
||||
|
||||
if [ -f "$archive" ] ; then
|
||||
case "$archive" in
|
||||
*.tar.bz2|*.tar.xz|*.tbz2) tar xvjf "$archive" ;;
|
||||
*.tar.gz|*.tgz) tar xvzf "$archive" ;;
|
||||
*.lzma) unlzma "$archive" ;;
|
||||
*.bz2) bunzip2 "$archive" ;;
|
||||
*.rar) unrar x -ad "$archive" ;;
|
||||
*.gz) gunzip "$archive" ;;
|
||||
*.tar) tar xvf "$archive" ;;
|
||||
*.zip) unzip "$archive" ;;
|
||||
*.Z) uncompress "$archive" ;;
|
||||
*.7z) 7z x "$archive" ;;
|
||||
*.xz) unxz "$archive" ;;
|
||||
*.exe) cabextract "$archive" ;;
|
||||
*) printf "extract: '%s' - unknown archive method\\n" "$archive" ;;
|
||||
esac
|
||||
else
|
||||
printf "File \"%s\" not found.\\n" "$archive"
|
||||
fi
|
14
.local/bin/tools/getbib
Executable file
14
.local/bin/tools/getbib
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/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 - | grep -io "doi:.*" -m 1) ||
|
||||
exit 1
|
||||
else
|
||||
doi="$1"
|
||||
fi
|
||||
|
||||
# Check crossref.org for the bib citation.
|
||||
curl -s "http://api.crossref.org/works/$doi/transform/application/x-bibtex" -w "\\n"
|
4
.local/bin/tools/getkeys
Executable file
4
.local/bin/tools/getkeys
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
cat ~/.config/getkeys/"$1" 2>/dev/null && exit
|
||||
echo "Run command with one of the following arguments for info about that program:"
|
||||
ls ~/.config/getkeys
|
3
.local/bin/tools/ifinstalled
Executable file
3
.local/bin/tools/ifinstalled
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
# If $1 command is not available, error code and notify.
|
||||
command -v "$1" >/dev/null || { notify-send "📦 $1" "must be installed for this function." && exit 1 ;}
|
22
.local/bin/tools/linkhandler
Executable file
22
.local/bin/tools/linkhandler
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Feed script a url or file location.
|
||||
# If an image, it will view in sxiv,
|
||||
# if a video or gif, it will view in mpv
|
||||
# if a music file or pdf, it will download,
|
||||
# otherwise it opens link in browser.
|
||||
|
||||
# If no url given. Opens browser. For using script as $BROWSER.
|
||||
[ -z "$1" ] && { "$BROWSER"; exit; }
|
||||
|
||||
case "$1" in
|
||||
*mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*)
|
||||
setsid mpv --input-ipc-server=/tmp/mpvsoc$(date +%s) -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 & ;;
|
||||
*mp3|*flac|*opus|*mp3?source*)
|
||||
setsid tsp curl -LO "$1" >/dev/null 2>&1 & ;;
|
||||
*)
|
||||
if [ -f "$1" ]; then "$TERMINAL" -e "$EDITOR $1"
|
||||
else setsid "$BROWSER" "$1" >/dev/null 2>&1 & fi ;;
|
||||
esac
|
42
.local/bin/tools/lmc
Executable file
42
.local/bin/tools/lmc
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
# A general audio interface for LARBS.
|
||||
|
||||
[ -z "$2" ] && num="2" || num="$2"
|
||||
|
||||
case "$1" in
|
||||
u*) pulsemixer --change-volume +"$num" ;;
|
||||
d*) pulsemixer --change-volume -"$num" ;;
|
||||
m*) pulsemixer --toggle-mute ;;
|
||||
truemute) pulsemixer --mute ;;
|
||||
play) mpc play ;;
|
||||
n*) mpc next ;;
|
||||
prev) mpc prev ;;
|
||||
t*) mpc toggle ;;
|
||||
p*) mpc pause ; pauseallmpv ;;
|
||||
f*) mpc seek +"$num" ;;
|
||||
b*) mpc seek -"$num" ;;
|
||||
r*) mpc seek 0% ;;
|
||||
*) cat << EOF
|
||||
lmc: cli music interface for mpd and pulse for those with divine intellect too
|
||||
grand to remember the mpc/pamixer commands.
|
||||
|
||||
Allowed options:
|
||||
up NUM Increase volume (2 secs default)
|
||||
down NUM Decrease volume (2 secs default)
|
||||
mute Toggle mute
|
||||
truemute Mute
|
||||
next Next track
|
||||
prev Previous track
|
||||
toggle Toggle pause
|
||||
truepause Pause
|
||||
foward NUM Seek foward in song (2 secs default)
|
||||
back NUM Seek back in song (2 secs default)
|
||||
restart Restart current song
|
||||
all else Print this message
|
||||
|
||||
All of these commands, except for \`truemute\`, \`prev\` and \`play\` can be truncated,
|
||||
i.e. \`lmc r\` for \`lmc restart\`.
|
||||
EOF
|
||||
esac
|
||||
|
||||
pkill -RTMIN+10 i3blocks
|
11
.local/bin/tools/opout
Executable file
11
.local/bin/tools/opout
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
# opout: "open output": A general handler for opening a file's intended output.
|
||||
# I find this useful especially running from vim.
|
||||
|
||||
basename="$(echo "$1" | sed 's/\.[^\/.]*$//')"
|
||||
|
||||
case "$1" in
|
||||
*.tex|*.md|*.rmd|*.ms|*.me|*.mom) setsid "$READER" "$basename".pdf >/dev/null 2>&1 & ;;
|
||||
*.html) setsid "$BROWSER" --new-window "$basename".html >/dev/null 2>&1 & ;;
|
||||
*.sent) setsid sent "$1" >/dev/null 2>&1 & ;;
|
||||
esac
|
4
.local/bin/tools/pauseallmpv
Executable file
4
.local/bin/tools/pauseallmpv
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
for i in $(ls /tmp/mpvsoc*); do
|
||||
echo '{ "command": ["set_property", "pause", true] }' | socat - $i;
|
||||
done
|
6
.local/bin/tools/podentr
Executable file
6
.local/bin/tools/podentr
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
# entr command to run `queueandnotify` when newsboat queue is changed
|
||||
|
||||
[ "$(pgrep -x $(basename $0) | wc -l)" -gt 2 ] && exit
|
||||
|
||||
echo ~/.local/share/newsboat/queue | entr -p queueandnotify 2>/dev/null
|
11
.local/bin/tools/qndl
Executable file
11
.local/bin/tools/qndl
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
# $1 is a url; $2 is a command
|
||||
[ -z "$1" ] && exit
|
||||
base="$(basename "$1")"
|
||||
notify-send "⏳ Queuing $base..."
|
||||
cmd="$2"
|
||||
[ -z "$cmd" ] && cmd="youtube-dl --add-metadata"
|
||||
idnum="$(tsp $cmd "$1")"
|
||||
realname="$(echo "$base" | sed "s/?\(source\|dest\).*//;s/%20/ /g")"
|
||||
tsp -D "$idnum" mv "$base" "$realname"
|
||||
tsp -D "$idnum" notify-send "👍 $realname done."
|
13
.local/bin/tools/queueandnotify
Executable file
13
.local/bin/tools/queueandnotify
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
# Podboat sucks. This script replaces it.
|
||||
# It reads the newsboat queue, queuing downloads with taskspooler.
|
||||
# It also removes the junk from extentions.
|
||||
queuefile="$HOME/.local/share/newsboat/queue"
|
||||
|
||||
while read -r line; do
|
||||
[ -z "$line" ] && continue
|
||||
url="$(echo "$line" | awk '{print $1}')"
|
||||
qndl "$url" "curl -LO"
|
||||
done < "$queuefile"
|
||||
|
||||
echo > "$queuefile"
|
4
.local/bin/tools/rotdir
Executable file
4
.local/bin/tools/rotdir
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
[ -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; }"
|
9
.local/bin/tools/rssadd
Executable file
9
.local/bin/tools/rssadd
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
! echo "$1" | grep "https*://\S\+\.[A-Za-z]\+\S*" >/dev/null &&
|
||||
notify-send "That doesn't look like a full URL." && exit
|
||||
RSSFILE="$HOME/.config/newsboat/urls"
|
||||
if awk '{print $1}' "$RSSFILE" | grep "^$1$" >/dev/null; then
|
||||
notify-send "You already have this RSS feed."
|
||||
else
|
||||
echo "$1" >> "$RSSFILE" && notify-send "RSS feed added."
|
||||
fi
|
4
.local/bin/tools/setbg
Executable file
4
.local/bin/tools/setbg
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
# Sets the background. If given an argument, will set file as background.
|
||||
[ ! -z "$1" ] && cp "$1" ~/.config/wall.png && notify-send -i "$HOME/.config/wall.png" "Wallpaper changed."
|
||||
xwallpaper --zoom ~/.config/wall.png
|
26
.local/bin/tools/shortcuts
Executable file
26
.local/bin/tools/shortcuts
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
# Output locations. Unactivated progs should go to /dev/null.
|
||||
shell_shortcuts="$HOME/.config/shortcutrc"
|
||||
ranger_shortcuts="/dev/null"
|
||||
qute_shortcuts="/dev/null"
|
||||
fish_shortcuts="/dev/null"
|
||||
vifm_shortcuts="$HOME/.config/vifm/vifmshortcuts"
|
||||
|
||||
# Remove, prepare files
|
||||
rm -f "$ranger_shortcuts" "$qute_shortcuts" 2>/dev/null
|
||||
printf "# vim: filetype=sh\\n" > "$fish_shortcuts"
|
||||
printf "# vim: filetype=sh\\nalias " > "$shell_shortcuts"
|
||||
printf "\" vim: filetype=vim\\n" > "$vifm_shortcuts"
|
||||
|
||||
# Format the `bmdirs` file in the correct syntax and sent it to all three configs.
|
||||
sed "s/\s*#.*$//;/^\s*$/d" "$HOME/.config/bmdirs" | tee >(awk '{print $1"=\"cd "$2" && ls -a\" \\"}' >> "$shell_shortcuts") \
|
||||
>(awk '{print "abbr", $1, "\"cd " $2 "; and ls -a\""}' >> "$fish_shortcuts") \
|
||||
>(awk '{print "map g" $1, ":cd", $2 "<CR>\nmap t" $1, "<tab>:cd", $2 "<CR><tab>\nmap M" $1, "<tab>:cd", $2 "<CR><tab>:mo<CR>\nmap Y" $1, "<tab>:cd", $2 "<CR><tab>:co<CR>" }' >> "$vifm_shortcuts") \
|
||||
>(awk '{print "config.bind(\";"$1"\", \"set downloads.location.directory "$2" ;; hint links download\")"}' >> "$qute_shortcuts") \
|
||||
| awk '{print "map g"$1" cd "$2"\nmap t"$1" tab_new "$2"\nmap m"$1" shell mv -v %s "$2"\nmap Y"$1" shell cp -rv %s "$2}' >> "$ranger_shortcuts"
|
||||
|
||||
# Format the `configs` file in the correct syntax and sent it to both configs.
|
||||
sed "s/\s*#.*$//;/^\s*$/d" "$HOME/.config/bmfiles" | tee >(awk '{print $1"=\"$EDITOR "$2"\" \\"}' >> "$shell_shortcuts") \
|
||||
>(awk '{print "abbr", $1, "\"$EDITOR "$2"\""}' >> "$fish_shortcuts") \
|
||||
>(awk '{print "map", $1, ":e", $2 "<CR>" }' >> "$vifm_shortcuts") \
|
||||
| awk '{print "map "$1" shell $EDITOR "$2}' >> "$ranger_shortcuts"
|
14
.local/bin/tools/texclear
Executable file
14
.local/bin/tools/texclear
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Clears the build files of a LaTeX/XeLaTeX build.
|
||||
# I have vim run this file whenever I exit a .tex file.
|
||||
|
||||
case "$1" in
|
||||
*.tex)
|
||||
file=$(readlink -f "$1")
|
||||
dir=$(dirname "$file")
|
||||
base="${file%.*}"
|
||||
find "$dir" -maxdepth 1 -type f -regextype gnu-awk -regex "^$base\\.(4tc|xref|tmp|pyc|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 "Give .tex file as argument.\\n" ;;
|
||||
esac
|
||||
|
9
.local/bin/tools/transadd
Executable file
9
.local/bin/tools/transadd
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Mimeapp script for adding torrent to transmission-daemon, but will also start the daemon first if not running.
|
||||
|
||||
# transmission-daemon sometimes fails to take remote requests in its first moments.
|
||||
|
||||
pgrep -x transmission-da || (transmission-daemon && notify-send "Starting transmission daemon..." && sleep 3 && pkill -RTMIN+7 i3blocks)
|
||||
|
||||
transmission-remote -a "$@" && notify-send "🔽 Torrent added."
|
13
.local/bin/tools/vifmimg
Executable file
13
.local/bin/tools/vifmimg
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
[ -z "$FIFO_UEBERZUG" ] && exit
|
||||
|
||||
readonly ID_PREVIEW="preview"
|
||||
|
||||
if [ "$1" = "draw" ]; then
|
||||
declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" [x]="$2" [y]="$3" [max_width]="$4" [max_height]="$5" [path]="${PWD}/$6") > "$FIFO_UEBERZUG"
|
||||
elif [ "$1" = "videopreview" ]; then
|
||||
[ ! -f "/tmp/$6.png" ] && ffmpegthumbnailer -i "${PWD}/$6" -o "/tmp/$6.png" -s 0 -q 10 &&
|
||||
declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" [x]="$2" [y]="$3" [max_width]="$4" [max_height]="$5" [path]="/tmp/$6.png") > "$FIFO_UEBERZUG"
|
||||
else
|
||||
declare -p -A cmd=([action]=remove [identifier]="$ID_PREVIEW") > "$FIFO_UEBERZUG"
|
||||
fi
|
15
.local/bin/tools/vu
Executable file
15
.local/bin/tools/vu
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env sh
|
||||
export FIFO_UEBERZUG="/tmp/vifm-ueberzug-${PPID}"
|
||||
|
||||
cleanup() {
|
||||
rm "$FIFO_UEBERZUG" 2>/dev/null
|
||||
pkill -P $$ 2>/dev/null
|
||||
}
|
||||
|
||||
rm "$FIFO_UEBERZUG" 2>/dev/null
|
||||
mkfifo "$FIFO_UEBERZUG"
|
||||
trap cleanup EXIT
|
||||
tail --follow "$FIFO_UEBERZUG" | ueberzug layer --silent --parser bash &
|
||||
|
||||
vifm
|
||||
cleanup
|
Reference in New Issue
Block a user