feat(udiskie): add aristides/udiskie plugin for usb/media drives management (#256)

* feat(udiskie): add Udiskie service for real-time device monitoring, notifications, and IPC

* feat(udiskie): add main manager panel for drives and partitions

* feat(udiskie): add plugin manifest, status widget, and english translation

* feat(udiskie): add Makefile for testing and linting translations

* feat(udiskie): add error handling for missing udiskie package

* feat(udiskie): add right-click functionality to refresh Udiskie service

* feat(udiskie): add option to hide widget when no devices are connected

* feat(udiskie): add settings button to the panel for quick access to configuration

* feat(udiskie): add button to copy mount path to clipboard in partition row

* fix(udiskie): duplicated notifications when removing or unmounting devices

* feat(udiskie): add disk usage information for mounted partitions in device state

* feat(udiskie): update partition row status colors and enhance UI for status display

* fix(udiskie): adjust timeout to give time for sudo tasks such as LUKS unlock

* feat(udiskie): update partition row status color for LUKS devices and adjust panel width

* fix(udiskie): scroll not working properly and items overflow container

* feat(udiskie): add missing translations and remove hardcoded strings messages

* feat(udiskie): add README and thumbnail

* docs(udiskie): add performance section to README with resource usage comparison

* fix(udiskie): update output parsing to use safe tab delimiters for device information

* fix(udiskie): improve device hierarchy parsing to correctly identify partitions

* feat(udiskie): centralize open with file manager code, and close panel on auto-open on mount (like manually open)

* fix(udiskie): exclude LUKS containers from "Drive Connected" notifications

* fix(udiskie): quote paths and device names in shell commands

* fix(udiskie): improve error message cleaning regex

* feat(udiskie): enhance README with device attributes and update service to suppress errors

* fix(udiskie): use shell quoting for device paths in panel async commands

* feat(udiskie): add spanish translations and update tests to check every translation
This commit is contained in:
Arístides Pérez
2026-08-05 17:58:15 -04:00
committed by GitHub
parent 52bb05d5aa
commit 57e4b108c4
10 changed files with 1055 additions and 0 deletions
+98
View File
@@ -0,0 +1,98 @@
# Udiskie Manager
Manage USB drives and media with notifications in just one panel.
## Features
- Real-time device discovery and status monitoring via UDisks2 event streaming.
- Storage capacity and partition usage indicators with formatted bytes and percentage.
- Automatic detection and dedicated unlock action for LUKS encrypted volumes (`crypto_LUKS`).
- Interactive management panel with drive hierarchy, open, mount, unmount, eject, and power off actions.
- Copy mount path to clipboard action.
- Configurable bar widget with mounted device counter and auto-hide when empty option.
- Native desktop notifications for drive connections, disconnections, mounts, unmounts, and errors.
- Quick refresh and native settings integration.
## Plugin
| Field | Value |
| ------- | ---------------------------------------------------------- |
| ID | `aristides/udiskie` |
| Entries | Bar widget: `status`; panel: `manager`; service: `service` |
## Requirements
Install `udiskie`, `udisks2`, and `xdg-open` on `PATH`:
- `udiskie`: Device mount operations and device info queries.
- `udisks2`: Provides `udisksctl` for real-time DBus event streaming.
- `xdg-open`: Launcher binary for opening mounted folders in the file manager.
> **`udiskie-info -o` fields**: the service queries `udiskie-info -o` with the
> device attributes listed under `VALID_PARAMETERS` (e.g. `is_drive`,
> `is_partition`, `is_luks`, `mount_path`, `is_detachable`). If your `udiskie` is
> old enough to lack any of them, the device list will come back empty — upgrade
> `udiskie` in that case. A recent release (2.x) is recommended.
## Usage
- **Bar Widget (`status`)**: Add `status` to the bar configuration in Noctalia settings. Left-click to open the Udiskie Manager Panel. Right-click to trigger an immediate plugin refresh.
- **Panel (`manager`)**: Open via the bar widget or run:
```sh
noctalia msg panel-toggle aristides/udiskie:manager
```
## Settings
| Setting | Type | Default | Description |
| ----------------------- | -------- | ------------ | ---------------------------------------------------------------------- |
| `enable_notifications` | `bool` | `true` | Show desktop notifications on drive events and errors. |
| `auto_open_filemanager` | `bool` | `false` | Automatically open mounted drives in the file manager upon connection. |
| `file_manager_cmd` | `string` | `xdg-open` | File manager launcher command. |
| `glyph` | `glyph` | `device-usb` | Icon glyph shown for the widget on the bar. |
| `show_count` | `bool` | `true` | Display the count of mounted devices on the bar widget. |
| `hide_when_empty` | `bool` | `false` | Hide the bar widget when no USB drives are connected. |
## IPC
```sh
# Toggle panel
noctalia msg panel-toggle aristides/udiskie:manager
# Service actions
noctalia msg plugin aristides/udiskie:service all mount /dev/sdX
noctalia msg plugin aristides/udiskie:service all unmount /dev/sdX
noctalia msg plugin aristides/udiskie:service all eject /dev/sdX
noctalia msg plugin aristides/udiskie:service all detach /dev/sdX
noctalia msg plugin aristides/udiskie:service all mount_all
noctalia msg plugin aristides/udiskie:service all unmount_all
noctalia msg plugin aristides/udiskie:service all refresh
```
## Performance
The plugin eliminates the standalone Python `udiskie` daemon by using an event-driven `udisksctl monitor` subprocess managed by Noctalia. Both approaches activate `udisksd` via D-Bus on first use.
| Component | RSS | VSZ | CPU |
| ------------------------------------ | ---------- | -------- | ---- |
| `udisksctl monitor` (this plugin) | ~12 MB | ~170 MB | 0.0% |
| `udiskie` Python daemon (standalone) | ~84–110 MB | ~1183 MB | 0.2% |
| `udisksd` (shared, D-Bus activated) | ~22 MB | ~688 MB | 0.2% |
**Total footprint**: plugin ~34 MB vs standalone ~106–132 MB. **Saves ~72–98 MB RAM** and avoids a persistent Python process.
> Measurements are local to a given system/kernel and udiskie version; actual
> RSS/VSZ/CPU values vary by hardware and environment.
## Development
Run plugin validation and tests using the workspace Makefile:
```sh
make test
```
## Notes
- Requires plugin API level 9 or newer.