launcher: search ~/Documents and ~/Downloads, not all of $HOME

Searching $HOME buried real results under game assets and nixos config
files. A missing root is harmless: fd reports it on stderr, which nothing
reads, and still searches the rest at exit 0.
This commit is contained in:
rope 2026-08-03 12:24:16 +01:00
parent 99525c98ed
commit 11f73e9e6a

View file

@ -1699,18 +1699,26 @@ in
open = false;
}
// File search: one fd run per settled keystroke, scoped to
// $HOME and nothing above it. No index and no daemon
// --max-results lets fd exit the moment it has enough, which
// is what keeps this feeling instant, and results are never
// stale the way a nightly updatedb is.
// File search: one fd run per settled keystroke. No index
// and no daemon --max-results lets fd exit the moment it has
// enough, which is what keeps this feeling instant, and
// results are never stale the way a nightly updatedb is.
//
// Dotfiles and dot-directories are skipped (fd's default
// there is deliberately no --hidden here). That is both what
// you want from a launcher and most of the speed: ~/.cache,
// ~/.local/share/Steam, ~/.var and every .git tree are the
// bulk of the files under $HOME and none of them are things
// you search for by name.
// Scoped to ~/Documents and ~/Downloads, not all of $HOME.
// Searching $HOME drowned the results in game assets and
// nixos config files technically matches, never what was
// being looked for. These two are where documents a person
// goes hunting for by name actually live.
//
// A missing directory is fine: fd reports it on stderr, which
// nothing reads, and still searches the rest at exit 0.
//
// Dotfiles and dot-directories are also skipped (fd's default,
// there is deliberately no --hidden here).
readonly property var fdRoots: [
Quickshell.env("HOME") + "/Documents",
Quickshell.env("HOME") + "/Downloads"
]
property var fileHits: []
property string fdQuery: ""
// A run cut short still flushes whatever stdout it had, and
@ -1761,12 +1769,11 @@ in
Commands.fd, "--absolute-path", "--ignore-case",
"--type", "f", "--type", "d",
"--max-results", String(fdMax),
// node_modules is the one big junk tree that isn't
// hidden, so it still needs naming. The old .git /
// .cache / .steam excludes are gone with --hidden.
// node_modules is the one junk tree that is neither
// hidden nor outside these roots.
"--exclude", "node_modules",
pat, Quickshell.env("HOME")
];
pat
].concat(fdRoots);
fdProc.running = true;
}