Update.
This commit is contained in:
parent
5fe9ae3c00
commit
19ee4a7871
10 changed files with 152 additions and 25 deletions
47
dmenuusbman
Executable file
47
dmenuusbman
Executable file
|
@ -0,0 +1,47 @@
|
|||
#!/bin/sh
|
||||
|
||||
driveCount(){
|
||||
count="$(echo "$1" | wc -l)"
|
||||
}
|
||||
|
||||
mount(){
|
||||
mountable="$(lsblk -lp | awk '/^\/dev\/sd.*part $/ { print $1 " ("$4")" }')"
|
||||
|
||||
if [ "$mountable" = "" ]; then
|
||||
quick-notify "Dmenu Usb Manager" "No drives to mount"
|
||||
exit
|
||||
fi
|
||||
|
||||
chosen="$(printf '%s' "$mountable" | dmenu -p "Drive to mount?")"
|
||||
|
||||
if [ -n "$chosen" ];then
|
||||
udisksctl mount -b "${chosen%% *}"
|
||||
else
|
||||
quick-notify "Dmenu Usb Manager" "No drives chosen to mount"
|
||||
exit
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
unmount(){
|
||||
mounted="$(lsblk -lp | awk '/run/ { print $1 " ("$4")" }')"
|
||||
|
||||
if [ "$mounted" = "" ]; then
|
||||
quick-notify "Dmenu Usb Manager" "No drives to unmount"
|
||||
exit
|
||||
fi
|
||||
|
||||
chosen="$(printf '%s' "$mounted" | dmenu -p "Drive to unmount?")"
|
||||
|
||||
if [ -n "$chosen" ];then
|
||||
udisksctl unmount -b "${chosen%% *}"
|
||||
else
|
||||
quick-notify "Dmenu Usb Manager" "No drives chosen to unmount"
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
case $(printf "mount\\nunmount" | dmenu -p "Chose your usb action") in
|
||||
"mount") mount ;;
|
||||
"unmount") unmount ;;
|
||||
esac
|
Loading…
Add table
Add a link
Reference in a new issue