Settings window #20

Merged
Zacharias-Brohn merged 83 commits from settingsWindow into main 2026-03-06 23:27:24 +01:00
9 changed files with 59 additions and 17 deletions
Showing only changes of commit 178375d861 - Show all commits
+1 -1
View File
@@ -14,7 +14,7 @@ Text {
color: DynamicColors.palette.m3onSurface color: DynamicColors.palette.m3onSurface
font.family: Appearance.font.family.sans font.family: Appearance.font.family.sans
font.pointSize: 12 font.pointSize: Appearance.font.size.normal
renderType: Text.NativeRendering renderType: Text.NativeRendering
textFormat: Text.PlainText textFormat: Text.PlainText
+1
View File
@@ -236,6 +236,7 @@ Singleton {
return { return {
weatherLocation: services.weatherLocation, weatherLocation: services.weatherLocation,
useFahrenheit: services.useFahrenheit, useFahrenheit: services.useFahrenheit,
ddcutilService: services.ddcutilService,
useTwelveHourClock: services.useTwelveHourClock, useTwelveHourClock: services.useTwelveHourClock,
gpuType: services.gpuType, gpuType: services.gpuType,
audioIncrement: services.audioIncrement, audioIncrement: services.audioIncrement,
+1
View File
@@ -4,6 +4,7 @@ import QtQuick
JsonObject { JsonObject {
property real audioIncrement: 0.1 property real audioIncrement: 0.1
property real brightnessIncrement: 0.1 property real brightnessIncrement: 0.1
property bool ddcutilService: false
property string defaultPlayer: "Spotify" property string defaultPlayer: "Spotify"
property string gpuType: "" property string gpuType: ""
property real maxVolume: 1.0 property real maxVolume: 1.0
+8 -1
View File
@@ -1,6 +1,8 @@
import Quickshell import Quickshell
import QtQuick import QtQuick
import QtQuick.Shapes import QtQuick.Shapes
import qs.Components
import qs.Config
import qs.Modules as Modules import qs.Modules as Modules
import qs.Modules.Notifications as Notifications import qs.Modules.Notifications as Notifications
import qs.Modules.Notifications.Sidebar as Sidebar import qs.Modules.Notifications.Sidebar as Sidebar
@@ -20,9 +22,14 @@ Shape {
anchors.fill: parent anchors.fill: parent
// anchors.margins: 8 // anchors.margins: 8
anchors.topMargin: bar.implicitHeight anchors.topMargin: Config.barConfig.autoHide && !visibilities.bar ? 0 : bar.implicitHeight
preferredRendererType: Shape.CurveRenderer preferredRendererType: Shape.CurveRenderer
Behavior on anchors.topMargin {
Anim {
}
}
Osd.Background { Osd.Background {
startX: root.width - root.panels.sidebar.width startX: root.width - root.panels.sidebar.width
startY: (root.height - wrapper.height) / 2 - rounding startY: (root.height - wrapper.height) / 2 - rounding
+40 -6
View File
@@ -12,6 +12,7 @@ Singleton {
property bool appleDisplayPresent: false property bool appleDisplayPresent: false
property list<var> ddcMonitors: [] property list<var> ddcMonitors: []
property list<var> ddcServiceMon: []
readonly property list<Monitor> monitors: variants.instances readonly property list<Monitor> monitors: variants.instances
function decreaseBrightness(): void { function decreaseBrightness(): void {
@@ -55,6 +56,8 @@ Singleton {
onMonitorsChanged: { onMonitorsChanged: {
ddcMonitors = []; ddcMonitors = [];
ddcServiceMon = [];
ddcServiceProc.running = true;
ddcProc.running = true; ddcProc.running = true;
} }
@@ -68,7 +71,7 @@ Singleton {
} }
Process { Process {
command: ["sh", "-c", "asdbctl get"] // To avoid warnings if asdbctl is not installed command: ["sh", "-c", "asdbctl get"]
running: true running: true
stdout: StdioCollector { stdout: StdioCollector {
@@ -89,6 +92,26 @@ Singleton {
} }
} }
Process {
id: ddcServiceProc
command: ["ddcutil-client", "detect"]
// running: true
stdout: StdioCollector {
onStreamFinished: {
const t = text.replace(/\r\n/g, "\n").trim();
const output = ("\n" + t).split(/\n(?=display:\s*\d+\s*\n)/).filter(b => b.startsWith("display:")).map(b => ({
display: Number(b.match(/^display:\s*(\d+)/m)?.[1] ?? -1),
name: (b.match(/^\s*product_name:\s*(.*)$/m)?.[1] ?? "").trim()
})).filter(d => d.display > 0);
root.ddcServiceMon = output;
}
}
}
CustomShortcut { CustomShortcut {
description: "Increase brightness" description: "Increase brightness"
name: "brightnessUp" name: "brightnessUp"
@@ -161,10 +184,15 @@ Singleton {
property real brightness property real brightness
readonly property string busNum: root.ddcMonitors.find(m => m.connector === modelData.name)?.busNum ?? "" readonly property string busNum: root.ddcMonitors.find(m => m.connector === modelData.name)?.busNum ?? ""
readonly property string displayNum: root.ddcServiceMon.find(m => m.name === modelData.model)?.display ?? ""
readonly property Process initProc: Process { readonly property Process initProc: Process {
stdout: StdioCollector { stdout: StdioCollector {
onStreamFinished: { onStreamFinished: {
if (monitor.isAppleDisplay) { if (monitor.isDdcService) {
const output = text.split("\n").filter(o => o.startsWith("vcp_current_value:"))[0].split(":")[1];
const val = parseInt(output.trim());
monitor.brightness = val / 100;
} else if (monitor.isAppleDisplay) {
const val = parseInt(text.trim()); const val = parseInt(text.trim());
monitor.brightness = val / 101; monitor.brightness = val / 101;
} else { } else {
@@ -176,6 +204,7 @@ Singleton {
} }
readonly property bool isAppleDisplay: root.appleDisplayPresent && modelData.model.startsWith("StudioDisplay") readonly property bool isAppleDisplay: root.appleDisplayPresent && modelData.model.startsWith("StudioDisplay")
readonly property bool isDdc: root.ddcMonitors.some(m => m.connector === modelData.name) readonly property bool isDdc: root.ddcMonitors.some(m => m.connector === modelData.name)
readonly property bool isDdcService: Config.services.ddcutilService
required property ShellScreen modelData required property ShellScreen modelData
property real queuedBrightness: NaN property real queuedBrightness: NaN
readonly property Timer timer: Timer { readonly property Timer timer: Timer {
@@ -190,7 +219,9 @@ Singleton {
} }
function initBrightness(): void { function initBrightness(): void {
if (isAppleDisplay) if (isDdcService)
initProc.command = ["ddcutil-client", "-d", displayNum, "getvcp", "10"];
else if (isAppleDisplay)
initProc.command = ["asdbctl", "get"]; initProc.command = ["asdbctl", "get"];
else if (isDdc) else if (isDdc)
initProc.command = ["ddcutil", "-b", busNum, "getvcp", "10", "--brief"]; initProc.command = ["ddcutil", "-b", busNum, "getvcp", "10", "--brief"];
@@ -206,25 +237,28 @@ Singleton {
if (Math.round(brightness * 100) === rounded) if (Math.round(brightness * 100) === rounded)
return; return;
if (isDdc && timer.running) { if ((isDdc || isDdcService) && timer.running) {
queuedBrightness = value; queuedBrightness = value;
return; return;
} }
brightness = value; brightness = value;
if (isAppleDisplay) if (isDdcService)
Quickshell.execDetached(["ddcutil-client", "-d", displayNum, "setvcp", "10", rounded]);
else if (isAppleDisplay)
Quickshell.execDetached(["asdbctl", "set", rounded]); Quickshell.execDetached(["asdbctl", "set", rounded]);
else if (isDdc) else if (isDdc)
Quickshell.execDetached(["ddcutil", "--disable-dynamic-sleep", "--sleep-multiplier", ".1", "--skip-ddc-checks", "-b", busNum, "setvcp", "10", rounded]); Quickshell.execDetached(["ddcutil", "--disable-dynamic-sleep", "--sleep-multiplier", ".1", "--skip-ddc-checks", "-b", busNum, "setvcp", "10", rounded]);
else else
Quickshell.execDetached(["brightnessctl", "s", `${rounded}%`]); Quickshell.execDetached(["brightnessctl", "s", `${rounded}%`]);
if (isDdc) if (isDdc || isDdcService)
timer.restart(); timer.restart();
} }
Component.onCompleted: initBrightness() Component.onCompleted: initBrightness()
onBusNumChanged: initBrightness() onBusNumChanged: initBrightness()
onDisplayNumChanged: initBrightness()
} }
} }
+2 -5
View File
@@ -69,15 +69,12 @@ Singleton {
onLoaded: { onLoaded: {
const up = parseInt(text().split(" ")[0] ?? 0); const up = parseInt(text().split(" ")[0] ?? 0);
const days = Math.floor(up / 86400); const hours = Math.floor(up / 3600);
const hours = Math.floor((up % 86400) / 3600);
const minutes = Math.floor((up % 3600) / 60); const minutes = Math.floor((up % 3600) / 60);
let str = ""; let str = "";
if (days > 0)
str += `${days} day${days === 1 ? "" : "s"}`;
if (hours > 0) if (hours > 0)
str += `${str ? ", " : ""}${hours} hour${hours === 1 ? "" : "s"}`; str += `${hours} hour${hours === 1 ? "" : "s"}`;
if (minutes > 0 || !str) if (minutes > 0 || !str)
str += `${str ? ", " : ""}${minutes} minute${minutes === 1 ? "" : "s"}`; str += `${str ? ", " : ""}${minutes} minute${minutes === 1 ? "" : "s"}`;
root.uptime = str; root.uptime = str;
+2
View File
@@ -43,6 +43,7 @@ Item {
MaterialIcon { MaterialIcon {
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
animate: true
color: Audio.muted ? DynamicColors.palette.m3error : root.textColor color: Audio.muted ? DynamicColors.palette.m3error : root.textColor
font.pointSize: 14 font.pointSize: 14
text: Audio.muted ? "volume_off" : "volume_up" text: Audio.muted ? "volume_off" : "volume_up"
@@ -71,6 +72,7 @@ Item {
MaterialIcon { MaterialIcon {
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
animate: true
color: (Audio.sourceMuted ?? false) ? DynamicColors.palette.m3error : root.textColor color: (Audio.sourceMuted ?? false) ? DynamicColors.palette.m3error : root.textColor
font.pointSize: 14 font.pointSize: 14
text: Audio.sourceMuted ? "mic_off" : "mic" text: Audio.sourceMuted ? "mic_off" : "mic"
+2 -2
View File
@@ -82,7 +82,7 @@ Row {
colour: DynamicColors.palette.m3tertiary colour: DynamicColors.palette.m3tertiary
icon: "timer" icon: "timer"
text: qsTr("up %1").arg(SystemInfo.uptime) text: qsTr("%1").arg(SystemInfo.uptime)
} }
} }
@@ -113,7 +113,7 @@ Row {
anchors.left: icon.right anchors.left: icon.right
anchors.leftMargin: icon.anchors.leftMargin anchors.leftMargin: icon.anchors.leftMargin
anchors.verticalCenter: icon.verticalCenter anchors.verticalCenter: icon.verticalCenter
elide: Text.ElideRight elide: Text.ElideNone
font.pointSize: 13 font.pointSize: 13
text: `: ${line.text}` text: `: ${line.text}`
width: Config.dashboard.sizes.infoWidth width: Config.dashboard.sizes.infoWidth
+2 -2
View File
@@ -5,8 +5,6 @@
# Stupid idea's from Daivin # Stupid idea's from Daivin
- [ ] An on screen pencil to draw on your screen :). - [ ] An on screen pencil to draw on your screen :).
- [ ] Audio module + cava / audio wave ;) ( Don't make it into minecraft blocks
but aan actual wave) -- Probably not planned
- [ ] Bluetooth device battery view -- Not planned ( Don't have a bluetooth - [ ] Bluetooth device battery view -- Not planned ( Don't have a bluetooth
receiver ) receiver )
@@ -21,3 +19,5 @@
- [x] Battery icon for Laptops. Broken? - [x] Battery icon for Laptops. Broken?
- [x] Quick toggle for BT, WiFi (modules in the tray do this too) - [x] Quick toggle for BT, WiFi (modules in the tray do this too)
- [x] Update module: When there is 1 package it still looks extremely off - [x] Update module: When there is 1 package it still looks extremely off
- [x] Audio module + cava / audio wave ;) ( Don't make it into minecraft blocks
but aan actual wave) -- Probably not planned