The panel is for "change it now" decisions, and two of the most obvious were reachable only through Settings. Night Light was already here; these were the genuine gaps. The colour scheme is a grid toggle beside it. It writes the preference and stops -- ColorScheme propagates the change to GTK, the portal, the terminals, the launcher, btop, tmux and the lock screen, and nothing in the panel needs to know that list. Light is the lit state because dark is what Panama ships, and "active" reads as the non-default everywhere else in this grid. Power profiles are a summary row that expands into a list, matching how the audio device lists behave. A row per profile rather than a cycling button: there are three, and cycling passes through one you did not want on a machine where the change is immediate and audible. The row hides entirely where no power-profiles daemon is running, and the panel re-reads the active profile on open, because the daemon owns it and anything on the system can change it. Worth recording, because it invalidates something I believed earlier in this session: the live shell runs `quickshell --daemonize` and does NOT hot-reload. Editing a file under config/dot/quickshell changes nothing until the shell is restarted. The PID changes I had taken for hot reloads were tests killing and restarting it. Both of these controls were written, verified in a harness, and completely absent from the running panel until the shell was restarted. Claude-Session: https://claude.ai/code/session_01BRvzt4H8XXLPVH5MyYdk9L
114 lines
3.3 KiB
QML
114 lines
3.3 KiB
QML
// The quick settings popover — GNOME's system menu (Super+S).
|
|
//
|
|
// A layer-shell surface rather than a PopupWindow because it needs keyboard
|
|
// focus for the wifi password field, and because the bar it hangs from is
|
|
// owned by a different module.
|
|
|
|
import QtQuick
|
|
import Quickshell
|
|
import Quickshell.Wayland
|
|
import Quickshell.Hyprland
|
|
import qs.config
|
|
import qs.services
|
|
import qs.widgets
|
|
|
|
PanelWindow {
|
|
id: root
|
|
|
|
visible: ShellState.quickSettingsOpen
|
|
color: "transparent"
|
|
|
|
// Hangs directly beneath the top-right status cluster. Two logical pixels
|
|
// preserve the Prism edge without making the surface feel detached.
|
|
anchors.top: true
|
|
anchors.right: true
|
|
margins.top: Theme.barHeight + Theme.controlCenterTopGap
|
|
margins.right: Theme.barSideMargin
|
|
exclusiveZone: 0
|
|
|
|
implicitWidth: Theme.controlCenterWidth
|
|
implicitHeight: panel.implicitHeight
|
|
readonly property string expandedSection: panel.expandedSection
|
|
|
|
function expand(name: string): void {
|
|
panel.expand(name);
|
|
}
|
|
|
|
// The `qs-popover` prefix is matched by a layerrule in hypr/rules.lua.
|
|
WlrLayershell.namespace: "qs-popover-quicksettings"
|
|
WlrLayershell.layer: WlrLayer.Overlay
|
|
// OnDemand rather than Exclusive: the panel must be able to take typing for
|
|
// the wifi password field, but must not steal it while merely visible.
|
|
WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand
|
|
|
|
onVisibleChanged: {
|
|
if (root.visible) {
|
|
KdeConnect.refresh();
|
|
HomeAssistant.refresh();
|
|
// The daemon owns the power profile and anything on the system can
|
|
// change it, so the panel asks rather than trusting what it last saw.
|
|
PowerProfiles.refresh();
|
|
openAnim.restart();
|
|
} else {
|
|
panel.reset();
|
|
}
|
|
}
|
|
|
|
// Closes the panel when a click lands anywhere else on the desktop.
|
|
HyprlandFocusGrab {
|
|
windows: [root]
|
|
active: root.visible
|
|
onCleared: ShellState.close()
|
|
}
|
|
|
|
Rectangle {
|
|
id: surface
|
|
anchors.fill: parent
|
|
radius: Theme.popoverRadius
|
|
color: Theme.alpha(Theme.bgPopover, Theme.popoverAlpha)
|
|
border.width: 1
|
|
border.color: Theme.alpha(Theme.fg, 0.08)
|
|
|
|
// The prism edge — see widgets/PrismEdge.qml. Sits just inside the 1px
|
|
// border so the two don't fight for the same row of pixels.
|
|
PrismEdge {
|
|
anchors.top: parent.top
|
|
anchors.topMargin: 1
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
inset: parent.radius
|
|
}
|
|
|
|
transform: Scale {
|
|
id: openScale
|
|
origin.x: surface.width
|
|
origin.y: 0
|
|
xScale: 1
|
|
yScale: 1
|
|
}
|
|
|
|
// Escape reaches here by propagating up from whatever holds focus
|
|
// (usually the password field), so it works in every sub-state.
|
|
Item {
|
|
anchors.fill: parent
|
|
focus: true
|
|
Keys.onEscapePressed: ShellState.close()
|
|
|
|
QuickSettingsPanel {
|
|
id: panel
|
|
anchors.fill: parent
|
|
}
|
|
}
|
|
}
|
|
|
|
NumberAnimation {
|
|
id: openAnim
|
|
target: openScale
|
|
property: "yScale"
|
|
from: 0.94
|
|
to: 1.0
|
|
duration: Theme.durNormal
|
|
easing.type: Easing.OutCubic
|
|
}
|
|
}
|