Add notifications about the success/failure when mounting/umounting
This commit is contained in:
parent
cae9d57360
commit
7b9199c542
1 changed files with 15 additions and 5 deletions
18
home.nix
18
home.nix
|
|
@ -118,11 +118,21 @@ let user = import ./name.nix; in
|
||||||
|
|
||||||
if [ -n "$device" ] ; then
|
if [ -n "$device" ] ; then
|
||||||
if ${pkgs.mount}/bin/mount | ${pkgs.gnugrep}/bin/grep "$device" ; then
|
if ${pkgs.mount}/bin/mount | ${pkgs.gnugrep}/bin/grep "$device" ; then
|
||||||
echo "mounted"
|
${pkgs.libnotify}/bin/notify-send "Unmounting $device..."
|
||||||
${pkgs.udisks}/bin/udisksctl unmount -b $device
|
output=$(${pkgs.udisks}/bin/udisksctl unmount -b $device 2>&1)
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
${pkgs.libnotify}/bin/notify-send "Device successfully unmounted."
|
||||||
else
|
else
|
||||||
echo "not mounted"
|
${pkgs.libnotify}/bin/notify-send "Failed to unmount device" "$output"
|
||||||
${pkgs.udisks}/bin/udisksctl mount -b $device
|
fi
|
||||||
|
else
|
||||||
|
${pkgs.libnotify}/bin/notify-send "Mounting $device..."
|
||||||
|
output=$(${pkgs.udisks}/bin/udisksctl mount -b $device 2>&1)
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
${pkgs.libnotify}/bin/notify-send "Device successfully mounted."
|
||||||
|
else
|
||||||
|
${pkgs.libnotify}/bin/notify-send "Failed to mount device" "$output"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue