453 lines
10 KiB
QML
453 lines
10 KiB
QML
import Quickshell
|
|
import QtQuick
|
|
import QtQuick.Layouts
|
|
import QtQuick.Controls
|
|
import qs.Modules.Settings.Controls
|
|
import qs.Config
|
|
import qs.Components
|
|
import qs.Helpers
|
|
|
|
SettingsPage {
|
|
id: root
|
|
|
|
function schemeTypeItem(items, value) {
|
|
for (let i = 0; i < items.length; i++) {
|
|
const item = items[i];
|
|
if (item.value === value)
|
|
return item;
|
|
}
|
|
|
|
return items[0] ?? null;
|
|
}
|
|
|
|
SettingsSection {
|
|
sectionId: "General"
|
|
|
|
SettingsHeader {
|
|
name: "General"
|
|
}
|
|
|
|
SettingInput {
|
|
name: "Logo"
|
|
object: Config.general
|
|
setting: "logo"
|
|
}
|
|
|
|
Separator {
|
|
}
|
|
|
|
SettingInput {
|
|
name: "Wallpaper path"
|
|
object: Config.general
|
|
setting: "wallpaperPath"
|
|
}
|
|
|
|
Separator {
|
|
}
|
|
|
|
SettingSwitch {
|
|
name: "Desktop icons"
|
|
object: Config.general
|
|
setting: "desktopIcons"
|
|
}
|
|
|
|
Separator {
|
|
}
|
|
|
|
SettingInput {
|
|
name: "Date format"
|
|
object: Config.general
|
|
setting: "dateFormat"
|
|
}
|
|
}
|
|
|
|
SettingsSection {
|
|
sectionId: "Color"
|
|
z: 1
|
|
|
|
SettingsHeader {
|
|
name: "Color"
|
|
}
|
|
|
|
CustomSplitButtonRow {
|
|
active: Config.general.color.mode === "light" ? menuItems[0] : menuItems[1]
|
|
enabled: Config.general.color.schemeGeneration
|
|
label: qsTr("Scheme mode")
|
|
|
|
menuItems: [
|
|
MenuItem {
|
|
icon: "light_mode"
|
|
text: qsTr("Light")
|
|
value: "light"
|
|
},
|
|
MenuItem {
|
|
icon: "dark_mode"
|
|
text: qsTr("Dark")
|
|
value: "dark"
|
|
}
|
|
]
|
|
|
|
onSelected: item => {
|
|
Config.general.color.mode = item.value;
|
|
Config.save();
|
|
|
|
if (item.value === "light")
|
|
ModeScheduler.applyLightMode();
|
|
else if (item.value === "dark")
|
|
ModeScheduler.applyDarkMode();
|
|
}
|
|
}
|
|
|
|
Separator {
|
|
}
|
|
|
|
CustomSplitButtonRow {
|
|
id: schemeType
|
|
|
|
active: root.schemeTypeItem(menuItems, Config.colors.schemeType)
|
|
enabled: Config.general.color.schemeGeneration
|
|
label: qsTr("Scheme type")
|
|
|
|
menuItems: [
|
|
MenuItem {
|
|
icon: "palette"
|
|
text: qsTr("Vibrant")
|
|
value: "vibrant"
|
|
},
|
|
MenuItem {
|
|
icon: "gesture"
|
|
text: qsTr("Expressive")
|
|
value: "expressive"
|
|
},
|
|
MenuItem {
|
|
icon: "contrast"
|
|
text: qsTr("Monochrome")
|
|
value: "monochrome"
|
|
},
|
|
MenuItem {
|
|
icon: "tonality"
|
|
text: qsTr("Neutral")
|
|
value: "neutral"
|
|
},
|
|
MenuItem {
|
|
icon: "gradient"
|
|
text: qsTr("Tonal spot")
|
|
value: "tonal-spot"
|
|
},
|
|
MenuItem {
|
|
icon: "target"
|
|
text: qsTr("Fidelity")
|
|
value: "fidelity"
|
|
},
|
|
MenuItem {
|
|
icon: "article"
|
|
text: qsTr("Content")
|
|
value: "content"
|
|
},
|
|
MenuItem {
|
|
icon: "colors"
|
|
text: qsTr("Rainbow")
|
|
value: "rainbow"
|
|
},
|
|
MenuItem {
|
|
icon: "nutrition"
|
|
text: qsTr("Fruit salad")
|
|
value: "fruit-salad"
|
|
}
|
|
]
|
|
|
|
onSelected: item => {
|
|
Config.colors.schemeType = item.value;
|
|
Config.save();
|
|
|
|
Quickshell.execDetached(["zshell-cli", "scheme", "generate", "--scheme", item.value]);
|
|
}
|
|
}
|
|
|
|
Separator {
|
|
}
|
|
|
|
SettingSwitch {
|
|
name: "Automatic color scheme"
|
|
object: Config.general.color
|
|
setting: "schemeGeneration"
|
|
}
|
|
|
|
Separator {
|
|
shouldBeActive: Config.general.color.schemeGeneration ? 0 : 1
|
|
}
|
|
|
|
SchemesListView {
|
|
name: "Color scheme presets"
|
|
object: Config.colors.presets
|
|
setting: "name"
|
|
shouldBeActive: Config.general.color.schemeGeneration ? 0 : 1
|
|
stringList: FetchPresets.presetNames()
|
|
}
|
|
|
|
Separator {
|
|
shouldBeActive: Config.colors.presets.name !== "" && !Config.general.color.schemeGeneration
|
|
}
|
|
|
|
SchemesListView {
|
|
name: "Preset variant"
|
|
object: Config.colors.presets
|
|
setting: "variant"
|
|
shouldBeActive: Config.colors.presets.name !== "" && !Config.general.color.schemeGeneration
|
|
stringList: FetchPresets.variantNames(Config.colors.presets.name)
|
|
|
|
onOptionSet: item => {
|
|
Quickshell.execDetached(["zshell-cli", "scheme", "generate", "--preset", `${Config.colors.presets.name.toLowerCase()}:${item}`]);
|
|
}
|
|
}
|
|
|
|
Separator {
|
|
shouldBeActive: Config.colors.presets.variant !== "" && FetchPresets.accents(Config.colors.presets.name, Config.colors.presets.variant).length > 0 && !Config.general.color.schemeGeneration
|
|
}
|
|
|
|
SchemesListView {
|
|
name: "Preset accent"
|
|
object: Config.colors.presets
|
|
setting: "accent"
|
|
shouldBeActive: Config.colors.presets.variant !== "" && FetchPresets.accents(Config.colors.presets.name, Config.colors.presets.variant).length > 0 && !Config.general.color.schemeGeneration
|
|
stringList: FetchPresets.accents(Config.colors.presets.name, Config.colors.presets.variant)
|
|
|
|
onOptionSet: item => {
|
|
Quickshell.execDetached(["zshell-cli", "scheme", "generate", "--preset", `${Config.colors.presets.name.toLowerCase()}:${Config.colors.presets.variant}`, "--accent", `${item}`]);
|
|
}
|
|
}
|
|
|
|
Separator {
|
|
shouldBeActive: Config.general.color.schemeGeneration ? 1 : 0
|
|
}
|
|
|
|
SettingSwitch {
|
|
name: "Smart color scheme"
|
|
object: Config.general.color
|
|
setting: "smart"
|
|
shouldBeActive: Config.general.color.schemeGeneration ? 1 : 0
|
|
}
|
|
|
|
Separator {
|
|
shouldBeActive: Config.general.color.schemeGeneration ? 1 : 0
|
|
}
|
|
|
|
SettingSpinner {
|
|
name: "Schedule dark mode"
|
|
object: Config.general.color
|
|
settings: ["scheduleDarkStart", "scheduleDarkEnd", "scheduleDark"]
|
|
shouldBeActive: Config.general.color.schemeGeneration ? 1 : 0
|
|
}
|
|
|
|
// Item {
|
|
// id: timeInput
|
|
//
|
|
// readonly property bool highlighted: SettingsHighlight.highlightedSetting === name
|
|
// property string name
|
|
// property var object
|
|
// property list<string> settings
|
|
// property bool shouldBeActive: true
|
|
//
|
|
// function commitChoice(choice: int, setting: string): void {
|
|
// timeInput.object[setting] = choice;
|
|
// Config.save();
|
|
// }
|
|
//
|
|
// function formattedValue(setting: string): string {
|
|
// const value = timeInput.object[setting];
|
|
//
|
|
// if (value === null || value === undefined)
|
|
// return "";
|
|
//
|
|
// return String(value);
|
|
// }
|
|
//
|
|
// function hourToAmPm(hour) {
|
|
// var h = Number(hour) % 24;
|
|
// var d = new Date(2000, 0, 1, h, 0, 0);
|
|
// return Qt.formatTime(d, "h AP");
|
|
// }
|
|
//
|
|
// anchors.left: parent.left
|
|
// anchors.right: parent.right
|
|
// implicitHeight: shouldBeActive ? row.implicitHeight + Appearance.padding.smaller * 2 : 0
|
|
// opacity: shouldBeActive ? 1 : 0
|
|
// scale: shouldBeActive ? 1 : 0.8
|
|
// visible: opacity > 0
|
|
//
|
|
// Behavior on opacity {
|
|
// Anim {
|
|
// }
|
|
// }
|
|
// Behavior on scale {
|
|
// Anim {
|
|
// }
|
|
// }
|
|
// Behavior on y {
|
|
// Anim {
|
|
// }
|
|
// }
|
|
//
|
|
// Rectangle {
|
|
// anchors.fill: parent
|
|
// anchors.margins: -Appearance.padding.smaller
|
|
// color: DynamicColors.palette.m3primaryContainer
|
|
// opacity: timeInput.highlighted ? 0.5 : 0
|
|
// radius: Appearance.rounding.small
|
|
//
|
|
// Behavior on opacity {
|
|
// Anim {
|
|
// duration: Appearance.anim.durations.normal
|
|
// }
|
|
// }
|
|
// }
|
|
//
|
|
// RowLayout {
|
|
// id: row
|
|
//
|
|
// anchors.left: parent.left
|
|
// anchors.margins: Appearance.padding.small
|
|
// anchors.right: parent.right
|
|
// anchors.verticalCenter: parent.verticalCenter
|
|
//
|
|
// ColumnLayout {
|
|
// Layout.fillHeight: true
|
|
// Layout.fillWidth: true
|
|
//
|
|
// CustomText {
|
|
// id: text
|
|
//
|
|
// Layout.alignment: Qt.AlignLeft
|
|
// Layout.fillWidth: true
|
|
// font.pointSize: Appearance.font.size.larger
|
|
// text: timeInput.name
|
|
// }
|
|
//
|
|
// CustomText {
|
|
// Layout.alignment: Qt.AlignLeft
|
|
// color: DynamicColors.palette.m3onSurfaceVariant
|
|
// font.pointSize: Appearance.font.size.normal
|
|
// text: qsTr("Dark mode will turn on at %1, and turn off at %2.").arg(timeInput.hourToAmPm(timeInput.object[timeInput.settings[0]])).arg(timeInput.hourToAmPm(timeInput.object[timeInput.settings[1]]))
|
|
// }
|
|
// }
|
|
//
|
|
// ColumnLayout {
|
|
// id: optionLayout
|
|
//
|
|
// Layout.fillHeight: true
|
|
// Layout.preferredWidth: 100
|
|
//
|
|
// RowLayout {
|
|
// Layout.preferredWidth: optionLayout.width
|
|
//
|
|
// CustomText {
|
|
// Layout.alignment: Qt.AlignLeft | Qt.AlignHCenter
|
|
// Layout.fillWidth: true
|
|
// text: qsTr("Enabled: ")
|
|
// }
|
|
//
|
|
// CustomSwitch {
|
|
// id: enabledSwitch
|
|
//
|
|
// Layout.alignment: Qt.AlignRight | Qt.AlignHCenter
|
|
// checked: timeInput.object[timeInput.settings[2]]
|
|
//
|
|
// onToggled: {
|
|
// timeInput.object[timeInput.settings[2]] = checked;
|
|
// Config.save();
|
|
// }
|
|
// }
|
|
// }
|
|
//
|
|
// RowLayout {
|
|
// Layout.preferredWidth: optionLayout.width
|
|
//
|
|
// CustomText {
|
|
// Layout.alignment: Qt.AlignLeft | Qt.AlignHCenter
|
|
// Layout.fillWidth: true
|
|
// text: qsTr("Start: ")
|
|
// }
|
|
//
|
|
// CustomRect {
|
|
// Layout.preferredHeight: 72
|
|
// Layout.preferredWidth: 96
|
|
// color: startHourField.focus ? DynamicColors.palette.m3primaryContainer : DynamicColors.palette.m3surfaceContainer
|
|
//
|
|
// CustomTextField {
|
|
// id: startHourField
|
|
//
|
|
// function convertHour(timeValue: int): int {
|
|
// return Math.floor(timeValue / 60);
|
|
// }
|
|
//
|
|
// function convertMinute(timeValue: int): int {
|
|
// return timeValue % 60;
|
|
// }
|
|
//
|
|
// anchors.fill: parent
|
|
// font.family: "Roboto"
|
|
// font.pixelSize: 57
|
|
// text: convertHour(Config.general.color.scheduleDarkStart)
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
Separator {
|
|
}
|
|
|
|
SettingHyprSpinner {
|
|
name: "Schedule Hyprsunset"
|
|
object: Config.general.color
|
|
settings: ["scheduleHyprsunsetStart", "scheduleHyprsunsetEnd", "scheduleHyprsunset", "hyprsunsetTemp"]
|
|
}
|
|
}
|
|
|
|
SettingsSection {
|
|
sectionId: "Default Apps"
|
|
|
|
SettingsHeader {
|
|
name: "Default Apps"
|
|
}
|
|
|
|
SettingStringList {
|
|
addLabel: qsTr("Add terminal command")
|
|
name: "Terminal"
|
|
object: Config.general.apps
|
|
setting: "terminal"
|
|
}
|
|
|
|
Separator {
|
|
}
|
|
|
|
SettingStringList {
|
|
addLabel: qsTr("Add audio command")
|
|
name: "Audio"
|
|
object: Config.general.apps
|
|
setting: "audio"
|
|
}
|
|
|
|
Separator {
|
|
}
|
|
|
|
SettingStringList {
|
|
addLabel: qsTr("Add playback command")
|
|
name: "Playback"
|
|
object: Config.general.apps
|
|
setting: "playback"
|
|
}
|
|
|
|
Separator {
|
|
}
|
|
|
|
SettingStringList {
|
|
addLabel: qsTr("Add explorer command")
|
|
name: "Explorer"
|
|
object: Config.general.apps
|
|
setting: "explorer"
|
|
}
|
|
}
|
|
}
|