Better pipes
This commit is contained in:
parent
3c871e994d
commit
90f2a2db1d
19
README.md
19
README.md
|
@ -48,9 +48,9 @@ list of input files.
|
|||
### Default handler programs
|
||||
|
||||
```sh
|
||||
DFMD_FOLDER_PROGRAM='echo %ARGS% | xargs -n1 xdg-open'
|
||||
DFMD_ITEMS_PROGRAM='echo %ARGS% | xargs -d " " -I {} sh -c '"'"'p="{}"; echo "${p%/*}"'"'"' | xargs -n1 xdg-open'
|
||||
DFMD_PROPERTIES_PROGRAM='echo %ARGS% | xargs -n1 xdg-open'
|
||||
DFMD_FOLDER_PROGRAM="echo %ARGS% | xargs -n1 xdg-open"
|
||||
DFMD_ITEMS_PROGRAM="echo %ARGS% | xargs -d ' ' -r -n1 dirname | xargs -n1 xdg-open"
|
||||
DFMD_PROPERTIES_PROGRAM="echo %ARGS% | xargs -n1 xdg-open"
|
||||
```
|
||||
|
||||
## Autostart
|
||||
|
@ -65,3 +65,16 @@ Create a DBus service in
|
|||
Name=org.freedesktop.FileManager1
|
||||
Exec=path/to/dfmd
|
||||
```
|
||||
|
||||
## 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
|
||||
Exec=env DFMD_ITEMS_PROGRAM="echo %ARGS% | xargs -d ' ' -r -n1 dirname | xargs -n1 notify-send 'File opened'" /usr/bin/dfmd
|
||||
```
|
||||
|
|
|
@ -66,9 +66,9 @@ async fn main() -> eyre::Result<()> {
|
|||
.ok()
|
||||
.unwrap_or_else(|| r#"echo %ARGS% | xargs -n1 xdg-open"#.to_string());
|
||||
|
||||
let show_items_program = env::var("DFMD_ITEMS_PROGRAM").ok().unwrap_or_else(||
|
||||
r#"echo %ARGS% | xargs -d " " -I {} sh -c 'p="{}"; echo "${p%/*}"' | xargs -n1 xdg-open"#.to_string(),
|
||||
);
|
||||
let show_items_program = env::var("DFMD_ITEMS_PROGRAM").ok().unwrap_or_else(|| {
|
||||
r#"echo %ARGS% | xargs -d ' ' -r -n1 dirname | xargs -n1 xdg-open"#.to_string()
|
||||
});
|
||||
|
||||
let show_properties_program = env::var("DFMD_PROPERTIES_PROGRAM")
|
||||
.ok()
|
||||
|
|
Loading…
Reference in New Issue