diff options
| author | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2022-05-15 12:02:59 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2022-05-15 12:02:59 +0200 |
| commit | 115ff9a06870d51702918cd926199e2271bf4f92 (patch) | |
| tree | 4c2abf616b9eec3ba485f49bcefaf0a98882fa33 /dmenu-unmount | |
| parent | 5ca3ebbf7c3cef6db6b8270af4fcf0be087c29c1 (diff) | |
| download | scripts-115ff9a06870d51702918cd926199e2271bf4f92.tar.gz scripts-115ff9a06870d51702918cd926199e2271bf4f92.zip | |
Added option to specify alternative menu. Some general cleanup.
Diffstat (limited to 'dmenu-unmount')
| -rwxr-xr-x | dmenu-unmount | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/dmenu-unmount b/dmenu-unmount index 2c59ec4..57f0c41 100755 --- a/dmenu-unmount +++ b/dmenu-unmount | |||
| @@ -1,10 +1,24 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | # Prompts selection for mounted devices and unmounts the selected one | 3 | # Prompts selection for mounted devices and unmounts the selected one |
| 4 | # Usage: dmenu-unmount [-m menu] [-w writer] | ||
| 5 | # Example: dmenu-unmount -m slmenu -w echo | ||
| 4 | # Requires: udevil, dmenu (or similar), notify-send or similar (optional) | 6 | # Requires: udevil, dmenu (or similar), notify-send or similar (optional) |
| 5 | 7 | ||
| 6 | menu=${MENU:-dmenu} | 8 | menu=dmenu |
| 7 | writeout=herbe # Change this to whatever you want, e.g. echo or notify-send | 9 | writeout=herbe |
| 10 | |||
| 11 | while getopts "m:w:" opt; do | ||
| 12 | case "$opt" in | ||
| 13 | m) | ||
| 14 | menu="$OPTARG" | ||
| 15 | ;; | ||
| 16 | w) | ||
| 17 | writeout="$OPTARG" | ||
| 18 | ;; | ||
| 19 | esac | ||
| 20 | done | ||
| 21 | shift `expr $OPTIND - 1` | ||
| 8 | 22 | ||
| 9 | listdev=$(grep "media" /proc/mounts | sed 's/\/media.*\///g' | \ | 23 | listdev=$(grep "media" /proc/mounts | sed 's/\/media.*\///g' | \ |
| 10 | awk '{print $1" ("$2")"}') | 24 | awk '{print $1" ("$2")"}') |
