@ -1,5 +1,5 @@ | |||
#!/bin/bash | |||
#!/bin/sh | |||
source $HOME/.local/bin/pins | |||
. "$HOME"/.local/bin/pins | |||
$1 $2 2> /dev/null | |||
"$1" "$2" 2> /dev/null |
@ -1,17 +1,18 @@ | |||
#!/bin/bash | |||
#!/bin/env sh | |||
source ~/.cache/wal/colors.sh | |||
. "$HOME"/.cache/wal/colors.sh | |||
command=bemenu | |||
if [[ "$1" == "-c" ]]; then | |||
if [ "$1" = "-c" ]; then | |||
while getopts 'c:' option; do | |||
case $option in | |||
case "$option" in | |||
c) command=$OPTARG && break;; | |||
*) exit ;; | |||
esac | |||
done | |||
shift $(($OPTIND - 1)) | |||
shift $(("$OPTIND" - 1)) | |||
fi | |||
$command -p "" --nb=$background --nf=$foreground --hb=$foreground --hf=$background --sb=$foreground --sf=$background --tb=$foreground --tf=$background --ff=$foreground --fb=$background --scb=$background --scf=$foreground --fn="mono 9" $@ | |||
"$command" -p "" --nb="$background" --nf="$foreground" --hb="$foreground" --hf="$background" --sb="$foreground" --sf="$background" --tb="$foreground" --tf="$background" --ff="$foreground" --fb="$background" --scb="$background" --scf="$foreground" --fn="mono 9" "$@" |
@ -1,15 +1,15 @@ | |||
#!/bin/bash | |||
#!/bin/env sh | |||
lookup=$1 | |||
action=$2 | |||
prompt=$3 | |||
alternate=$4 | |||
lookup="$1" | |||
action="$2" | |||
prompt="$3" | |||
alternate="$4" | |||
chosen=$(sed -n 's/^\([^:]*\):.*$/\1/p' $lookup|bemenucolor -i -p "$prompt") | |||
chosen=$(sed -n 's/^\([^:]*\):.*$/\1/p' "$lookup"|bemenucolor -i -p "$prompt") | |||
expanded=$(sed -n "s/^${chosen}:\(.*\)$/\1/p" $lookup) | |||
expanded=$(sed -n "s/^${chosen}:\(.*\)$/\1/p" "$lookup") | |||
if [ "$expanded" != "" ]; then | |||
$action $expanded | |||
"$action" "$expanded" | |||
elif [ "$alternate" != "" ] && [ "$chosen" != "" ]; then | |||
$alternate "$chosen" | |||
"$alternate" "$chosen" | |||
fi |
@ -1,3 +1,3 @@ | |||
#!/bin/bash | |||
#!/bin/env sh | |||
i3-msg "$(cat $XDG_CONFIG_HOME/i3/config | sed -E 's/^bindsym\s*(\S*)\s*(\S.*$)/\1|\2/;t;d'|column -s'|' -t | bemenucolor -l 30 | cut -d' ' -f2- | xargs -0)" | |||
i3-msg "$(sed -E 's/^bindsym\s*(\S*)\s*(\S.*$)/\1|\2/;t;d' "$XDG_CONFIG_HOME"/i3/config |column -s'|' -t | bemenucolor -l 30 | cut -d' ' -f2- | xargs -0)" |
@ -1,25 +1,25 @@ | |||
#!/bin/bash | |||
#!/bin/env sh | |||
pgrep -x bemenu && exit | |||
mountable=$(lsblk -lp -o NAME,FSTYPE,SIZE,TYPE,MOUNTPOINT|grep 'part\|lvm'|grep -v "\(part\|lvm\)[[:space:]]\+/\|t[[:space:]]\+\[SWAP\]\|crypto_LUKS"|awk '{print $1, "(" $3 ")"}') | |||
[[ "$mountable" = "" ]] && exit 1 | |||
[ "$mountable" = "" ] && exit 1 | |||
chosen=$(echo "$mountable"|bemenucolor -i -p "Unmounted Drives:"|awk '{print $1}') | |||
[[ "$chosen" = "" ]] && exit 1 | |||
[ "$chosen" = "" ] && exit 1 | |||
sudo mount "$chosen" && exit 0 | |||
already_mounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$2=="part"&&$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not \( -path *%s -prune \) \ \n",$3}') | |||
dirs=$(find /mnt /media /mount /home -type d -maxdepth 5 $already_mounted 2>/dev/null) | |||
dirs=$(find /mnt /media /mount /home -type d -maxdepth 5 "$already_mounted" 2>/dev/null) | |||
mountpoint=$(echo "$dirs"|bemenucolor -i -p "Mount Point:") | |||
[[ "$mountpoint" = "" ]] && exit 1 | |||
if [[ ! -d "$mountpoint" ]]; then | |||
mkdiryn=$(echo -e "No\nYes" | bemenucolor -i -p "Create?") | |||
[[ "$mkdiryn" = Yes ]] && sudo mkdir -p "$mountpoint" | |||
[ "$mountpoint" = "" ] && exit 1 | |||
if [ ! -d "$mountpoint" ]; then | |||
mkdiryn=$(printf "No\nYes" | bemenucolor -i -p "Create?") | |||
[ "$mkdiryn" = Yes ] && sudo mkdir -p "$mountpoint" | |||
fi | |||
sudo mount $chosen $mountpoint && notify-send "$chosen mounted to $mountpoint" | |||
sudo mount "$chosen" "$mountpoint" && notify-send "$chosen mounted to $mountpoint" |
@ -1,10 +1,10 @@ | |||
#!/bin/bash | |||
#!/bin/env sh | |||
pgrep -x bemenu && exit | |||
exclusionregex="\(/boot\|/home\|/\)$" | |||
drives=$(lsblk -lp | grep "\(part\|lvm\)[[:space:]]\+/" | grep -v "$exclusionregex" | awk '{print $1, "(" $4 ")", "on", $7}') | |||
[[ "$drives" = "" ]] && exit | |||
[ "$drives" = "" ] && exit | |||
chosen=$(echo "$drives" | bemenucolor -i -p "Unmount:" | awk '{print $1}') | |||
[[ "$chosen" = "" ]] && exit | |||
sudo umount $chosen && notify-send "$chosen unmounted." | |||
[ "$chosen" = "" ] && exit | |||
sudo umount "$chosen" && notify-send "$chosen unmounted." |
@ -1,9 +1,9 @@ | |||
#!/bin/bash | |||
#!/bin/env sh | |||
pgrep -x bemenu && exit | |||
walls=$(wpg -l) | |||
[[ "$walls" = "" ]] && exit 1 | |||
[ "$walls" = "" ] && exit 1 | |||
chosen=$(echo "$walls"|bemenucolor -l 20-i -p "Wallpapers:"|awk '{print $1}') | |||
[[ "$chosen" = "" ]] && exit 1 | |||
setbackground $chosen wal | |||
[ "$chosen" = "" ] && exit 1 | |||
setbackground "$chosen" wal |
@ -1,6 +1,6 @@ | |||
#!/bin/bash | |||
#!/bin/env sh | |||
pass OpenVpn/micah | sudo openvpn --config $XDG_CONFIG_HOME/openvpn/micah.ovpn --askpass /dev/stdin --script-security 2 \ | |||
pass OpenVpn/micah | sudo openvpn --config "$XDG_CONFIG_HOME"/openvpn/mhalter3-gtri.ovpn --askpass /dev/stdin --script-security 2 \ | |||
--setenv PATH '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' \ | |||
--up /etc/openvpn/scripts/update-systemd-resolved \ | |||
--down /etc/openvpn/scripts/update-systemd-resolved \ | |||
@ -1,4 +1,4 @@ | |||
#!/usr/bin/zsh | |||
#!/usr/bin/env zsh | |||
. $ZDOTDIR/.zshrc | |||
@ -1,10 +1,9 @@ | |||
#!/bin/bash | |||
#!/bin/env sh | |||
DRIVE="$1" | |||
DRIVE_NAME="$(basename $DRIVE)" | |||
DRIVE_NAME="$(basename "$DRIVE")" | |||
sudo cryptsetup luksOpen $DRIVE ${DRIVE_NAME}-OPEN | |||
if [ $? == 0 ]; then | |||
sudo mkdir -p /media/$DRIVE_NAME | |||
sudo mount /dev/mapper/${DRIVE_NAME}-OPEN /media/$DRIVE_NAME | |||
if sudo cryptsetup luksOpen "$DRIVE" "$DRIVE_NAME"-OPEN; then | |||
sudo mkdir -p /media/"$DRIVE_NAME" | |||
sudo mount /dev/mapper/"$DRIVE_NAME"-OPEN /media/"$DRIVE_NAME" | |||
fi |
@ -1,3 +1,3 @@ | |||
#!/bin/bash | |||
#!/bin/env sh | |||
mpv --no-video "https://www.youtube.com/watch?v=NEmIPDs9CZw" |
@ -1,9 +1,6 @@ | |||
#!/bin/bash | |||
#!/bin/env sh | |||
DRIVE="$1" | |||
DRIVE_NAME="$(basename $DRIVE)" | |||
DRIVE_NAME="$(basename "$DRIVE")" | |||
sudo umount /media/$DRIVE_NAME | |||
if [ $? == 0 ]; then | |||
sudo cryptsetup luksClose ${DRIVE_NAME}-OPEN | |||
fi | |||
sudo umount /media/"$DRIVE_NAME" && sudo cryptsetup luksClose "$DRIVE_NAME"-OPEN |
@ -1,3 +1,3 @@ | |||
#!/bin/bash | |||
#!/bin/env sh | |||
aria2c --bt-metadata-only=true --bt-save-metadata=true --listen-port=6881 "$@" |
@ -1,3 +1,3 @@ | |||
#!/usr/bin/zsh | |||
#!/usr/bin/env zsh | |||
exec $TERMINAL -e "i3-runner neomutt \"$@\"" |
@ -1,3 +1,3 @@ | |||
#!/bin/bash | |||
#!/bin/env sh | |||
nvim -d $@ | |||
nvim -d "$@" |
@ -1,24 +1,25 @@ | |||
#!/bin/bash | |||
#!/bin/env sh | |||
tmpfile=/tmp/rangerpick | |||
if [[ "$1" == "get" ]]; then | |||
cat $tmpfile 2>/dev/null | |||
if [ "$1" = "get" ]; then | |||
cat "$tmpfile" 2>/dev/null | |||
exit | |||
elif [[ "$1" == "save" ]]; then | |||
[ -f $tmpfile ] && cat > "`cat $tmpfile`" | |||
elif [ "$1" = "save" ]; then | |||
[ -f "$tmpfile" ] && cat > "$(cat "$tmpfile")" | |||
exit | |||
fi | |||
rm -f /tmp/rangerpick | |||
if [[ "$1" == "dir" ]]; then | |||
ranger --choosedir $tmpfile | |||
elif [[ "$1" == "single" ]]; then | |||
ranger --choosefile $tmpfile | |||
if [ "$1" = "dir" ]; then | |||
ranger --choosedir "$tmpfile" | |||
elif [ "$1" = "single" ]; then | |||
ranger --choosefile "$tmpfile" | |||
else | |||
ranger --choosefiles $tmpfile | |||
ranger --choosefiles "$tmpfile" | |||
fi | |||
if [ -f $tmpfile ]; then | |||
[[ "$1" == "attach" ]] && echo "$(awk 'BEGIN {printf "%s", "push "} {printf "%s", "<attach-file>"$0"<enter>"}' $tmpfile)" > $tmpfile | |||
if [ -f "$tmpfile" ]; then | |||
midtmp="$(mktemp)" | |||
[ "$1" = "attach" ] && awk 'BEGIN {printf "%s", "push "} {printf "%s", "<attach-file>"$0"<enter>"}' "$tmpfile" > "$midtmp" && mv "$midtmp" "$tmpfile" | |||
fi |
@ -1,4 +1,4 @@ | |||
#!/bin/bash | |||
#!/bin/env sh | |||
xset r rate 300 50 | |||
setxkbmap -option ctrl:nocaps | |||
@ -1,15 +1,15 @@ | |||
#!/bin/bash | |||
#!/bin/env sh | |||
while [[ -f $HOME/screencast$n.mp4 ]] | |||
while [ -f "$HOME/screencast$n.mp4" ] | |||
do | |||
n=$((n+1)) | |||
n=$((n+1)) | |||
done | |||
filename="$HOME/screencast$n.mp4" | |||
ffmpeg -y \ | |||
-f x11grab \ | |||
-s $(xdpyinfo | grep dimensions | awk '{print $2;}') \ | |||
-s "$(xdpyinfo | grep dimensions | awk '{print $2;}')" \ | |||
-i :0.0 \ | |||
-f alsa -i default \ | |||
-c:v libx264 -r 30 -c:a flac $filename | |||
# -c:v libx264 -r 30 $filename | |||
-c:v libx264 -r 30 "$filename" | |||
# -f alsa -i default \ | |||
# -c:v libx264 -r 30 -c:a flac $filename |
@ -1,4 +1,5 @@ | |||
#!/bin/bash | |||
#!/bin/env sh | |||
ACCOUNT=$1 | |||
MIMEmbellish | msmtpq -a "$1" "${@:2}" | |||
ACCOUNT="$1" | |||
shift | |||
MIMEmbellish | msmtpq -a "$ACCOUNT" "$@" |
@ -1,15 +1,15 @@ | |||
#!/bin/bash | |||
#!/bin/env bash | |||
file="$1" | |||
base="${file##*/}" | |||
if [ ! -z "$2" ]; then | |||
if [ -n "$2" ]; then | |||
wpg -a "$1" | |||
file="$XDG_CONFIG_HOME/wpg/wallpapers/${base//\ /_}" | |||
fi | |||
[ ! -z "$file" ] && cp "$file" $XDG_CONFIG_HOME/wall && notify-send "Wallpaper changed" | |||
[ -n "$file" ] && cp "$file" "$XDG_CONFIG_HOME"/wall && notify-send "Wallpaper changed" | |||
xwallpaper --zoom "$XDG_CONFIG_HOME/wall" | |||
[ ! -z "$2" ] && wpg -s "${base//\ /_}" | |||
[ -n "$2" ] && wpg -s "${base//\ /_}" |
@ -1,3 +1,3 @@ | |||
#!/bin/bash | |||
#!/bin/env sh | |||
echo " $(date '+%H:%M:%S')" |
@ -1,3 +1,3 @@ | |||
#!/bin/bash | |||
#!/bin/env sh | |||
echo " $(date '+%b %d, %Y')" |
@ -1,6 +1,6 @@ | |||
#!/bin/bash | |||
#!/bin/env sh | |||
device="enp*" | |||
device="ens*" | |||
ip="$(ip -4 addr show|grep "$device"|grep -oP '(?<=inet )\d*(\.\d*){3}')" | |||
if [ "$ip" != "" ]; then | |||
echo " $ip" | |||
@ -1,13 +1,13 @@ | |||
#!/bin/bash | |||
#!/bin/env sh | |||
scripts="$HOME/.local/bin/statusbar" | |||
echo "$({ $scripts/mail; | |||
$scripts/volume; | |||
$scripts/network; | |||
$scripts/powersaver; | |||
$scripts/battery; | |||
$scripts/date; | |||
$scripts/clock; | |||
$scripts/layout; | |||
} | tr '\n' ' ')" | |||
{ "$scripts"/mail; | |||
"$scripts"/volume; | |||
"$scripts"/network; | |||
"$scripts"/powersaver; | |||
"$scripts"/battery; | |||
"$scripts"/date; | |||
"$scripts"/clock; | |||
"$scripts"/layout; | |||
} | tr '\n' ' ' |
@ -1,3 +1,3 @@ | |||
#!/bin/bash | |||
#!/bin/env sh | |||
echo "$(i3-msg -t get_workspaces|jq 'group_by(.rect.x, .rect.y)|map(map(if .focused then "<b>"+.name+"</b>" else "<small>"+.name+"</small>" end))|.[]|.[]' | tr '\n' ' '|sed 's/"//g')" | |||
i3-msg -t get_workspaces|jq 'group_by(.rect.x, .rect.y)|map(map(if .focused then "<b>"+.name+"</b>" else "<small>"+.name+"</small>" end))|.[]|.[]' | tr '\n' ' '|sed 's/"//g' |
@ -1,7 +1,7 @@ | |||
#!/bin/bash | |||
#!/bin/env sh | |||
layout=`i3-msg -t get_tree | jq -r 'recurse(.nodes[]) | select(.nodes[].focused == true) | .layout'` | |||
if [[ "$layout" == "splitv" ]]; then | |||
layout=$(i3-msg -t get_tree | jq -r 'recurse(.nodes[]) | select(.nodes[].focused == true) | .layout') | |||
if [ "$layout" = "splitv" ]; then | |||
echo "" | |||
else | |||
echo "" | |||
@ -1,5 +1,3 @@ | |||
#!/bin/bash | |||
#!/bin/env sh | |||
if [[ -f $XDG_CACHE_HOME/nowplaying ]]; then | |||
echo " $(cat $XDG_CACHE_HOME/nowplaying)" | |||
fi | |||
[ -f "$XDG_CACHE_HOME"/nowplaying ] && echo " $(cat "$XDG_CACHE_HOME"/nowplaying)" |
@ -1,5 +1,5 @@ | |||
#!/bin/bash | |||
#!/bin/env sh | |||
scripts="$HOME/.local/bin/statusbar" | |||
echo "$({ $scripts/vpn; $scripts/wifi; $scripts/ethernet; } | tr '\n' ' ')" | |||
{ "$scripts"/vpn; "$scripts"/wifi; "$scripts"/ethernet; } | tr '\n' ' ' |
@ -1,11 +1,11 @@ | |||
#!/bin/bash | |||
#!/bin/env sh | |||
line="$(amixer sget Master | grep 'Right:')" | |||
stat="$(echo $line | awk -F'[][]' '{ print $4 }')" | |||
level="$(echo $line | awk -F'[][]' '{ print $2 }')" | |||
stat="$(echo "$line" | awk -F'[][]' '{ print $4 }')" | |||
level="$(echo "$line" | awk -F'[][]' '{ print $2 }')" | |||
if [[ "$stat" == "off" ]]; then | |||
if [ "$stat" = "off" ]; then | |||
echo "婢 0%" | |||
else | |||
echo "墳 $level" | |||
@ -1,7 +1,7 @@ | |||
#!/bin/bash | |||
#!/bin/env sh | |||
if ip addr|grep -q tun0; then | |||
echo -e '\uf817' | |||
printf '\uf817 ' | |||
else | |||
echo '' | |||
printf '' | |||
fi |
@ -1,6 +1,6 @@ | |||
#!/bin/bash | |||
#!/bin/env sh | |||
device=wlp3s0 | |||
device=wlp59s0 | |||
ssid="$(iw dev $device info|grep -oP '(?<=ssid ).*')" | |||
if [ "$ssid" != "" ]; then | |||
echo "說 $ssid" | |||
@ -1,3 +1,3 @@ | |||
#!/bin/bash | |||
#!/bin/env sh | |||
echo "Workspaces:" |
@ -1,15 +1,15 @@ | |||
#!/usr/bin/bash | |||
#!/bin/env sh | |||
case $@ in | |||
case "$@" in | |||
http*://*) | |||
folder="/tmp/$(date '+%Y%m%d%H%M%S%N')-sxevimages" | |||
mkdir $folder | |||
for url in $@; do | |||
mkdir "$folder" | |||
for url in "$@"; do | |||
name="$folder/${url##*/}" | |||
curl -L -o $name -s $url | |||
curl -L -o "$name" -s "$url" | |||
done | |||
sxiv -ba $folder/* | |||
rm -r $folder | |||
sxiv -ba "$folder"/* | |||
rm -r "$folder" | |||
;; | |||
*) sxiv -b $@;; | |||
*) sxiv -b "$@";; | |||
esac |
@ -1,7 +1,7 @@ | |||
#!/bin/bash | |||
#!/bin/env sh | |||
service=$1 | |||
service="$1" | |||
systemctl --user is-active $service 2&> /dev/null && systemctl --user stop $service && notify-send "$service off" && exit | |||
systemctl --user is-active "$service" >/dev/null 2>&1 && systemctl --user stop "$service" && notify-send "$service off" && exit | |||
systemctl --user start $service && notify-send "$service on" | |||
systemctl --user start "$service" && notify-send "$service on" |
@ -1,9 +1,9 @@ | |||
#!/bin/bash | |||
#!/bin/env sh | |||
device="SynPS/2 Synaptics TouchPad" | |||
state=`xinput list-props "$device" | grep "Device Enabled" | grep -o "[01]$"` | |||
state=$(xinput list-props "$device" | grep "Device Enabled" | grep -o "[01]$") | |||
if [ $state == '1' ]; then | |||
if [ "$state" = "1" ]; then | |||
xinput disable "$device" | |||
else | |||
xinput enable "$device" | |||
@ -1,18 +1,18 @@ | |||
#!/bin/bash | |||
#!/bin/env sh | |||
if [ $# -eq 0 ]; then | |||
echo -e "No arguments specified. Usage:\ntransfer /tmp/test.md"; | |||
printf "No arguments specified. Usage:\ntransfer /tmp/test.md\n"; | |||
exit 1; | |||
fi | |||
tmpfile=$( mktemp -t transferXXX ); | |||
if tty -s; then | |||
basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); | |||
curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; | |||
curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> "$tmpfile"; | |||
else | |||
curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; | |||
curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> "$tmpfile"; | |||
fi; | |||
cat $tmpfile; | |||
command -v xclip > /dev/null && cat $tmpfile | xclip -selection clipboard; | |||
command -v qrencode > /dev/null && cat $tmpfile | qrencode -t UTF8i; | |||
rm -f $tmpfile; | |||
cat "$tmpfile"; | |||
command -v xclip > /dev/null && xclip -selection clipboard "$tmpfile"; | |||
command -v qrencode > /dev/null && qrencode -t UTF8i <"$tmpfile"; | |||
rm -f "$tmpfile"; |
@ -1,17 +1,17 @@ | |||
#!/bin/bash | |||
#!/bin/env sh | |||
function setclip { | |||
setclip() { | |||
xclip -selection c | |||
} | |||
function getclip { | |||
getclip() { | |||
xclip -selection clipboard -o | |||
} | |||
file=$(mktemp).md | |||
$TERMINAL -e 'i3-runner "$EDITOR '$file'"' # replace with your favorite terminal | |||
$TERMINAL -e "i3-runner \"$EDITOR '$file'\"" # replace with your favorite terminal | |||
cat $file | setclip | |||
rm $file | |||
setclip <"$file" | |||
rm "$file" | |||
xdotool key ctrl+v |
@ -1,4 +1,4 @@ | |||
#!/usr/bin/bash | |||
#!/usr/bin/env sh | |||
i3-msg reload > /dev/null | |||
systemctl --user restart dunst.service | |||
@ -1,3 +1,3 @@ | |||
#!/bin/bash | |||
#!/bin/sh | |||
pass vdirsyncer/$1 | |||
pass vdirsyncer/"$1" |