fogine / udiskie-dmenu

Manage removable devices in couple of keystrokes!
MIT License
44 stars 4 forks source link

Do something sensible when no disks are present #4

Closed rien333 closed 5 years ago

rien333 commented 5 years ago

Currently, I get an empty dmenu prompt when I have no disks present. I'm working on a PR to remedy this, but I was wondering:

  1. Is this behavior intentional? There is already a line:
    notifyIfErr(`Nothing to unmount / mount`);
  2. I think I would like to have just nothing happen if I call this command (sometimes I press the keybinding by accident), but maybe you would prefer if a notification is send when no disks are found?

My javascript is not terribly good, so if you have a quick fix then I will stop work on my PR :)

fogine commented 5 years ago

Thank you for your pull request! I have merged your changes and added notification before exit as the user should be properly informed. Just exiting without notification could be frustrating as the user wouldnt know whats happening.

There is already a line: notifyIfErr(Nothing to unmount / mount);

The notification in that case was misleading as in that case, the user selected a device which couldn't be recognized by the script.

If you really wanted the behavior of aborting without the notification, the --quiet/-q option could be added. However that would require breaking changes to how dmenu/rofi arguments are provided.