aboutsummaryrefslogtreecommitdiffstats
path: root/home/quickshell/bar/BarBlock.qml
diff options
context:
space:
mode:
authorPetri Hienonen <petri.hienonen@gmail.com>2024-05-23 13:56:00 +0300
committerPetri Hienonen <petri.hienonen@gmail.com>2025-11-30 12:29:57 +0200
commit08297376a85a1719518507e54fca9de954d2376a (patch)
tree3b9c58304b40248533bbb2bb5b7bad2da9da1ff0 /home/quickshell/bar/BarBlock.qml
parent75c2af4aedd2ac5c2cfc74b346625fa4b265541d (diff)
downloadnixos-08297376a85a1719518507e54fca9de954d2376a.tar.zst
Agenix configuration
Diffstat (limited to 'home/quickshell/bar/BarBlock.qml')
-rw-r--r--home/quickshell/bar/BarBlock.qml75
1 files changed, 75 insertions, 0 deletions
diff --git a/home/quickshell/bar/BarBlock.qml b/home/quickshell/bar/BarBlock.qml
new file mode 100644
index 0000000..edd4aca
--- /dev/null
+++ b/home/quickshell/bar/BarBlock.qml
@@ -0,0 +1,75 @@
+import QtQuick
+import QtQuick.Layouts
+import Quickshell
+
+Rectangle {
+ id: root
+ Layout.preferredWidth: contentContainer.implicitWidth + 10
+ Layout.preferredHeight: 30
+
+ property Item content
+ property Item mouseArea: mouseArea
+
+ property string text
+ property bool dim: false
+ property bool underline
+ property var onClicked: function() {}
+ property int leftPadding
+ property int rightPadding
+
+ property string hoveredBgColor: "#666666"
+
+ // Background color
+ color: {
+ if (mouseArea.containsMouse)
+ return hoveredBgColor;
+ return "transparent";
+ }
+
+ states: [
+ State {
+ when: mouseArea.containsMouse
+ PropertyChanges {
+ target: root
+ }
+ }
+ ]
+
+ Behavior on color {
+ ColorAnimation {
+ duration: 200
+ }
+ }
+
+ Item {
+ // Contents of the bar block
+ id: contentContainer
+ implicitWidth: content.implicitWidth
+ implicitHeight: content.implicitHeight
+ anchors.centerIn: parent
+ children: content
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: root
+ hoverEnabled: true
+ acceptedButtons: Qt.LeftButton
+ onClicked: root.onClicked()
+ }
+
+ // While line underneath workspace
+ Rectangle {
+ id: wsLine
+ width: parent.width
+ height: 2
+
+ color: {
+ if (parent.underline)
+ return "white";
+ return "transparent";
+ }
+ anchors.bottom: parent.bottom
+ }
+}
+