feat: complete quickshell redesign
This commit is contained in:
1 parent
5245f4aaf2
commit
8be610fbdd
25 files changed
+1410
-401
No files matched your search
@@ -8,12 +8,15 @@ PanelWindow {
|
||||
id: logoutWindow
|
||||
property QtObject rootState
|
||||
property int currentIndex: 2 // Default to Logout in the middle
|
||||
// Destructive actions (Reboot/Shutdown) require a second confirmation
|
||||
// before executing - selecting them the first time just arms them.
|
||||
property int armedIndex: -1
|
||||
property var actions: [
|
||||
{ cmd: "loginctl lock-session" },
|
||||
{ cmd: "systemctl suspend" },
|
||||
{ cmd: "loginctl terminate-user $USER" },
|
||||
{ cmd: "systemctl reboot" },
|
||||
{ cmd: "systemctl poweroff" }
|
||||
{ cmd: "loginctl lock-session", key: "L", label: "Lock", sub: "loginctl lock-session", destructive: false },
|
||||
{ cmd: "loginctl terminate-user $USER", key: "E", label: "Logout", sub: "loginctl terminate-user", destructive: false },
|
||||
{ cmd: "systemctl suspend", key: "U", label: "Suspend", sub: "systemctl suspend", destructive: false },
|
||||
{ cmd: "systemctl reboot", key: "R", label: "Reboot", sub: "systemctl reboot", destructive: true },
|
||||
{ cmd: "systemctl poweroff", key: "S", label: "Shutdown", sub: "systemctl poweroff", destructive: true }
|
||||
]
|
||||
|
||||
visible: rootState.logoutMenuOpen
|
||||
@@ -24,7 +27,7 @@ PanelWindow {
|
||||
left: true
|
||||
right: true
|
||||
}
|
||||
|
||||
|
||||
exclusiveZone: 0
|
||||
color: "transparent"
|
||||
|
||||
@@ -39,74 +42,101 @@ PanelWindow {
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: Theme.colors.overlay // Full screen dim/blur
|
||||
color: Theme.colors.overlay // Full screen dim
|
||||
|
||||
Behavior on opacity { NumberAnimation { duration: Theme.animation.durationNormal } }
|
||||
opacity: rootState.logoutMenuOpen ? 1 : 0
|
||||
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: rootState.logoutMenuOpen = false
|
||||
}
|
||||
|
||||
Item {
|
||||
Surface {
|
||||
id: container
|
||||
width: buttonRow.width
|
||||
height: buttonRow.height
|
||||
anchors.centerIn: parent
|
||||
width: modalColumn.width + Theme.geometry.padding * 2
|
||||
height: modalColumn.height + Theme.geometry.padding * 2
|
||||
anchors.centerIn: parent
|
||||
tint: Theme.colors.primary
|
||||
glow: true
|
||||
|
||||
Behavior on scale { SpringAnimation { spring: Theme.motion.springSoft.spring; damping: Theme.motion.springSoft.damping } }
|
||||
Behavior on scale { NumberAnimation { duration: Theme.animation.durationFast; easing.type: Easing.OutCubic } }
|
||||
|
||||
Row {
|
||||
id: buttonRow
|
||||
spacing: Theme.geometry.spacing * 3
|
||||
|
||||
// Lock
|
||||
LogoutButton {
|
||||
icon: ""
|
||||
label: "Lock"
|
||||
isSelected: logoutWindow.currentIndex === 0
|
||||
onClicked: executeAction(logoutWindow.actions[0].cmd)
|
||||
onHovered: logoutWindow.currentIndex = 0
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
// Suspend
|
||||
LogoutButton {
|
||||
icon: ""
|
||||
label: "Suspend"
|
||||
isSelected: logoutWindow.currentIndex === 1
|
||||
onClicked: executeAction(logoutWindow.actions[1].cmd)
|
||||
onHovered: logoutWindow.currentIndex = 1
|
||||
|
||||
Column {
|
||||
id: modalColumn
|
||||
anchors.centerIn: parent
|
||||
spacing: Theme.geometry.spacing
|
||||
|
||||
// Title strip
|
||||
Item {
|
||||
width: buttonRow.width
|
||||
height: 24
|
||||
|
||||
Row {
|
||||
anchors.left: parent.left
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Theme.geometry.spacing / 2
|
||||
|
||||
Rectangle {
|
||||
width: 10
|
||||
height: 10
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: Theme.colors.primary
|
||||
border.width: Theme.geometry.borderWidth
|
||||
border.color: Theme.colors.crust
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "[SYSTEM // POWER MANAGEMENT]"
|
||||
color: Theme.colors.text
|
||||
font.family: Theme.font.family
|
||||
font.bold: true
|
||||
font.pixelSize: Theme.type.caption
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: logoutWindow.armedIndex >= 0 ? "LATCH: ARMED" : "LATCH: IDLE"
|
||||
color: logoutWindow.armedIndex >= 0 ? Theme.colors.alert : Theme.colors.textMuted
|
||||
font.family: Theme.font.family
|
||||
font.bold: true
|
||||
font.pixelSize: Theme.type.caption
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
id: buttonRow
|
||||
spacing: Theme.geometry.spacing * 2
|
||||
|
||||
Repeater {
|
||||
model: logoutWindow.actions
|
||||
|
||||
delegate: LogoutButton {
|
||||
action: modelData
|
||||
index: model.index
|
||||
isSelected: logoutWindow.currentIndex === model.index
|
||||
isArmed: logoutWindow.armedIndex === model.index
|
||||
onClicked: logoutWindow.select(model.index)
|
||||
onHovered: logoutWindow.currentIndex = model.index
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HintBar {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
hints: [
|
||||
{ key: "L/E/U/R/S", label: "Select" },
|
||||
{ key: "↵", label: "Confirm" },
|
||||
{ key: "Esc", label: "Abort" }
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
// Logout
|
||||
LogoutButton {
|
||||
icon: ""
|
||||
label: "Logout"
|
||||
isSelected: logoutWindow.currentIndex === 2
|
||||
onClicked: executeAction(logoutWindow.actions[2].cmd)
|
||||
onHovered: logoutWindow.currentIndex = 2
|
||||
}
|
||||
|
||||
// Reboot
|
||||
LogoutButton {
|
||||
icon: ""
|
||||
label: "Reboot"
|
||||
isSelected: logoutWindow.currentIndex === 3
|
||||
onClicked: executeAction(logoutWindow.actions[3].cmd)
|
||||
onHovered: logoutWindow.currentIndex = 3
|
||||
}
|
||||
|
||||
// Poweroff
|
||||
LogoutButton {
|
||||
icon: ""
|
||||
label: "Shutdown"
|
||||
isDestructive: true
|
||||
isSelected: logoutWindow.currentIndex === 4
|
||||
onClicked: executeAction(logoutWindow.actions[4].cmd)
|
||||
onHovered: logoutWindow.currentIndex = 4
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,30 +144,43 @@ PanelWindow {
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
focus: true
|
||||
|
||||
|
||||
Keys.onEscapePressed: (event) => {
|
||||
rootState.logoutMenuOpen = false;
|
||||
if (logoutWindow.armedIndex >= 0) {
|
||||
logoutWindow.armedIndex = -1;
|
||||
} else {
|
||||
rootState.logoutMenuOpen = false;
|
||||
}
|
||||
event.accepted = true;
|
||||
}
|
||||
|
||||
|
||||
Keys.onLeftPressed: (event) => {
|
||||
if (logoutWindow.currentIndex > 0) {
|
||||
logoutWindow.currentIndex--;
|
||||
}
|
||||
if (logoutWindow.currentIndex > 0) logoutWindow.currentIndex--;
|
||||
logoutWindow.armedIndex = -1;
|
||||
event.accepted = true;
|
||||
}
|
||||
|
||||
|
||||
Keys.onRightPressed: (event) => {
|
||||
if (logoutWindow.currentIndex < 4) {
|
||||
logoutWindow.currentIndex++;
|
||||
}
|
||||
if (logoutWindow.currentIndex < logoutWindow.actions.length - 1) logoutWindow.currentIndex++;
|
||||
logoutWindow.armedIndex = -1;
|
||||
event.accepted = true;
|
||||
}
|
||||
|
||||
|
||||
Keys.onReturnPressed: (event) => {
|
||||
executeAction(logoutWindow.actions[logoutWindow.currentIndex].cmd);
|
||||
logoutWindow.select(logoutWindow.currentIndex);
|
||||
event.accepted = true;
|
||||
}
|
||||
|
||||
Keys.onPressed: (event) => {
|
||||
for (let i = 0; i < logoutWindow.actions.length; i++) {
|
||||
if (event.text.toUpperCase() === logoutWindow.actions[i].key) {
|
||||
logoutWindow.currentIndex = i;
|
||||
logoutWindow.select(i);
|
||||
event.accepted = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
@@ -145,9 +188,19 @@ PanelWindow {
|
||||
running: false
|
||||
}
|
||||
|
||||
function executeAction(cmd) {
|
||||
actionProcess.command = ["bash", "-c", cmd];
|
||||
// Non-destructive actions execute immediately. Destructive ones
|
||||
// (Reboot/Shutdown) arm on first selection and only execute once armed
|
||||
// and selected again - the "dual-stage confirmation / latch" from the
|
||||
// power-menu design.
|
||||
function select(index) {
|
||||
let action = logoutWindow.actions[index];
|
||||
if (action.destructive && logoutWindow.armedIndex !== index) {
|
||||
logoutWindow.armedIndex = index;
|
||||
return;
|
||||
}
|
||||
actionProcess.command = ["bash", "-c", action.cmd];
|
||||
actionProcess.running = true;
|
||||
logoutWindow.armedIndex = -1;
|
||||
rootState.logoutMenuOpen = false;
|
||||
}
|
||||
|
||||
@@ -155,50 +208,89 @@ PanelWindow {
|
||||
if (visible) {
|
||||
container.scale = 1.0;
|
||||
logoutWindow.currentIndex = 2; // Reset to center
|
||||
logoutWindow.armedIndex = -1;
|
||||
} else {
|
||||
container.scale = 0.95;
|
||||
}
|
||||
}
|
||||
|
||||
// Inline component for the big buttons
|
||||
|
||||
// Inline component for the big power-action tiles.
|
||||
component LogoutButton: Surface {
|
||||
property string icon: ""
|
||||
property string label: ""
|
||||
property bool isDestructive: false
|
||||
id: button
|
||||
property var action
|
||||
property int index: 0
|
||||
property bool isSelected: false
|
||||
property bool isArmed: false
|
||||
signal clicked()
|
||||
signal hovered()
|
||||
|
||||
width: 120
|
||||
height: 120
|
||||
color: Theme.colors.surface
|
||||
tint: isSelected ? (isDestructive ? Theme.colors.alert : Theme.colors.primary) : Theme.colors.border
|
||||
border.width: isSelected ? 2 : 1
|
||||
glow: isSelected
|
||||
readonly property color actionColor: isArmed ? Theme.colors.alert
|
||||
: action.destructive ? Theme.colors.alert
|
||||
: Theme.colors.primary
|
||||
|
||||
Behavior on scale { SpringAnimation { spring: Theme.motion.springSnappy.spring; damping: Theme.motion.springSnappy.damping } }
|
||||
scale: isSelected ? 1.05 : 1.0
|
||||
width: 128
|
||||
height: 128
|
||||
color: isSelected ? Theme.colors.surfaceHover : Theme.colors.surface
|
||||
tint: isSelected || isArmed ? actionColor : Theme.colors.border
|
||||
glow: isSelected || isArmed
|
||||
pressed: hoverArea.pressed
|
||||
|
||||
Column {
|
||||
anchors.centerIn: parent
|
||||
spacing: Theme.geometry.spacing
|
||||
|
||||
Text {
|
||||
text: parent.parent.icon
|
||||
font.family: Theme.font.family
|
||||
font.pixelSize: 36
|
||||
spacing: Theme.geometry.spacing / 2
|
||||
|
||||
Row {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
color: parent.parent.isSelected ? parent.parent.tint : Theme.colors.text
|
||||
spacing: Theme.geometry.spacing / 2
|
||||
|
||||
Rectangle {
|
||||
width: 16
|
||||
height: 16
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: button.isArmed ? Theme.colors.alert : "transparent"
|
||||
border.width: Theme.geometry.borderWidth
|
||||
border.color: Theme.colors.crust
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: button.action.key
|
||||
font.family: Theme.font.family
|
||||
font.bold: true
|
||||
font.pixelSize: 10
|
||||
color: button.isArmed ? Theme.colors.textOnAccent : Theme.colors.text
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: button.isArmed ? "ARMED" : ("#0" + (button.index + 1))
|
||||
font.family: Theme.font.family
|
||||
font.bold: true
|
||||
font.pixelSize: Theme.type.caption
|
||||
color: button.isArmed ? Theme.colors.alert : Theme.colors.textMuted
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Text {
|
||||
text: parent.parent.label
|
||||
font.family: Theme.font.family
|
||||
text: button.action.label
|
||||
font.family: Theme.font.headlineFamily
|
||||
font.pixelSize: 16
|
||||
font.bold: true
|
||||
font.capitalization: Font.AllUppercase
|
||||
color: Theme.colors.text
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
Text {
|
||||
text: button.action.sub
|
||||
font.family: Theme.font.family
|
||||
font.pixelSize: 9
|
||||
color: button.action.destructive ? Theme.colors.alert : Theme.colors.textMuted
|
||||
width: button.width - Theme.geometry.spacing * 2
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
wrapMode: Text.WordWrap
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
@@ -206,8 +298,8 @@ PanelWindow {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onEntered: parent.hovered()
|
||||
onClicked: parent.clicked()
|
||||
onEntered: button.hovered()
|
||||
onClicked: button.clicked()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user