dfmd/README.md

81 lines
1.9 KiB
Markdown
Raw Normal View History

2024-02-03 16:03:43 +00:00
# dfmd
A small utility daemon to handle "open containing folder" activities in various
software.
🦊
2024-02-03 16:45:32 +00:00
## Quick installation
AUR package: `dfmd-git`
2024-02-03 19:33:28 +00:00
If some other handler takes precedence over this one, try copying the D-Bus
2024-02-03 16:45:32 +00:00
service file into your user directory. Also make sure no other service is
running while executing `dfmd`.
2024-02-03 16:53:15 +00:00
Bash et al.:
```sh
mkdir -p "${XDG_DATA_HOME:-"$HOME/.local/share"}/dbus-1/services"
cp /usr/share/dbus-1/services/sh.natty.FileManager1.service "${XDG_DATA_HOME:-"$HOME/.local/share"}/dbus-1/services/org.freedesktop.FileManager1.service"
```
Fish:
```sh
# Fallback universal variable in case XDG_DATA_HOME is not set
set -U XDG_DATA_HOME ~/.local/share
mkdir -p "$XDG_DATA_HOME/dbus-1/services"
cp /usr/share/dbus-1/services/sh.natty.FileManager1.service "$XDG_DATA_HOME/dbus-1/services/org.freedesktop.FileManager1.service"
```
2024-02-03 16:45:32 +00:00
2024-02-03 16:03:43 +00:00
## Dependencies
2024-02-03 19:33:28 +00:00
- D-Bus
2024-02-03 16:03:43 +00:00
- xdg-open as the default handler
## Building
2024-02-03 16:53:15 +00:00
```sh
2024-02-03 16:03:43 +00:00
cargo build --release
```
## Configuration
2024-02-03 19:33:28 +00:00
Use the DFMD_*_PROGRAM environment variables. Filenames are provided via stdin,
one per line.
2024-02-03 16:03:43 +00:00
### Default handler programs
2024-02-03 16:53:15 +00:00
```sh
2024-02-03 19:33:28 +00:00
DFMD_FOLDER_PROGRAM="xargs -r -n1 xdg-open"
DFMD_ITEMS_PROGRAM="xargs -r -n1 dirname | xargs -n1 xdg-open"
DFMD_PROPERTIES_PROGRAM="xargs -r -n1 xdg-open"
2024-02-03 16:03:43 +00:00
```
## Autostart
2024-02-03 19:33:28 +00:00
Create a D-Bus service in
2024-02-03 16:03:43 +00:00
`$XDG_DATA_HOME/dbus-1/services/org.freedesktop.FileManager1.service`.
(The default directory for `XDG_DATA_HOME` is `$HOME/.local/share/`)
```
[D-BUS Service]
Name=org.freedesktop.FileManager1
Exec=path/to/dfmd
```
2024-02-03 19:17:23 +00:00
## Overriding defaults in D-Bus service files
Since D-Bus service files do not understand environment variables, the actions
can be overridden using `env`:
(Theoretical example where showing a file sends a desktop notification)
```
[D-BUS Service]
Name=org.freedesktop.FileManager1
2024-02-03 19:33:28 +00:00
Exec=env DFMD_ITEMS_PROGRAM="xargs -r -n1 dirname | xargs -n1 notify-send 'File opened'" /usr/bin/dfmd
2024-02-03 19:17:23 +00:00
```