Two of the panels this desktop still handed to GNOME Settings. Users manages the account through accountsservice -- the same daemon GNOME's panel drives, so a name or picture set here is what the login screen and lock screen read. Name, picture, account type, password, automatic login, and adding or removing other accounts. Every change is authorized by polkit through the agent this session already runs; a dismissed prompt is a normal outcome and says so. A new password is read from the helper's stdin, hashed by openssl reading its own stdin, and handed over D-Bus from inside that process. It is never an argument: argv is world-readable through /proc, so a password passed that way is published to every process on the machine. Removing an account takes two presses and says it destroys their files; the last administrator cannot be removed or demoted, because a machine nobody can administer is not a state to offer. Sharing reports what is actually true, including "the software for this is not installed" -- the honest answer for Samba here, and the case the panel it replaces shows as a switch that does nothing. Password sign-in is reported from sshd's configuration rather than assumed: claiming "keys only" when the file is silent would state a security property that cannot be backed up. The Control Center now draws the account's real picture and name. A generic glyph sat there while a real avatar was already set, which made the desktop look like it did not know whose it was. Also here: the KDE Connect contract no longer requires a phone to be awake. kdeconnectd drops its device objects for a phone it has not seen recently while the pairing survives in its config, so demanding one failed whenever the phone was off. Claude-Session: https://claude.ai/code/session_01BRvzt4H8XXLPVH5MyYdk9L
389 lines
14 KiB
QML
389 lines
14 KiB
QML
// The contents of the quick settings popover — GNOME's system menu, in order:
|
|
// toggle grid, detail lists, sliders, footer.
|
|
//
|
|
// Kept separate from QuickSettings.qml (the PanelWindow) so it can be dropped
|
|
// into a FloatingWindow for testing: layer-shell surfaces cannot map outside a
|
|
// wlroots compositor.
|
|
|
|
import QtQuick
|
|
import Quickshell
|
|
import Quickshell.Widgets
|
|
import Quickshell.Networking
|
|
import Quickshell.Bluetooth
|
|
import Quickshell.Services.Pipewire
|
|
import qs.config
|
|
import qs.services
|
|
import qs.widgets
|
|
|
|
Item {
|
|
id: root
|
|
|
|
implicitWidth: Theme.controlCenterWidth
|
|
implicitHeight: content.implicitHeight + Theme.popoverPadding * 2
|
|
|
|
// "" | "wifi" | "bluetooth" | "sink" | "source". Only one detail list is
|
|
// open at a time, so the panel never grows past the screen.
|
|
property string expandedSection: ""
|
|
|
|
function expand(name: string): void {
|
|
root.expandedSection = root.expandedSection === name ? "" : name;
|
|
}
|
|
|
|
// Collapse everything — called when the popover closes so it reopens in a
|
|
// known state.
|
|
function reset(): void {
|
|
root.expandedSection = "";
|
|
}
|
|
|
|
// ── System state ────────────────────────────────────────────────────────
|
|
|
|
readonly property var wifiDevice: {
|
|
for (const device of Networking.devices.values) {
|
|
if (device.type === DeviceType.Wifi)
|
|
return device;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
readonly property var wiredDevice: {
|
|
for (const device of Networking.devices.values) {
|
|
if (device.type === DeviceType.Wired && device.connected)
|
|
return device;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
readonly property string ssid: {
|
|
if (!root.wifiDevice || !root.wifiDevice.networks)
|
|
return "";
|
|
for (const network of root.wifiDevice.networks.values) {
|
|
if (network.connected)
|
|
return network.name;
|
|
}
|
|
return "";
|
|
}
|
|
|
|
readonly property var btAdapter: Bluetooth.defaultAdapter
|
|
|
|
readonly property string btSummary: {
|
|
if (!root.btAdapter)
|
|
return "Unavailable";
|
|
if (!root.btAdapter.enabled)
|
|
return "Off";
|
|
for (const device of Bluetooth.devices.values) {
|
|
if (device.connected)
|
|
return device.name || device.address;
|
|
}
|
|
return "On";
|
|
}
|
|
|
|
readonly property int cellWidth: (content.width - Theme.itemSpacing) / 2
|
|
|
|
Column {
|
|
id: content
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
anchors.top: parent.top
|
|
anchors.margins: Theme.popoverPadding
|
|
spacing: Theme.itemSpacing
|
|
|
|
// ── Toggle grid ─────────────────────────────────────────────────────
|
|
Grid {
|
|
columns: 2
|
|
spacing: Theme.itemSpacing
|
|
|
|
Toggle {
|
|
width: root.cellWidth
|
|
icon: Networking.wifiEnabled ? "network-wireless-symbolic" : "network-wireless-offline-symbolic"
|
|
label: "Wi-Fi"
|
|
active: Networking.wifiEnabled
|
|
enabled: Networking.wifiHardwareEnabled
|
|
sublabel: {
|
|
if (!Networking.wifiEnabled)
|
|
return "Off";
|
|
return root.ssid !== "" ? root.ssid : "Not connected";
|
|
}
|
|
onToggled: Networking.wifiEnabled = !Networking.wifiEnabled
|
|
onExpanded: root.expand("wifi")
|
|
}
|
|
|
|
Toggle {
|
|
width: root.cellWidth
|
|
icon: root.btAdapter && root.btAdapter.enabled ? "bluetooth-active-symbolic" : "bluetooth-disabled-symbolic"
|
|
label: "Bluetooth"
|
|
active: root.btAdapter !== null && root.btAdapter.enabled
|
|
enabled: root.btAdapter !== null
|
|
sublabel: root.btSummary
|
|
onToggled: {
|
|
if (root.btAdapter)
|
|
root.btAdapter.enabled = !root.btAdapter.enabled;
|
|
}
|
|
onExpanded: root.expand("bluetooth")
|
|
}
|
|
|
|
Toggle {
|
|
width: root.cellWidth
|
|
icon: "preferences-desktop-screensaver-symbolic"
|
|
label: "Caffeine"
|
|
sublabel: Caffeine.enabled ? "Staying awake" : "Off"
|
|
active: Caffeine.enabled
|
|
onToggled: Caffeine.toggle()
|
|
}
|
|
|
|
Toggle {
|
|
width: root.cellWidth
|
|
icon: ColorScheme.dark ? "weather-clear-night-symbolic" : "weather-clear-symbolic"
|
|
label: "Appearance"
|
|
sublabel: ColorScheme.dark ? "Dark" : "Light"
|
|
// "active" reads as the non-default state across this grid, and
|
|
// dark is what Panama ships, so light is the lit one.
|
|
active: !ColorScheme.dark
|
|
// Writes the preference and stops. ColorScheme propagates it to
|
|
// GTK, the portal, the terminals, the launcher, btop, tmux and
|
|
// the lock screen; nothing here needs to know that list.
|
|
onToggled: SystemSettings.commitPreference("colorScheme",
|
|
ColorScheme.dark ? "light" : "dark")
|
|
}
|
|
|
|
Toggle {
|
|
width: root.cellWidth
|
|
icon: "night-light-symbolic"
|
|
label: "Night Light"
|
|
active: NightLight.active
|
|
sublabel: {
|
|
if (NightLight.automatic)
|
|
return NightLight.active ? "Scheduled · on" : "Scheduled";
|
|
return NightLight.active ? NightLight.temperature + "K" : "Off";
|
|
}
|
|
onToggled: NightLight.toggle()
|
|
// No detail list to open, so the secondary action flips the
|
|
// schedule on and off instead.
|
|
onExpanded: NightLight.automatic = !NightLight.automatic
|
|
}
|
|
}
|
|
|
|
RowButton {
|
|
width: content.width
|
|
icon: "preferences-system-time-symbolic"
|
|
iconFallback: "appointment-soon-symbolic"
|
|
label: FocusSession.active ? "Focus · " + FocusSession.workspaceLabel : "Start focus session"
|
|
sublabel: FocusSession.active ? FocusSession.remainingText + (FocusSession.paused ? " · paused" : " remaining") : Settings.focusDurationMinutes + " minutes · current workspace"
|
|
selected: FocusSession.active
|
|
onClicked: {
|
|
ShellState.close();
|
|
FocusSession.reveal();
|
|
}
|
|
}
|
|
|
|
// ── Detail lists ────────────────────────────────────────────────────
|
|
Section {
|
|
width: content.width
|
|
expanded: root.expandedSection === "wifi"
|
|
|
|
WifiList {
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
device: root.wifiDevice
|
|
active: root.expandedSection === "wifi"
|
|
}
|
|
}
|
|
|
|
Section {
|
|
width: content.width
|
|
expanded: root.expandedSection === "bluetooth"
|
|
|
|
BluetoothList {
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
active: root.expandedSection === "bluetooth"
|
|
}
|
|
}
|
|
|
|
Rectangle {
|
|
width: content.width
|
|
height: 1
|
|
color: Theme.alpha(Theme.fg, 0.1)
|
|
}
|
|
|
|
// ── Power ───────────────────────────────────────────────────────────
|
|
// Only where a power-profiles daemon is actually running. A desktop
|
|
// without one should not show a control that cannot do anything.
|
|
RowButton {
|
|
visible: PowerProfiles.available
|
|
width: content.width
|
|
icon: {
|
|
switch (PowerProfiles.active) {
|
|
case "power-saver": return "power-profile-power-saver-symbolic";
|
|
case "performance": return "power-profile-performance-symbolic";
|
|
default: return "power-profile-balanced-symbolic";
|
|
}
|
|
}
|
|
iconFallback: "preferences-system-power-symbolic"
|
|
label: "Power profile"
|
|
sublabel: PowerProfiles.degraded !== ""
|
|
? PowerProfiles.label(PowerProfiles.active) + " · limited"
|
|
: PowerProfiles.label(PowerProfiles.active)
|
|
selected: root.expandedSection === "power"
|
|
onClicked: root.expand("power")
|
|
}
|
|
|
|
Section {
|
|
width: content.width
|
|
expanded: root.expandedSection === "power"
|
|
|
|
PowerProfileList {
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
}
|
|
}
|
|
|
|
// ── Sliders ─────────────────────────────────────────────────────────
|
|
AudioSlider {
|
|
width: content.width
|
|
node: Pipewire.defaultAudioSink
|
|
output: true
|
|
expanded: root.expandedSection === "sink"
|
|
onToggleExpanded: root.expand("sink")
|
|
}
|
|
|
|
Section {
|
|
width: content.width
|
|
expanded: root.expandedSection === "sink"
|
|
|
|
AudioDeviceList {
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
output: true
|
|
}
|
|
}
|
|
|
|
AudioSlider {
|
|
width: content.width
|
|
node: Pipewire.defaultAudioSource
|
|
output: false
|
|
expanded: root.expandedSection === "source"
|
|
onToggleExpanded: root.expand("source")
|
|
}
|
|
|
|
Section {
|
|
width: content.width
|
|
expanded: root.expandedSection === "source"
|
|
|
|
AudioDeviceList {
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
output: false
|
|
}
|
|
}
|
|
|
|
BrightnessControl {
|
|
width: content.width
|
|
}
|
|
|
|
// ── Connected life ─────────────────────────────────────────────────
|
|
HomeControls {
|
|
width: content.width
|
|
expanded: root.expandedSection === "home"
|
|
onToggleExpanded: root.expand("home")
|
|
}
|
|
|
|
PhoneControls {
|
|
width: content.width
|
|
expanded: root.expandedSection === "phone"
|
|
onToggleExpanded: root.expand("phone")
|
|
}
|
|
|
|
Rectangle {
|
|
width: content.width
|
|
height: 1
|
|
color: Theme.alpha(Theme.fg, 0.1)
|
|
}
|
|
|
|
// ── Footer ──────────────────────────────────────────────────────────
|
|
Item {
|
|
width: content.width
|
|
height: 36
|
|
|
|
// The account's own picture, the same file the lock screen and the
|
|
// login screen read. A generic glyph sat here while a real avatar
|
|
// was already set, which made the desktop look like it did not know
|
|
// whose it was.
|
|
Item {
|
|
id: avatar
|
|
anchors.left: parent.left
|
|
anchors.leftMargin: 4
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
width: 22
|
|
height: 22
|
|
|
|
ClippingRectangle {
|
|
anchors.fill: parent
|
|
radius: width / 2
|
|
color: "transparent"
|
|
visible: UserAccounts.avatarUrl !== ""
|
|
|
|
Image {
|
|
anchors.fill: parent
|
|
source: UserAccounts.avatarUrl
|
|
fillMode: Image.PreserveAspectCrop
|
|
// Replaced in place when the picture changes, so the
|
|
// cache has to be told to let go of the old one.
|
|
cache: false
|
|
asynchronous: true
|
|
sourceSize.width: 44
|
|
sourceSize.height: 44
|
|
}
|
|
}
|
|
|
|
ThemedIcon {
|
|
anchors.centerIn: parent
|
|
visible: UserAccounts.avatarUrl === ""
|
|
size: 20
|
|
icon: "avatar-default-symbolic"
|
|
iconFallback: "user-info-symbolic"
|
|
}
|
|
}
|
|
|
|
Text {
|
|
anchors.left: avatar.right
|
|
anchors.leftMargin: 10
|
|
anchors.right: actions.left
|
|
anchors.rightMargin: 8
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
text: UserAccounts.me
|
|
? UserAccounts.displayName(UserAccounts.me)
|
|
: (Quickshell.env("USER") || "user")
|
|
color: Theme.fg
|
|
elide: Text.ElideRight
|
|
font.family: Theme.fontFamily
|
|
font.pixelSize: Theme.fontSize
|
|
font.weight: Font.Medium
|
|
}
|
|
|
|
Row {
|
|
id: actions
|
|
anchors.right: parent.right
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
spacing: 4
|
|
|
|
IconButton {
|
|
size: 32
|
|
iconSize: 17
|
|
icon: "preferences-system-symbolic"
|
|
onClicked: {
|
|
ShellState.close();
|
|
ShellState.openSettings("home");
|
|
}
|
|
}
|
|
|
|
IconButton {
|
|
size: 32
|
|
iconSize: 17
|
|
icon: "system-shutdown-symbolic"
|
|
onClicked: ShellState.open("powermenu")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|