diff --git a/hosts/common/programs/rofi/config.rasi b/hosts/common/programs/rofi/config.rasi index f0a2db6e..5b9de123 100644 --- a/hosts/common/programs/rofi/config.rasi +++ b/hosts/common/programs/rofi/config.rasi @@ -11,6 +11,7 @@ configuration { kb-accept-entry: "Return,KP_Enter,XF86PowerOff"; kb-row-up: "Up,XF86AudioRaiseVolume"; kb-row-down: "Down,XF86AudioLowerVolume"; + cache-dir: "~/.cache/rofi"; /* to position rofi to the top of the screen: */ /* location: 2; */ @@ -31,7 +32,8 @@ configuration { filebrowser { /* directory: filebrowser starting directory. leave unset to start at the last directory. */ - directory: "/home"; + /* directory: "/home"; */ + /* display-name: text to prepend in combi mode */ display-name: "/"; /* `command` is the prefix to prepend (along with a space) *before* passing it off to `run-command` */ diff --git a/hosts/common/programs/rofi/default.nix b/hosts/common/programs/rofi/default.nix index 060851fc..20306049 100644 --- a/hosts/common/programs/rofi/default.nix +++ b/hosts/common/programs/rofi/default.nix @@ -97,12 +97,10 @@ in ]; fs.".config/rofi/config.rasi".symlink.target = ./config.rasi; - # redirect its default drun cache location - fs.".cache/rofi3.druncache".symlink.target = "rofi/rofi3.druncache"; - fs.".cache/rofi3.filebrowsercache".symlink.target = "rofi/rofi3.filebrowsercache"; - fs.".cache/rofi-drun-desktop.cache".symlink.target = "rofi/rofi-drun-desktop.cache"; persist.byStore.cryptClearOnBoot = [ - # optional, for caching .desktop files rofi finds on disk (perf) + # this gets us a few things: + # - file browser remembers its last directory + # - caching of .desktop files (perf) ".cache/rofi" ]; }; diff --git a/hosts/common/programs/rofi/rofi-run-command b/hosts/common/programs/rofi/rofi-run-command index fe2ad884..423936a0 100755 --- a/hosts/common/programs/rofi/rofi-run-command +++ b/hosts/common/programs/rofi/rofi-run-command @@ -14,6 +14,12 @@ shift binArgs=("$@") if [ "$desktop" != .desktop ]; then + # launching an app; the file browser position is no longer interesting: clear it so it opens in ~ next time. + # better UX would be to manage this in the other branch: + # - open in ~ by default, regardless of last directory + # - after launching a *file*, when that file is closed, re-open rofi in that file's directory. + # however, `xdg-open` and the `OpenFile` xdg-desktop-portal API don't give any obvious way to block for the app to close. + rm -f ~/.cache/rofi/rofi3.filebrowsercache exec sane-open-desktop "$desktop" elif [ "$binary" = "xdg-open" ]; then exec xdg-open "$@"