initial commit
commit
96bdcdf6ac
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env sh
|
||||
BACKUP_LOC="/media/SEAGATE/HOME_BACKUP/"
|
||||
DIR="$HOME/"
|
||||
EXCLUDE_CONF="$HOME/.config/rsync-exclude.conf"
|
||||
|
||||
EXCL_INCL="--exclude-from=$EXCLUDE_CONF"
|
||||
|
||||
if [ "$1" = "-r" ]; then
|
||||
notify-send "backup.sh" "restoring from backup"
|
||||
rsync -ru $EXCL_INCL "$BACKUP_LOC" "$DIR"
|
||||
else
|
||||
|
||||
notify-send "backup.sh" "performing backup"
|
||||
if [ -d $BACKUP_LOC ]; then
|
||||
rsync -arP --delete $EXCL_INCL "$DIR" "$BACKUP_LOC"
|
||||
else
|
||||
notify-send "backup.sh" "backup location not found"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
sync
|
|
@ -0,0 +1,69 @@
|
|||
#!/bin/sh
|
||||
|
||||
BEMENUOPTS_FILE="$HOME/.config/bemenu/bemenu_opts.sh"
|
||||
|
||||
HEIGHT="22" #height in pixels to make the bemenu prompt
|
||||
|
||||
help () {
|
||||
echo " usage: sh bemenu-colorgen.sh FILE"
|
||||
echo " where FILE contains hex values of a base16 color scheme in this format:"
|
||||
echo " NOTE: the file must contain 16 color values"
|
||||
echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
||||
echo " #282936"
|
||||
echo " #3a3c4e"
|
||||
echo " #F7CA88"
|
||||
echo " #626483"
|
||||
echo " #62d6e8"
|
||||
echo " #e9e9f4"
|
||||
echo " #f1f2f8"
|
||||
echo " #f7f7fb"
|
||||
echo " #ea51b2"
|
||||
echo " #b45bcf"
|
||||
echo " #00f769"
|
||||
echo " #ebff87"
|
||||
echo " #a1efe4"
|
||||
echo " #62d6e8"
|
||||
echo " #b45bcf"
|
||||
echo " #00f769"
|
||||
echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
||||
}
|
||||
|
||||
|
||||
FILE="$1"
|
||||
|
||||
! [ -f "$FILE" ] && help && exit
|
||||
[ "$( wc -l "$FILE" | cut -d ' ' -f 1 )" != "16" ] && help && exit
|
||||
|
||||
|
||||
NB=""
|
||||
NF=""
|
||||
HB=""
|
||||
HF=""
|
||||
SB=""
|
||||
SF=""
|
||||
TB=""
|
||||
TF=""
|
||||
FB=""
|
||||
FF="#ffffff"
|
||||
|
||||
IFS='
|
||||
'
|
||||
|
||||
COUNT=0
|
||||
for LINE in $(cat "$FILE")
|
||||
do
|
||||
case $COUNT in
|
||||
0) NB="$LINE" && HB="$LINE" && TB="$LINE" && FB="$LINE";;
|
||||
1) SB="$LINE";;
|
||||
6) HF="$LINE" && SF="$LINE";;
|
||||
10) NF="$LINE" && TF="$LINE";;
|
||||
esac
|
||||
|
||||
COUNT=$((COUNT + 1))
|
||||
done
|
||||
|
||||
echo "bemenu colors updated."
|
||||
|
||||
echo "#!/bin/sh" > "$BEMENUOPTS_FILE"
|
||||
echo "#generated from: $1" >> "$BEMENUOPTS_FILE"
|
||||
echo "export BEMENU_OPTS=\"-H $HEIGHT --nb $NB --nf $NF --hb $HB --hf $HF --sb $SB --sf $SF --tb $TB --tf $TF --fb $FB --ff $FF\"" >> "$BEMENUOPTS_FILE"
|
|
@ -0,0 +1,83 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
WBROWSER=chromium-wayland
|
||||
|
||||
|
||||
#OPTS=" Torrent )
|
||||
OPTS="Web
|
||||
Video
|
||||
YT
|
||||
Audio
|
||||
Youtube-dl audio
|
||||
File
|
||||
RSS
|
||||
Torrent"
|
||||
|
||||
rss() {
|
||||
#sfeed
|
||||
sed -i '$d' ~/.config/sfeed/sfeedrc
|
||||
FEED_NAME="$(echo "" | bemenu -p "Feed Name: ")"
|
||||
echo "feed \"$FEED_NAME\" \"$1\"" >> ~/.config/sfeed/sfeedrc
|
||||
echo "}" >> ~/.config/sfeed/sfeedrc
|
||||
|
||||
#newsboat
|
||||
#echo "$1" >> ~/.config/newsboat/urls
|
||||
}
|
||||
|
||||
|
||||
ydl() {
|
||||
OPT="default
|
||||
select"
|
||||
|
||||
SEL="$( echo "$OPT" | bemenu)"
|
||||
|
||||
LOC="$HOME/media/audio/"
|
||||
|
||||
if [ "$SEL" = "select" ]; then
|
||||
if [ ! -f ~/.cache/lf/lastpath ]; then
|
||||
mkdir -p ~/.cache/lf/
|
||||
touch ~/.cache/lf/lastpath
|
||||
echo "~" > ~/.cache/lf/lastpath
|
||||
fi
|
||||
$TERMINAL -e lf -last-dir-path ~/.cache/lf/lastpath "$(cat ~/.cache/lf/lastpath)"
|
||||
LOC="$(cat ~/.cache/lf/lastpath)"
|
||||
fi
|
||||
|
||||
cd "$LOC"
|
||||
youtube-dl "$1" -f 140
|
||||
sleep 5
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
sel() {
|
||||
SEL="$( echo "$OPTS" | bemenu)"
|
||||
|
||||
[ "$SEL" = "Web" ] && $WBROWSER "$1" && exit
|
||||
|
||||
[ "$SEL" = "Video" ] && mpv "$1" && exit
|
||||
|
||||
[ "$SEL" = "YT" ] && mpv --ytdl-format=18 "$1" && exit
|
||||
|
||||
[ "$SEL" = "Audio" ] && $TERMINAL -e mpv "$1" && exit
|
||||
|
||||
[ "$SEL" = "Youtube-dl audio" ] && ydl "$1" && exit
|
||||
|
||||
[ "$SEL" = "File" ] && cd "$XDG_DOWNLOAD_DIR" && curl -O -L "$1" && exit
|
||||
|
||||
[ "$SEL" = "RSS" ] && rss "$1" && exit
|
||||
|
||||
[ "$SEL" = "Torrent" ] && transadd "$1" && exit
|
||||
|
||||
#$WBROWSER "$1"
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
#$WBROWSER #URL="$( xclip -o | sed 's/$//g')" && sel "$URL" && exit
|
||||
#$WBROWSER #URL="$(wl-paste)" && sel "$URL" && exit
|
||||
sel "$(wl-paste)"
|
||||
else
|
||||
#echo "$1" >> ~/.cache/log/browsersh.log
|
||||
sel "$1"
|
||||
fi
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
#chromium --enable-features=UseOzonePlatform --ozone-platform=wayland "$@"
|
||||
chromium --ozone-platform-hint=auto "$@"
|
|
@ -0,0 +1,91 @@
|
|||
#!/bin/sh
|
||||
|
||||
mkname() {
|
||||
FILES="$( echo "$@" | head -1 - )"
|
||||
|
||||
NAME="$(echo "$FILES" | awk '{print $1}' | xargs -0 basename | cut -f 1 -d '.')"
|
||||
|
||||
#C=0 #create counter variable in case of infinite loop
|
||||
#while :
|
||||
#do
|
||||
# case "$NAME" in
|
||||
# *.*) NAME="$(echo "$NAME" | cut -f 2 -d '.')" ;; #trim file extensions
|
||||
# #.*) NAME="$(echo "$NAME" | sed 's/^\.//g')" ;; #trim leading periods
|
||||
# /*) NAME="$(echo "$NAME" | sed 's/^\///g')" ;; #trim leading slashes
|
||||
# *) break;; #break if all above conditions are gone
|
||||
# esac
|
||||
#
|
||||
# C=$((C + 1))
|
||||
# [ $C -gt 10 ] && break #if counter limit reached break loop
|
||||
#done
|
||||
|
||||
echo "$NAME"
|
||||
}
|
||||
|
||||
compress() {
|
||||
set -f
|
||||
echo "@ = $@"
|
||||
FILES="$(echo "$@" | xargs -0)"
|
||||
echo "FILES = $FILES"
|
||||
|
||||
DIRNAME="$(basename "$FILES")"
|
||||
echo "DIRNAME = $DIRNAME"
|
||||
|
||||
if ! [ -d "$DIRNAME" ]; then
|
||||
DIRNAME="$(mkname "$@")"
|
||||
|
||||
echo "making directory $DIRNAME"
|
||||
mkdir "$DIRNAME"
|
||||
for f in $FILES
|
||||
do
|
||||
cp -r "$f" "$DIRNAME"
|
||||
done
|
||||
DELFLAG="TRUE" #set delete flag if we created a temp directory
|
||||
fi
|
||||
|
||||
echo "enter compression type [tar.gz, zip, 7z(default)]: "
|
||||
read TYPE
|
||||
|
||||
case "$TYPE" in
|
||||
tar.gz) tar czf "$DIRNAME".tar.gz "$DIRNAME";;
|
||||
zip) zip -r "$DIRNAME".zip "$DIRNAME";;
|
||||
*) 7z a "$DIRNAME".7z "$DIRNAME";;
|
||||
esac
|
||||
|
||||
[ "$DELFLAG" ] && rm -rf "$DIRNAME"
|
||||
}
|
||||
|
||||
extract() {
|
||||
set -f
|
||||
FILE="$(echo "$1" | xargs)" #use xargs to trim whitespace
|
||||
DIR="$(basename "$FILE" | cut -f 1 -d '.')"
|
||||
mkdir "$DIR"
|
||||
case $FILE in
|
||||
*.tar.bz|*.tar.bz2|*.tbz|*.tbz2) tar xjvf "$FILE" --directory="$DIR";;
|
||||
*.tar.gz|*.tgz) tar xzvf "$FILE" --directory="$DIR";;
|
||||
*.tar.xz|*.txz) tar xJvf "$FILE" --directory="$DIR";;
|
||||
*.zip) unzip "$FILE" -d "$DIR";;
|
||||
*.rar) unrar x "$FILE" "$DIR";;
|
||||
*.7z | *.crx) 7z x "$FILE" -o"$DIR";;
|
||||
esac
|
||||
}
|
||||
|
||||
help () {
|
||||
echo "script to compress/extract files using tar/zip/rar"
|
||||
echo " -c [ files/directories ] => compress input files/directories"
|
||||
echo " -e [ file ] => extract input file to a subdirectory of the files name"
|
||||
}
|
||||
|
||||
#get all input except first argument, if first argument has a '-' and save in ARGS
|
||||
#ARGS="$( echo "$@" | sed 's/^-.* //g' )"
|
||||
ARGS="$(echo "$2")"
|
||||
|
||||
echo "ARGS = $ARGS"
|
||||
|
||||
if [ "$1" = "-c" ]; then
|
||||
compress "$ARGS"
|
||||
elif [ "$1" = "-e" ]; then
|
||||
extract "$ARGS"
|
||||
else
|
||||
help
|
||||
fi
|
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
help() {
|
||||
echo "\$1 -> file to update or compare against"
|
||||
echo "\$2 -> -u -> update file given by \$1"
|
||||
}
|
||||
|
||||
! [ -f "$1" ] && touch "$1"
|
||||
|
||||
|
||||
if [ "$2" = "-u" ]; then
|
||||
echo $(date "+%y%m%d %H") >> "$1"
|
||||
else
|
||||
|
||||
LAST="$( awk 'END{print $1}' < "$1" )"
|
||||
HOUR="$( awk 'END{print $2}' < "$1" )"".0"
|
||||
HOUR_NOW="$(date +%H)"".0"
|
||||
|
||||
DAYS=$(( (($(date --date="$(date +%y%m%d)" +%s) - $(date --date="$LAST" +%s) ))/(60*60*24) ))
|
||||
RET=$(bc <<< "scale=2; $DAYS + (($HOUR_NOW - $HOUR)/24.0)")
|
||||
|
||||
echo "$RET"
|
||||
fi
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ "$1" = "-e" ];then
|
||||
|
||||
if [ "$2" ]; then
|
||||
tar -cvzf - "$2" | gpg -c > "$2".tar.gz.gpg
|
||||
fi
|
||||
|
||||
elif [ "$1" = "-d" ];then
|
||||
|
||||
|
||||
if [ "$2" ]; then
|
||||
gpg -d "$2" | tar -xvzf -
|
||||
fi
|
||||
|
||||
else
|
||||
echo " $1 : -e, encrypt $2"
|
||||
echo " -d, decrypt $2"
|
||||
echo " $2 : directory or file to encrypt/decrypt"
|
||||
|
||||
fi
|
|
@ -0,0 +1,84 @@
|
|||
#!/bin/sh
|
||||
|
||||
RES="1920x1080"
|
||||
MON="VGA-1"
|
||||
LAPTOP="LVDS-1"
|
||||
|
||||
|
||||
list_mons() {
|
||||
wlr-randr | grep -v "^ " | awk '{print $1}'
|
||||
}
|
||||
|
||||
get_mon() {
|
||||
echo "$(list_mons)" | bemenu -p "Select monitor: "
|
||||
}
|
||||
|
||||
#$1 -> monitor to get resolutions of
|
||||
get_res() {
|
||||
if [ -z "$1" ]; then
|
||||
echo "$RES"
|
||||
else
|
||||
echo "$(wlr-randr | sed '1,/VGA-1/d' | sed '1,/[0-9]/d' | awk '{print $1}')" | bemenu
|
||||
fi
|
||||
}
|
||||
|
||||
laptop_only() {
|
||||
wlr-randr --output VGA-1 --off #TODO only needed because my thinkpad has an issue, remove when no longer needed
|
||||
wlr-randr --output "$LAPTOP" --on
|
||||
}
|
||||
|
||||
#$1 -> monitor
|
||||
#$2 -> resolution
|
||||
monitor_only() {
|
||||
MON="$1"
|
||||
RES="$2"
|
||||
|
||||
echo "$MON $RES" >> ~/.cache/log/fixscrsh.log
|
||||
|
||||
[ -z "$1" ] && MON="$(get_mon)"
|
||||
[ -z "$2" ] && RES="$(get_res "$MON")"
|
||||
|
||||
wlr-randr --output "$LAPTOP" --off
|
||||
wlr-randr --output "$MON" --on --mode "$RES"
|
||||
}
|
||||
|
||||
span() {
|
||||
MONS="$(list_mons)"
|
||||
for i in $MONS
|
||||
do
|
||||
wlr-randr --output "$i" --on
|
||||
done
|
||||
}
|
||||
|
||||
menu() {
|
||||
OPTS="laptop_only
|
||||
monitor_only
|
||||
mirror
|
||||
span
|
||||
quit"
|
||||
|
||||
SEL="$(echo "$OPTS" | bemenu)"
|
||||
|
||||
[ "$SEL" = "laptop_only" ] && laptop_only
|
||||
[ "$SEL" = "monitor_only" ] && monitor_only
|
||||
[ "$SEL" = "span" ] && span
|
||||
}
|
||||
|
||||
help() {
|
||||
echo "Usage: ./fixscr.sh"
|
||||
echo " --menu => show bemenu prompts to select monitor configuration"
|
||||
echo " --laptop-only => enable only laptop"
|
||||
echo " --monitor-only [MONITOR] [RESOLUTION] => enable only external monitor"
|
||||
echo " --help => show this help prompt"
|
||||
}
|
||||
|
||||
[ "$2" ] && MON="$2"
|
||||
[ "$3" ] && RES="$3"
|
||||
|
||||
if [ "$1" = "--menu" ]; then
|
||||
menu
|
||||
else
|
||||
[ "$1" = "--monitor-only" ] && monitor_only "$MON" "$RES"
|
||||
[ "$1" = "--laptop-only" ] && laptop_only
|
||||
[ -z "$1" ] && help
|
||||
fi
|
|
@ -0,0 +1,10 @@
|
|||
#!/bin/sh
|
||||
#run this to start gammastep
|
||||
#got this from https://rumpelsepp.org/blog/geolocation-for-gammastep/
|
||||
#modified to be a posix shell script, and to save location data to a file
|
||||
#so gammastep still works if internet is out.
|
||||
|
||||
FN="$HOME/.cache/gs_geoclue.json"
|
||||
|
||||
curl -Ls https://ipapi.co/json > "$FN"
|
||||
gammastep -l "$( cat "$FN" | jq ".latitude" )":"$( cat "$FN" | jq ".longitude" )" -m wayland
|
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
run () {
|
||||
killall swhks
|
||||
|
||||
swhks & pkexec swhkd
|
||||
}
|
||||
|
||||
close () {
|
||||
killall swhks
|
||||
sudo killall swhkd
|
||||
}
|
||||
|
||||
if [ "$1" = "-k" ]; then
|
||||
close
|
||||
else
|
||||
run
|
||||
fi
|
|
@ -0,0 +1,107 @@
|
|||
#!/bin/sh
|
||||
|
||||
#using PID for dirname in case multiple instances are opened they do not interfere
|
||||
CACHEDIR="$HOME/.cache/mangaterm"
|
||||
TMPDIR="$CACHEDIR/$$"
|
||||
|
||||
# read_char var
|
||||
# from: https://stackoverflow.com/a/30022297
|
||||
read_char() {
|
||||
stty -icanon -echo
|
||||
eval "$1=\$(dd bs=1 count=1 2>/dev/null)"
|
||||
stty icanon echo
|
||||
}
|
||||
|
||||
help() {
|
||||
echo "Read manga/comics/pdfs in the terminal"
|
||||
echo " mangaterm.sh DIRECTORY"
|
||||
echo " mangaterm.sh FILE"
|
||||
echo ""
|
||||
echo " --help show this help menu"
|
||||
echo ""
|
||||
echo "keybindings:"
|
||||
echo " j -> next page"
|
||||
echo " k -> previous page"
|
||||
echo " q -> quit"
|
||||
echo ""
|
||||
exit
|
||||
}
|
||||
|
||||
disp() {
|
||||
FILE="$DIR"/"$(echo "$FILES" | head -n "$1" | tail -n 1)"
|
||||
clear
|
||||
[ -f "$FILE" ] && chafa -C on "$FILE"
|
||||
|
||||
printf "%s" "$FILE"
|
||||
}
|
||||
|
||||
close() {
|
||||
rm -rf "$TMPDIR"
|
||||
clear
|
||||
exit
|
||||
}
|
||||
|
||||
readDir() {
|
||||
DIR="$(echo "$1" | xargs)"
|
||||
|
||||
#if opening an archive that created a subdirectory, open subdirectories until there are multiple files
|
||||
SDIR="$(ls -A "$DIR")"
|
||||
if [ "$(echo "$SDIR" | wc -l)" = "1" ]; then
|
||||
if [ -d "$DIR/$SDIR" ]; then
|
||||
readDir "$DIR"/"$SDIR"
|
||||
fi
|
||||
fi
|
||||
|
||||
FILES="$(ls "$DIR")"
|
||||
LEN="$(echo "$FILES" | wc -l)"
|
||||
|
||||
disp "1"
|
||||
|
||||
I=1
|
||||
while read_char char; do
|
||||
if [ "$char" = "j" ]; then
|
||||
I=$((I + 1))
|
||||
elif [ "$char" = "k" ]; then
|
||||
I=$((I - 1))
|
||||
elif [ "$char" = "q" ]; then
|
||||
close
|
||||
fi
|
||||
|
||||
if [ "$I" -ge "$LEN" ] || [ "$I" -le "0" ]; then
|
||||
if [ "$I" -ge "$LEN" ]; then
|
||||
I="$LEN"
|
||||
elif [ "$I" -le "0" ]; then
|
||||
I=0
|
||||
fi
|
||||
fi
|
||||
|
||||
disp "$I"
|
||||
done
|
||||
|
||||
close
|
||||
}
|
||||
|
||||
handleFile() {
|
||||
case $(file --mime-type "$1" -b) in
|
||||
inode/directory) readDir "$1" ;;
|
||||
application/zip) unzip "$1" -d "$TMPDIR" && readDir "$TMPDIR" ;;
|
||||
application/*rar) 7z x "$1" -o"$TMPDIR" && readDir "$TMPDIR" ;;
|
||||
application/gzip) tar xzvf "$1" --directory="$TMPDIR" && readDir "$TMPDIR" ;;
|
||||
application/pdf) pdftoppm -jpeg "$1" "$TMPDIR"/page && readDir "$TMPDIR" ;;
|
||||
*) help ;;
|
||||
|
||||
esac
|
||||
}
|
||||
|
||||
trap 'close' 2
|
||||
trap 'close' 15
|
||||
|
||||
[ "$1" = "--help" ] && help
|
||||
|
||||
mkdir -p "$TMPDIR"
|
||||
|
||||
if [ "$(echo "$1" | cut -c1-1)" = "-" ]; then
|
||||
foot -e mangaterm "$2" 2>/dev/null > /dev/null
|
||||
fi
|
||||
|
||||
handleFile "$1"
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/sh
|
||||
|
||||
#programs to run to initialize pipewire, separated by spaces
|
||||
PROGS="pipewire pipewire-pulse wireplumber"
|
||||
|
||||
trap 'kill' 2
|
||||
trap 'kill' 15
|
||||
|
||||
kill() {
|
||||
for PRG in $PROGS
|
||||
do
|
||||
pkill -KILL "$PRG"
|
||||
sleep 1
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
for PRG in $PROGS
|
||||
do
|
||||
|
||||
[ -z "$(pgrep "^$PRG\$")" ] && "$PRG" &
|
||||
sleep 1
|
||||
done
|
||||
|
||||
wait
|
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/env sh
|
||||
#sets a random wallpaper using feh from the ~/wallpapers directory
|
||||
|
||||
setwp() {
|
||||
#wal -n -s -t -e -i "$1"
|
||||
rm ~/.config/wall
|
||||
cp "$1" "$HOME/.config/wall"
|
||||
swaymsg "output * bg ~/.config/wall fill"
|
||||
swaybg --image "$HOME/.config/wall"
|
||||
}
|
||||
|
||||
|
||||
#TODO convert this to be usable in wayland/sway
|
||||
#[ "$1" = "-r" ] && WALLP=$(find -L ~/wallpapers/ -iname "*.*" -print | shuf -n 1) && feh --bg-scale "$WALLP" && exit
|
||||
|
||||
#if [ -d "$1" ]; then
|
||||
# case $1 in
|
||||
# /*) sel="$(sxiv -o "$1" | sed '$!d')" ;;
|
||||
# *) sel="$PWD/$(sxiv "$1" -o | sed '$!d')" ;;
|
||||
# esac
|
||||
# [ -f "$sel" ] && setwp "$sel"
|
||||
#
|
||||
#elif [ -f "$1" ]; then
|
||||
# #setwp "$PWD/$1"
|
||||
# setwp "$1"
|
||||
#fi
|
||||
|
||||
if [ -f "$1" ]; then
|
||||
setwp "$1"
|
||||
fi
|
||||
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
#!/bin/sh
|
||||
#Script wrapper for using grim for screenshots in sway
|
||||
#commands taken from grim's github README, commands saved below for reference
|
||||
#requires that sway, grim, jq, and imagemagick are installed
|
||||
|
||||
#for all functions:
|
||||
# $1 -> filename for output, will be set to - if -clip flag is set
|
||||
# $2 -> program to pipe grim output to, defaults to cat, is set to wl-copy if -clip is set
|
||||
# $3 -> seconds to wait before taking screenshot
|
||||
|
||||
ss_all() {
|
||||
sleep "$3"
|
||||
grim "$1" | "$2"
|
||||
}
|
||||
|
||||
ss_mon() {
|
||||
sleep "$3"
|
||||
grim -o "$(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name')" "$1" | "$2"
|
||||
}
|
||||
|
||||
ss_win() {
|
||||
sleep "$3"
|
||||
grim -g "$(swaymsg -t get_tree | jq -j '.. | select(.type?) | select(.focused).rect | "\(.x),\(.y) \(.width)x\(.height)"')" "$1" | "$2"
|
||||
}
|
||||
|
||||
ss_sel() {
|
||||
grim -g "$(slurp && sleep "$3")" "$1" | "$2"
|
||||
}
|
||||
|
||||
ss_color_pick() {
|
||||
grim -g "$(slurp -p)" -t ppm - | convert - -format '%[pixel:p{0,0}]' txt:- | "$2"
|
||||
}
|
||||
|
||||
help() {
|
||||
echo "ss.sh [OPTIONS]"
|
||||
echo " -a -> take screenshot of entire display"
|
||||
echo " -m -> take screenshot of current monitor"
|
||||
echo " -w -> take screenshot of currently active window"
|
||||
echo " -s -> take screenshot of selection"
|
||||
echo " -o FILENAME -> override filename output with given string FILENAME"
|
||||
echo " --color-picker -> get the current color value of a selected pixel, prints data to stdout"
|
||||
echo " --clip -> copy image to clipboard instead of writing to file"
|
||||
echo " --secs SECS -> wait SECS seconds before taking screenshot"
|
||||
echo " --help -> print this help message"
|
||||
echo ""
|
||||
}
|
||||
|
||||
CMD="help"
|
||||
|
||||
FN=$(date +'%s_grim.png')
|
||||
|
||||
SECS="0"
|
||||
|
||||
FN_FLAG=""
|
||||
SL_FLAG=""
|
||||
|
||||
PIPE_CMD="cat"
|
||||
|
||||
for ARG in "$@"
|
||||
do
|
||||
[ "$ARG" = "-a" ] && CMD="ss_all"
|
||||
[ "$ARG" = "-m" ] && CMD="ss_mon"
|
||||
[ "$ARG" = "-w" ] && CMD="ss_win"
|
||||
[ "$ARG" = "-s" ] && CMD="ss_sel"
|
||||
[ "$ARG" = "--color-picker" ] && CMD="ss_color_pick"
|
||||
[ "$ARG" = "--clip" ] && FN="-" && PIPE_CMD="wl-copy"
|
||||
[ "$ARG" = "--help" ] && CMD="help"
|
||||
|
||||
[ "$FN_FLAG" = "1" ] && FN_FLAG="" && FN="$ARG" #turn off FN_FLAG and set FN to argument after -o
|
||||
[ "$ARG" = "-o" ] && FN_FLAG="1" #flag next argument to be file name
|
||||
|
||||
[ "$SL_FLAG" = "1" ] && SL_FLAG="" && SECS="$ARG" #turn off SL_FLAG and set SECS to argument after -secs
|
||||
[ "$ARG" = "-secs" ] && SL_FLAG="1" #flag next argument to be SECS
|
||||
|
||||
done
|
||||
|
||||
$CMD "$FN" "$PIPE_CMD" "$SECS"
|
|
@ -0,0 +1,30 @@
|
|||
#!/bin/sh
|
||||
#DATA_LOC="/media/SEAGATE/CRYPTO/monero/BLOCKCHAIN/"
|
||||
#DATA_LOC="$HOME/.local/share/monero/BLOCKCHAIN/"
|
||||
DATA_LOC="/media/SEAGATE/CRYPTO/monero/BLOCKCHAIN2/"
|
||||
WALLET_LOC="$HOME"/.local/wallets/monero/myWallet/myWallet
|
||||
|
||||
#add this in /etc/security/limits.conf
|
||||
# $USER hard memlock 2048
|
||||
# $USER soft memlock 2048
|
||||
|
||||
#ulimit -l 2048
|
||||
|
||||
#monerod --data-dir "$DATA_LOC" --mining-threads 3 --detach
|
||||
#sleep 60
|
||||
|
||||
if [ "$1" = "-w" ]; then
|
||||
monero-wallet-cli --wallet-file "$WALLET_LOC"
|
||||
elif [ "$1" = "-i" ]; then
|
||||
mkdir -p "$DATA_LOC"
|
||||
ulimit -l 2048
|
||||
monerod --data-dir "$DATA_LOC" --prune-blockchain --max-concurrency=4 --detach
|
||||
#monerod --data-dir "$DATA_LOC" --db-salvage
|
||||
echo "sleeping..."
|
||||
sleep 1200
|
||||
echo "Wallet started."
|
||||
else
|
||||
echo "-i -> initialize, set ulimits and start monerod"
|
||||
echo "-w -> open wallet in cli"
|
||||
fi
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
#!/bin/sh
|
||||
#=========================================================================
|
||||
# This script is used to set the status bar for dwm, or
|
||||
# other wms that use xsetroot for a status bar.
|
||||
#
|
||||
# by default this script will only run once, to run in
|
||||
# a loop give it the -l flag: ./sway-bar.sh -l
|
||||
#
|
||||
# Requires: pamixer
|
||||
#
|
||||
# ddate -> creates a date string
|
||||
# audio -> creates a string representing the state of pulseaudio
|
||||
# netup -> creates a string for the current network interface and status
|
||||
# weather -> reads file written by ~/scripts/update-weather.sh to set the weather
|
||||
#
|
||||
# update -> calls all the above functions into swaybar to set status bar
|
||||
#
|
||||
# https://gitlab.com/ahub/dotfiles
|
||||
#========================================================================
|
||||
|
||||
MAIL_DIR="$HOME/.local/share/mail"
|
||||
|
||||
SEP=" | "
|
||||
|
||||
ddate () {
|
||||
printf " %s\n" "$(date "+%b %d, %Y ( %I:%M )")" #(%a)
|
||||
}
|
||||
|
||||
|
||||
audio () {
|
||||
#volstat="$(amixer get Master)"
|
||||
# if [ -n "$(echo "$volstat" | grep "\[off\]")" ]; then
|
||||
# icon="🔇"
|
||||
# else
|
||||
# icon="$(echo "$volstat" | grep -o "\[[0-9]\+%\]" | sed 's/[^0-9]*//g' | sed -n 1p -) 🔊"
|
||||
# fi
|
||||
|
||||
icon="$(vol.sh -g) 🔊"
|
||||
[ "$(pamixer --get-mute)" = "true" ] && icon="🔇"
|
||||
|
||||
printf "%s\n" "$icon"
|
||||
}
|
||||
|
||||
rss() {
|
||||
rss_cnt=$(sfeed_plain ~/.local/share/sfeed/feeds/* | grep -c "^N" )
|
||||
#rss_cnt="$(newsboat -x print-unread | awk '{print $1}')"
|
||||
printf "%s \n" "$rss_cnt"
|
||||
}
|
||||
|
||||
mail() {
|
||||
#MAIL_DIR="$HOME/.local/share/mail/main/INBOX/new"
|
||||
#COUNT="$(ls "$MAIL_DIR" | wc -l)"
|
||||
|
||||
COUNT=0
|
||||
for MBOX in $(ls "$MAIL_DIR")
|
||||
do
|
||||
TMP_DIR="$MAIL_DIR""/$MBOX""/INBOX/new"
|
||||
COUNT=$((COUNT+$(ls "$TMP_DIR" | wc -l)))
|
||||
|
||||
done
|
||||
|
||||
icon="$COUNT 📧"
|
||||
|
||||
printf "%s\n" "$icon"
|
||||
|
||||
}
|
||||
|
||||
netup() {
|
||||
icon="❗"
|
||||
for iface in $(ls -1 /sys/class/net | sed '/^lo/d')
|
||||
do
|
||||
if [ $(cat /sys/class/net/"$iface"/operstate | grep up) ] ; then
|
||||
if [ "$(echo "$iface" | grep w)" ]; then
|
||||
icon=" "
|
||||
else
|
||||
icon=""
|
||||
fi
|
||||
elif [ -z "$icon" ]; then
|
||||
icon="❗"
|
||||
fi
|
||||
done
|
||||
|
||||
printf "%s\n" "$icon"
|
||||
}
|
||||
|
||||
weather() {
|
||||
if ! [ -f ~/.cache/wttr ]; then
|
||||
sh ~/.local/scripts/update-weather.sh
|
||||
fi
|
||||
icon="$(cat ~/.cache/wttr)"
|
||||
|
||||
printf "%s\n" "$icon"
|
||||
}
|
||||
|
||||
cputemp() {
|
||||
icon="$(cat /sys/class/thermal/thermal_zone0/temp | sed 's/\(.\)..$/.\1°C/')"
|
||||
|
||||
printf "%s\n" "$icon"
|
||||
}
|
||||
|
||||
battery() {
|
||||
BATT_DIR="/sys/class/power_supply/BAT0"
|
||||
if [ -d "$BATT_DIR" ]; then
|
||||
status="$(cat "$BATT_DIR"/status)"
|
||||
charge="$(cat "$BATT_DIR"/capacity)"
|
||||
fi
|
||||
icon=""
|
||||
if [ "$status" = "Discharging" ]; then
|
||||
icon="${charge}% 🔋"
|
||||
elif [ -z "$status" ]; then
|
||||
icon="🔌"
|
||||
else
|
||||
icon="${charge}% 🔌"
|
||||
fi
|
||||
|
||||
printf "%s\n" "$icon"
|
||||
}
|
||||
|
||||
crypto() {
|
||||
icon="$(cat ~/.cache/rate)"
|
||||
printf "%s\n" "$icon"
|
||||
}
|
||||
|
||||
update() {
|
||||
echo " $(crypto)$SEP$(cputemp)$SEP$(battery)$SEP$(netup)$SEP$(audio)$SEP$(rss)$SEP$(weather)$SEP$(ddate) "
|
||||
}
|
||||
|
||||
|
||||
#trap 'exit' 2
|
||||
#trap 'exit' 15
|
||||
#trap 'exit' 9
|
||||
if [ "$1" ] && [ "$1" = "-l" ]; then
|
||||
echo "$$" > ~/.cache/statusbar_pid
|
||||
|
||||
sh ~/.local/scripts/update-crypto.sh -i &
|
||||
sh ~/.local/scripts/update-weather.sh -i &
|
||||
|
||||
while true
|
||||
do
|
||||
update
|
||||
sleep 60
|
||||
done
|
||||
else
|
||||
update
|
||||
fi
|
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env sh
|
||||
# * TR_APP_VERSION
|
||||
# * TR_TIME_LOCALTIME
|
||||
# * TR_TORRENT_DIR
|
||||
# * TR_TORRENT_HASH
|
||||
# * TR_TORRENT_ID
|
||||
# * TR_TORRENT_NAME
|
||||
notify-send "✔️ Transmission-daemon" "$TR_TORRENT_NAME download complete."
|
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
#sleep 30
|
||||
[ ! -d ~/.cache/transmission ] && mkdir -p ~/.cache/transmission
|
||||
|
||||
while [ ! -f ~/.cache/transmission/bt_blocklists.gz ]; do
|
||||
sleep 10
|
||||
cd ~/.cache/transmission/
|
||||
#curl -O -L https://github.com/sahsu/transmission-blocklist/releases/download/1.0.0/blocklist.gz
|
||||
#curl -O -L https://github.com/sahsu/transmission-blocklist/releases/latest/download/blocklist.gz
|
||||
curl -O -L https://github.com/Naunter/BT_BlockLists/raw/master/bt_blocklists.gz
|
||||
done
|
||||
|
||||
gunzip ~/.cache/transmission/bt_blocklists.gz
|
||||
rm ~/.cache/transmission/bt_blocklists.gz
|
||||
|
||||
if [ -f ~/.config/transmission-daemon/blocklists/bt_blocklists ]; then
|
||||
rm ~/.config/transmission-daemon/blocklists/*
|
||||
fi
|
||||
|
||||
mv ~/.cache/transmission/bt_blocklists ~/.config/transmission-daemon/blocklists/
|
||||
|
||||
[ -z "$(pgrep transmission)" ] && transmission-daemon &
|
|
@ -0,0 +1,30 @@
|
|||
#!/bin/sh
|
||||
# script acts as a basic wrapper for 7z for extracting .rar files
|
||||
# requires p7zip-rar , p7zip with rar archive support
|
||||
# not everything is implemented just x and l flags
|
||||
# $1 -> flag
|
||||
# $2 -> archive file name ex: archive.rar
|
||||
# $3 -> (optional) directory to extract to
|
||||
|
||||
|
||||
if [ "$1" = "x" ]; then
|
||||
if [ "$(echo "$2" | grep ".rar" )" ]; then
|
||||
if [ -d "$3" ]; then
|
||||
7z x "$2" -o"$3"
|
||||
else
|
||||
7z x "$2"
|
||||
fi
|
||||
fi
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ "$1" = "l" ]; then
|
||||
7z l "$2"
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "This is a script that serves as a wrapper for 7z to use unrar commands."
|
||||
echo ""
|
||||
echo "unrar x file.rar --> extracts file to current directory"
|
||||
echo "unrar x file.rar /path/to/directory/ --> extracts file to specified directory"
|
||||
echo "unrar l file.rar --> prints out contents of file to terminal"
|
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
get() {
|
||||
val="$(curl --connect-timeout 30 "rate.sx/1$1" | sed 's/\(\.[0-9][0-9]\).*$/\1/g')"
|
||||
|
||||
printf "%s: %s\n" "$1" "$val"
|
||||
}
|
||||
|
||||
[ "$1" = "-i" ] && sleep 10
|
||||
|
||||
|
||||
UPDATE="$(get 'LINK') $(get 'XMR')"
|
||||
|
||||
if [ $(echo $UPDATE | wc -m) -le 30 ]; then
|
||||
echo "$UPDATE" > ~/.cache/rate
|
||||
else
|
||||
echo "❗" > ~/.cache/rate
|
||||
fi
|
|
@ -0,0 +1,46 @@
|
|||
#!/usr/bin/env sh
|
||||
#===================
|
||||
#TODO:
|
||||
# + currently making /etc/hosts a symlink to a user owned file to allow script to run w/o sudo, possible security issue.
|
||||
#
|
||||
#FLAGS:
|
||||
# if $1 is -u then update files from internet
|
||||
#
|
||||
# ==================
|
||||
|
||||
BLOCKFILE="$HOME/.config/blocklist"
|
||||
|
||||
update() {
|
||||
mkdir -p ~/.local/share/update_hosts
|
||||
cd ~/.local/share/update_hosts
|
||||
|
||||
if [ ! -f "./.hosts.orig" ]; then
|
||||
cp /etc/hosts ./.hosts.orig
|
||||
fi
|
||||
|
||||
if [ "$1" = "-u" ]; then
|
||||
|
||||
rm ./.swc_hosts
|
||||
#get someonewhocares.org hosts file
|
||||
curl https://someonewhocares.org/hosts/hosts -o ./.swc_hosts
|
||||
|
||||
fi
|
||||
|
||||
#curl https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/porn/hosts -o ./.sb_hosts
|
||||
|
||||
#[ -f "$BLOCKFILE" ] && echo "blocklist file found." && sed 's/^/127.0.0.1 /g' "$BLOCKFILE" > ./blocklist
|
||||
|
||||
#if [ -f "./blocklist" ]; then
|
||||
# cat ./.hosts.orig ./.swc_hosts ./.sb_hosts ./blocklist > ./hosts
|
||||
#else
|
||||
cat ./.hosts.orig ./.swc_hosts > ./hosts
|
||||
#fi
|
||||
|
||||
#cat ./.hosts.orig ./.swc_hosts > ./hosts
|
||||
|
||||
#sudo mv ./hosts /etc/
|
||||
[ "$1" = "-u" ] && sudo rm /etc/hosts && sudo ln -s $HOME/.local/share/update_hosts/hosts /etc/ && exit
|
||||
}
|
||||
|
||||
|
||||
update "$1"
|
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
[ "$1" = "-i" ] && sleep 10
|
||||
|
||||
UPDATE="$(curl --connect-timeout 30 "wttr.in/?format=1")" # > ~/.cache/wttr
|
||||
|
||||
echo $UPDATE | wc -m
|
||||
|
||||
if [ $(echo $UPDATE | wc -m) -le 30 ]; then
|
||||
echo "$UPDATE" > ~/.cache/wttr
|
||||
|
||||
else
|
||||
echo "❗" > ~/.cache/wttr
|
||||
|
||||
fi
|
|
@ -0,0 +1,53 @@
|
|||
#!/bin/sh
|
||||
|
||||
PERC="0.05"
|
||||
|
||||
refbar() {
|
||||
pkill sleep -P "$(cat ~/.cache/statusbar_pid )"
|
||||
}
|
||||
|
||||
inc() {
|
||||
[ "$1" ] && PERC="$1"
|
||||
#pulsemixer --change-volume +"$1" && refbar
|
||||
#amixer sset Master 1%+ && refbar
|
||||
#pamixer -i "$PERC" && refbar
|
||||
wpctl set-volume @DEFAULT_AUDIO_SINK@ "$(echo "$(get) + $PERC" | bc)" && refbar
|
||||
}
|
||||
|
||||
dec() {
|
||||
[ "$1" ] && PERC="$1"
|
||||
#pulsemixer --change-volume -"$1" && refbar
|
||||
#amixer sset Master 1%- && refbar
|
||||
#pamixer -d "$PERC" && refbar
|
||||
wpctl set-volume @DEFAULT_AUDIO_SINK@ "$(echo "$(get) - $PERC" | bc)" && refbar
|
||||
}
|
||||
|
||||
mute() {
|
||||
#pulsemixer --toggle-mute && refbar
|
||||
#amixer sset Master toggle && refbar
|
||||
#pamixer -t && refbar
|
||||
wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle && refbar
|
||||
}
|
||||
|
||||
get() {
|
||||
wpctl get-volume @DEFAULT_AUDIO_SINK@ | cut -d' ' -f 2
|
||||
}
|
||||
|
||||
help() {
|
||||
echo "-i N -> increment volume by N (0.00 - 1.00)"
|
||||
echo "-d N -> decrement volume by N (0.00 - 1.00)"
|
||||
echo "-g -> get current volume"
|
||||
echo "--toggle-mute -> toggle mute sound"
|
||||
}
|
||||
|
||||
if [ "$1" = "-i" ]; then
|
||||
inc "$2"
|
||||
elif [ "$1" = "-d" ]; then
|
||||
dec "$2"
|
||||
elif [ "$1" = "--toggle-mute" ]; then
|
||||
mute
|
||||
elif [ "$1" = "-g" ]; then
|
||||
get
|
||||
else
|
||||
help
|
||||
fi
|
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
wget --mirror --convert-links --adjust-extension --page-requisites --no-parent "$1"
|
Loading…
Reference in New Issue