diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc index a83d8cb..a28bc6c 100644 --- a/.config/sxhkd/sxhkdrc +++ b/.config/sxhkd/sxhkdrc @@ -47,6 +47,10 @@ super + shift + e fawesome F11 [ $(pgrep ffmpeg) ] && blaze -s || blaze +F1 + mounter +F2 + umounter #~~~~~~~~~~~ diff --git a/.local/bin/scripts/mounter b/.local/bin/scripts/mounter new file mode 100755 index 0000000..f38d1cf --- /dev/null +++ b/.local/bin/scripts/mounter @@ -0,0 +1,14 @@ +#!/bin/sh + +data() { lsblk -r | sed '/.*k $/d; /t \//d; 1d' | awk '{ print $1 " - " $4 }' ;} +[ ! "$(data)" ] && { rofi -e "Nothing to mount!"; exit 1 ;} +m() { rofi -dmenu -i "$@" ;} + +part="$(data | m -p "Partition" -l "$(data | wc -l)" | awk '{ print $1 }')" +[ ! "$part" ] && exit 1 +mpoints() { find /mnt /media -type d ;} +mountpoint="$(mpoints | m -p "Mountpoint" -l "$(mpoints | wc -l)")" +[ ! "$mountpoint" ] && exit 1 + +pass="$(m -l 0 -p "Password" -password)" +echo "$pass" | sudo -S -v && sudo mount /dev/"$part" "$mountpoint" diff --git a/.local/bin/scripts/umounter b/.local/bin/scripts/umounter new file mode 100755 index 0000000..26f0641 --- /dev/null +++ b/.local/bin/scripts/umounter @@ -0,0 +1,10 @@ +#!/bin/sh + +data() { lsblk -r | awk '/t \// { print $1 " - " $7 }' ;} +m() { rofi -dmenu -i "$@" ;} + +part="$(data | m -p "Partition" -l "$(data | wc -l)" | awk '{ print $1 }')" +[ ! "$part" ] && exit 1 + +pass="$(m -l 0 -p "Password" -password)" +echo "$pass" | sudo -S -v && sudo umount /dev/"$part"