Skip to content

Renhg/ranger-usb-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ranger-usb-manager

A lightweight Bash script to mount and unmount USB drives and automatically open Ranger at the mount point.

Designed for minimalist Linux environments and keyboard-driven workflows such as qtile, i3, sway, and bspwm.


🚀 Why ranger-usb-manager?

In many minimalist setups, mounting a USB drive usually means:

  • opening a terminal
  • running mount commands manually
  • navigating to the mount point
  • dealing with permissions or root access

This project removes that friction.

With a single command or keybinding, your USB device is mounted safely and opened directly in Ranger — no root, no mouse, no hassle.


✨ Features

  • 🔌 Safe mount and unmount using udisksctl
  • 📂 Automatically opens Ranger at the mount point
  • 🔢 Supports multiple USB devices using numeric indexes
  • ⌨️ Perfect for window manager keybindings
  • 🔧 Configurable terminal and file manager
  • 🚫 No root permissions required
  • 🧠 Simple, readable, and hackable Bash script

📦 Requirements

The following tools must be installed:

  • bash
  • udisks2
  • lsblk (from util-linux)
  • ranger
  • alacritty (or any terminal emulator)

Arch Linux

sudo pacman -S udisks2 util-linux ranger alacritty

### Installation

git clone https://github.com/YOUR_USERNAME/ranger-usb-manager.git
cd ranger-usb-manager
chmod +x usb-manager.sh
cp usb-manager.sh ~/.local/bin/

###Usage

##Mount a USB device

usb-manager.sh mount 1

###Unmount a USB device

usb-manager.sh unmount 1

USB devices are indexed starting from 1, based on the order
reported by lsblk.

###Configuration

You can override the terminal emulator or file manager
using environment variables:

TERMINAL=kitty FILEMANAGER=lf usb-manager.sh mount 1

About

Minimal USB mount/unmount manager for Linux with Ranger and Qtile integration

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages