Windows shell replacement in Rust: taskbar, file manager, NTFS search, task manager, disk cleaner. One installer exe.
Rust
Restore original service startup settings on Explorer uninstall (PR #46)
Lemxy2b907e17e451
diff --git a/Cargo.toml b/Cargo.tomlindex 5025d57..a10e5ea 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -11,7 +11,7 @@ test = false # the embedded manifest demands admin: a test exe could not start f[dependencies]winrust-common = { path = "common" }-windows-sys = { version = "0.61.2", features = ["Win32_Foundation", "Win32_Graphics_Dwm", "Win32_Graphics_Gdi", "Win32_Graphics_GdiPlus", "Win32_System_Console", "Win32_System_LibraryLoader", "Win32_UI_Input_KeyboardAndMouse", "Win32_UI_WindowsAndMessaging"] }+windows-sys = { version = "0.61.2", features = ["Win32_Foundation", "Win32_Graphics_Dwm", "Win32_Graphics_Gdi", "Win32_Graphics_GdiPlus", "Win32_System_Console", "Win32_System_LibraryLoader", "Win32_System_Registry", "Win32_UI_Input_KeyboardAndMouse", "Win32_UI_WindowsAndMessaging"] }[build-dependencies]embed-resource = "3"@@ -45,3 +45,7 @@ strip = true[profile.release.package.rs-du]opt-level = 3 # MFT parsing: speed over size, as before the workspace++[[test]]+name = "explorer-service-settings"+path = "src/install/explorer/dword_snapshot.rs"diff --git a/README.md b/README.mdindex 18116ff..b2863f9 100644--- a/README.md+++ b/README.md@@ -30,6 +30,8 @@ The installer is in English. The **Русский** button in its corner (or "Wi- One plugin at a time: `plugin-launcher uninstall <plugin>` (see [Command line](#command-line)).- **If the screen is left without a taskbar or desktop:** press Ctrl+Alt+Del → Task Manager → Run new task → `explorer.exe`, then run the installer and press Remove all.+On uninstall, `rust-explorer` restores the service startup values and the svchost grouping threshold saved before installation. Older installs without those backups keep their current values and report a warning.+## What gets installed| Plugin | What you get | What it changes in Windows |@@ -37,7 +39,7 @@ The installer is in English. The **Русский** button in its corner (or "Wi| **rust-search** | File search over all NTFS drives, Alt+Space | Disables the Windows Search service, blocks SearchHost.exe, hides the taskbar search box || **rtaskmgr-win32** | Task Manager (Ctrl+Shift+Esc opens it) | `taskmgr.exe` is redirected to it (the system file is untouched). Also installs the **rs-du** disk cleaner. The **Speed** page has opt-in, reversible switches: Game / Work profiles (stop background services, close launchers or sync apps, start them again), clear the memory standby cache (now, or automatically while topbar runs), block the Windows Start menu, widgets and Phone Link processes, one weekly `winget upgrade` instead of third-party updaters, Defender exclusions for build caches and game libraries, faster NTFS (no last-access times, no 8.3 names), an ad-blocking hosts file. **Startup** also lists logon/boot tasks and third-party auto-start services, with how much each slowed the last boots (Windows' own boot log). **What's slow** shows driver time (DPC/interrupts), hung windows, slow disk and boot times. Uninstall turns all of it back || **topbar** | A Windows 11-style bottom bar: windows, clock, volume, menus | Hides the stock taskbar. Also installs **reshell** (hotkeys: Win+1/2/3 and Win+\` switch desktops, Win+D shows the desktop, Win+I opens Settings, Win+E the file manager; brings the taskbar back if the bar dies), **rs-du**, and a block in your PowerShell profile (`zoxide`, `grep`=rg, `ll`=eza, `cat`=bat; does nothing if they are missing) |-| **rust-explorer** | A file manager with tabs, and the desktop | Folders and drives open in it; **Explorer stops being the shell** (comes back by itself if topbar fails). Disables PcaSvc, InventorySvc, lfsvc, cbdhsvc, sets DoSvc to manual, merges svchost processes. Its own copier (several files at once on SSDs, unbuffered for big files, progress in the status line) and right-click **Compress to ZIP** (all cores) / **Extract here** (ZIP and 7z). Requires topbar |+| **rust-explorer** | A file manager with tabs, and the desktop | Folders and drives open in it; **Explorer stops being the shell** (comes back by itself if topbar fails). On fresh installs, adjusts the startup settings of PcaSvc, InventorySvc, lfsvc, cbdhsvc and DoSvc, and the svchost grouping threshold, when their values can be backed up. Its own copier (several files at once on SSDs, unbuffered for big files, progress in the status line) and right-click **Compress to ZIP** (all cores) / **Extract here** (ZIP and 7z). Requires topbar || **wiztree** | A disk-usage map ("WinRust Disk" in Start) | Nothing, apart from the file and a shortcut || **photoview** | A fast photo viewer | Adds it to "Open with" (it does not become the default) || **rust-settings** | Settings in Rust: display (resolution, refresh rate), sound (volume), power plan and drive space, per-app volume and device choice, night light, display arrangement by dragging, network adapters, Wi-Fi on every adapter (password or 802.1X), VPN and proxy, Bluetooth, apps, Windows Update, disk cleanup, theme, about | Nothing, apart from the file and a shortcut. Win+I and the bar menus open this window instead of Windows Settings (only a few rare pages still open the system ones) |diff --git a/README.ru.md b/README.ru.mdindex dbd4ccd..ba58d71 100644--- a/README.ru.md+++ b/README.ru.md@@ -30,6 +30,8 @@- По одному плагину: `plugin-launcher uninstall <плагин>` (см. [Командная строка](#командная-строка)).- **Если на экране не осталось панели или рабочего стола:** Ctrl+Alt+Del → Диспетчер задач → Запустить новую задачу → `explorer.exe`, затем откройте установщик и нажмите «Удалить всё».+При удалении `rust-explorer` восстанавливает настройки запуска служб и порог группировки svchost, сохранённые перед установкой. Если в старой установке копий нет, текущие значения сохраняются и появляется предупреждение.+## Что ставится| Плагин | Что вы получаете | Что меняется в Windows |@@ -37,7 +39,7 @@| **rust-search** | Поиск файлов по всем NTFS-дискам, Alt+Space | Отключается служба поиска Windows, блокируется SearchHost.exe, прячется строка поиска на панели || **rtaskmgr-win32** | Диспетчер задач (Ctrl+Shift+Esc открывает его) | Запуск `taskmgr.exe` перенаправляется на него (системный файл не трогается). Заодно ставится чистильщик диска **rs-du**. На странице **«Ускорение»** обратимые переключатели, всё по желанию: профили «Игра» и «Работа» (останавливают фоновые службы, закрывают лаунчеры или синхронизацию и потом запускают обратно), очистка кэша памяти standby (сейчас или автоматически, пока работает topbar), блок процессов меню «Пуск» Windows, виджетов и «Связи с телефоном», один еженедельный `winget upgrade` вместо сторонних апдейтеров, исключения Defender для кэшей сборки и библиотек игр, быстрее NTFS (без времени последнего доступа и имён 8.3), блокировка рекламы через hosts. **«Автозагрузка»** показывает ещё задачи при входе и загрузке и сторонние службы с автозапуском и то, насколько каждая замедлила последние загрузки (журнал самой Windows). **«Что тормозит»** показывает время драйверов (DPC и прерывания), зависшие окна, медленный диск и время загрузки. Удаление всё возвращает || **topbar** | Нижняя панель в стиле Windows 11: окна, часы, громкость, меню | Стандартная панель задач прячется. Заодно ставятся **reshell** (хоткеи: Win+1/2/3 и Win+\` переключают рабочие столы, Win+D показывает рабочий стол, Win+I открывает Параметры, Win+E файловый менеджер; возвращает панель задач, если topbar упал), **rs-du** и блок в профиле PowerShell (`zoxide`, `grep`=rg, `ll`=eza, `cat`=bat; молчит, если их нет) |-| **rust-explorer** | Файловый менеджер с вкладками и рабочий стол | Папки и диски открываются в нём; **Проводник перестаёт быть оболочкой** (возвращается сам, если topbar не работает). Отключаются PcaSvc, InventorySvc, lfsvc, cbdhsvc, DoSvc ставится вручную, процессы svchost объединяются. Своё копирование (на SSD несколько файлов сразу, большие файлы без кэша, прогресс в строке состояния) и в меню правой кнопки **«Compress to ZIP»** (на всех ядрах) и **«Extract here»** (ZIP и 7z). Нужен topbar |+| **rust-explorer** | Файловый менеджер с вкладками и рабочий стол | Папки и диски открываются в нём; **Проводник перестаёт быть оболочкой** (возвращается сам, если topbar не работает). При первой установке меняются настройки запуска PcaSvc, InventorySvc, lfsvc, cbdhsvc и DoSvc, а также порог группировки svchost, если удалось сохранить их исходные значения. Своё копирование (на SSD несколько файлов сразу, большие файлы без кэша, прогресс в строке состояния) и в меню правой кнопки **«Compress to ZIP»** (на всех ядрах) и **«Extract here»** (ZIP и 7z). Нужен topbar || **wiztree** | Карта занятого места на диске («WinRust Disk» в Пуске) | Ничего, кроме файла и ярлыка || **photoview** | Быстрый просмотр фото | Добавляется в «Открыть с помощью» (по умолчанию не назначается) || **rust-settings** | Параметры на Rust: экран (разрешение, частота, ночной свет, расположение мониторов перетаскиванием), звук (устройства, громкость по приложениям), схема питания, место на дисках и очистка, сетевые адаптеры, Wi-Fi на всех адаптерах (пароль или 802.1X), VPN и прокси, Bluetooth, приложения, Центр обновления, тема, о системе | Ничего, кроме файла и ярлыка. Win+I и меню панели открывают это окно вместо Параметров Windows (лишь несколько редких разделов по-прежнему системные) |diff --git a/src/install/explorer.rs b/src/install/explorer.rsindex 87eda0f..ca6f4a2 100644--- a/src/install/explorer.rs+++ b/src/install/explorer.rs@@ -1,5 +1,12 @@//! rust-explorer: the file manager that replaces Explorer as folder handler and (with rs-shell) as the shell.use crate::*;+use windows_sys::Win32::System::Registry::{+ HKEY_LOCAL_MACHINE, KEY_QUERY_VALUE, KEY_SET_VALUE, REG_DWORD, RRF_RT_REG_DWORD,+ RegCloseKey, RegFlushKey, RegGetValueW, RegOpenKeyExW, RegSetValueExW,+};++mod dword_snapshot;+use dword_snapshot::{Dword, backup_and_set, restore};pub(crate) fn rx_dir() -> PathBuf {program_files().join("rust-explorer")@@ -16,28 +23,98 @@ pub(crate) const WINLOGON_KEY: &str = r"HKLM\SOFTWARE\Microsoft\Windows NT\Currepub(crate) const RX_SWITCH: &str = r"HKCU\Software\rs-shell";pub(crate) const RX_FOLDERS: [&str; 3] = [r"HKCU\Software\Classes\Directory\shell\open", r"HKCU\Software\Classes\Folder\shell\open", r"HKCU\Software\Classes\Drive\shell\open"];-// svchost RAM trim, done with rust-explorer: (service, Start we set, Windows default). Uninstall puts back the Windows defaults,-// not the values found at install: they may already be our own (the same tweak was first run by hand).-// DoSvc's key is ACL-protected on some builds, so every step is soft: a refused one is only a warning.-// DiagTrack (telemetry) is debloat's job: two plugins switching it would turn it back on when either one is removed.-pub(crate) const RX_SVCS: [(&str, u32, u32); 5] = [("PcaSvc", 4, 2), ("InventorySvc", 4, 2), ("lfsvc", 4, 3), ("cbdhsvc", 4, 2), ("DoSvc", 3, 2)];-pub(crate) const SPLIT_KEY: &str = r"HKLM\SYSTEM\CurrentControlSet\Control";-pub(crate) const SPLIT_DEFAULT: u32 = 3670016; // 3.5 GB: above it Windows gives every service its own svchost+// The original DWORDs are saved in the installer's HKLM state key before changing them.+const RX_SVCS: [(&str, u32); 5] = [("PcaSvc", 4), ("InventorySvc", 4), ("lfsvc", 4), ("cbdhsvc", 4), ("DoSvc", 3)];+const SPLIT_KEY: &str = r"HKLM\SYSTEM\CurrentControlSet\Control";+const SPLIT_VALUE: &str = "SvcHostSplitThresholdInKB";++fn trim_settings() -> impl Iterator<Item = (&'static str, String, &'static str, u32)> {+ RX_SVCS.into_iter()+ .map(|(service, start)| (service, svc_key(service), "Start", start))+ .chain(std::iter::once((SPLIT_VALUE, SPLIT_KEY.into(), SPLIT_VALUE, 0x4000000)))+}++fn trim_subkey(key: &str) -> Vec<u16> {+ wide(key.strip_prefix(r"HKLM\").expect("service settings live under HKLM"))+}++fn trim_registry_error(key: &str, name: &str, code: u32) -> String {+ format!(r"{key}\{name}: {}", std::io::Error::from_raw_os_error(code as i32))+}++fn trim_read((key, name): Dword<'_>) -> Result<Option<u32>, String> {+ let subkey = trim_subkey(key);+ let value_name = wide(name);+ let mut value = 0u32;+ let mut len = size_of::<u32>() as u32;+ let code = unsafe {+ RegGetValueW(HKEY_LOCAL_MACHINE, subkey.as_ptr(), value_name.as_ptr(), RRF_RT_REG_DWORD,+ null_mut(), (&mut value as *mut u32).cast(), &mut len)+ };+ match code {+ ERROR_SUCCESS if len == size_of::<u32>() as u32 => Ok(Some(value)),+ ERROR_FILE_NOT_FOUND | ERROR_PATH_NOT_FOUND => Ok(None),+ ERROR_SUCCESS => Err(trim_registry_error(key, name, ERROR_INVALID_DATA)),+ _ => Err(trim_registry_error(key, name, code)),+ }+}++fn trim_write((key, name): Dword<'_>, value: u32) -> Result<(), String> {+ let subkey = trim_subkey(key);+ let value_name = wide(name);+ let mut handle = null_mut();+ // Open an existing key so a removed service is not recreated during uninstall.+ let code = unsafe {+ RegOpenKeyExW(HKEY_LOCAL_MACHINE, subkey.as_ptr(), 0, KEY_QUERY_VALUE | KEY_SET_VALUE, &mut handle)+ };+ if code != ERROR_SUCCESS {+ return Err(trim_registry_error(key, name, code));+ }+ let bytes = value.to_le_bytes();+ let mut code = unsafe { RegSetValueExW(handle, value_name.as_ptr(), 0, REG_DWORD, bytes.as_ptr(), bytes.len() as u32) };+ if code == ERROR_SUCCESS && key == RX_STATE {+ // The backup and the service setting are in different hives. Persist the backup first.+ code = unsafe { RegFlushKey(handle) };+ }+ unsafe { RegCloseKey(handle) };+ if code != ERROR_SUCCESS {+ return Err(trim_registry_error(key, name, code));+ }+ if trim_read((key, name))? != Some(value) {+ return Err(tf!("{key}: не удалось подтвердить запись {name}", "{key}: could not verify the write to {name}"));+ }+ Ok(())+}-pub(crate) fn rx_trim(on: bool) {- for (s, off, def) in RX_SVCS {- let v = if on { off } else { def };- soft(&tf!("служба {s}", "service {s}"), run("reg", &["add", &format!(r"HKLM\SYSTEM\CurrentControlSet\Services\{s}"), "/v", "Start", "/t", "REG_DWORD", "/d", &v.to_string(), "/f"]));- if on && off == 4 {- let _ = run("sc.exe", &["stop", s]); // the per-user cbdhsvc_xxxx instance stops at the next sign-in+fn apply_service_trim() {+ for (backup, key, value, new) in trim_settings() {+ let result = backup_and_set((&key, value), (RX_STATE, backup), new, trim_read, trim_write);+ if matches!(&result, Ok(true)) && value == "Start" && new == 4 {+ let _ = run("sc.exe", &["stop", backup]);}+ soft(backup, result.map(|_| ()));}- // launchers up to v0.2.1 disabled DiagTrack here: put it back, unless debloat is the one keeping it off- if !on && !db_dir().join("debloat.exe").is_file() {- soft("DiagTrack", run("reg", &["add", r"HKLM\SYSTEM\CurrentControlSet\Services\DiagTrack", "/v", "Start", "/t", "REG_DWORD", "/d", "2", "/f"]));+}++fn restore_service_trim() -> Result<(), String> {+ let mut restored = false;+ let mut errors = Vec::new();+ for (backup, key, value, _) in trim_settings() {+ match restore((&key, value), (RX_STATE, backup), trim_read, trim_write) {+ Ok(saved) => restored |= saved,+ Err(e) => errors.push(e),+ }+ }+ if !errors.is_empty() {+ return Err(errors.join("; "));}- let t = if on { 0x4000000 } else { SPLIT_DEFAULT };- soft("SvcHostSplitThresholdInKB", run("reg", &["add", SPLIT_KEY, "/v", "SvcHostSplitThresholdInKB", "/t", "REG_DWORD", "/d", &t.to_string(), "/f"]));+ if !restored && rx_dir().join("rust-explorer.exe").is_file() {+ WARN.lock().unwrap().push(t!(+ "исходные настройки служб не сохранены; текущие значения оставлены как есть",+ "no service settings were backed up; the current values were left in place"+ ).into());+ }+ Ok(())}/// In our Program Files folder (admin-only): a .reg a user could plant would be imported by the elevated uninstall.@@ -53,6 +130,9 @@ pub(crate) fn rx_install() -> Result<(), String> {if !bar_dir().join("topbar.exe").is_file() {return Err(t!("сначала установите topbar: без него после отключения Explorer не будет панели", "install topbar first: without it there will be no bar after Explorer is disabled").into());}+ // An older installation may already have applied the tweaks without saving the originals.+ let fresh = !rx_dir().join("rust-explorer.exe").is_file()+ && trim_read((RX_STATE, "AutoRestartShell"))?.is_none();with_payload(&["rust-explorer.exe", "rs-shell.exe"], |d| {for n in ["rs-shell.exe", "rust-explorer.exe"] {let _ = run("taskkill", &["/f", "/im", n]); // an update: a running exe cannot be overwritten@@ -91,7 +171,9 @@ pub(crate) fn rx_install() -> Result<(), String> {}run("reg", &["add", RX_SWITCH, "/v", "ReplaceExplorer", "/t", "REG_DWORD", "/d", "1", "/f"])?;run("reg", &["add", WINLOGON_KEY, "/v", "AutoRestartShell", "/t", "REG_DWORD", "/d", "0", "/f"])?;- rx_trim(true);+ if fresh {+ apply_service_trim();+ }// the bar's Start panel and the search list Start Menu shortcuts only: without one rust-explorer has no entry (and no icon) theresoft(t!("ярлык «Rust Explorer» в меню Пуск не создан", "Start menu shortcut 'Rust Explorer' was not created"), shortcut(&start_lnk("Rust Explorer"), &fm, ""));// Start it now, with the user's normal token: explorer.exe opens a shortcut unelevated, and the shortcut carries --overlay.@@ -104,13 +186,13 @@ pub(crate) fn rx_install() -> Result<(), String> {}pub(crate) fn rx_uninstall() -> Result<(), String> {+ restore_service_trim()?;// Windows may restart its shell again; our hooks off; then the shell back, unelevated, only if none is runninglet back = reg_dword(RX_STATE, "AutoRestartShell").unwrap_or(1);let r = run("reg", &["add", WINLOGON_KEY, "/v", "AutoRestartShell", "/t", "REG_DWORD", "/d", &back.to_string(), "/f"]);let _ = run("reg", &["delete", RUN_KEY, "/v", "rs-overlay", "/f"]);let _ = run("schtasks", &["/delete", "/tn", "rs-overlay", "/f"]);let _ = run("reg", &["delete", RX_SWITCH, "/f"]);- rx_trim(false);for (i, k) in RX_FOLDERS.iter().enumerate() {let _ = run("reg", &["delete", k, "/f"]); // only our HKCU override; the system's verbs under HKLM staylet bak = rx_folders_bak(i);diff --git a/src/install/explorer/dword_snapshot.rs b/src/install/explorer/dword_snapshot.rsnew file mode 100644index 0000000..84f544a--- /dev/null+++ b/src/install/explorer/dword_snapshot.rs@@ -0,0 +1,117 @@+//! Snapshot and restore the DWORDs changed by rust-explorer's service tuning.++pub(crate) type Dword<'a> = (&'a str, &'a str);++pub(crate) fn backup_and_set<'a>(+ setting: Dword<'a>,+ backup: Dword<'a>,+ new: u32,+ read: impl Fn(Dword<'a>) -> Result<Option<u32>, String>,+ write: impl Fn(Dword<'a>, u32) -> Result<(), String>,+) -> Result<bool, String> {+ let Some(old) = read(setting)? else { return Ok(false) };+ if old == new {+ return Ok(false);+ }+ if read(backup)?.is_none() {+ write(backup, old)?;+ }+ write(setting, new)?;+ Ok(true)+}++pub(crate) fn restore<'a>(+ setting: Dword<'a>,+ backup: Dword<'a>,+ read: impl Fn(Dword<'a>) -> Result<Option<u32>, String>,+ write: impl Fn(Dword<'a>, u32) -> Result<(), String>,+) -> Result<bool, String> {+ let Some(old) = read(backup)? else { return Ok(false) };+ if read(setting)? != Some(old) {+ write(setting, old)?;+ }+ Ok(true)+}++#[cfg(test)]+mod tests {+ use super::*;+ use std::{cell::RefCell, collections::HashMap};++ const START: Dword<'static> = ("Services\\Example", "Start");+ const BACKUP: Dword<'static> = ("Installer", "Example");++ #[derive(Default)]+ struct Registry {+ values: RefCell<HashMap<Dword<'static>, u32>>,+ write_error: Option<Dword<'static>>,+ }++ impl Registry {+ fn get(&self, key: Dword<'static>) -> Option<u32> {+ self.values.borrow().get(&key).copied()+ }++ fn write(&self, key: Dword<'static>, value: u32) -> Result<(), String> {+ if self.write_error == Some(key) {+ return Err("access denied".into());+ }+ self.values.borrow_mut().insert(key, value);+ Ok(())+ }++ fn apply(&self, new: u32) -> Result<bool, String> {+ backup_and_set(START, BACKUP, new, |key| Ok(self.get(key)), |key, value| self.write(key, value))+ }++ fn undo(&self) -> Result<bool, String> {+ restore(START, BACKUP, |key| Ok(self.get(key)), |key, value| self.write(key, value))+ }+ }++ #[test]+ fn keeps_the_original_across_retries_and_restores_it() {+ let reg = Registry::default();+ reg.write(START, 3).unwrap();+ assert!(reg.apply(4).unwrap());+ assert!(reg.apply(2).unwrap());+ assert_eq!(reg.get(BACKUP), Some(3));+ assert!(reg.undo().unwrap());+ assert_eq!(reg.get(START), Some(3));+ }++ #[test]+ fn leaves_missing_targets_and_legacy_installations_alone() {+ let reg = Registry::default();+ assert!(!reg.apply(4).unwrap());+ assert!(reg.values.borrow().is_empty());+ reg.write(START, 4).unwrap();+ assert!(!reg.undo().unwrap());+ assert_eq!(reg.get(START), Some(4));+ }++ #[test]+ fn a_failed_snapshot_prevents_the_system_write() {+ let reg = Registry { write_error: Some(BACKUP), ..Registry::default() };+ reg.write(START, 3).unwrap();+ assert!(reg.apply(4).is_err());+ assert_eq!(reg.get(START), Some(3));+ }++ #[test]+ fn a_failed_restore_leaves_the_backup_for_retry() {+ let reg = Registry { write_error: Some(START), ..Registry::default() };+ reg.write(BACKUP, 3).unwrap();+ reg.values.borrow_mut().insert(START, 4);+ assert!(reg.undo().is_err());+ assert_eq!(reg.get(BACKUP), Some(3));+ }++ #[test]+ fn a_read_error_is_not_treated_as_a_missing_value() {+ let reg = Registry::default();+ let result = backup_and_set(START, BACKUP, 4, |_| Err("access denied".into()), |key, value| reg.write(key, value));+ assert!(result.is_err());+ assert!(reg.values.borrow().is_empty());+ }+}diff --git a/src/install/mod.rs b/src/install/mod.rsindex 99cb043..ba5019f 100644--- a/src/install/mod.rs+++ b/src/install/mod.rs@@ -155,12 +155,22 @@ pub(crate) fn uninstall_plugin(i: usize) -> Result<String, String> {let w = WARN.lock().unwrap().clone();log(&format!("{}: {} {}", p.name, t!("удалён", "removed"), w.join(" | ")));let note = if w.is_empty() { String::new() } else { tf!(" Предупреждений: {} (см. %ProgramData%\\plugin-launcher\\install.log).", " Warnings: {} (see %ProgramData%\\plugin-launcher\\install.log).", w.len()) };- Ok(tf!("{} удалён, система восстановлена.{note}", "{} removed, system restored.{note}", p.name))+ Ok(tf!("{} удалён.{note}", "{} removed.{note}", p.name))}pub(crate) fn rollback() -> Result<String, String> {+ WARN.lock().unwrap().clear();init_soft();// reverse install order: rust-explorer (which switched Explorer off) goes before topbar, else the session is left with no panel and no shelllet errs: Vec<String> = PLUGINS.iter().rev().filter(|p| (p.installed)()).filter_map(|p| p.actions.and_then(|a| a.1().err().map(|e| format!("{}: {e}", p.name)))).collect();- if errs.is_empty() { Ok(t!("Все плагины удалены, система восстановлена.", "All plugins removed, system restored.").into()) } else { Err(errs.join("; ")) }+ let warnings = WARN.lock().unwrap().join(" | ");+ let note = if warnings.is_empty() { "" } else {+ log(&format!("rollback: {warnings}"));+ t!(" Есть предупреждения (см. %ProgramData%\\plugin-launcher\\install.log).", " See warnings in %ProgramData%\\plugin-launcher\\install.log.")+ };+ if errs.is_empty() {+ Ok(tf!("Все плагины удалены.{note}", "All plugins removed.{note}"))+ } else {+ Err(format!("{}{note}", errs.join("; ")))+ }}