Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return path of mounted drive #3

Open
rien333 opened this issue May 7, 2019 · 3 comments
Open

Return path of mounted drive #3

rien333 opened this issue May 7, 2019 · 3 comments

Comments

@rien333
Copy link
Contributor

rien333 commented May 7, 2019

Great little app! I find the default mount path a bit troublesome to reach though (I know that I can run lsblk and copy/paste, but simpler solutions are def possible), so I was thinking about auto opening udiskie-dmenu mounts with a file manager/terminal. Turns out that there is no easy way to script this app.

Initially I wanted to open a PR to support auto-opening mounts in filemanagers, but I fortunately thought of the more elegant idea to just return the path of the mount point. In this way, users can script their own udiskie-dmenu behaviors on basis of the returned path, which is totally inline with the dmenu philosophy. (ofc, the default behaviour of dmenu itself is just to return the selected output)

For example:

#!/usr/bin/fish
set path (udiskie-dmenu) 
if lsblk | grep $path
   kitty -d  $path # open a terminal with the wd of the mount path
end
@fogine
Copy link
Owner

fogine commented May 7, 2019

I think, its a good idea.
The output will have to be a little bit more complex than that though as the user can select multiple paths or the whole device with multiple partitions to umout/mount at once.
Meaning that the output of udiskie-dmenu should provide a collection of mounted paths (I dont see how it could be beneficial to also provide a collection of umounted paths at the moment)

@rien333
Copy link
Contributor Author

rien333 commented May 7, 2019

Hm, that seems reasonable. I'm not aware of how to select more than one item in dmenu, but maybe I'm missing something. I would implement this myself, but unfortunately my node/js is a bit rusty.

@fogine
Copy link
Owner

fogine commented May 8, 2019

I'm not aware of how to select more than one item in dmenu

dmenu can be compiled with multi-select feature, users of rofi have also multi-select capabilities. Even without the multi-select feature when you have a device with multiple partitions, udiskie-dmenu will show this:

/dev/sdc  : DeviceName
/dev/sdc1 : DevicePartitionLabel
/dev/sdc2 : DevicePartitionLabel

In that case when you select the first option which represents the whole device, not just a single partition, udiskie-dmenu will operate on all device partitions, mounting or umounting them depending on its state.

Your particular case would be perhaps better solved if you hooked up directly to udiskie.
From its man pages:

-f PROGRAM, --file-manager=PROGRAM
Set program to open mounted directories. Default is 'xdg-open'.

So when you run udiskie as a daemon on system startup and specify your script under --file-manager option, it should work:

eg. in your .xinitrc

udiskie --file-manager /path/to/your/executable &

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants