From a57e9ab7dabea6ab03fe987cd8e9ab95ff2a60e4 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 21 Oct 2020 16:46:59 +0200 Subject: [PATCH] disks: Add removable media automounting `udiskie` is kept running in the background and automatically mounting any inserted media, which will then also show its tray icon so that it can be quickly unmounted as well. Additional ideas would be to allow mounting / unmounting through keyboard sequences instead of gui (via rofi for example). --- .../systemd/user/default.target.wants/udiskie.service | 1 + disks/.config/systemd/user/udiskie.service | 10 ++++++++++ disks/.config/udiskie/config.yml | 9 +++++++++ disks/README.md | 9 +++++++++ 4 files changed, 29 insertions(+) create mode 120000 disks/.config/systemd/user/default.target.wants/udiskie.service create mode 100644 disks/.config/systemd/user/udiskie.service create mode 100644 disks/.config/udiskie/config.yml create mode 100644 disks/README.md diff --git a/disks/.config/systemd/user/default.target.wants/udiskie.service b/disks/.config/systemd/user/default.target.wants/udiskie.service new file mode 120000 index 0000000..fceef55 --- /dev/null +++ b/disks/.config/systemd/user/default.target.wants/udiskie.service @@ -0,0 +1 @@ +../udiskie.service \ No newline at end of file diff --git a/disks/.config/systemd/user/udiskie.service b/disks/.config/systemd/user/udiskie.service new file mode 100644 index 0000000..9daa44b --- /dev/null +++ b/disks/.config/systemd/user/udiskie.service @@ -0,0 +1,10 @@ +[Unit] +Description=Automated mounting of removable devices (udisks) + +[Service] +# workaround to allow relative executable invocation (i.e. current users' home dir) +ExecStart=/usr/bin/udiskie +Restart=always + +[Install] +WantedBy=default.target diff --git a/disks/.config/udiskie/config.yml b/disks/.config/udiskie/config.yml new file mode 100644 index 0000000..f105bb6 --- /dev/null +++ b/disks/.config/udiskie/config.yml @@ -0,0 +1,9 @@ +program_options: + tray: auto + automount: true + notify: true +device_config: +# ignore any snap loopback devices +# see https://github.com/coldfix/udiskie/issues/180 +- id_type: squashfs + ignore: true diff --git a/disks/README.md b/disks/README.md new file mode 100644 index 0000000..fbeab62 --- /dev/null +++ b/disks/README.md @@ -0,0 +1,9 @@ +# Removable disk configuration + +This simple unit depends on `udiskie2` being installed and enables auto-mounting of any inserted removable media. +It will additionally *ignore* any snaps managed by `snapd`, since they would otherwise be detected as loopback devices. + +Automatically installs a `systemd` service which is also enabled to start up on system start (as a user service). + +The end result is `udiskie` running in the background and automatically mounting any inserted media, +which will then also show its tray icon so that it can be quickly unmounted as well.