267 lines
6.9 KiB
QML
267 lines
6.9 KiB
QML
import Quickshell // for PanelWindow
|
|
import QtQuick // for Text
|
|
import QtQuick.Shapes
|
|
import QtQuick.Controls
|
|
import QtQuick.Layouts
|
|
import Quickshell.Io
|
|
import Quickshell.Widgets
|
|
import Quickshell.Wayland
|
|
import Quickshell.Hyprland
|
|
|
|
PanelWindow {
|
|
|
|
property real radius: 10
|
|
|
|
property list<string> hyprcmds: [
|
|
`hl.dsp.exec_cmd("hyprctl eval \\\"hl.config({\
|
|
general = {\
|
|
gaps_out = 5,\
|
|
border_size = 1,\
|
|
},\
|
|
decoration = {\
|
|
blur = {\
|
|
enabled = true,\
|
|
},\
|
|
active_opacity = 0.96,\
|
|
inactive_opacity = 0.96,\
|
|
rounding = ${radius},\
|
|
},\
|
|
misc = {\
|
|
session_lock_xray = true,\
|
|
},\
|
|
})\
|
|
hl.window_rule({\
|
|
match = {\
|
|
title = 'lockscreen',\
|
|
},\
|
|
no_blur = true,\
|
|
fullscreen = true,\
|
|
})\
|
|
hl.monitor({\
|
|
output = '${Hyprland.monitorFor(root.screen).name}',\
|
|
reserved_area = {\
|
|
top = ${topEx},\
|
|
bottom = ${botEx},\
|
|
left = ${leftEx},\
|
|
right = ${rightEx},\
|
|
},\
|
|
})\\\"")`
|
|
]
|
|
|
|
onRadiusChanged: root.hyprcmds.forEach((c) => Hyprland.dispatch(c))
|
|
|
|
anchors {
|
|
top: true
|
|
left: true
|
|
right: true
|
|
bottom: true
|
|
}
|
|
|
|
IpcHandler {
|
|
target: "shell"
|
|
function reload() {
|
|
Quickshell.reload(false)
|
|
}
|
|
}
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
root.hyprcmds.forEach((c) => { Hyprland.dispatch(c) })
|
|
|
|
Hyprland.rawEvent.connect((e) => {
|
|
if(e.name == "configreloaded") {
|
|
root.hyprcmds.forEach((c) => { Hyprland.dispatch(c) })
|
|
}
|
|
})
|
|
|
|
Settings.reload()
|
|
}
|
|
|
|
property int topEx: topRect.reserve
|
|
property int botEx: botRect.reserve
|
|
|
|
property int leftEx: leftRect.reserve
|
|
property int rightEx: rightRect.reserve
|
|
|
|
property color bg: (Settings.special.background)
|
|
|
|
id: root
|
|
|
|
exclusionMode: ExclusionMode.Ignore
|
|
WlrLayershell.layer: WlrLayer.Top
|
|
|
|
color: "transparent"
|
|
|
|
mask: Region {
|
|
|
|
Region {
|
|
item: topRect.topRectArea
|
|
}
|
|
|
|
Region {
|
|
item: leftRect
|
|
}
|
|
|
|
Region {
|
|
item: topRect.midFO.visible ? topRect.midFO : leftRect
|
|
}
|
|
|
|
Region {
|
|
item: dash.visible ? dash : leftRect
|
|
}
|
|
|
|
Region {
|
|
item: botRect
|
|
}
|
|
|
|
Region {
|
|
item: botRect.midFO.visible ? botRect.midFO : botRect
|
|
}
|
|
}
|
|
|
|
|
|
BarBottom {
|
|
id: botRect
|
|
radius: root.radius
|
|
hyprcmds: root.hyprcmds
|
|
x: leftRect.x + leftRect.width
|
|
implicitWidth: rightRect.x - (leftRect.x + leftRect.width)
|
|
color: root.bg
|
|
}
|
|
|
|
BarLeft {
|
|
id: leftRect
|
|
window: root
|
|
color: root.bg
|
|
}
|
|
|
|
BarRight {
|
|
id: rightRect
|
|
color: root.bg
|
|
}
|
|
|
|
Shape {
|
|
|
|
x: leftRect.cornerX
|
|
y: topRect.cornerY
|
|
|
|
ShapePath {
|
|
strokeWidth: 1
|
|
|
|
strokeColor: "transparent"
|
|
fillColor: root.bg
|
|
startX: 0; startY: 0
|
|
|
|
PathLine { relativeX: 0; relativeY: radius }
|
|
PathArc {
|
|
radiusX: radius
|
|
radiusY: -radius
|
|
relativeX: radius
|
|
relativeY: -radius
|
|
}
|
|
PathLine { relativeX: -radius; relativeY: 0 }
|
|
}
|
|
}
|
|
Shape {
|
|
|
|
x: rightRect.x
|
|
y: topRect.cornerY
|
|
|
|
ShapePath {
|
|
strokeWidth: 1
|
|
|
|
strokeColor: "transparent"
|
|
fillColor: root.bg
|
|
|
|
startX: 0; startY: 0
|
|
|
|
PathLine { relativeX: 0; relativeY: radius }
|
|
PathArc {
|
|
direction: PathArc.Counterclockwise
|
|
radiusX: radius
|
|
radiusY: radius
|
|
relativeX: -radius
|
|
relativeY: -radius
|
|
}
|
|
PathLine { relativeX: radius; relativeY: 0 }
|
|
}
|
|
}
|
|
Shape {
|
|
|
|
x: leftRect.cornerX
|
|
y: botRect.cornerY
|
|
|
|
ShapePath {
|
|
strokeWidth: 1
|
|
|
|
strokeColor: "transparent"
|
|
fillColor: root.bg
|
|
|
|
startX: 0; startY: 0
|
|
|
|
PathLine { relativeX: 0; relativeY: -radius }
|
|
PathArc {
|
|
direction: PathArc.Counterclockwise
|
|
radiusX: radius
|
|
radiusY: radius
|
|
relativeX: radius
|
|
relativeY: radius
|
|
}
|
|
PathLine { relativeX: -radius; relativeY: 0 }
|
|
}
|
|
}
|
|
Shape {
|
|
|
|
x: rightRect.x
|
|
y: botRect.cornerY
|
|
|
|
ShapePath {
|
|
strokeWidth: 1
|
|
strokeColor: "transparent"
|
|
fillColor: root.bg
|
|
|
|
startX: 0; startY: 0
|
|
|
|
PathLine { relativeX: 0; relativeY: -radius }
|
|
PathArc {
|
|
radiusX: radius
|
|
radiusY: -radius
|
|
relativeX: -radius
|
|
relativeY: radius
|
|
}
|
|
PathLine { relativeX: radius; relativeY: 0 }
|
|
}
|
|
}
|
|
|
|
BarTop {
|
|
id: topRect
|
|
x: leftRect.x + leftRect.width
|
|
width: rightRect.x - x
|
|
//y: topRect.y + topRect.height - 1
|
|
window: root
|
|
radius: root.radius
|
|
color: root.bg
|
|
|
|
onShowDashChanged: dash.visible = showDash
|
|
}
|
|
|
|
onTopExChanged: Hyprland.dispatch(`hl.dsp.exec_cmd("hyprctl eval \\\"hl.monitor({ output = '${Hyprland.monitorFor(root.screen).name}', mode = '1920x1080@60', position = '0x0', scale = 1, reserved_area = { top = ${topEx}, bottom = ${botEx}, left = ${leftEx}, right = ${rightEx}, }, })\\\"")`)
|
|
onBotExChanged: Hyprland.dispatch(`hl.dsp.exec_cmd("hyprctl eval \\\"hl.monitor({ output = '${Hyprland.monitorFor(root.screen).name}', mode = '1920x1080@60', position = '0x0', scale = 1, reserved_area = { top = ${topEx}, bottom = ${botEx}, left = ${leftEx}, right = ${rightEx}, }, })\\\"")`)
|
|
onRightExChanged: Hyprland.dispatch(`hl.dsp.exec_cmd("hyprctl eval \\\"hl.monitor({ output = '${Hyprland.monitorFor(root.screen).name}', mode = '1920x1080@60', position = '0x0', scale = 1, reserved_area = { top = ${topEx}, bottom = ${botEx}, left = ${leftEx}, right = ${rightEx}, }, })\\\"")`)
|
|
onLeftExChanged: Hyprland.dispatch(`hl.dsp.exec_cmd("hyprctl eval \\\"hl.monitor({ output = '${Hyprland.monitorFor(root.screen).name}', mode = '1920x1080@60', position = '0x0', scale = 1, reserved_area = { top = ${topEx}, bottom = ${botEx}, left = ${leftEx}, right = ${rightEx}, }, })\\\"")`)
|
|
|
|
Dashboard {
|
|
id: dash
|
|
|
|
x: root.screen.width / 2 - width / 2
|
|
y: topRect.reserve - 1
|
|
|
|
onVisibleChanged: topRect.showDash = visible
|
|
//onEntered: topRect.midFO.visible = true
|
|
onHoveredChanged: topRect.midFO.visible = !hovered
|
|
|
|
radius: root.radius
|
|
}
|
|
}
|