Add high contrast, and make remote desktop configurable

Two of the three panels still handed to GNOME, having actually checked
each rather than repeating that they were not worth owning.

Universal Access turned out to be mostly ours already: the magnifier,
pointer size, text scale, motion and dimming were all present. High
contrast was the real gap. It reaches GTK4 applications through the
desktop portal, which republishes GNOME's accessibility setting as
org.freedesktop.appearance contrast -- so no high-contrast theme is
involved, and none is installed here. Verified end to end: committing
the preference drove gsettings and the portal reported contrast 1.

Sticky, slow and bounce keys stay absent. There is no Wayland or
Hyprland implementation, and the compositor would store the XKB option
while nothing ever acted on it.

Remote desktop gained port, view-only, and clearing stored credentials.
SETTING credentials opens a terminal running grdctl, which prompts for
the password itself. That is not a hand-off for lack of effort: grdctl
takes the password on a terminal and core-dumps without one, and the
only alternative -- passing it as an argument -- would publish it
through /proc to every process on this machine. Typed into grdctl
directly it never passes through Panama, and a contract now fails if it
ever appears on a command line.

Color stays with GNOME, and not for lack of effort either. colord runs
here with seven profiles and zero devices registered, because the
daemons that register displays do not run under this session, and
Hyprland exposes no ICC, gamma, or color-management option at all. A
Color page could import a profile, attach it to nothing, and change
nothing -- the same failure refused for rollback and printer drivers.

