feat: basic quickshell setup
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import "./widgets/"
|
||||
import "../config"
|
||||
|
||||
Scope {
|
||||
Variants {
|
||||
model: Quickshell.screens
|
||||
|
||||
PanelWindow {
|
||||
id: barRoot
|
||||
property var modelData
|
||||
screen: modelData
|
||||
|
||||
anchors {
|
||||
top: true
|
||||
left: true
|
||||
right: true
|
||||
}
|
||||
|
||||
color: Appearance.colors.m3background
|
||||
|
||||
implicitHeight: 40
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
|
||||
spacing: 0
|
||||
|
||||
Clock {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import "../config/"
|
||||
|
||||
// Mostly from here: https://github.com/ChrisTitusTech/quickshell/blob/main/bar/BarBlock.qml
|
||||
Rectangle {
|
||||
id: root
|
||||
radius: Appearance.rounding.barItems
|
||||
|
||||
Layout.preferredWidth: contentContainer.implicitWidth + 20
|
||||
Layout.preferredHeight: 30
|
||||
|
||||
property Item content: Text {
|
||||
text: "No content"
|
||||
}
|
||||
property bool hoverEnabled: false
|
||||
property Item mouseArea: mouseArea
|
||||
|
||||
property bool dim: false
|
||||
property var onClicked: function () {}
|
||||
property int leftPadding
|
||||
property int rightPadding
|
||||
|
||||
// Background color
|
||||
color: {
|
||||
if (mouseArea.containsMouse)
|
||||
return Appearance.colors.m3primary;
|
||||
return Appearance.colors.m3background;
|
||||
}
|
||||
|
||||
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 {
|
||||
enabled: root.hoverEnabled
|
||||
id: mouseArea
|
||||
anchors.fill: root
|
||||
hoverEnabled: true
|
||||
acceptedButtons: Qt.LeftButton
|
||||
onClicked: root.onClicked()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
Bar 1.0 Bar.qml
|
||||
WidgetWrapper 1.0 WidgetWrapper.qml
|
||||
@@ -0,0 +1,4 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
|
||||
Scope {}
|
||||
@@ -0,0 +1,10 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import "."
|
||||
import "../../config"
|
||||
|
||||
Text {
|
||||
text: `${ClockHandler.date}, ${ClockHandler.time}`
|
||||
color: Appearance.colors.m3onBackground
|
||||
Layout.leftMargin: 10
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
pragma Singleton
|
||||
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import QtQuick
|
||||
|
||||
Singleton {
|
||||
property string time
|
||||
property string date
|
||||
|
||||
Process {
|
||||
id: dateProc
|
||||
command: ["date", "+%a %e %b|%T"]
|
||||
running: true
|
||||
|
||||
stdout: SplitParser {
|
||||
onRead: data => {
|
||||
date = data.split("|")[0];
|
||||
time = data.split("|")[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
interval: 1000
|
||||
running: true
|
||||
repeat: true
|
||||
onTriggered: dateProc.running = true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
|
||||
Scope {
|
||||
id: root
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
Clock 1.0 Clock.qml
|
||||
singleton ClockHandler 1.0 ClockHandler.qml
|
||||
Reference in New Issue
Block a user