diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/common/y2chid | 7 | ||||
-rwxr-xr-x | bin/common/y2feed | 14 | ||||
-rwxr-xr-x | bin/extra/ehbvpn | 17 | ||||
-rwxr-xr-x | bin/extra/fzwin | 5 | ||||
-rwxr-xr-x | bin/guiscripts/copyhist | 16 | ||||
-rwxr-xr-x | bin/guiscripts/favwal | 10 | ||||
-rwxr-xr-x | bin/guiscripts/imgclip | 4 | ||||
-rwxr-xr-x | bin/guiscripts/keyadd | 52 | ||||
-rwxr-xr-x | bin/guiscripts/locker | 24 | ||||
-rwxr-xr-x | bin/guiscripts/newwal | 1 | ||||
-rwxr-xr-x | bin/guiscripts/nordtheme | 16 | ||||
-rwxr-xr-x | bin/guiscripts/wintitle | 3 | ||||
-rwxr-xr-x | bin/menuscripts/mpass | 13 |
13 files changed, 151 insertions, 31 deletions
diff --git a/bin/common/y2chid b/bin/common/y2chid deleted file mode 100755 index 68ba6bc..0000000 --- a/bin/common/y2chid +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -test -z "${chidot:=$1}" \ - && chidot="$(cat /dev/stdin)" - -echo "chidot: ${chidot}" 1>&2 -curl -s "https://www.youtube.com/${chidot}/"| pup 'meta[itemprop="channelId"] attr{content}' diff --git a/bin/common/y2feed b/bin/common/y2feed index 0f27d68..196ecb7 100755 --- a/bin/common/y2feed +++ b/bin/common/y2feed @@ -1,8 +1,12 @@ -#!/usr/bin/env sh +#!/bin/sh +ua="$(yt-dlp --dump-user-agent)" -test -z "${url:=$1}" \ - && url="$(cat /dev/stdin)" +test -z "${url:=$1}" && + url="$(cat /dev/stdin)" -echo "url: ${url}" 1>&2 +url="http://youtube.com/$(echo "$url" | + awk -F '/' '{print $NF}')" +echo "url: $url" >&2 -curl -s "$url" | pup 'link attr{href}' | grep 'feeds' +curl -L -s -H "$ua" "$url" | + pup 'link[title=RSS] attr{href}' diff --git a/bin/extra/ehbvpn b/bin/extra/ehbvpn index 5d5643c..d3e587c 100755 --- a/bin/extra/ehbvpn +++ b/bin/extra/ehbvpn @@ -5,17 +5,19 @@ then exit 1 fi -which pptpsetup > /dev/null 2>&1 || +if ! which pptpsetup > /dev/null 2>&1 +then echo "Please install pptpsetup..." >&2 + exit 1 +fi name="ehb_tunnel" ip="193.190.238.38" -pass="e-mails/luca.raymaekers@student.ehb.be" -username="$(su aluc -c "pass show $pass" | - grep "^login:" | - cut -f 2- -d ' ')" -password="$(su aluc -c "pass show $pass" | - head -1)" +read -p "username: " username +stty -echo # disable terminal output +read -p "password: " password +stty echo +echo pptpsetup \ --create "$name" \ @@ -28,4 +30,3 @@ Created tunnel: $name activate it with # pon ehb_tunnel debug dump logfd 2 nodetach EOF - diff --git a/bin/extra/fzwin b/bin/extra/fzwin new file mode 100755 index 0000000..4e1cc79 --- /dev/null +++ b/bin/extra/fzwin @@ -0,0 +1,5 @@ +#!/bin/sh +hyprctl clients -j | + jq '.[].pid' | + fzf --preview "hyprctl clients -j | + jq '.[] | select(.pid == {}) | {class, title, workspace, xwayland}'" diff --git a/bin/guiscripts/copyhist b/bin/guiscripts/copyhist new file mode 100755 index 0000000..19dfb59 --- /dev/null +++ b/bin/guiscripts/copyhist @@ -0,0 +1,16 @@ +#!/bin/sh + +if [ "$MENUCMD" = "tofi" ] +then + menucmd="tofi --width 30% --height 50% --anchor bottom-right --matching-algorithm normal" +elif [ "$MENUCMD" = "dmenu" ] +then + menucmd="dmenu -l 10 -g 1 -x -i" +else + menucmd="fzf" +fi + +cliphist list | + $menucmd | + cliphist decode | + wl-copy -n diff --git a/bin/guiscripts/favwal b/bin/guiscripts/favwal new file mode 100755 index 0000000..f3222a2 --- /dev/null +++ b/bin/guiscripts/favwal @@ -0,0 +1,10 @@ +#!/bin/sh +pics="$(xdg-user-dir PICTURES)" +favs="wallpapers/favorites" + +mkdir -p "${pics:=$HOME/pics}/$favs" +wal="$(realpath "$pics/wallpaper")" +diff "$wal" "$pics/$favs/$(realpath "$wal" | xargs basename)" > /dev/null 2>&1 && + exit +cp "$wal" "$pics/$favs" +echo "$wal" diff --git a/bin/guiscripts/imgclip b/bin/guiscripts/imgclip index 710770b..466f2c6 100755 --- a/bin/guiscripts/imgclip +++ b/bin/guiscripts/imgclip @@ -3,8 +3,8 @@ tmppic="/tmp/imgclip.png" if [ "$WAYLAND_DISPLAY" ] then - clipo='wl-paste' - clipp='wl-copy' + clipo='wl-paste -n' + clipp='wl-copy -n' else clipo='xclip -o -selection clipboard -r' clipp='xclip -selection clipboard -r' diff --git a/bin/guiscripts/keyadd b/bin/guiscripts/keyadd new file mode 100755 index 0000000..b5bc4d9 --- /dev/null +++ b/bin/guiscripts/keyadd @@ -0,0 +1,52 @@ +#!/bin/sh + +# For when script calls itself +if [ -n "$PASSWORD" ] +then + pass show "$PASSWORD" && + exit + exit 1 +fi + + +if [ "$MENUCMD" = "tofi" ] +then + menucmd="tofi --matching-algorithm=normal" +else + menucmd="$MENUCMD" +fi + + +die () +{ + echo "$1" >&2 +} + +SSHFOLDER="$HOME/.ssh" + +key="$(find "$SSHFOLDER" -iname "*.pub" | + sed "s,$SSHFOLDER/,," | # Clean + sed 's/\.pub$//' | + $menucmd)" +die "key: $key" + +test ! -f "$SSHFOLDER/$key" && exit 1 + +HOST=$(hostnamectl hostname | sed 's/forlure/fl/;s/montecristo/mc/') +die "HOST: $HOST" + +if [ "$1" = "-d" ] +then + ssh-add -d - < "$SSHFOLDER"/$key.pub && + notify-send "$0" "deleted <b>$key</b>" || + notify-send "$0" "could not delete." +elif ! ssh-add -l | grep -q "$(ssh-keygen -lf "$SSHFOLDER"/$key)" +then + export PASSWORD="keys/$HOST/ssh/$key" + export SSH_ASKPASS="$0" + ssh-add - < "$SSHFOLDER"/$key && + notify-send "$0" "added <b>$key</b>" +else + die "key already added." + notify-send "$0" "key already added." +fi diff --git a/bin/guiscripts/locker b/bin/guiscripts/locker index 0070a86..c35f6d4 100755 --- a/bin/guiscripts/locker +++ b/bin/guiscripts/locker @@ -1,8 +1,22 @@ #!/bin/sh -which swaylock convert grim > /dev/null || +which swaylock grim pixelate > /dev/null || exit 1 umask 077 -file=/tmp/bg.png -grim -l 0 - > $file -convert -resize 10% -resize 1000% $file $file -swaylock -i $file + +monitors="$(hyprctl monitors -j | + jq -r '.[].name' | + tr '\n' ' ' | + sed 's,.$,,')" + +for monitor in $monitors +do + file="/tmp/locker-$monitor.png" + grim -l 0 -o "$monitor" "$file" + pixelate "$file" "$file" + # Create image command for swaylock + icmd="$icmd --image $monitor:$file" + files="$files $file" +done + +swaylock -f -u $icmd +shred -uz -- $files diff --git a/bin/guiscripts/newwal b/bin/guiscripts/newwal index 4d64a6e..b913552 100755 --- a/bin/guiscripts/newwal +++ b/bin/guiscripts/newwal @@ -69,3 +69,4 @@ EOF # waybar ln -sf "$walcache/colors-waybar.css" "$HOME/.config/waybar/colors.css" pkill -USR2 waybar +pywalfox update diff --git a/bin/guiscripts/nordtheme b/bin/guiscripts/nordtheme new file mode 100755 index 0000000..5d118c4 --- /dev/null +++ b/bin/guiscripts/nordtheme @@ -0,0 +1,16 @@ +#!/bin/sh +if test -z "$1" +then + ln -sf /usr/share/foot/themes/nord ~/.config/foot/colors + ln -sf ~/.config/tofi/themes/nord ~/.config/tofi/config + ln -sf ~/.config/waybar/colors/colors-nord ~/.config/waybar/colors.css + ln -sf ~/pics/wallpapers/nord/nord_background3.jpg ~/pics/wallpaper + swaybg -i ~/pics/wallpaper & + pkill -USR2 waybar + sed -i 's/ColorMyPencils("[^"]\+")/ColorMyPencils("nord")/g' ~/.config/nvim/after/plugin/colors.lua +else + ln -sf ~/.cache/wal/colors-waybar.css ~/.config/waybar/colors.css + ln -sf ~/.config/tofi/themes/base16 ~/.config/tofi/config + newwal + sed -i 's/ColorMyPencils("[^"]\+")/ColorMyPencils("pywal")/g' ~/.config/nvim/after/plugin/colors.lua +fi diff --git a/bin/guiscripts/wintitle b/bin/guiscripts/wintitle new file mode 100755 index 0000000..64938a5 --- /dev/null +++ b/bin/guiscripts/wintitle @@ -0,0 +1,3 @@ +#!/bin/sh + +notify-send "wintitle" "<b>$(hyprctl activewindow -j | jq -r '.title')</b>" diff --git a/bin/menuscripts/mpass b/bin/menuscripts/mpass index ebe3956..01c40e3 100755 --- a/bin/menuscripts/mpass +++ b/bin/menuscripts/mpass @@ -10,10 +10,15 @@ then else menucmd="fzf --prompt pass:" fi -while [ -d "${store}/${file}" ] +while [ -d "$store/$file" ] do - choice="$($lscmd "${store}/${file}" | sed 's/\.gpg$//'| $menucmd)" + choice="$($lscmd "$store/$file" | sed 's/\.gpg$//'| $menucmd)" [ "$choice" ] || break - file="${file}/${choice}" + file="$file/$choice" done -pass show -c "${file}" + +pass show -c "$file" && + if [ -n "$WAYLAND_DISPLAY" ] && cliphist list >/dev/null +then + cliphist list | head -n 1 | cliphist delete +fi |