Claude-Session: https://claude.ai/code/session_01BRvzt4H8XXLPVH5MyYdk9L
This commit is contained in:
Gabriel Brown
2026-08-19 16:42:20 -04:00
parent 1f40f8e136
commit 6997dd535f
10 changed files with 157 additions and 10 deletions
@@ -702,6 +702,14 @@ Singleton {
detail: "Moves the magnified view in increments rather than gliding with the pointer",
hypr: { path: ["cursor", "zoom_rigid"], option: "cursor:zoom_rigid", readAs: "bool" }
},
{
key: "highContrast", type: "bool", def: false, group: "accessibility",
label: "High contrast",
detail: "Increases contrast in applications that support it. Modern GTK applications read this from the desktop portal and restyle themselves; older ones need a high-contrast theme, which is not installed here.",
// No hypr mapping: this is a GNOME interface setting the portal
// republishes as org.freedesktop.appearance contrast, which is what
// libadwaita actually reads. DesktopStyle applies it.
},
{
key: "dimInactive", type: "bool", def: false, group: "accessibility",
label: "Dim inactive windows",
@@ -27,7 +27,12 @@ SettingsPage {
title: "Text"
subtitle: "Scales text in applications. The shell's own panels are drawn at their design size, so they are unaffected."
SliderRow { setting: "textScale"; divider: false }
SliderRow { setting: "textScale" }
// Reaches GTK4 applications through the desktop portal, which
// republishes it as org.freedesktop.appearance contrast. No
// high-contrast theme is involved, and none is installed here -- older
// GTK3 applications will not change.
ToggleRow { setting: "highContrast"; divider: false }
}
SettingsCard {
@@ -114,14 +114,49 @@ SettingsPage {
value: String(Sharing.remoteDesktop?.port ?? "")
}
TextRow {
SwitchRow {
visible: Sharing.remoteDesktop?.available === true
label: "View only"
detail: "Let someone watch this desktop without controlling the pointer or keyboard"
checked: Sharing.remoteDesktop?.viewOnly === true
enabled: !Sharing.busy
onToggled: value => Sharing.setRdpViewOnly(value)
}
TextFieldRow {
visible: Sharing.remoteDesktop?.available === true
label: "Port"
detail: "The port other machines connect to"
text: String(Sharing.remoteDesktop?.port ?? "")
placeholder: "3389"
enabled: !Sharing.busy
onAccepted: value => Sharing.setRdpPort(value)
}
// The password is typed into gnome-remote-desktop's own tool in a
// terminal, never into this page. grdctl prompts for it on a terminal
// and crashes without one, and passing it as an argument would publish
// it through /proc to every process on this machine.
ActionRow {
visible: Sharing.remoteDesktop?.available === true
label: "Credentials"
detail: Sharing.remoteDesktop?.hasCredentials === true
? "Stored in the login keyring, where Privacy & Security can manage them"
: "None stored yet"
value: Sharing.remoteDesktop?.hasCredentials === true ? "Stored" : "Not set"
? "Stored in the login keyring · setting new ones opens a terminal to type into"
: "None stored yet · remote desktop cannot be turned on without them"
action: "Set"
enabled: !Sharing.busy
onTriggered: Sharing.setRdpCredentials(Quickshell.env("USER") || "")
}
ActionRow {
visible: Sharing.remoteDesktop?.available === true
&& Sharing.remoteDesktop?.hasCredentials === true
label: "Forget the stored credentials"
detail: "Remote desktop cannot be turned on again until new ones are set"
action: "Clear"
enabled: !Sharing.busy
divider: false
onTriggered: Sharing.clearRdpCredentials()
}
}
+32 -1
View File
@@ -80,6 +80,7 @@ def remote_desktop() -> dict:
state["rdpEnabled"] = False
state["port"] = ""
state["hasCredentials"] = False
state["viewOnly"] = False
if not state["available"]:
return state
@@ -93,6 +94,7 @@ def remote_desktop() -> dict:
# grdctl prints "(hidden)" when a credential is stored and nothing when
# it is not, so this reads presence without ever reading the value.
state["hasCredentials"] = "(hidden)" in block
state["viewOnly"] = re.search(r"View-only:\s*yes", block) is not None
return state
@@ -144,6 +146,27 @@ def set_remote_desktop(enabled: bool) -> None:
raise BoundaryError(_refusal(result, "The remote desktop service could not be changed."))
def set_rdp_port(port: str) -> None:
if not port.isdigit() or not (1 <= int(port) <= 65535):
raise BoundaryError("That is not a port number.")
result = run(["grdctl", "rdp", "set-port", port])
if result.returncode != 0:
raise BoundaryError(_refusal(result, "The port could not be changed."))
def set_rdp_view_only(view_only: bool) -> None:
result = run(["grdctl", "rdp",
"enable-view-only" if view_only else "disable-view-only"])
if result.returncode != 0:
raise BoundaryError(_refusal(result, "That could not be changed."))
def clear_rdp_credentials() -> None:
result = run(["grdctl", "rdp", "clear-credentials"])
if result.returncode != 0:
raise BoundaryError(_refusal(result, "The credentials could not be cleared."))
def set_hostname(name: str) -> None:
if not HOSTNAME.fullmatch(name or ""):
raise BoundaryError("A name may use letters, digits and hyphens.")
@@ -170,10 +193,18 @@ def main(arguments: list[str]) -> int:
set_remote_desktop(arguments[1] == "true")
elif len(arguments) == 2 and arguments[0] == "set-hostname":
set_hostname(arguments[1])
elif len(arguments) == 2 and arguments[0] == "set-rdp-port":
set_rdp_port(arguments[1])
elif len(arguments) == 2 and arguments[0] == "set-rdp-view-only":
set_rdp_view_only(arguments[1] == "true")
elif arguments == ["clear-rdp-credentials"]:
clear_rdp_credentials()
else:
raise BoundaryError(
"Usage: panama-sharing snapshot | set-remote-login true|false | "
"set-remote-desktop true|false | set-hostname NAME")
"set-remote-desktop true|false | set-hostname NAME | "
"set-rdp-port PORT | set-rdp-view-only true|false | "
"clear-rdp-credentials")
except BoundaryError as error:
state = snapshot()
state["error"] = str(error)
@@ -208,7 +208,12 @@ Singleton {
DesktopPreferences.get("middleClickPaste")),
root.setting("org.gnome.desktop.wm.preferences", "button-layout", root.buttonLayout()),
root.setting("org.gnome.desktop.wm.preferences", "action-double-click-titlebar",
DesktopPreferences.get("titlebarDoubleClick"))
DesktopPreferences.get("titlebarDoubleClick")),
// The portal republishes this as org.freedesktop.appearance
// contrast, which is what libadwaita reads -- so this reaches GTK4
// applications without any high-contrast theme being installed.
root.setting("org.gnome.desktop.a11y.interface", "high-contrast",
DesktopPreferences.get("highContrast"))
]);
}
@@ -93,6 +93,31 @@ Singleton {
root.run(["set-hostname", name]);
}
function setRdpPort(port: string): void {
root.run(["set-rdp-port", port]);
}
function setRdpViewOnly(viewOnly: bool): void {
root.run(["set-rdp-view-only", viewOnly ? "true" : "false"]);
}
function clearRdpCredentials(): void {
root.run(["clear-rdp-credentials"]);
}
// Setting credentials opens a terminal running gnome-remote-desktop's own
// tool, which prompts for the password itself.
//
// That is not a cop-out, it is the only safe path: grdctl takes the
// password on a terminal and CRASHES without one, and the alternative --
// passing it as an argument -- would publish it through /proc to every
// process on this machine. Typed into grdctl directly, it never passes
// through Panama at all.
function setRdpCredentials(userName: string): void {
Quickshell.execDetached(["kitty", "--hold", "-e",
"grdctl", "rdp", "set-credentials", userName]);
}
Process {
id: query
stdout: StdioCollector { onStreamFinished: root.absorb(this.text) }