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