Skip to content

Windows shell replacement in Rust: taskbar, file manager, NTFS search, task manager, disk cleaner. One installer exe.

Rust

rust-explorer: Ctrl+A selects all, Quick access follows moved known folders; topbar search: Ctrl+A, Ctrl+Backspace

Lemxyc93e4c3bb698
diff --git a/CLAUDE.md b/CLAUDE.md
index f862e42..d5a6681 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -57,6 +57,7 @@ powershell -ExecutionPolicy Bypass -File scripts\update-plugin.ps1 <rust-search|
- Никаких `Co-Authored-By` и упоминаний Claude в коммитах, PR и релизах: Claude не должен появляться контрибьютором. Это важнее общих шаблонов атрибуции.
- Автор: `Lemxy <[email protected]>` (уже в git config). Настоящую почту владельца в репозиторий не писать.
- `git push --force`, удаление репозитория/тегов/релизов и смена видимости только по прямой просьбе.
+- Чужие PR вливать только через `git merge --squash` и коммит от Lemxy без `Co-Authored-By` (владелец не хочет чужих контрибьюторов в истории). Мерж-коммиты с авторством автора PR не использовать; после пуша PR на GitHub уже будут помечены merged.
- Не коммитить `payload\*.exe`, `target\`, логи (они в `.gitignore`).
**Документация.**
diff --git a/plugins/rust-explorer/src/main.rs b/plugins/rust-explorer/src/main.rs
index d85aeab..9bbf93c 100644
--- a/plugins/rust-explorer/src/main.rs
+++ b/plugins/rust-explorer/src/main.rs
@@ -500,6 +500,16 @@ mod sh {
}).collect()
}
+ /// A known folder where Windows says it is (it may be moved to another drive).
+ pub fn known_dir(id: &GUID) -> Option<PathBuf> {
+ unsafe {
+ let p = SHGetKnownFolderPath(id, KF_FLAG_DEFAULT, None).ok()?;
+ let s = p.to_string().ok();
+ CoTaskMemFree(Some(p.0 as *const c_void));
+ s.map(PathBuf::from)
+ }
+ }
+
pub fn init() { unsafe { let _ = OleInitialize(None); } }
fn wide(p: &PathBuf) -> Vec<u16> { p.as_os_str().encode_wide().chain([0]).collect() }
@@ -1201,6 +1211,13 @@ unsafe extern "system" fn proc(h: HWND, m: u32, wp: WPARAM, lp: LPARAM) -> LRESU
}
0x5D if !paths.is_empty() => item_menu(h, &dir, &paths),
0x43 | 0x58 if ctrl && !paths.is_empty() => { let _ = sh::clip_set(h, &paths, vk == 0x58); return 0; }
+ 0x41 if ctrl => { // Ctrl+A: select all (state mask LVIS_SELECTED, item -1 = every row)
+ let mut it: LVITEMW = std::mem::zeroed();
+ it.stateMask = LVIS_SELECTED;
+ it.state = LVIS_SELECTED;
+ put(list, LVM_SETITEMSTATE, usize::MAX, &it as *const _ as isize);
+ return 0;
+ }
0x56 if ctrl => paste(h, &dir),
0x4E if ctrl => new_entry(&dir, "New folder", true),
0x48 if ctrl => { SHOW_HIDDEN.fetch_xor(true, Relaxed); } // Ctrl+H: hidden files
diff --git a/plugins/rust-explorer/src/ui.rs b/plugins/rust-explorer/src/ui.rs
index 1f1c5fe..7ee9dd2 100644
--- a/plugins/rust-explorer/src/ui.rs
+++ b/plugins/rust-explorer/src/ui.rs
@@ -729,9 +729,10 @@ pub fn nav_init(h: HWND) {
let home = PathBuf::from(env::var_os("USERPROFILE").unwrap_or_default());
let head = |t: &str| NavItem { title: t.into(), path: PathBuf::new(), glyph: "", cap: None };
let mut v = vec![head("Quick access"), NavItem { title: "Home".into(), path: home.clone(), glyph: "\u{E80F}", cap: None }];
- for (t, sub, g) in [("Desktop", "Desktop", "\u{E7F4}"), ("Downloads", "Downloads", "\u{E896}"), ("Documents", "Documents", "\u{E8A5}"), ("Pictures", "Pictures", "\u{E91B}"), ("Music", "Music", "\u{E8D6}"), ("Videos", "Videos", "\u{E714}")] {
- let p = home.join(sub);
- if p.is_dir() { v.push(NavItem { title: t.into(), path: p, glyph: g, cap: None }); }
+ use windows::Win32::UI::Shell::{FOLDERID_Desktop, FOLDERID_Documents, FOLDERID_Downloads, FOLDERID_Music, FOLDERID_Pictures, FOLDERID_Videos};
+ for (t, id, g) in [("Desktop", &FOLDERID_Desktop, "\u{E7F4}"), ("Downloads", &FOLDERID_Downloads, "\u{E896}"), ("Documents", &FOLDERID_Documents, "\u{E8A5}"), ("Pictures", &FOLDERID_Pictures, "\u{E91B}"), ("Music", &FOLDERID_Music, "\u{E8D6}"), ("Videos", &FOLDERID_Videos, "\u{E714}")] {
+ let Some(p) = crate::sh::known_dir(id).filter(|p| p.is_dir()) else { continue };
+ v.push(NavItem { title: t.into(), path: p, glyph: g, cap: None });
}
v.push(head("This PC"));
unsafe {
diff --git a/plugins/topbar/src/fly.rs b/plugins/topbar/src/fly.rs
index 6b4e5e2..5d12640 100644
--- a/plugins/topbar/src/fly.rs
+++ b/plugins/topbar/src/fly.rs
@@ -105,6 +105,7 @@ thread_local! {
static CTX: RefCell<Option<(String, i32, i32, u64)>> = const { RefCell::new(None) }; // Wi-Fi right-click menu: network (by name: the list reorders), x, y (px), opened at
static QUERY: RefCell<String> = const { RefCell::new(String::new()) };
static SCROLL: Cell<usize> = const { Cell::new(0) };
+ static SELALL: Cell<bool> = const { Cell::new(false) }; // Ctrl+A in the search: the next key replaces the query
static ICONS: RefCell<HashMap<Vec<u16>, HICON>> = RefCell::new(HashMap::new()); // by path: the app list is reloaded and reordered
static SEL: Cell<usize> = const { Cell::new(0) }; // Start: the row Enter opens (arrow keys move it)
static OVER: Cell<Option<Act>> = const { Cell::new(None) };
@@ -880,6 +881,7 @@ pub fn toggle(k: Kind) {
HV.with_borrow_mut(|m| m.retain(|k, _| *k < 1_000_000)); // flyout keys are >= 1_000_000: no stale glow from the last panel
CTX.set(None);
QUERY.set(String::new());
+ SELALL.set(false);
SCROLL.set(0);
SEL.set(0);
PASS.set(None);
@@ -1573,7 +1575,7 @@ unsafe fn paint(hw: HWND, k: Kind) {
if q.is_empty() {
text(dc, "Type to search apps", r(64, 20, w - 64, 56), pal().dim, DT_LEFT);
} else {
- text(dc, &q, r(64, 20, w - 64, 56), pal().text, DT_LEFT);
+ text(dc, &q, r(64, 20, w - 64, 56), if SELALL.get() { pal().accent } else { pal().text }, DT_LEFT);
}
if let Some((kr, ka)) = rects(k).into_iter().find(|(_, a)| *a == Act::Keyboard) {
g(ka, kr, card, mix(card, pal().text, 0.1), sc(14));
@@ -1817,9 +1819,16 @@ unsafe extern "system" fn proc(hw: HWND, msg: u32, wp: WPARAM, lp: LPARAM) -> LR
}
} else {
QUERY.with_borrow_mut(|q| {
- if c == 8 {
- q.pop();
+ let all = SELALL.replace(false);
+ if c == 1 {
+ SELALL.set(!q.is_empty()); // Ctrl+A
+ } else if c == 127 {
+ // Ctrl+Backspace: the last word
+ if all { q.clear() } else { let t = q.trim_end().len(); q.truncate(q[..t].rfind(' ').map_or(0, |i| i + 1)); }
+ } else if c == 8 {
+ if all { q.clear() } else { q.pop(); }
} else if let Some(ch) = char::from_u32(c).filter(|_| c >= 32) {
+ if all { q.clear() }
q.push(ch);
}
});