usable
This commit is contained in:
@@ -1,120 +1,126 @@
|
||||
import Quickshell
|
||||
import Quickshell // for PanelWindow
|
||||
import QtQuick // for Text
|
||||
import QtQuick.Shapes
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import Quickshell.Hyprland
|
||||
import Quickshell.Io
|
||||
import Quickshell.Widgets
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Hyprland
|
||||
|
||||
Item {
|
||||
width: 30
|
||||
height: 30
|
||||
PanelWindow {
|
||||
|
||||
anchors {
|
||||
top: true
|
||||
left: true
|
||||
right: true
|
||||
bottom: true
|
||||
}
|
||||
|
||||
exclusionMode: ExclusionMode.Ignore
|
||||
WlrLayershell.layer: WlrLayer.Overlay
|
||||
|
||||
id: root
|
||||
|
||||
required property PanelWindow window
|
||||
required property real popupOffset
|
||||
|
||||
ClippingWrapperRectangle {
|
||||
radius: 5
|
||||
width: 30; height: 30
|
||||
Button {
|
||||
id: button
|
||||
text: " "
|
||||
font.pointSize: 16
|
||||
|
||||
onClicked: {
|
||||
menu.visible = true
|
||||
grab.active = true
|
||||
}
|
||||
implicitHeight: parent.height
|
||||
}
|
||||
mask: Region {
|
||||
item: out
|
||||
}
|
||||
|
||||
PopupWindow {
|
||||
|
||||
id: menu
|
||||
color: "#99000000"
|
||||
|
||||
anchor.window: window
|
||||
anchor.rect.x: popupOffset
|
||||
anchor.rect.y: 50
|
||||
implicitWidth: 150
|
||||
implicitHeight: 250
|
||||
visible: false
|
||||
Lock {
|
||||
id: lock
|
||||
bg_path: "/tmp/nathan/tmp.jpg"
|
||||
//locked: true
|
||||
}
|
||||
|
||||
color: "transparent"
|
||||
|
||||
ClippingWrapperRectangle {
|
||||
radius: 5
|
||||
MouseArea {
|
||||
|
||||
implicitHeight: parent.height - 20
|
||||
implicitWidth: parent.width
|
||||
|
||||
ColumnLayout {
|
||||
id: out
|
||||
|
||||
spacing: 0
|
||||
anchors.fill: parent
|
||||
|
||||
Button {
|
||||
Layout.topMargin: 5
|
||||
x: (parent.width - width) / 2
|
||||
implicitWidth: parent.width - 10
|
||||
implicitHeight: parent.height / 5 - parent.spacing
|
||||
onClicked: {
|
||||
root.visible = false
|
||||
}
|
||||
|
||||
text: 'shutdown'
|
||||
onClicked: shutdown.running = true
|
||||
Process {
|
||||
id: shutdown
|
||||
running: false
|
||||
command: ["systemctl", "poweroff"]
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
x: (parent.width - width) / 2
|
||||
implicitWidth: parent.width - 10
|
||||
implicitHeight: parent.height / 5 - parent.spacing
|
||||
text: 'reboot'
|
||||
onClicked: reboot.running = true
|
||||
Process {
|
||||
id: reboot
|
||||
running: false
|
||||
command: ["systemctl", "reboot"]
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
x: (parent.width - width) / 2
|
||||
implicitWidth: parent.width - 10
|
||||
implicitHeight: parent.height / 5 - parent.spacing
|
||||
text: 'logout'
|
||||
onClicked: logout.running = true
|
||||
Process {
|
||||
id: logout
|
||||
running: false
|
||||
command: ["loginctl", "kill-session", "self" ]
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
Layout.bottomMargin: 10
|
||||
x: (parent.width - width) / 2
|
||||
implicitWidth: parent.width - 10
|
||||
implicitHeight: parent.height / 5 - parent.spacing
|
||||
text: 'sleep'
|
||||
onClicked: sleep.running = true
|
||||
Process {
|
||||
id: sleep
|
||||
running: false
|
||||
command: ["systemctl", "sleep"]
|
||||
ClippingRectangle {
|
||||
implicitWidth: 200
|
||||
implicitHeight: 200
|
||||
id: main
|
||||
anchors.centerIn: parent
|
||||
radius: 10
|
||||
color: "transparent"
|
||||
GridLayout {
|
||||
columns: 2
|
||||
rows: 2
|
||||
|
||||
Repeater {
|
||||
model: 4
|
||||
WrapperMouseArea {
|
||||
ClippingWrapperRectangle {
|
||||
radius: 10
|
||||
Text {
|
||||
text: switch(index) {
|
||||
case 0:
|
||||
return ""
|
||||
case 1:
|
||||
return " "
|
||||
case 2:
|
||||
return " "
|
||||
case 3:
|
||||
return " "
|
||||
default:
|
||||
return " "
|
||||
break;
|
||||
}
|
||||
font.pointSize: 16
|
||||
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
|
||||
color: Pywal.special.foreground
|
||||
}
|
||||
|
||||
implicitHeight: 60
|
||||
implicitWidth: 60
|
||||
color: parent.contansMouse ? Pywal.colors.color12 : Pywal.colors.color4
|
||||
}
|
||||
|
||||
hoverEnabled: true
|
||||
|
||||
onEntered: {
|
||||
child.color = Pywal.colors.color12
|
||||
}
|
||||
|
||||
onExited: {
|
||||
child.color = Pywal.colors.color4
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
root.visible = false
|
||||
switch(index) {
|
||||
case 0:
|
||||
Hyprland.dispatch("exec loginctl kill-session self")
|
||||
break;
|
||||
case 1:
|
||||
Hyprland.dispatch("exec systemctl reboot")
|
||||
break;
|
||||
case 2:
|
||||
Hyprland.dispatch("exec loginctl lock-session")
|
||||
break;
|
||||
case 3:
|
||||
Hyprland.dispatch("exec systemctl poweroff")
|
||||
break;
|
||||
default:
|
||||
lock.locked = true
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HyprlandFocusGrab {
|
||||
id: grab
|
||||
windows: [ menu ]
|
||||
onCleared: menu.visible = false
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user