This script draws menu to choose, mount and unmount drives using udisksctl and ncurses for ranger file manager
Go to file
Syphdias a13aba5569
Cull children since the script does not mount parents
I don't thing this is entirely correct but I have no example at hand.
You should be able to create a filesystem on e.g. /dev/sde directly without
creating a partition /dev/sde1 first. So, technically this "parent" without
"children" should be mountable.

Since the script does not consider this. This commit filters for
elements/"parents" without "children".

For most cases this will keep the height of the output smaller not to run into a
curses crash. Not ideal and the curses crashes should get looked at, but for now
this will do to reduce crashes with small windows and large amount or block
devices – thanks snap.
2022-03-21 00:14:49 +01:00
.gitignore first 2021-04-25 19:25:47 +03:00
LICENSE Create LICENSE 2021-04-26 13:43:01 +03:00
menu.py Cull children since the script does not mount parents 2022-03-21 00:14:49 +01:00
mounter.py open selected mountpoint in the current tab 2021-06-11 15:47:46 +03:00
README.md update for older version of lsblk and update documentation 2021-06-19 14:51:28 +03:00
screenshot.png fix help string 2021-04-25 21:35:48 +03:00

Ranger udisk menu

This script draws menu to mount and unmount partitions using udisksctl and ncurses

Screenshot

Requirements

  • python3.8 or newer
  • udisks2 (for udisksctl)
  • lsblk 2.3 or newer

How to install

Firstly you need to clone this repo to ranger config directory

cd ~/.config/ranger
git clone https://github.com/SL-RU/ranger_udisk_menu

Then you need to add to ~/.config/ranger/commands.py line:

from ranger_udisk_menu.mounter import mount

Thats all

How to use

Enter in ranger :mount, than will be shown menu. In this menu you can press:

  • j or arrow down or Ctrl+n to move selection down
  • k or arrow up or Ctrl+p to move selection up
  • Ctrl+g or Esc or q to quit
  • g or r to refresh all partitions and drives
  • m to mount selected partition
  • u to unmount selected partition
  • e to unmount all partitions of selected partition's drive
  • p to power off selected the selected partition's drive (also called safely remove). It can be done only when all partitions of the drive are unmounted
  • ENTER to open selected mountpoint in current tab of the ranger

Troubles

If there is trouble with permissions, then you need to create group storage and add your user to it. Then you need to update your Polkit or PolicyKit permissions like it shown here: https://github.com/coldfix/udiskie/wiki/Permissions