diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-11 18:30:58 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-11 18:30:58 +0200 |
| commit | 1b252e32d93e1e0207d2a69ee3445e1dbf6505ae (patch) | |
| tree | d4280dae5cab886898e7e5e674508728e2d5150a /appearance/MockScreen.qml | |
| parent | 43c31deaa313a8e471ecc3b5a55411a3b93b6f08 (diff) | |
| download | quickshell-1b252e32d93e1e0207d2a69ee3445e1dbf6505ae.tar.gz quickshell-1b252e32d93e1e0207d2a69ee3445e1dbf6505ae.zip | |
feat(appearance): wallpaper picker and scheme switcher
One drawer for how the desktop looks, on SUPER+Return, replacing the
qarma file dialog that key used to open. wallp is untouched and still
does the work: the panel calls it with H= and V= and it still runs from
a terminal.
Clicking a thumbnail stages it rather than setting it, so both screens
can be composed before anything changes and Apply is a single wallp
call. The mock screens show the result: the staged pick where there is
one, what is set where there is not, and the hovered thumbnail on the
targeted screen. They are drawn at the real proportions from hyprctl
monitors, DP-3 upright because it has transform=1, centred against each
other as Hyprland has them.
The scheme tab reads the palette pair unified-desktop-theme keeps for
each scheme, so the swatches are that scheme's real colours and the list
needs no edit when a scheme is added. Applying writes roles.conf and
runs install.sh, and reloads nothing, because install.sh reloads
nothing: the panel says what is still showing the old scheme rather than
pretending the switch is done.
Two QML traps are documented in AGENTS.md because neither announces
itself: there is no String.matchAll, which threw inside a try and left
every swatch empty, and assigning running = true to an already-running
Process does nothing, which stopped the scheme loader after the first
file.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G7NRsGyF9jGfPYS4zPqpN7
Diffstat (limited to 'appearance/MockScreen.qml')
| -rw-r--r-- | appearance/MockScreen.qml | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/appearance/MockScreen.qml b/appearance/MockScreen.qml new file mode 100644 index 0000000..7a09ee2 --- /dev/null +++ b/appearance/MockScreen.qml @@ -0,0 +1,94 @@ +// Copyright (C) 2026 Danilo M. <danix@danix.xyz> +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License version 2 as +// published by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +import QtQuick + +// One monitor in the mock desk layout: a bezel, a stand, and the panel at the +// screen's real aspect ratio. Drawn rather than loaded from an SVG so it takes +// its colours from the theme and stays sharp at any scale. +Item { + id: mock + + property string label: "" + property string source: "" + property bool targeted: false + + // The panel's size; the bezel and stand are added around it. + property real panelWidth: 100 + property real panelHeight: 100 + + readonly property real bezel: Math.max(4, Math.round(panelWidth * 0.02)) + // Proportional to width rather than height: the vertical monitor is tall + // and narrow, and a share of its height would give it an absurd stand. + readonly property real standHeight: Math.max(14, Math.round(panelWidth * 0.1)) + + implicitWidth: panelWidth + bezel * 2 + implicitHeight: panelHeight + bezel * 2 + standHeight + + Column { + anchors.horizontalCenter: parent.horizontalCenter + spacing: 0 + + // Case. + Rectangle { + width: mock.panelWidth + mock.bezel * 2 + height: mock.panelHeight + mock.bezel * 2 + radius: Math.max(3, mock.bezel) + color: "#1a1a1e" + border.width: 1 + border.color: mock.targeted ? Theme.accent : Qt.alpha("#ffffff", 0.14) + + // Screen. + Rectangle { + anchors.centerIn: parent + width: mock.panelWidth + height: mock.panelHeight + color: Theme.base + clip: true + + Image { + anchors.fill: parent + source: mock.source === "" ? "" : "file://" + mock.source + asynchronous: true + cache: false + // swaybg is called with -m fill, so the mock crops the same way. + fillMode: Image.PreserveAspectCrop + sourceSize.width: 640 + } + + Text { + anchors.centerIn: parent + visible: mock.source === "" + text: mock.label + font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 } + color: Theme.overlay + } + } + } + + // Neck. + Rectangle { + anchors.horizontalCenter: parent.horizontalCenter + width: Math.max(8, Math.round(mock.panelWidth * 0.09)) + height: Math.round(mock.standHeight * 0.55) + color: "#26262e" + } + + // Foot. + Rectangle { + anchors.horizontalCenter: parent.horizontalCenter + width: Math.max(30, Math.round(mock.panelWidth * 0.32)) + height: Math.max(5, Math.round(mock.standHeight * 0.45)) + radius: height / 2 + color: "#2c2c35" + } + } +} |
