windows: the dark theme's off and disabled controls readable; upgrades with tunnels up

Dark theme: a switch that is off has a lighter track (#737373, was #404040
under a near-black thumb), radio buttons, checkboxes and text fields a
lighter edge (#525252); a disabled button's text is the muted colour itself
rather than half of it (widgets::Inactive). The title bar is set again a
moment after Windows' appearance changes, as GPUI resets it to Windows' own.

Upgrades: a running system-wide AmneziaWG tunnel is stopped while the
release's newer amneziawg replaces bin\amneziawg, and started again;
WinDivert's driver is let go of before zapret or zapret2 is replaced. The
fetched setup program goes once the update it brought is running.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Opus 5.5 committed 2026-10-27 22:39:10 +03:00
1 parent 5bd47f7676
commit d33f05c62c
19 files changed
+101 -21

No files matched your search

+1
View File
@@ -48,6 +48,7 @@ fn main() {
gpui_kit::application().with_assets(assets::AppAssets).with_quit_mode(QuitMode::Explicit).run(move |cx| {
gpui_kit::init(cx);
cx.set_global(prefs::load());
prefs::tune_dark(cx);
prefs::apply_theme(None, cx);
let model = cx.new(|cx| model::Model::new(bridge, cx));
shell::start(model, !args.hidden, cx);
+13
View File
@@ -4,6 +4,7 @@
//! In `%APPDATA%\ProxySuite\app.json` (elsewhere `$XDG_CONFIG_HOME/proxy-suite/app.json`).
use std::path::PathBuf;
use std::rc::Rc;
use gpui_kit::component::{Theme, ThemeMode};
use gpui_kit::*;
@@ -76,6 +77,18 @@ pub fn change(cx: &mut App, edit: impl FnOnce(&mut Prefs)) {
cx.refresh_windows();
}
/// Controls that are off all but vanish on the dark theme's near-black page: its switch, a
/// near-black thumb on a #404040 track, gets a lighter track (the thumb stays dark: it is the
/// on switch's too, on a white track); unchecked radio buttons and checkboxes, and text
/// fields, a lighter edge than #2f2f2f.
pub fn tune_dark(cx: &mut App) {
let theme = Theme::global_mut(cx);
let mut dark = (*theme.dark_theme).clone();
dark.colors.switch = Some("#737373".into());
dark.colors.input = Some("#525252".into());
theme.dark_theme = Rc::new(dark);
}
/// The theme the preference picks: Windows' appearance (the window's, when there is one), or
/// the one chosen.
pub fn apply_theme(window: Option<&mut Window>, cx: &mut App) {
+3 -3
View File
@@ -16,7 +16,7 @@ use ps_client::edits;
use ps_ipc::Request;
use serde_json::{Value, json};
use super::widgets::{card, hint, page};
use super::widgets::{card, hint, page, Inactive as _};
use crate::model::Model;
pub struct AutoProxyPage {
@@ -218,10 +218,10 @@ impl Render for AutoProxyPage {
.small()
.icon(IconName::Gauge)
.label(if probing { "Probing…" } else { "Probe" })
.disabled(probing || !running)
.inactive(probing || !running, cx)
.on_click(cx.listener(|this, _, window, cx| this.probe(window, cx))),
)
.child(Button::new("ap-learn").small().primary().icon(IconName::Plus).label("Learn").disabled(!running).on_click(cx.listener(|this, _, window, cx| this.learn(window, cx)))),
.child(Button::new("ap-learn").small().primary().icon(IconName::Plus).label("Learn").inactive(!running, cx).on_click(cx.listener(|this, _, window, cx| this.learn(window, cx)))),
);
match &self.probe {
Some(Ok(p)) => {
+2 -2
View File
@@ -9,7 +9,7 @@ use gpui_kit::*;
use ps_ipc::Request;
use serde_json::Value;
use super::widgets::{card, hint, page};
use super::widgets::{card, hint, page, Inactive as _};
use crate::model::Model;
pub struct ComponentsPage {
@@ -72,7 +72,7 @@ impl Render for ComponentsPage {
.small()
.icon(IconName::Download)
.label(if self.installing { "Installing…" } else { "Fetch all again" })
.disabled(self.installing)
.inactive(self.installing, cx)
.on_click(cx.listener(|this, _, _, cx| this.install(Vec::new(), cx))),
);
let mut list = card("Programs", Some(actions.into_any_element()), cx).child(hint(
+8 -4
View File
@@ -103,11 +103,15 @@ impl AppView {
pub fn new(model: Entity<Model>, window: &mut Window, cx: &mut Context<Self>) -> Self {
let subscriptions = vec![
cx.observe(&model, |_, _, cx| cx.notify()),
// As Windows' appearance changes, when the theme follows it.
// As Windows' appearance changes: the theme, when it follows it; the title bar, which
// GPUI sets to Windows' own just after this, a moment later.
cx.observe_window_appearance(window, |_, window, cx| {
if cx.global::<crate::prefs::Prefs>().theme == crate::prefs::ThemeChoice::System {
crate::prefs::apply_theme(Some(window), cx);
}
crate::prefs::apply_theme(Some(window), cx);
cx.spawn_in(window, async move |_, cx| {
cx.background_executor().timer(std::time::Duration::from_millis(300)).await;
cx.update(|window, cx| crate::prefs::apply_theme(Some(window), cx)).ok();
})
.detach();
}),
cx.subscribe_in(&model, window, |_, _, outcome: &Outcome, window, cx| {
let note = match outcome {
+3 -3
View File
@@ -16,7 +16,7 @@ use ps_client::edits::{self, OutboundSource};
use ps_ipc::Request;
use serde_json::Value;
use super::widgets::{card, hint, page};
use super::widgets::{card, hint, page, Inactive as _};
use crate::model::Model;
const MODES: [(&str, &str); 5] = [
@@ -175,7 +175,7 @@ impl Render for OutboundsPage {
let mut list = card(
format!("Outbounds ({})", tags.len()),
Some(Button::new("test-all").small().icon(IconName::Gauge).label(if self.testing { "Testing…" } else { "Test all" }).disabled(self.testing || tags.is_empty()).on_click(cx.listener(|this, _, _, cx| this.test(Vec::new(), cx))).into_any_element()),
Some(Button::new("test-all").small().icon(IconName::Gauge).label(if self.testing { "Testing…" } else { "Test all" }).inactive(self.testing || tags.is_empty(), cx).on_click(cx.listener(|this, _, _, cx| this.test(Vec::new(), cx))).into_any_element()),
cx,
);
if let Some(Err(e)) = self.delays.get("") {
@@ -205,7 +205,7 @@ impl Render for OutboundsPage {
.small()
.icon(IconName::RefreshCw)
.label("Update all")
.disabled(subs.is_empty())
.inactive(subs.is_empty(), cx)
.on_click(move |_, _, cx| model.update(cx, |m, cx| m.request("Subscriptions updated", Request::SubsUpdate { tag: None }, cx)))
.into_any_element(),
),
+2 -2
View File
@@ -12,7 +12,7 @@ use ps_client::edits;
use serde_json::Value;
use super::AppView;
use super::widgets::{card, fact, hint, page, state_tag};
use super::widgets::{card, fact, hint, page, state_tag, Inactive as _};
use crate::model::{Connection, Model, Update};
fn text(v: &Value) -> SharedString {
@@ -155,7 +155,7 @@ fn updates(model: &Entity<Model>, cx: &mut Context<AppView>) -> Div {
.ghost()
.icon(IconName::RefreshCw)
.label("Check for updates")
.disabled(busy)
.inactive(busy, cx)
.on_click(move |_, _, cx| model.update(cx, |m, cx| m.check_update(cx)))
};
let card = card(format!("Proxy Suite {}", m.version()), Some(check.into_any_element()), cx);
+2 -2
View File
@@ -14,7 +14,7 @@ use ps_client::Issue;
use ps_ipc::Request;
use serde_json::Value;
use super::widgets::{card, hint, page};
use super::widgets::{card, hint, page, Inactive as _};
use crate::model::Model;
use crate::prefs::{self, Prefs, ThemeChoice};
@@ -189,7 +189,7 @@ impl Render for SettingsPage {
.gap_2()
.child(Button::new("cfg-reload").small().ghost().icon(IconName::RefreshCw).label("Reload").on_click(cx.listener(|this, _, window, cx| this.reload(window, cx))))
.child(Button::new("cfg-validate").small().label("Check").on_click(cx.listener(|this, _, _, cx| this.validate(cx))))
.child(Button::new("cfg-save").small().primary().icon(IconName::Save).label("Save").disabled(!changed).on_click(cx.listener(|this, _, _, cx| this.save(cx))));
.child(Button::new("cfg-save").small().primary().icon(IconName::Save).label("Save").inactive(!changed, cx).on_click(cx.listener(|this, _, _, cx| this.save(cx))));
let verdict = match &self.verdict {
Verdict::None => div(),
+16
View File
@@ -1,6 +1,8 @@
//! Pieces the pages share: the page frame, cards, a unit's state as a tag.
use gpui_kit::component::button::Button;
use gpui_kit::component::tag::Tag;
use gpui_kit::prelude::FluentBuilder as _;
use gpui_kit::assets::IconName;
use gpui_kit::component::*;
use gpui_kit::*;
@@ -48,3 +50,17 @@ pub fn hint(text: impl Into<SharedString>, cx: &App) -> Div {
pub fn fact(label: &'static str, value: impl Into<SharedString>, cx: &App) -> Div {
div().h_flex().gap_2().text_sm().child(div().w(px(110.)).text_color(cx.theme().muted_foreground).child(label)).child(value.into())
}
/// A button that cannot be pressed now. gpui-component draws a disabled button's text at half
/// the muted colour, which the dark theme all but hides: here at the muted colour itself (a
/// button's own style is laid over its disabled state's), still plainly dimmer than an active
/// button's.
pub trait Inactive: Sized {
fn inactive(self, disabled: bool, cx: &App) -> Self;
}
impl Inactive for Button {
fn inactive(self, disabled: bool, cx: &App) -> Self {
self.disabled(disabled).when(disabled, |b| b.text_color(cx.theme().muted_foreground))
}
}