feat: add toggle for showing active window icon in title bar

This commit is contained in:
ferreo 2025-07-12 13:33:48 +01:00
parent 4f2a434860
commit 492f2dd9cc
4 changed files with 214 additions and 122 deletions

View file

@ -7,12 +7,14 @@ import qs.Settings
Rectangle {
id: profileSettingsCard
Layout.fillWidth: true
Layout.preferredHeight: 140
Layout.preferredHeight: 200
color: Theme.surface
radius: 18
border.color: "transparent"
border.width: 0
Layout.bottomMargin: 16
property bool showActiveWindowIcon: false
signal showAWIconChanged(bool showActiveWindowIcon)
ColumnLayout {
anchors.fill: parent
@ -27,14 +29,13 @@ Rectangle {
Text {
text: "person"
font.family: "Material Symbols Outlined"
font.pixelSize: Theme.fontSizeBody
font.pixelSize: 20
color: Theme.accentPrimary
}
Text {
text: "Profile Image"
font.family: Theme.fontFamily
font.pixelSize: Theme.fontSizeBody
font.pixelSize: 16
font.bold: true
color: Theme.textPrimary
Layout.fillWidth: true
@ -83,7 +84,7 @@ Rectangle {
anchors.centerIn: parent
text: "person"
font.family: "Material Symbols Outlined"
font.pixelSize: Theme.fontSizeBody
font.pixelSize: 18
color: Theme.accentPrimary
visible: Settings.profileImage === ""
}
@ -92,7 +93,7 @@ Rectangle {
// Text input styled exactly like weather city
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 40
Layout.preferredHeight: 36
radius: 8
color: Theme.surfaceVariant
border.color: profileImageInput.activeFocus ? Theme.accentPrimary : Theme.outline
@ -100,17 +101,10 @@ Rectangle {
TextInput {
id: profileImageInput
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.leftMargin: 12
anchors.rightMargin: 12
anchors.topMargin: 6
anchors.bottomMargin: 6
anchors.fill: parent
anchors.margins: 12
text: Settings.profileImage
font.family: Theme.fontFamily
font.pixelSize: Theme.fontSizeSmall
font.pixelSize: 13
color: Theme.textPrimary
verticalAlignment: TextInput.AlignVCenter
clip: true
@ -132,6 +126,58 @@ Rectangle {
}
}
// Show Active Window Icon Setting
RowLayout {
spacing: 8
Layout.fillWidth: true
Text {
text: "Show Active Window Icon"
font.pixelSize: 13
font.bold: true
color: Theme.textPrimary
}
Item {
Layout.fillWidth: true
}
// Custom Material 3 Switch
Rectangle {
id: customSwitch
width: 52
height: 32
radius: 16
color: Theme.accentPrimary
border.color: Theme.accentPrimary
border.width: 2
Rectangle {
id: thumb
width: 28
height: 28
radius: 14
color: Theme.surface
border.color: Theme.outline
border.width: 1
y: 2
x: showActiveWindowIcon ? customSwitch.width - width - 2 : 2
Behavior on x {
NumberAnimation { duration: 200; easing.type: Easing.OutCubic }
}
}
MouseArea {
anchors.fill: parent
onClicked: {
showAWIconChanged(!showActiveWindowIcon)
}
}
}
}
// Video Path Input Row
RowLayout {
spacing: 8
@ -139,15 +185,14 @@ Rectangle {
Text {
text: "Video Path"
font.family: Theme.fontFamily
font.pixelSize: Theme.fontSizeSmall
font.pixelSize: 14
color: Theme.textPrimary
Layout.alignment: Qt.AlignVCenter
}
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 40
Layout.preferredHeight: 36
radius: 8
color: Theme.surfaceVariant
border.color: videoPathInput.activeFocus ? Theme.accentPrimary : Theme.outline
@ -155,17 +200,10 @@ Rectangle {
TextInput {
id: videoPathInput
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.leftMargin: 12
anchors.rightMargin: 12
anchors.topMargin: 6
anchors.bottomMargin: 6
anchors.fill: parent
anchors.margins: 12
text: Settings.videoPath !== undefined ? Settings.videoPath : ""
font.family: Theme.fontFamily
font.pixelSize: Theme.fontSizeSmall
font.pixelSize: 13
color: Theme.textPrimary
verticalAlignment: TextInput.AlignVCenter
clip: true
@ -184,4 +222,4 @@ Rectangle {
}
}
}
}
}

View file

@ -20,12 +20,12 @@ PanelWindow {
//border.width: 1
WlrLayershell.keyboardFocus: visible ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None
// Local properties for editing (not saved until apply)
property string tempWeatherCity: (Settings.weatherCity !== undefined && Settings.weatherCity !== null) ? Settings.weatherCity : ""
property bool tempUseFahrenheit: Settings.useFahrenheit
property string tempProfileImage: (Settings.profileImage !== undefined && Settings.profileImage !== null) ? Settings.profileImage : ""
property string tempWallpaperFolder: (Settings.wallpaperFolder !== undefined && Settings.wallpaperFolder !== null) ? Settings.wallpaperFolder : ""
property bool tempShowActiveWindowIcon: Settings.showActiveWindowIcon
Rectangle {
anchors.fill: parent
@ -55,7 +55,6 @@ PanelWindow {
}
Text {
text: "Settings"
font.family: Theme.fontFamily
font.pixelSize: 26
font.bold: true
color: Theme.textPrimary
@ -117,21 +116,32 @@ PanelWindow {
WeatherSettings {
weatherCity: (typeof tempWeatherCity !== 'undefined' && tempWeatherCity !== null) ? tempWeatherCity : ""
useFahrenheit: tempUseFahrenheit
onCityChanged: function(city) { tempWeatherCity = city }
onTemperatureUnitChanged: function(useFahrenheit) { tempUseFahrenheit = useFahrenheit }
onCityChanged: function (city) {
tempWeatherCity = city;
}
onTemperatureUnitChanged: function (useFahrenheit) {
tempUseFahrenheit = useFahrenheit;
}
}
}
CollapsibleCategory {
title: "System"
expanded: false
ProfileSettings { }
ProfileSettings {
showActiveWindowIcon: tempShowActiveWindowIcon
onShowAWIconChanged: function (showActiveWindowIcon) {
tempShowActiveWindowIcon = showActiveWindowIcon;
}
}
}
CollapsibleCategory {
title: "Wallpaper"
expanded: false
WallpaperSettings {
wallpaperFolder: (typeof tempWallpaperFolder !== 'undefined' && tempWallpaperFolder !== null) ? tempWallpaperFolder : ""
onWallpaperFolderEdited: function(folder) { tempWallpaperFolder = folder }
onWallpaperFolderEdited: function (folder) {
tempWallpaperFolder = folder;
}
}
}
}
@ -150,7 +160,6 @@ PanelWindow {
Text {
anchors.centerIn: parent
text: "Apply Changes"
font.family: Theme.fontFamily
font.pixelSize: 17
font.bold: true
color: applyButtonArea.containsMouse ? Theme.onAccent : Theme.onAccent
@ -160,15 +169,16 @@ PanelWindow {
anchors.fill: parent
hoverEnabled: true
onClicked: {
Settings.weatherCity = (typeof tempWeatherCity !== 'undefined' && tempWeatherCity !== null) ? tempWeatherCity : ""
Settings.useFahrenheit = tempUseFahrenheit
Settings.profileImage = (typeof tempProfileImage !== 'undefined' && tempProfileImage !== null) ? tempProfileImage : ""
Settings.wallpaperFolder = (typeof tempWallpaperFolder !== 'undefined' && tempWallpaperFolder !== null) ? tempWallpaperFolder : ""
Settings.saveSettings()
Settings.weatherCity = (typeof tempWeatherCity !== 'undefined' && tempWeatherCity !== null) ? tempWeatherCity : "";
Settings.useFahrenheit = tempUseFahrenheit;
Settings.profileImage = (typeof tempProfileImage !== 'undefined' && tempProfileImage !== null) ? tempProfileImage : "";
Settings.wallpaperFolder = (typeof tempWallpaperFolder !== 'undefined' && tempWallpaperFolder !== null) ? tempWallpaperFolder : "";
Settings.showActiveWindowIcon = tempShowActiveWindowIcon;
Settings.saveSettings();
if (typeof weather !== 'undefined' && weather) {
weather.fetchCityWeather()
weather.fetchCityWeather();
}
settingsModal.closeSettings()
settingsModal.closeSettings();
}
}
}
@ -177,19 +187,21 @@ PanelWindow {
// Function to open the modal and initialize temp values
function openSettings() {
tempWeatherCity = (Settings.weatherCity !== undefined && Settings.weatherCity !== null) ? Settings.weatherCity : ""
tempUseFahrenheit = Settings.useFahrenheit
tempProfileImage = (Settings.profileImage !== undefined && Settings.profileImage !== null) ? Settings.profileImage : ""
tempWallpaperFolder = (Settings.wallpaperFolder !== undefined && Settings.wallpaperFolder !== null) ? Settings.wallpaperFolder : ""
if (tempWallpaperFolder === undefined || tempWallpaperFolder === null) tempWallpaperFolder = ""
visible = true
tempWeatherCity = (Settings.weatherCity !== undefined && Settings.weatherCity !== null) ? Settings.weatherCity : "";
tempUseFahrenheit = Settings.useFahrenheit;
tempShowActiveWindowIcon = Settings.showActiveWindowIcon;
tempProfileImage = (Settings.profileImage !== undefined && Settings.profileImage !== null) ? Settings.profileImage : "";
tempWallpaperFolder = (Settings.wallpaperFolder !== undefined && Settings.wallpaperFolder !== null) ? Settings.wallpaperFolder : "";
if (tempWallpaperFolder === undefined || tempWallpaperFolder === null)
tempWallpaperFolder = "";
visible = true;
// Force focus on the text input after a short delay
focusTimer.start()
focusTimer.start();
}
// Function to close the modal and release focus
function closeSettings() {
visible = false
visible = false;
}
Timer {
@ -197,16 +209,17 @@ PanelWindow {
interval: 100
repeat: false
onTriggered: {
if (visible) {
// Focus will be handled by the individual components
}
if (visible)
// Focus will be handled by the individual components
{}
}
}
// Release focus when modal becomes invisible
onVisibleChanged: {
if (!visible) {
// Focus will be handled by the individual components
}
if (!visible)
// Focus will be handled by the individual components
{}
}
}
}