quickshell: init config

This commit is contained in:
Bloxx12 2025-06-26 20:46:50 +02:00
commit 5e9c4e8e4c
Signed by: faukah
SSH key fingerprint: SHA256:Uj2AXqvtdCA4hn5Hq0ZonhIAyUqI1q4w2sMG3Z1TH7E
20 changed files with 1650 additions and 0 deletions

View file

@ -0,0 +1,50 @@
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Layouts
import Quickshell
import "../../config"
import "components"
Item {
id: root
required property ShellScreen screen
anchors {
top: parent.top
bottom: parent.bottom
left: parent.left
}
implicitWidth: Config.bar.width
Item {
id: child
anchors {
top: parent.top
bottom: parent.bottom
horizontalCenter: parent.horizontalCenter
}
implicitWidth: Math.max(clock.implicitWidth, workspaces.implicitWidth)
ColumnLayout {
spacing: 2
anchors {
top: parent.top
left: parent.left
right: parent.right
margins: 0
}
Clock {
id: clock
}
Workspaces {
id: workspaces
screen: root.screen
}
}
}
}

View file

@ -0,0 +1,34 @@
import QtQuick
import Quickshell
import "../../../config"
Rectangle {
id: root
width: text.width + 5
height: text.height + 5
implicitWidth: width
border.color: Config.catppuccin.rosewater
border.width: 0
radius: 5
color: "transparent"
Text {
id: text
anchors.centerIn: parent
property var date: Date()
text: Qt.formatDateTime(clock.date, "hh mm")
font.family: "JetBrainsMono NF Mono"
font.pointSize: 15
color: Config.catppuccin.text
}
SystemClock {
id: clock
precision: SystemClock.Seconds
}
}

View file

@ -0,0 +1,109 @@
pragma ComponentBehavior: Bound
import QtQuick
import Quickshell
import Quickshell.Io
import QtQuick.Layouts
import "../../../services/niri"
import "../../../config"
Rectangle {
id: root
required property ShellScreen screen
property var workspaces: Niri.workspaces
property var wsCount: Niri.workspaces.length
property var activeWorkspace: Niri.activeWorkspace
property var activeWorkspaceIndex: Niri.activeWorkspaceIndex
property int wsItemHeight: 15
signal workspaceAdded(workspace: var)
function onWorkspaceAdded(workspace: var) {
root.workspaces.push(workspace);
}
// property bool _: log()
// function log() {
// console.log(workspaces.values);
// return true;
// }
// Works
height: 300
// Gives warning
// height: workspaces.length * root.wsItemHeight
implicitWidth: list.implicitWidth
color: "transparent"
border.color: Config.catppuccin.rosewater
border.width: 0
radius: 7
Layout.fillWidth: true
ListView {
id: list
model: root.workspaces
implicitHeight: contentHeight
implicitWidth: contentItem.childrenRect.width
anchors.horizontalCenter: parent.horizontalCenter
// anchors.fill: parent
delegate: Item {
id: wsItem
// Name of the workspace
property string name: "VOID"
// ID of the workspace
required property string id
required property string output
property bool isActive: (id - 1 == root.activeWorkspaceIndex)
property real animActive: isActive ? 1 : 0.65
Behavior on animActive {
NumberAnimation {
duration: 150
}
}
// property bool isCorrectScreen: log()
// function log() {
// console.log("Screen name: " + root.screen.name);
// console.log(wsItem.output);
// console.log(wsItem.id);
// let isCorrect = root.screen.name == wsItem.output;
// console.log("isCorrect: ", isCorrect);
// return root.screen.name == wsItem.output;
// }
implicitHeight: root.wsItemHeight
implicitWidth: 50
anchors {
right: parent.right
left: parent.left
}
Rectangle {
anchors.centerIn: parent
height: wsItem.height - 5
width: parent.width * wsItem.animActive
radius: height / 2
border.color: Config.catppuccin.mantle
border.width: 0
color: Config.catppuccin.blue
}
}
}
Component.onCompleted: {
Niri.workspaces.forEach(workspace => {
root.workspaceAdded(workspace);
});
}
}