settings: more options

This commit is contained in:
end-4
2025-06-23 02:37:28 +02:00
parent 06574c19ae
commit b6ba428404
5 changed files with 197 additions and 41 deletions
@@ -113,8 +113,8 @@ Singleton {
property QtObject overview: QtObject {
property real scale: 0.18 // Relative to screen size
property real numOfRows: 2
property real numOfCols: 5
property real rows: 2
property real columns: 5
}
property QtObject resources: QtObject {
@@ -17,7 +17,7 @@ Item {
required property var panelWindow
readonly property HyprlandMonitor monitor: Hyprland.monitorFor(panelWindow.screen)
readonly property var toplevels: ToplevelManager.toplevels
readonly property int workspacesShown: ConfigOptions.overview.numOfRows * ConfigOptions.overview.numOfCols
readonly property int workspacesShown: ConfigOptions.overview.rows * ConfigOptions.overview.columns
readonly property int workspaceGroup: Math.floor((monitor.activeWorkspace?.id - 1) / workspacesShown)
property bool monitorIsFocused: (Hyprland.focusedMonitor?.id == monitor.id)
property var windows: HyprlandData.windowList
@@ -71,18 +71,18 @@ Item {
anchors.centerIn: parent
spacing: workspaceSpacing
Repeater {
model: ConfigOptions.overview.numOfRows
model: ConfigOptions.overview.rows
delegate: RowLayout {
id: row
property int rowIndex: index
spacing: workspaceSpacing
Repeater { // Workspace repeater
model: ConfigOptions.overview.numOfCols
model: ConfigOptions.overview.columns
Rectangle { // Workspace
id: workspace
property int colIndex: index
property int workspaceValue: root.workspaceGroup * workspacesShown + rowIndex * ConfigOptions.overview.numOfCols + colIndex + 1
property int workspaceValue: root.workspaceGroup * workspacesShown + rowIndex * ConfigOptions.overview.columns + colIndex + 1
property color defaultWorkspaceColor: Appearance.colors.colLayer1 // TODO: reconsider this color for a cleaner look
property color hoveredWorkspaceColor: ColorUtils.mix(defaultWorkspaceColor, Appearance.colors.colLayer1Hover, 0.1)
property color hoveredBorderColor: Appearance.colors.colLayer2Hover
@@ -171,8 +171,8 @@ Item {
property bool atInitPosition: (initX == x && initY == y)
restrictToWorkspace: Drag.active || atInitPosition
property int workspaceColIndex: (windowData?.workspace.id - 1) % ConfigOptions.overview.numOfCols
property int workspaceRowIndex: Math.floor((windowData?.workspace.id - 1) % root.workspacesShown / ConfigOptions.overview.numOfCols)
property int workspaceColIndex: (windowData?.workspace.id - 1) % ConfigOptions.overview.columns
property int workspaceRowIndex: Math.floor((windowData?.workspace.id - 1) % root.workspacesShown / ConfigOptions.overview.columns)
xOffset: (root.workspaceImplicitWidth + workspaceSpacing) * workspaceColIndex - (monitor?.x * root.scale)
yOffset: (root.workspaceImplicitHeight + workspaceSpacing) * workspaceRowIndex - (monitor?.y * root.scale)
@@ -245,8 +245,8 @@ Item {
Rectangle { // Focused workspace indicator
id: focusedWorkspaceIndicator
property int activeWorkspaceInGroup: monitor.activeWorkspace?.id - (root.workspaceGroup * root.workspacesShown)
property int activeWorkspaceRowIndex: Math.floor((activeWorkspaceInGroup - 1) / ConfigOptions.overview.numOfCols)
property int activeWorkspaceColIndex: (activeWorkspaceInGroup - 1) % ConfigOptions.overview.numOfCols
property int activeWorkspaceRowIndex: Math.floor((activeWorkspaceInGroup - 1) / ConfigOptions.overview.columns)
property int activeWorkspaceColIndex: (activeWorkspaceInGroup - 1) % ConfigOptions.overview.columns
x: (root.workspaceImplicitWidth + workspaceSpacing) * activeWorkspaceColIndex
y: (root.workspaceImplicitHeight + workspaceSpacing) * activeWorkspaceRowIndex
z: root.windowZ
@@ -48,32 +48,6 @@ ContentPage {
}
}
}
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"
@@ -225,7 +199,7 @@ ContentPage {
}
}
ConfigRow {
uniform: false
uniform: true
ConfigSwitch {
text: "Automatic suspend"
checked: ConfigOptions.battery.automaticSuspend
@@ -248,4 +222,42 @@ ContentPage {
}
}
}
ContentSection {
title: "Overview"
ConfigSpinBox {
text: "Scale (%)"
value: ConfigOptions.overview.scale * 100
from: 1
to: 100
stepSize: 1
onValueChanged: {
ConfigLoader.setConfigValueAndSave("overview.scale", value / 100);
}
}
ConfigRow {
uniform: true
ConfigSpinBox {
text: "Rows"
value: ConfigOptions.overview.rows
from: 1
to: 20
stepSize: 1
onValueChanged: {
ConfigLoader.setConfigValueAndSave("overview.rows", value);
}
}
ConfigSpinBox {
text: "Columns"
value: ConfigOptions.overview.columns
from: 1
to: 20
stepSize: 1
onValueChanged: {
ConfigLoader.setConfigValueAndSave("overview.columns", value);
}
}
}
}
}
@@ -0,0 +1,139 @@
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: "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"
}
}
ConfigRow {
// uniform: true
ConfigSpinBox {
text: "Max allowed increase"
value: ConfigOptions.audio.protection.maxAllowedIncrease
from: 0
to: 100
stepSize: 2
onValueChanged: {
ConfigLoader.setConfigValueAndSave("audio.protection.maxAllowedIncrease", value);
}
}
ConfigSpinBox {
text: "Volume limit"
value: ConfigOptions.audio.protection.maxAllowed
from: 0
to: 100
stepSize: 2
onValueChanged: {
ConfigLoader.setConfigValueAndSave("audio.protection.maxAllowed", value);
}
}
}
}
ContentSection {
title: "AI"
MaterialTextField {
Layout.fillWidth: true
placeholderText: "System prompt"
text: ConfigOptions.ai.systemPrompt
wrapMode: TextEdit.Wrap
onTextChanged: {
ConfigLoader.setConfigValueAndSave("ai.systemPrompt", text);
}
}
}
ContentSection {
title: "Battery"
ConfigRow {
uniform: true
ConfigSpinBox {
text: "Low warning"
value: ConfigOptions.battery.low
from: 0
to: 100
stepSize: 5
onValueChanged: {
ConfigLoader.setConfigValueAndSave("battery.low", value);
}
}
ConfigSpinBox {
text: "Critical warning"
value: ConfigOptions.battery.critical
from: 0
to: 100
stepSize: 5
onValueChanged: {
ConfigLoader.setConfigValueAndSave("battery.critical", value);
}
}
}
ConfigRow {
uniform: true
ConfigSwitch {
text: "Automatic suspend"
checked: ConfigOptions.battery.automaticSuspend
onCheckedChanged: {
ConfigLoader.setConfigValueAndSave("battery.automaticSuspend", checked);
}
StyledToolTip {
content: "Automatically suspends the system when battery is low"
}
}
ConfigSpinBox {
text: "Suspend at"
value: ConfigOptions.battery.suspend
from: 0
to: 100
stepSize: 5
onValueChanged: {
ConfigLoader.setConfigValueAndSave("battery.suspend", value);
}
}
}
}
ContentSection {
title: "Networking"
MaterialTextField {
Layout.fillWidth: true
placeholderText: "User agent (for services that require it)"
text: ConfigOptions.networking.userAgent
wrapMode: TextEdit.Wrap
onTextChanged: {
ConfigLoader.setConfigValueAndSave("networking.userAgent", text);
}
}
}
ContentSection {
title: "Resources"
ConfigSpinBox {
text: "Polling interval (ms)"
value: ConfigOptions.resources.updateInterval
from: 100
to: 10000
stepSize: 100
onValueChanged: {
ConfigLoader.setConfigValueAndSave("resources.updateInterval", value);
}
}
}
}
+9 -4
View File
@@ -33,9 +33,14 @@ ApplicationWindow {
component: "modules/settings/StyleConfig.qml"
},
{
name: "General",
name: "Interface",
icon: "cards",
component: "modules/settings/InterfaceConfig.qml"
},
{
name: "Services",
icon: "settings",
component: "modules/settings/GeneralConfig.qml"
component: "modules/settings/ServicesConfig.qml"
},
{
name: "About",
@@ -217,7 +222,7 @@ ApplicationWindow {
properties: "opacity"
from: 1
to: 0
duration: 0
duration: 100
easing.type: Appearance.animation.elementMoveExit.type
easing.bezierCurve: Appearance.animationCurves.emphasizedFirstHalf
}
@@ -231,7 +236,7 @@ ApplicationWindow {
properties: "opacity"
from: 0
to: 1
duration: 0
duration: 200
easing.type: Appearance.animation.elementMoveEnter.type
easing.bezierCurve: Appearance.animationCurves.emphasizedLastHalf
}