forked from xtonousou/xfce4-genmon-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env bash | ||
# Dependencies: bash>=3.2, coreutils, file, gawk | ||
|
||
# Makes the script more portable | ||
readonly DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
|
||
# Optional icon to display before the text | ||
# Insert the absolute path of the icon | ||
# Recommended size is 24x24 px | ||
readonly ICON="${DIR}/icons/disk/eject.png" | ||
|
||
# Script to eject drives | ||
readonly EJECT="${DIR}/eject.sh" | ||
|
||
# Panel | ||
if [[ $(file -b "${ICON}") =~ PNG|SVG ]]; then | ||
INFO="<img>${ICON}</img>" | ||
if [[ $(file -b "${EJECT}") =~ sh ]]; then | ||
INFO+="<click>${EJECT}</click>" | ||
fi | ||
INFO+="<txt>" | ||
else | ||
INFO="<txt>" | ||
INFO+="Icon is missing!" | ||
fi | ||
INFO+="</txt>" | ||
|
||
# Tooltip | ||
MORE_INFO="<tool>" | ||
MORE_INFO+="Eject Drives" | ||
MORE_INFO+="</tool>" | ||
|
||
# Panel Print | ||
echo -e "${INFO}" | ||
|
||
# Tooltip Print | ||
echo -e "${MORE_INFO}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env bash | ||
# Dependencies: coreutils, gksu, util-linux, zenity | ||
|
||
readonly TITLE="Select the source you want to unmount" | ||
declare -a DRIVES_ARRAY=($(df --sync --output=source | awk '/^\/dev\//{print $1}' | sort -V)) | ||
declare -a FSTYPE_ARRAY=($(df --sync --output=source,fstype | sort -V | awk '/^\/dev\//{print $2}')) | ||
declare -a MNTPOINT_ARRAY=($(df --sync --output=source,target | sort -V | awk '/^\/dev\//{print $2}')) | ||
declare -a TO_BE_MOUNTED_ARRAY | ||
|
||
# zenity GUI | ||
readonly CHOICES=$(zenity --list --text "${TITLE}" --width 512 --height 256 \ | ||
--checklist --column "Unmount" --column "Source" --column "Filesystem" \ | ||
--column "Mountpoint" \ | ||
$(for ITEM in "${!DRIVES_ARRAY[@]}"; do \ | ||
echo 0 "${DRIVES_ARRAY[ITEM]}" "${FSTYPE_ARRAY[ITEM]}" "${MNTPOINT_ARRAY[ITEM]}"; \ | ||
done | ||
) | ||
) | ||
|
||
# Pass selected sources to be mounted on an array | ||
IFS='|' read -r -a TO_BE_MOUNTED_ARRAY <<< "${CHOICES}" | ||
|
||
for SOURCE in "${TO_BE_MOUNTED_ARRAY[@]}"; do | ||
umount "${SOURCE}" | ||
done |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.