diff options
| author | Danilo M. <danix@danix.xyz> | 2026-12-04 11:32:57 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-12-04 11:32:57 +0100 |
| commit | 2830b2c1dd5ebe8ebcb5a48816479eff0b0950f6 (patch) | |
| tree | c51da477b588244574df088571b6d3b6e97adf2c /desktop/WindowButton.qml | |
| parent | 1a5c04780f7ec7ab1055cd4594aae3e6374fedd0 (diff) | |
| download | quickshell-2830b2c1dd5ebe8ebcb5a48816479eff0b0950f6.tar.gz quickshell-2830b2c1dd5ebe8ebcb5a48816479eff0b0950f6.zip | |
refactor: WindowButton, Keystone's round titlebar button
Shared so the assistant card's titlebar looks the same.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'desktop/WindowButton.qml')
| -rw-r--r-- | desktop/WindowButton.qml | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/desktop/WindowButton.qml b/desktop/WindowButton.qml new file mode 100644 index 0000000..e89ee99 --- /dev/null +++ b/desktop/WindowButton.qml @@ -0,0 +1,41 @@ +// 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 + +// A titlebar's round icon button: no box, a round tint on hover, red for a +// danger one (close). Keystone's titlebar and the assistant card's. +Rectangle { + id: btn + property string icon: "" + property bool danger: false + signal clicked() + + width: 28 + height: 28 + radius: 14 + color: area.containsMouse ? Qt.alpha(btn.danger ? Theme.red : Theme.accent, 0.25) : "transparent" + + Text { + anchors.centerIn: parent + text: btn.icon + font { family: Theme.iconFamily; pixelSize: Theme.fontSize - 2 } + color: Theme.text + } + + MouseArea { + id: area + anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + onClicked: btn.clicked() + } +} |
