Merge branch 'LukeSmithxyz:master' into patch-4
This commit is contained in:
@@ -37,7 +37,7 @@ case "$ext" in
|
||||
java) javac -d classes "$file" && java -cp classes "${1%.*}" ;;
|
||||
m) octave "$file" ;;
|
||||
md) if [ -x "$(command -v lowdown)" ]; then
|
||||
lowdown -d nointem -e super "$file" -Tms | groff -mpdfmark -ms -kept > "$base".pdf
|
||||
lowdown --parse-no-intraemph "$file" -Tms | groff -mpdfmark -ms -kept > "$base".pdf
|
||||
elif [ -x "$(command -v groffdown)" ]; then
|
||||
groffdown -i "$file" | groff > "$base.pdf"
|
||||
else
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
/usr/bin/notify-send "📰 Updating RSS feeds..."
|
||||
|
||||
pgrep -f newsboat$ && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name newsboat)" R && exit
|
||||
pgrep -f newsboat$ && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name "^newsboat$")" R && exit
|
||||
|
||||
echo 🔃 > /tmp/newsupdate
|
||||
pkill -RTMIN+6 "${STATUSBAR:-dwmblocks}"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
feed="${1:-$(printf "%s" | dmenu -p 'Paste URL or file path')}"
|
||||
|
||||
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 ;;
|
||||
"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 ;;
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# A general, all-purpose extraction script. Not all extraction programs here
|
||||
# are installed by LARBS automatically.
|
||||
#
|
||||
# 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 1 ;;
|
||||
esac done
|
||||
|
||||
if [ -z "$extracthere" ]; then
|
||||
archive="$(readlink -f "$*")" &&
|
||||
directory="$(echo "$archive" | sed 's/\.[^\/.]*$//')" &&
|
||||
mkdir -p "$directory" &&
|
||||
cd "$directory" || exit 1
|
||||
else
|
||||
archive="$(readlink -f "$(echo "$*" | cut -d' ' -f2)" 2>/dev/null)"
|
||||
fi
|
||||
|
||||
[ -z "$archive" ] && printf "Give archive to extract as argument.\\n" && exit 1
|
||||
|
||||
if [ -f "$archive" ] ; then
|
||||
case "$archive" in
|
||||
*.tar.bz2|*.tbz2) bsdtar -xf "$archive" ;;
|
||||
*.tar.xz) bsdtar -xf "$archive" ;;
|
||||
*.tar.gz|*.tgz) bsdtar -xf "$archive" ;;
|
||||
*.tar.zst) bsdtar -xf "$archive" ;;
|
||||
*.tar) bsdtar -xf "$archive" ;;
|
||||
*.lzma) unlzma "$archive" ;;
|
||||
*.bz2) bunzip2 "$archive" ;;
|
||||
*.rar) unrar x -ad "$archive" ;;
|
||||
*.gz) gunzip "$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
|
||||
@@ -5,9 +5,8 @@
|
||||
# it informs the user that they need that command to continue. This is used in
|
||||
# various other scripts for clarity's sake.
|
||||
|
||||
for x in "$@";do
|
||||
notify() { notify-send "📦 $x" "must be installed for this function." && exit 1 ;}
|
||||
which_out="$( /usr/bin/which "$x" >/dev/null 2>&1 )" && exit 0 #you might have compiled the prog, and not install the repo pkg...
|
||||
pkgname="$(pacman -Qqo "$which_out" >/dev/null 2>&1 )" #...thats why two variables.
|
||||
pacman -Qq "$pkgname" >/dev/null 2>&1 || notify
|
||||
for x in "$@"; do
|
||||
if ! which "$x" >/dev/null 2>&1 && ! pacman -Qq "$x" >/dev/null 2>&1; then
|
||||
notify-send "📦 $x" "must be installed for this function." && exit 1 ;
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# usually the pdf of a compiled document. I find this useful especially
|
||||
# running from vim.
|
||||
|
||||
basename="$(echo "${*}" | sed 's/\.[^\/.]*$//')"
|
||||
basename="${1%.*}"
|
||||
|
||||
case "${*}" in
|
||||
*.tex|*.m[dse]|*.[rR]md|*.mom|*.[0-9]) setsid -f xdg-open "$basename".pdf >/dev/null 2>&1 ;;
|
||||
|
||||
53
.local/bin/otp
Executable file
53
.local/bin/otp
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Get a one-time password, or add a OTP secret to your pass-otp store.
|
||||
|
||||
# The assumption of this script is that all otp passwords are stored with the
|
||||
# suffix `-otp`. This script automatically appends newly added otps as such.
|
||||
|
||||
# For OTP passwords to be generated properly, it is important for the local
|
||||
# computer to have its time properly synced. This can be done with the command
|
||||
# below which requires the package `ntp`.
|
||||
|
||||
ifinstalled pass pass-otp
|
||||
|
||||
dir="${PASSWORD_STORE_DIR}"
|
||||
|
||||
choice="$({ echo "🆕add" ; echo "🕙sync-time" ; ls ${dir}/*-otp.gpg ;} | sed "s/.*\///;s/-otp.gpg//" | dmenu -p "Pick a 2FA:")"
|
||||
|
||||
case $choice in
|
||||
🆕add )
|
||||
ifinstalled maim zbar xclip || exit 1
|
||||
|
||||
temp="$dir/temp.png"
|
||||
otp="otp-test-script"
|
||||
trap 'shred -fu $temp; pass rm $otp' HUP INT QUIT TERM PWR EXIT
|
||||
|
||||
notify-send "Scan the image." "Scan the OTP QR code."
|
||||
|
||||
maim -s "$temp" || exit 1
|
||||
info="$(zbarimg -q "$temp")"
|
||||
info="${info#QR-Code:}"
|
||||
issuer="$(echo "$info" | grep -o "issuer=[A-z0-9]\+")"
|
||||
name="${issuer#issuer=}"
|
||||
|
||||
if echo "$info" | pass otp insert "$otp"; then
|
||||
while true ; do
|
||||
export name="$(dmenu -p "Give this One Time Password a one-word name:")"
|
||||
echo "$name" | grep -q -- "^[A-z0-9-]\+$" && break
|
||||
done
|
||||
pass mv "$otp" "$name-otp"
|
||||
notify-send "Successfully added." "$name-otp has been created."
|
||||
else
|
||||
notify-send "No OTP data found." "Try to scan the image again more precisely."
|
||||
fi
|
||||
|
||||
;;
|
||||
🕙sync-time )
|
||||
ifinstalled ntp || exit 1
|
||||
notify-send -u low "🕙 Synchronizing Time..." "Synching time with remote NTP servers..."
|
||||
updatedata="$(sudo ntpdate pool.ntp.org)" &&
|
||||
notify-send -u low "🕙 Synchronizing Time..." "Done. Time changed by ${updatedata#*offset }"
|
||||
;;
|
||||
*) pass otp -c ${choice}-otp ;;
|
||||
esac
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
# Open a terminal window in the same directory as the currently active window.
|
||||
|
||||
PID=$(xprop -id "$(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')" | grep -m 1 PID | cut -d " " -f 3)
|
||||
PID="$(pstree -lpA "$PID" | tail -n 1 | awk -F'---' '{print $NF}' | sed -re 's/[^0-9]//g')"
|
||||
PID=$(xprop -id "$(xprop -root | xprop -root | sed -n "/_NET_ACTIVE_WINDOW/ s/^.*# // p")" | sed -n "/PID/ s/^.*= // p")
|
||||
PID="$(pstree -lpA "$PID")"
|
||||
PID="${PID##*(}"
|
||||
PID="${PID%)}"
|
||||
cd "$(readlink /proc/"$PID"/cwd)" || return 1
|
||||
"$TERMINAL"
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
# Location of link to wallpaper link.
|
||||
bgloc="${XDG_DATA_HOME:-$HOME/.local/share/}/bg"
|
||||
|
||||
# Configuration files of applications that have their themes changed by pywal.
|
||||
dunstconf="${XDG_CONFIG_HOME:-$HOME/.config}/dunst/dunstrc"
|
||||
zathuraconf="${XDG_CONFIG_HOME:-$HOME/.config}/zathura/zathurarc"
|
||||
|
||||
trueloc="$(readlink -f "$1")" &&
|
||||
case "$(file --mime-type -b "$trueloc")" in
|
||||
image/* ) ln -sf "$(readlink -f "$1")" "$bgloc" && notify-send -i "$bgloc" "Changing wallpaper..." ;;
|
||||
@@ -18,12 +22,12 @@ esac
|
||||
|
||||
# If pywal is installed, use it.
|
||||
if command -v wal >/dev/null 2>&1 ; then
|
||||
wal -i "$(readlink -f $bgloc)" -o "${XDG_CONFIG_HOME:-$HOME/.config}/wal/postrun" >/dev/null 2>&1 &&
|
||||
pidof dwm >/dev/null && xdotool key super+F12
|
||||
wal -i "$(readlink -f $bgloc)" -o "${XDG_CONFIG_HOME:-$HOME/.config}/wal/postrun" >/dev/null 2>&1 &&
|
||||
pidof dwm >/dev/null && xdotool key super+F12
|
||||
# If pywal is removed, return config files to normal.
|
||||
else
|
||||
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/dunst/dunstrc.bak" ] && unlink "${XDG_CONFIG_HOME:-$HOME/.config}/dunst/dunstrc" && mv "${XDG_CONFIG_HOME:-$HOME/.config}/dunst/dunstrc.bak" "${XDG_CONFIG_HOME:-$HOME/.config}/dunst/dunstrc"
|
||||
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/zathura/zathurarc.bak" ] && unlink "${XDG_CONFIG_HOME:-$HOME/.config}/zathura/zathurarc" && mv "${XDG_CONFIG_HOME:-$HOME/.config}/zathura/zathurarc.bak" "${XDG_CONFIG_HOME:-$HOME/.config}/zathura/zathurarc"
|
||||
[ -f "$dunstconf.bak" ] && unlink "$dunstconf" && mv "$dunstconf.bak" "$dunstconf"
|
||||
[ -f "$zathuraconf.bak" ] && unlink "$zathuraconf" && mv "$zathuraconf.bak" "$zathuraconf"
|
||||
fi
|
||||
|
||||
xwallpaper --zoom "$bgloc"
|
||||
|
||||
@@ -19,10 +19,12 @@ vol="$(pamixer --get-volume)"
|
||||
|
||||
if [ "$vol" -gt "70" ]; then
|
||||
icon="🔊"
|
||||
elif [ "$vol" -lt "30" ]; then
|
||||
elif [ "$vol" -gt "30" ]; then
|
||||
icon="🔉"
|
||||
elif [ "$vol" -gt "0" ]; then
|
||||
icon="🔈"
|
||||
else
|
||||
icon="🔉"
|
||||
echo 🔇 && exit
|
||||
fi
|
||||
|
||||
echo "$icon$vol%"
|
||||
|
||||
@@ -5,14 +5,14 @@ case "$(readlink -f /sbin/init)" in
|
||||
*) ctl='loginctl' ;;
|
||||
esac
|
||||
|
||||
case "$(printf "🔒 lock\n🚪 leave dwm\n♻️ renew dwm\n🐻 hibernate\n💤 sleep\n🔃 reboot\n🖥️shutdown\n📺 display off" | dmenu -i -p 'Action: ')" in
|
||||
case "$(printf "🔒 lock\n🚪 leave dwm\n♻️ renew dwm\n🐻 hibernate\n🔃 reboot\n🖥️shutdown\n💤 sleep\n📺 display off" | dmenu -i -p 'Action: ')" in
|
||||
'🔒 lock') slock ;;
|
||||
'🚪 leave dwm') kill -TERM "$(pgrep -u "$USER" "\bdwm$")" ;;
|
||||
'♻️ renew dwm') kill -HUP "$(pgrep -u "$USER" "\bdwm$")" ;;
|
||||
'🐻 hibernate') slock $ctl hibernate ;;
|
||||
'💤 sleep') slock $ctl suspend ;;
|
||||
'🔃 reboot') $ctl reboot ;;
|
||||
'🖥️shutdown') $ctl poweroff ;;
|
||||
'🔃 reboot') $ctl reboot -i ;;
|
||||
'🖥️shutdown') $ctl poweroff -i ;;
|
||||
'📺 display off') xset dpms force off ;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user