settings: reorganize and add settings

This commit is contained in:
end-4
2025-06-21 11:59:40 +02:00
parent 5ffbd55f58
commit 7e46e40eeb
12 changed files with 489 additions and 317 deletions
@@ -1,65 +0,0 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import "root:/services/"
import "root:/modules/common/"
import "root:/modules/common/widgets/"
ContentPage {
ContentSection {
title: "Policies"
ConfigRow {
ColumnLayout { // Weeb policy
StyledText {
text: "Weeb"
color: Appearance.colors.colSubtext
}
ConfigSelectionArray {
currentValue: ConfigOptions.policies.weeb
configOptionName: "policies.weeb"
onSelected: (newValue) => {
ConfigLoader.setConfigValueAndSave("policies.weeb", newValue);
}
options: [
{ displayName: "No", value: 0 },
{ displayName: "Yes", value: 1 },
{ displayName: "Closet", value: 2 }
]
}
}
ColumnLayout { // AI policy
StyledText {
text: "AI"
color: Appearance.colors.colSubtext
}
ConfigSelectionArray {
currentValue: ConfigOptions.policies.ai
configOptionName: "policies.ai"
onSelected: (newValue) => {
ConfigLoader.setConfigValueAndSave("policies.ai", newValue);
}
options: [
{ displayName: "No", value: 0 },
{ displayName: "Yes", value: 1 },
{ displayName: "Local only", value: 2 }
]
}
}
}
}
ContentSection {
title: "Audio"
ConfigSwitch {
text: "Earbang protection"
checked: ConfigOptions.audio.protection.enable
onCheckedChanged: {
ConfigLoader.setConfigValueAndSave("audio.protection.enable", checked);
}
StyledToolTip {
content: "Prevents abrupt increments and restricts volume limit"
}
}
}
}
@@ -0,0 +1,144 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import "root:/services/"
import "root:/modules/common/"
import "root:/modules/common/widgets/"
ContentPage {
forceWidth: true
ContentSection {
title: "Policies"
ConfigRow {
ColumnLayout { // Weeb policy
ContentSubsectionLabel {
text: "Weeb"
}
ConfigSelectionArray {
currentValue: ConfigOptions.policies.weeb
configOptionName: "policies.weeb"
onSelected: (newValue) => {
ConfigLoader.setConfigValueAndSave("policies.weeb", newValue);
}
options: [
{ displayName: "No", value: 0 },
{ displayName: "Yes", value: 1 },
{ displayName: "Closet", value: 2 }
]
}
}
ColumnLayout { // AI policy
ContentSubsectionLabel {
text: "AI"
}
ConfigSelectionArray {
currentValue: ConfigOptions.policies.ai
configOptionName: "policies.ai"
onSelected: (newValue) => {
ConfigLoader.setConfigValueAndSave("policies.ai", newValue);
}
options: [
{ displayName: "No", value: 0 },
{ displayName: "Yes", value: 1 },
{ displayName: "Local only", value: 2 }
]
}
}
}
}
ContentSection {
title: "Audio"
ConfigSwitch {
text: "Earbang protection"
checked: ConfigOptions.audio.protection.enable
onCheckedChanged: {
ConfigLoader.setConfigValueAndSave("audio.protection.enable", checked);
}
StyledToolTip {
content: "Prevents abrupt increments and restricts volume limit"
}
}
}
ContentSection {
title: "AI"
MaterialTextField {
id: systemPromptField
Layout.fillWidth: true
placeholderText: "System prompt"
text: ConfigOptions.ai.systemPrompt
wrapMode: TextEdit.Wrap
onTextChanged: {
ConfigLoader.setConfigValueAndSave("ai.systemPrompt", text);
}
}
}
ContentSection {
title: "Bar"
ContentSubsection {
title: "Appearance"
ConfigRow {
uniform: true
ConfigSwitch {
text: 'Borderless'
checked: ConfigOptions.bar.borderless
onCheckedChanged: {
ConfigLoader.setConfigValueAndSave("bar.borderless", checked);
}
}
ConfigSwitch {
text: 'Show background'
checked: ConfigOptions.bar.showBackground
onCheckedChanged: {
ConfigLoader.setConfigValueAndSave("bar.showBackground", checked);
}
StyledToolTip {
content: "Note: turning off can hurt readability"
}
}
}
}
ContentSubsection {
title: "Buttons"
ConfigRow {
uniform: true
ConfigSwitch {
text: "Screen snip"
checked: ConfigOptions.bar.utilButtons.showScreenSnip
onCheckedChanged: {
ConfigLoader.setConfigValueAndSave("bar.utilButtons.showScreenSnip", checked);
}
}
ConfigSwitch {
text: "Color picker"
checked: ConfigOptions.bar.utilButtons.showColorPicker
onCheckedChanged: {
ConfigLoader.setConfigValueAndSave("bar.utilButtons.showColorPicker", checked);
}
}
}
ConfigRow {
uniform: true
ConfigSwitch {
text: "Mic toggle"
checked: ConfigOptions.bar.utilButtons.showMicToggle
onCheckedChanged: {
ConfigLoader.setConfigValueAndSave("bar.utilButtons.showMicToggle", checked);
}
}
ConfigSwitch {
text: "Keyboard toggle"
checked: ConfigOptions.bar.utilButtons.showKeyboardToggle
onCheckedChanged: {
ConfigLoader.setConfigValueAndSave("bar.utilButtons.showKeyboardToggle", checked);
}
}
}
}
}
}
@@ -1,238 +0,0 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Quickshell
import Quickshell.Io
import Quickshell.Hyprland
import "root:/services/"
import "root:/modules/common/"
import "root:/modules/common/widgets/"
import "root:/modules/common/functions/color_utils.js" as ColorUtils
import "root:/modules/common/functions/file_utils.js" as FileUtils
ContentPage {
baseWidth: lightDarkButtonGroup.implicitWidth
forceWidth: true
Process {
id: konachanWallProc
property string status: ""
command: ["bash", "-c", FileUtils.trimFileProtocol(`${Directories.config}/quickshell/scripts/colors/random_konachan_wall.sh`)]
stdout: SplitParser {
onRead: data => {
console.log(`Konachan wall proc output: ${data}`);
konachanWallProc.status = data.trim();
}
}
}
ContentSection {
title: "Colors & Wallpaper"
// Light/Dark mode preference
ButtonGroup {
id: lightDarkButtonGroup
Layout.fillWidth: true
LightDarkPreferenceButton {
dark: false
}
LightDarkPreferenceButton {
dark: true
}
}
// Material palette selection
StyledText {
text: "Material palette"
color: Appearance.colors.colSubtext
}
ConfigSelectionArray {
currentValue: ConfigOptions.appearance.palette.type
configOptionName: "appearance.palette.type"
onSelected: (newValue) => {
ConfigLoader.setConfigValueAndSave("appearance.palette.type", newValue);
}
options: [
{"value": "auto", "displayName": "Auto"},
{"value": "scheme-content", "displayName": "Content"},
{"value": "scheme-expressive", "displayName": "Expressive"},
{"value": "scheme-fidelity", "displayName": "Fidelity"},
{"value": "scheme-fruit-salad", "displayName": "Fruit Salad"},
{"value": "scheme-monochrome", "displayName": "Monochrome"},
{"value": "scheme-neutral", "displayName": "Neutral"},
{"value": "scheme-rainbow", "displayName": "Rainbow"},
{"value": "scheme-tonal-spot", "displayName": "Tonal Spot"}
]
}
// Wallpaper selection
StyledText {
text: "Wallpaper"
color: Appearance.colors.colSubtext
}
RowLayout {
Layout.alignment: Qt.AlignHCenter
RippleButtonWithIcon {
id: rndWallBtn
Layout.alignment: Qt.AlignHCenter
buttonRadius: Appearance.rounding.small
materialIcon: "wallpaper"
mainText: konachanWallProc.running ? "Be patient..." : "Random: Konachan"
onClicked: {
console.log(konachanWallProc.command.join(" "))
konachanWallProc.running = true;
}
StyledToolTip {
content: "Random SFW Anime wallpaper from Konachan\nImage is saved to ~/Pictures/Wallpapers"
}
}
RippleButtonWithIcon {
materialIcon: "wallpaper"
StyledToolTip {
content: "Pick wallpaper image on your system"
}
onClicked: {
Quickshell.execDetached(`${Directories.wallpaperSwitchScriptPath}`)
}
mainContentComponent: Component {
RowLayout {
spacing: 10
StyledText {
font.pixelSize: Appearance.font.pixelSize.small
text: "Choose file"
color: Appearance.colors.colOnSecondaryContainer
}
RowLayout {
spacing: 3
KeyboardKey {
key: "Ctrl"
}
KeyboardKey {
key: "󰖳"
}
StyledText {
Layout.alignment: Qt.AlignVCenter
text: "+"
}
KeyboardKey {
key: "T"
}
}
}
}
}
}
StyledText {
Layout.alignment: Qt.AlignHCenter
text: "Change any time later with /dark, /light, /img in the launcher"
font.pixelSize: Appearance.font.pixelSize.smaller
color: Appearance.colors.colSubtext
}
}
ContentSection {
title: "Shell style"
ColumnLayout { // Fake screen rounding
StyledText {
text: "Fake screen rounding"
color: Appearance.colors.colSubtext
}
ButtonGroup {
id: fakeScreenRoundingButtonGroup
property int selectedPolicy: ConfigOptions.appearance.fakeScreenRounding
spacing: 2
SelectionGroupButton {
property int value: 0
leftmost: true
buttonText: "No"
toggled: (fakeScreenRoundingButtonGroup.selectedPolicy === value)
onClicked: {
ConfigLoader.setConfigValueAndSave("appearance.fakeScreenRounding", value);
}
}
SelectionGroupButton {
property int value: 1
buttonText: "Yes"
toggled: (fakeScreenRoundingButtonGroup.selectedPolicy === value)
onClicked: {
ConfigLoader.setConfigValueAndSave("appearance.fakeScreenRounding", value);
}
}
SelectionGroupButton {
property int value: 2
rightmost: true
buttonText: "When not fullscreen"
toggled: (fakeScreenRoundingButtonGroup.selectedPolicy === value)
onClicked: {
ConfigLoader.setConfigValueAndSave("appearance.fakeScreenRounding", value);
}
}
}
}
ConfigRow {
ConfigSwitch {
text: "Transparency"
checked: ConfigOptions.appearance.transparency
onCheckedChanged: {
ConfigLoader.setConfigValueAndSave("appearance.transparency", checked);
}
StyledToolTip {
content: "Might look ass. Unsupported."
}
}
}
StyledText {
text: "Bar"
color: Appearance.colors.colSubtext
}
ConfigRow {
uniform: true
ConfigSwitch {
text: 'Borderless'
checked: ConfigOptions.bar.borderless
onCheckedChanged: {
ConfigLoader.setConfigValueAndSave("bar.borderless", checked);
}
}
ConfigSwitch {
text: 'Show background'
checked: ConfigOptions.bar.showBackground
onCheckedChanged: {
ConfigLoader.setConfigValueAndSave("bar.showBackground", checked);
}
StyledToolTip {
content: "Note: turning off can hurt readability"
}
}
}
}
ContentSection {
title: "Shell windows"
spacing: 4
ConfigRow {
uniform: true
ConfigSwitch {
text: "Title bar"
checked: ConfigOptions.windows.showTitlebar
onCheckedChanged: {
ConfigLoader.setConfigValueAndSave("windows.showTitlebar", checked);
}
}
ConfigSwitch {
text: "Center title"
checked: ConfigOptions.windows.centerTitle
onCheckedChanged: {
ConfigLoader.setConfigValueAndSave("windows.centerTitle", checked);
}
}
}
}
}
@@ -0,0 +1,213 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Quickshell
import Quickshell.Io
import Quickshell.Widgets
import Quickshell.Hyprland
import "root:/services/"
import "root:/modules/common/"
import "root:/modules/common/widgets/"
import "root:/modules/common/functions/color_utils.js" as ColorUtils
import "root:/modules/common/functions/file_utils.js" as FileUtils
ContentPage {
baseWidth: lightDarkButtonGroup.implicitWidth
forceWidth: true
Process {
id: konachanWallProc
property string status: ""
command: ["bash", "-c", FileUtils.trimFileProtocol(`${Directories.config}/quickshell/scripts/colors/random_konachan_wall.sh`)]
stdout: SplitParser {
onRead: data => {
console.log(`Konachan wall proc output: ${data}`);
konachanWallProc.status = data.trim();
}
}
}
ContentSection {
title: "Colors & Wallpaper"
// Light/Dark mode preference
ButtonGroup {
id: lightDarkButtonGroup
Layout.fillWidth: true
LightDarkPreferenceButton {
dark: false
}
LightDarkPreferenceButton {
dark: true
}
}
// Material palette selection
ContentSubsection {
title: "Material palette"
ConfigSelectionArray {
currentValue: ConfigOptions.appearance.palette.type
configOptionName: "appearance.palette.type"
onSelected: (newValue) => {
ConfigLoader.setConfigValueAndSave("appearance.palette.type", newValue);
}
options: [
{"value": "auto", "displayName": "Auto"},
{"value": "scheme-content", "displayName": "Content"},
{"value": "scheme-expressive", "displayName": "Expressive"},
{"value": "scheme-fidelity", "displayName": "Fidelity"},
{"value": "scheme-fruit-salad", "displayName": "Fruit Salad"},
{"value": "scheme-monochrome", "displayName": "Monochrome"},
{"value": "scheme-neutral", "displayName": "Neutral"},
{"value": "scheme-rainbow", "displayName": "Rainbow"},
{"value": "scheme-tonal-spot", "displayName": "Tonal Spot"}
]
}
}
// Wallpaper selection
ContentSubsection {
title: "Wallpaper"
RowLayout {
Layout.alignment: Qt.AlignHCenter
RippleButtonWithIcon {
id: rndWallBtn
buttonRadius: Appearance.rounding.small
materialIcon: "wallpaper"
mainText: konachanWallProc.running ? "Be patient..." : "Random: Konachan"
onClicked: {
console.log(konachanWallProc.command.join(" "))
konachanWallProc.running = true;
}
StyledToolTip {
content: "Random SFW Anime wallpaper from Konachan\nImage is saved to ~/Pictures/Wallpapers"
}
}
RippleButtonWithIcon {
materialIcon: "wallpaper"
StyledToolTip {
content: "Pick wallpaper image on your system"
}
onClicked: {
Quickshell.execDetached(`${Directories.wallpaperSwitchScriptPath}`)
}
mainContentComponent: Component {
RowLayout {
spacing: 10
StyledText {
font.pixelSize: Appearance.font.pixelSize.small
text: "Choose file"
color: Appearance.colors.colOnSecondaryContainer
}
RowLayout {
spacing: 3
KeyboardKey {
key: "Ctrl"
}
KeyboardKey {
key: "󰖳"
}
StyledText {
Layout.alignment: Qt.AlignVCenter
text: "+"
}
KeyboardKey {
key: "T"
}
}
}
}
}
}
}
StyledText {
Layout.topMargin: 5
Layout.alignment: Qt.AlignHCenter
text: "Alternatively use /dark, /light, /img in the launcher"
font.pixelSize: Appearance.font.pixelSize.smaller
color: Appearance.colors.colSubtext
}
}
ContentSection {
title: "Decorations & Effects"
ContentSubsection {
title: "Transparency"
ConfigRow {
ConfigSwitch {
text: "Enable"
checked: ConfigOptions.appearance.transparency
onCheckedChanged: {
ConfigLoader.setConfigValueAndSave("appearance.transparency", checked);
}
StyledToolTip {
content: "Might look ass. Unsupported."
}
}
}
}
ContentSubsection {
title: "Fake screen rounding"
ButtonGroup {
id: fakeScreenRoundingButtonGroup
property int selectedPolicy: ConfigOptions.appearance.fakeScreenRounding
spacing: 2
SelectionGroupButton {
property int value: 0
leftmost: true
buttonText: "No"
toggled: (fakeScreenRoundingButtonGroup.selectedPolicy === value)
onClicked: {
ConfigLoader.setConfigValueAndSave("appearance.fakeScreenRounding", value);
}
}
SelectionGroupButton {
property int value: 1
buttonText: "Yes"
toggled: (fakeScreenRoundingButtonGroup.selectedPolicy === value)
onClicked: {
ConfigLoader.setConfigValueAndSave("appearance.fakeScreenRounding", value);
}
}
SelectionGroupButton {
property int value: 2
rightmost: true
buttonText: "When not fullscreen"
toggled: (fakeScreenRoundingButtonGroup.selectedPolicy === value)
onClicked: {
ConfigLoader.setConfigValueAndSave("appearance.fakeScreenRounding", value);
}
}
}
}
ContentSubsection {
title: "Shell windows"
ConfigRow {
uniform: true
ConfigSwitch {
text: "Title bar"
checked: ConfigOptions.windows.showTitlebar
onCheckedChanged: {
ConfigLoader.setConfigValueAndSave("windows.showTitlebar", checked);
}
}
ConfigSwitch {
text: "Center title"
checked: ConfigOptions.windows.centerTitle
onCheckedChanged: {
ConfigLoader.setConfigValueAndSave("windows.centerTitle", checked);
}
}
}
}
}
}