mirror of
https://github.com/belsabbagh/dotfiles.git
synced 2026-04-11 17:47:09 +00:00
quickshell and hyprland additions
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import qs.config
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
RowLayout {
|
||||
id: main
|
||||
property string title: "Title"
|
||||
property string description: "Description"
|
||||
property string prefField: ''
|
||||
|
||||
ColumnLayout {
|
||||
StyledText { text: main.title; font.pixelSize: Metrics.fontSize(16); }
|
||||
StyledText { text: main.description; font.pixelSize: Metrics.fontSize(12); }
|
||||
}
|
||||
Item { Layout.fillWidth: true }
|
||||
|
||||
StyledSwitch {
|
||||
// Safely resolve nested key (e.g. "background.showClock" or "bar.modules.some.setting")
|
||||
checked: {
|
||||
if (!main.prefField) return false;
|
||||
var parts = main.prefField.split('.');
|
||||
var cur = Config.runtime;
|
||||
for (var i = 0; i < parts.length; ++i) {
|
||||
if (cur === undefined || cur === null) return false;
|
||||
cur = cur[parts[i]];
|
||||
}
|
||||
// If the config value is undefined, default to false
|
||||
return cur === undefined || cur === null ? false : cur;
|
||||
}
|
||||
|
||||
onToggled: {
|
||||
// Persist change (updateKey will create missing objects)
|
||||
Config.updateKey(main.prefField, checked);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user