mirror of
https://github.com/pnx/dotfiles
synced 2026-10-15 04:36:46 +02:00
add quickshell config
This commit is contained in:
parent
d2394e3c7a
commit
200a1e3b59
12 changed files with 435 additions and 0 deletions
76
quickshell/components/Tray/Tray.qml
Normal file
76
quickshell/components/Tray/Tray.qml
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Quickshell.Widgets
|
||||
import Quickshell.Services.SystemTray
|
||||
import ".."
|
||||
|
||||
RowLayout {
|
||||
id: root
|
||||
spacing: 4
|
||||
property color backgroundColor: "transparent"
|
||||
property color backgroundHoverColor: "transparent"
|
||||
|
||||
Repeater {
|
||||
model: SystemTray.items
|
||||
TrayItem {
|
||||
id: entry
|
||||
required property SystemTrayItem modelData
|
||||
readonly property var tooltipData: getTooltip(modelData)
|
||||
|
||||
function getTooltip(item) {
|
||||
// Quick hack for nextcloud
|
||||
if (item.id == "Nextcloud") {
|
||||
return [
|
||||
"Nextcloud",
|
||||
item.tooltipTitle
|
||||
]
|
||||
}
|
||||
return [
|
||||
item.tooltipTitle || item.title,
|
||||
item.tooltipDescription || ""
|
||||
]
|
||||
}
|
||||
|
||||
icon: modelData.icon
|
||||
tooltip: tooltipData[0]
|
||||
tooltipDescription: tooltipData[1]
|
||||
backgroundColor: root.backgroundColor
|
||||
backgroundHoverColor: root.backgroundHoverColor
|
||||
|
||||
onClicked: button => {
|
||||
switch (button) {
|
||||
case Qt.LeftButton:
|
||||
if (modelData.onlyMenu) {
|
||||
menuAnchor.open()
|
||||
} else {
|
||||
modelData.activate()
|
||||
}
|
||||
break
|
||||
|
||||
case Qt.RightButton:
|
||||
if (modelData.hasMenu) {
|
||||
menuAnchor.open()
|
||||
} else {
|
||||
modelData.secondaryActivate()
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
QsMenuAnchor {
|
||||
id: menuAnchor
|
||||
menu: entry.modelData.menu
|
||||
|
||||
anchor {
|
||||
item: entry
|
||||
|
||||
edges: Edges.Top | Edges.Left
|
||||
gravity: Edges.Top | Edges.Right
|
||||
|
||||
adjustment: PopupAdjustment.All
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
8
quickshell/components/Tray/TrayItem.qml
Normal file
8
quickshell/components/Tray/TrayItem.qml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import QtQuick
|
||||
import "../../components"
|
||||
|
||||
Button {
|
||||
paddingY: 4
|
||||
paddingX: 4
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue