diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-07-08 18:25:20 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-07-08 18:25:20 +0800 |
| commit | b707a6ee3ebfb5b527af63f0eacfb63ec1a580cb (patch) | |
| tree | 47008e296e936b32287c5cf9ebe065a119f5b2aa | |
init
| -rw-r--r-- | bar/Bar.qml | 62 | ||||
| -rw-r--r-- | bar/Workspace.qml | 21 | ||||
| -rw-r--r-- | config/Bar.qml | 16 | ||||
| -rw-r--r-- | config/Icons.qml | 22 | ||||
| -rw-r--r-- | config/Style.qml | 85 | ||||
| -rw-r--r-- | services/Hyprland.qml | 51 | ||||
| -rw-r--r-- | shell.qml | 6 | ||||
| -rw-r--r-- | utils/IWindow.qml | 12 |
8 files changed, 275 insertions, 0 deletions
diff --git a/bar/Bar.qml b/bar/Bar.qml new file mode 100644 index 0000000..f28b836 --- /dev/null +++ b/bar/Bar.qml @@ -0,0 +1,62 @@ +import "../utils" +import "../config" +import QtQuick +import Quickshell +import QtQuick.Layouts + +Scope { + id: root + + Variants { + model: Quickshell.screens + + IWindow { + name: "Bar" + + anchors { + top: true + left: true + right: true + } + implicitHeight: child.implicitHeight + Bar.topMargin * 2 + + Rectangle { + id: child + radius: Bar.borderRadius + implicitHeight: Bar.height + implicitWidth: parent.width + + anchors { + left: parent.left + right: parent.mid + fill: parent + top: parent.top + topMargin: Bar.topMargin + leftMargin: Bar.leftMargin + rightMargin: Bar.rightMargin + } + RowLayout { + anchors { + fill: parent + left: parent.left + } + Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter + id: row + + Workspace { + id: workspace + } + // Workspace { + // + // id: workspace2 + // } + // Workspace { + // + // id: workspace3 + // } + } + + } + } + } +} diff --git a/bar/Workspace.qml b/bar/Workspace.qml new file mode 100644 index 0000000..2f8d1ea --- /dev/null +++ b/bar/Workspace.qml @@ -0,0 +1,21 @@ +import "../services" +import QtQuick.Layouts +import QtQuick +import Quickshell + +Item { + Layout.preferredHeight: 50 + Layout.preferredWidth: parent.width / 3 + + RowLayout { + anchors.fill: parent + spacing: 0 + Repeater { + model: Hyprland.workspaces + + Text { + text: modelData.active ? modelData.name + " (Active)" : modelData.name + } + } + } +} diff --git a/config/Bar.qml b/config/Bar.qml new file mode 100644 index 0000000..a851efc --- /dev/null +++ b/config/Bar.qml @@ -0,0 +1,16 @@ +pragma Singleton + +import Quickshell +import QtQuick + +Singleton { + id: root + + readonly property int height: 45 + readonly property int borderRadius: Style.rounding.small + readonly property int topMargin: Style.spacing.small + readonly property int leftMargin: Style.spacing.larger + readonly property int rightMargin: Style.spacing.larger + + readonly property int workspaces: 10 +} diff --git a/config/Icons.qml b/config/Icons.qml new file mode 100644 index 0000000..df9636e --- /dev/null +++ b/config/Icons.qml @@ -0,0 +1,22 @@ +pragma Singleton + +import Quickshell + +Singleton { + id: root + + readonly property var ws: ({ + 1: "", + 2: "", + 3: "", + 4: "", + 5: "", + 6: "", + 7: "", + 8: "", + 9: "", + urgent: "", + active: "", + default: " ", + }) +} diff --git a/config/Style.qml b/config/Style.qml new file mode 100644 index 0000000..c867ee9 --- /dev/null +++ b/config/Style.qml @@ -0,0 +1,85 @@ +pragma Singleton + +import Quickshell +import QtQuick + +Singleton { + id: root + + readonly property Rounding rounding: Rounding {} + readonly property Spacing spacing: Spacing {} + readonly property Padding padding: Padding {} + readonly property Font font: Font {} + readonly property Anim anim: Anim {} + + component Rounding: QtObject { + readonly property int small: 12 + readonly property int normal: 17 + readonly property int large: 25 + readonly property int full: 1000 + } + + component Spacing: QtObject { + readonly property int small: 7 + readonly property int smaller: 10 + readonly property int normal: 12 + readonly property int larger: 15 + readonly property int large: 20 + } + + component Padding: QtObject { + readonly property int small: 5 + readonly property int smaller: 7 + readonly property int normal: 10 + readonly property int larger: 12 + readonly property int large: 15 + } + + component FontFamily: QtObject { + readonly property string symbols: "Symbols Nerd Font" + readonly property string iosevka: "Iosevka Nerd Font" + readonly property string mono: "JetBrains Mono" + } + + component FontSize: QtObject { + readonly property int small: 11 + readonly property int smaller: 12 + readonly property int normal: 13 + readonly property int larger: 15 + readonly property int large: 18 + readonly property int extraLarge: 28 + } + + component Font: QtObject { + readonly property FontFamily family: FontFamily {} + readonly property FontSize size: FontSize {} + } + + component AnimCurves: QtObject { + readonly property list<real> emphasized: [0.05, 0, 2 / 15, 0.06, 1 / 6, 0.4, 5 / 24, 0.82, 0.25, 1, 1, 1] + readonly property list<real> emphasizedAccel: [0.3, 0, 0.8, 0.15, 1, 1] + readonly property list<real> emphasizedDecel: [0.05, 0.7, 0.1, 1, 1, 1] + readonly property list<real> standard: [0.2, 0, 0, 1, 1, 1] + readonly property list<real> standardAccel: [0.3, 0, 1, 1, 1, 1] + readonly property list<real> standardDecel: [0, 0, 0, 1, 1, 1] + readonly property list<real> expressiveFastSpatial: [0.42, 1.67, 0.21, 0.9, 1, 1] + readonly property list<real> expressiveDefaultSpatial: [0.38, 1.21, 0.22, 1, 1, 1] + readonly property list<real> expressiveEffects: [0.34, 0.8, 0.34, 1, 1, 1] + } + + component AnimDurations: QtObject { + readonly property int small: 200 + readonly property int normal: 400 + readonly property int large: 600 + readonly property int extraLarge: 1000 + readonly property int expressiveFastSpatial: 350 + readonly property int expressiveDefaultSpatial: 500 + readonly property int expressiveEffects: 200 + } + + component Anim: QtObject { + readonly property AnimCurves curves: AnimCurves {} + readonly property AnimDurations durations: AnimDurations {} + } +} + diff --git a/services/Hyprland.qml b/services/Hyprland.qml new file mode 100644 index 0000000..84db674 --- /dev/null +++ b/services/Hyprland.qml @@ -0,0 +1,51 @@ +pragma Singleton + +import Quickshell +import Quickshell.Hyprland +import QtQuick +import "../config" + +Singleton { + id: root + + readonly property var toplevels: Hyprland.toplevels + readonly property var workspaces: Hyprland.workspaces + readonly property var monitors: Hyprland.monitors + // readonly property HyprlandToplevel activeToplevel: Hyprland.activeToplevel + readonly property HyprlandWorkspace focusedWorkspace: Hyprland.focusedWorkspace + readonly property HyprlandMonitor focusedMonitor: Hyprland.focusedMonitor + readonly property int activeWs: focusedWorkspace?.id ?? 1 + + function dispatch(request: string): void { + Hyprland.dispatch(request); + } + + function getAllWorkspaces(): var { + var allWorkspaces = { + values: [], + count: 0 + }; + for (let i = 1; i <= Bar.workspaces; i++) { + if (workspaces[i] === undefined) { + allWorkspaces.values[i] = HyprlandWorkspace; + } + } + return allWorkspaces; + } + + Connections { + target: Hyprland + + function onRawEvent(event: HyprlandEvent): void { + if (event.name.endsWith("v2")) + return; + + if (event.name.includes("mon")) + Hyprland.refreshMonitors(); + else if (event.name.includes("workspace")) + Hyprland.refreshWorkspaces(); + // else + // Hyprland.refreshToplevels(); + } + } +} diff --git a/shell.qml b/shell.qml new file mode 100644 index 0000000..a2059bc --- /dev/null +++ b/shell.qml @@ -0,0 +1,6 @@ +import Quickshell +import "bar" + +Scope { + Bar {} +} diff --git a/utils/IWindow.qml b/utils/IWindow.qml new file mode 100644 index 0000000..85f2205 --- /dev/null +++ b/utils/IWindow.qml @@ -0,0 +1,12 @@ +import Quickshell +import Quickshell.Wayland + +PanelWindow { + required property string name + required property ShellScreen modelData + + screen: modelData + WlrLayershell.namespace: `${name}` + color: "transparent" +} + |
