starting to use config files

This commit is contained in:
Zacharias-Brohn
2025-11-11 01:50:05 +01:00
parent 80ac9081d1
commit 9ffae63e55
9 changed files with 55 additions and 37 deletions
+2 -2
View File
@@ -1,4 +1,3 @@
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
@@ -9,6 +8,7 @@ import Quickshell.Wayland
import Qt5Compat.GraphicalEffects import Qt5Compat.GraphicalEffects
import Quickshell.Hyprland import Quickshell.Hyprland
import qs.Modules import qs.Modules
import qs.Config
Scope { Scope {
Variants { Variants {
@@ -39,7 +39,7 @@ Scope {
Rectangle { Rectangle {
id: backgroundRect id: backgroundRect
anchors.fill: parent anchors.fill: parent
color: "#801a1a1a" color: Config.baseBgColor
radius: 0 radius: 0
RowLayout { RowLayout {
+11
View File
@@ -0,0 +1,11 @@
import Quickshell.Io
JsonObject {
property Accents accents: Accents {}
component Accents: JsonObject {
property string primary: "#4080ff"
property string warning: "#ff6b6b"
property string primaryAlt: "#60a0ff"
}
}
+30
View File
@@ -0,0 +1,30 @@
pragma Singleton
import Quickshell
import Quickshell.Io
Singleton {
property alias appCount: adapter.appCount
property alias baseBgColor: adapter.baseBgColor
property alias accentColor: adapter.accentColor
FileView {
id: root
property var configRoot: Quickshell.env("HOME")
path: configRoot + "/.config/z-bar/config.json"
watchChanges: true
onFileChanged: reload()
onAdapterChanged: writeAdapter()
JsonAdapter {
id: adapter
property int appCount: 20
property string baseBgColor: "#801a1a1a"
property AccentColor accentColor: AccentColor {}
}
}
}
+2 -2
View File
@@ -5,7 +5,7 @@ import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Effects import QtQuick.Effects
import QtQuick.Layouts import QtQuick.Layouts
import qs import qs.Config
Scope { Scope {
id: root id: root
@@ -224,7 +224,7 @@ Scope {
} }
verticalLayoutDirection: ListView.BottomToTop verticalLayoutDirection: ListView.BottomToTop
implicitHeight: Math.min( count, 20 ) * 48 implicitHeight: Math.min( count, Config.appCount ) * 48
preferredHighlightBegin: 0 preferredHighlightBegin: 0
preferredHighlightEnd: appListRect.height preferredHighlightEnd: appListRect.height
+2 -1
View File
@@ -4,6 +4,7 @@ import Quickshell.Wayland
import QtQuick.Layouts import QtQuick.Layouts
import QtQuick import QtQuick
import Quickshell.Services.Notifications import Quickshell.Services.Notifications
import qs.Config
PanelWindow { PanelWindow {
id: root id: root
@@ -66,7 +67,7 @@ PanelWindow {
implicitHeight: 90 implicitHeight: 90
x: root.centerX - implicitWidth - 20 x: root.centerX - implicitWidth - 20
y: 34 + 20 + ( root.index * ( implicitHeight + 10 )) y: 34 + 20 + ( root.index * ( implicitHeight + 10 ))
color: "#801a1a1a" color: Config.baseBgColor
border.color: "#555555" border.color: "#555555"
radius: 8 radius: 8
+3 -2
View File
@@ -7,6 +7,7 @@ import QtQuick.Controls.FluentWinUI3
import QtQuick.Effects import QtQuick.Effects
import QtQuick import QtQuick
import Quickshell.Services.Notifications import Quickshell.Services.Notifications
import qs.Config
PanelWindow { PanelWindow {
id: root id: root
@@ -125,7 +126,7 @@ PanelWindow {
x: Screen.width x: Screen.width
implicitWidth: 400 implicitWidth: 400
implicitHeight: root.height - 20 implicitHeight: root.height - 20
color: "#801a1a1a" color: Config.baseBgColor
radius: 8 radius: 8
border.color: "#555555" border.color: "#555555"
border.width: 1 border.width: 1
@@ -276,7 +277,7 @@ PanelWindow {
required property var index required property var index
width: parent.width width: parent.width
height: groupColumn.isExpanded ? ( modelData.actions.length > 1 ? 130 : 80 ) : ( groupColumn.notifications.length === 1 ? ( modelData.actions.length > 1 ? 130 : 80 ) : 80 ) height: groupColumn.isExpanded ? ( modelData.actions.length > 1 ? 130 : 80 ) : ( groupColumn.notifications.length === 1 ? ( modelData.actions.length > 1 ? 130 : 80 ) : 80 )
color: "#801a1a1a" color: Config.baseBgColor
border.color: "#555555" border.color: "#555555"
border.width: 1 border.width: 1
radius: 8 radius: 8
+2 -1
View File
@@ -2,6 +2,7 @@ import qs.Modules
import QtQuick import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
import Quickshell import Quickshell
import qs.Config
Item { Item {
id: root id: root
@@ -71,7 +72,7 @@ Item {
var startAngle = -Math.PI / 2; // Start at top var startAngle = -Math.PI / 2; // Start at top
var endAngle = startAngle + (2 * Math.PI * percentage); var endAngle = startAngle + (2 * Math.PI * percentage);
ctx.fillStyle = warning ? "#ff6b6b" : "#4080ff"; ctx.fillStyle = warning ? Config.accentColor.accents.warning : Config.accentColor.accents.primary;
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(centerX, centerY); ctx.moveTo(centerX, centerY);
ctx.arc(centerX, centerY, radius, startAngle, endAngle); ctx.arc(centerX, centerY, radius, startAngle, endAngle);
+3 -2
View File
@@ -3,6 +3,7 @@ import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import Quickshell import Quickshell
import Quickshell.Hyprland import Quickshell.Hyprland
import qs.Config
Rectangle { Rectangle {
id: root id: root
@@ -37,9 +38,9 @@ Rectangle {
height: 14 height: 14
radius: height / 2 radius: height / 2
color: modelData.id === Hyprland.focusedWorkspace.id ? "#4080ff" : "#606060" color: modelData.id === Hyprland.focusedWorkspace.id ? Config.accentColor.accents.primary : "#606060"
border.color: modelData.id === Hyprland.focusedWorkspace.id ? "#60a0ff" : "#808080" border.color: modelData.id === Hyprland.focusedWorkspace.id ? Config.accentColor.accents.primaryAlt : "#808080"
border.width: 1 border.width: 1
scale: 1.0 scale: 1.0
-27
View File
@@ -1,27 +0,0 @@
pragma Singleton
import Quickshell
Singleton {
id: root
// thanks to Soramane :>
// expressive curves => thanks end cutie ;)
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 int emphasizedAccelTime: 200
readonly property list<real> emphasizedDecel: [0.05, 0.7, 0.1, 1, 1, 1]
readonly property int emphasizedDecelTime: 400
readonly property int emphasizedTime: 500
readonly property list<real> expressiveDefaultSpatial: [0.38, 1.21, 0.22, 1.00, 1, 1]
readonly property int expressiveDefaultSpatialTime: 500
readonly property list<real> expressiveEffects: [0.34, 0.80, 0.34, 1.00, 1, 1]
readonly property int expressiveEffectsTime: 200
readonly property list<real> expressiveFastSpatial: [0.42, 1.67, 0.21, 0.90, 1, 1]
readonly property int expressiveFastSpatialTime: 350
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 int standardAccelTime: 200
readonly property list<real> standardDecel: [0, 0, 0, 1, 1, 1]
readonly property int standardDecelTime: 250
readonly property int standardTime: 300
}