Open Andrew15-5 opened 11 months ago
I do my automounting and unmounting stuff with udiskie (on Debian).
For lf I have following cmd:
cmd media-eject ${{ udiskie-umount --detach "$f" }}
map E media-eject
With that, I just jump to the /media/USER/USBSTICK and execute the cmd by E.
Although it's nice that I can use this new utility for me to unmount + turn-off the device, I still have a few problems:
It would be nice to have as a built-in feature, but maybe it will be hard to do cross-platform, so at least a script in the https://github.com/gokcehan/lf/wiki/Tips would be great to have. I've made a script that uses
rofi
in which I can select one of the mounted partitions and based on the selection I can unmount it and power off its device. So basically what "eject"/"unmount" button does in Nautilus or any other GUI file manager.But the problem is that I can't integrate it with
lf
(which would be 100% much easier and quicker to do). Theudisksctl
command that I use to unmount and power off says that the device is busy. Eitherlf
is blocking the device orsh
, since the customlf
command, is executingsh
in the directory of the mounted device (partition). And doingcd /
inside the${{}}
script doesn't help.If I could do command chain (like in
ranger
, I remember it vaguely), then maybecmd eject :chain saved_pwd=$PWD; cd /media/; eject "$saved_pwd"
would work, since the underlyingsh
command will be executed in the/media/
directory and lf's PWD would also be in the/media/
so the external device shouldn't be busy anymore and could be ejected with no problem.I can only think of creating a wrapper script that isn't somehow executed from the target device directory. If someone have any idea of how it can be done with pure scripts (POSIX shell is ideal), then please let me know.