diff --git a/quickshell/Common/SettingsData.qml b/quickshell/Common/SettingsData.qml index b2892ad74..9a88287a8 100644 --- a/quickshell/Common/SettingsData.qml +++ b/quickshell/Common/SettingsData.qml @@ -462,6 +462,7 @@ Singleton { property bool clockCompactMode: false property int focusedWindowSize: 1 property bool focusedWindowCompactMode: false + property bool focusedWindowShowIcon: false property bool runningAppsCompactMode: true property int barMaxVisibleApps: 0 property int barMaxVisibleRunningApps: 0 @@ -1751,7 +1752,8 @@ Singleton { if (obj?.lockScreenActiveMonitor !== undefined) { var oldVal = obj.lockScreenActiveMonitor; if (oldVal && oldVal !== "all") { - if (!obj.screenPreferences) obj.screenPreferences = {}; + if (!obj.screenPreferences) + obj.screenPreferences = {}; if (obj.screenPreferences.lockScreen === undefined) { obj.screenPreferences.lockScreen = [oldVal]; } diff --git a/quickshell/Common/settings/SettingsSpec.js b/quickshell/Common/settings/SettingsSpec.js index b55752a2a..7a844981e 100644 --- a/quickshell/Common/settings/SettingsSpec.js +++ b/quickshell/Common/settings/SettingsSpec.js @@ -192,6 +192,7 @@ var SPEC = { clockCompactMode: { def: false }, focusedWindowCompactMode: { def: false }, focusedWindowSize: { def: 1 }, + focusedWindowShowIcon: { def: false }, runningAppsCompactMode: { def: true }, barMaxVisibleApps: { def: 0 }, barMaxVisibleRunningApps: { def: 0 }, diff --git a/quickshell/Modules/DankBar/Widgets/FocusedApp.qml b/quickshell/Modules/DankBar/Widgets/FocusedApp.qml index c6a67ec4f..dc7bfa991 100644 --- a/quickshell/Modules/DankBar/Widgets/FocusedApp.qml +++ b/quickshell/Modules/DankBar/Widgets/FocusedApp.qml @@ -15,6 +15,7 @@ BasePill { property var widgetData: null property bool compactMode: widgetData?.focusedWindowCompactMode !== undefined ? widgetData.focusedWindowCompactMode : SettingsData.focusedWindowCompactMode + property bool showIcon: widgetData?.focusedWindowShowIcon !== undefined ? widgetData.focusedWindowShowIcon : SettingsData.focusedWindowShowIcon readonly property int maxWidth: { const size = widgetData?.focusedWindowSize !== undefined ? widgetData.focusedWindowSize : SettingsData.focusedWindowSize; switch (size) { @@ -239,6 +240,37 @@ BasePill { spacing: Theme.spacingS visible: !root.isVerticalOrientation + IconImage { + id: horizontalAppIcon + Layout.preferredWidth: Theme.barIconSize(root.barThickness, undefined, root.barConfig?.maximizeWidgetIcons, root.barConfig?.iconScale) + Layout.preferredHeight: Layout.preferredWidth + visible: root.showIcon && activeWindow && status === Image.Ready + source: { + if (!activeWindow || !activeWindow.appId) + return ""; + return Paths.getAppIcon(activeWindow.appId, activeDesktopEntry); + } + smooth: true + mipmap: true + asynchronous: true + layer.enabled: activeWindow && (activeWindow.appId === "org.quickshell" || activeWindow.appId === "com.danklinux.dms") + layer.smooth: true + layer.mipmap: true + layer.effect: MultiEffect { + saturation: 0 + colorization: 1 + colorizationColor: Theme.primary + } + } + + DankIcon { + Layout.preferredWidth: Theme.barIconSize(root.barThickness, undefined, root.barConfig?.maximizeWidgetIcons, root.barConfig?.iconScale) + size: Layout.preferredWidth + name: "sports_esports" + color: Theme.widgetTextColor + visible: root.showIcon && activeWindow && activeWindow.appId && horizontalAppIcon.status !== Image.Ready && Paths.isSteamApp(activeWindow.appId) + } + StyledText { id: appText text: { diff --git a/quickshell/Modules/Settings/WidgetsTab.qml b/quickshell/Modules/Settings/WidgetsTab.qml index d7b3ad579..fb5fbf0d7 100644 --- a/quickshell/Modules/Settings/WidgetsTab.qml +++ b/quickshell/Modules/Settings/WidgetsTab.qml @@ -526,7 +526,7 @@ Item { "id": widget.id, "enabled": widget.enabled }; - var keys = ["size", "selectedGpuIndex", "pciId", "mountPath", "diskUsageMode", "minimumWidth", "showSwap", "showInGb", "mediaSize", "clockCompactMode", "focusedWindowSize", "focusedWindowCompactMode", "runningAppsCompactMode", "keyboardLayoutNameCompactMode", "keyboardLayoutNameShowIcon", "runningAppsGroupByApp", "runningAppsCurrentWorkspace", "runningAppsCurrentMonitor", "showNetworkIcon", "showBluetoothIcon", "showAudioIcon", "showAudioPercent", "showVpnIcon", "showBrightnessIcon", "showBrightnessPercent", "showMicIcon", "showMicPercent", "showBatteryIcon", "showBatteryPercent", "showBatteryPercentOnlyOnBattery", "showBatteryTime", "showBatteryTimeOnlyOnBattery", "batteryPillStyle", "batteryPillPercentSign", "showPrinterIcon", "showScreenSharingIcon", "showIdleInhibitorIcon", "showDoNotDisturbIcon", "controlCenterGroupOrder", "barMaxVisibleApps", "barMaxVisibleRunningApps", "barShowOverflowBadge", "trayUseInlineExpansion", "trayPopupSingleLine", "trayAutoOverflow", "trayMaxVisibleItems", "hideWhenIdle"]; + var keys = ["size", "selectedGpuIndex", "pciId", "mountPath", "diskUsageMode", "minimumWidth", "showSwap", "showInGb", "mediaSize", "clockCompactMode", "focusedWindowSize", "focusedWindowCompactMode", "focusedWindowShowIcon", "runningAppsCompactMode", "keyboardLayoutNameCompactMode", "keyboardLayoutNameShowIcon", "runningAppsGroupByApp", "runningAppsCurrentWorkspace", "runningAppsCurrentMonitor", "showNetworkIcon", "showBluetoothIcon", "showAudioIcon", "showAudioPercent", "showVpnIcon", "showBrightnessIcon", "showBrightnessPercent", "showMicIcon", "showMicPercent", "showBatteryIcon", "showBatteryPercent", "showBatteryPercentOnlyOnBattery", "showBatteryTime", "showBatteryTimeOnlyOnBattery", "batteryPillStyle", "batteryPillPercentSign", "showPrinterIcon", "showScreenSharingIcon", "showIdleInhibitorIcon", "showDoNotDisturbIcon", "controlCenterGroupOrder", "barMaxVisibleApps", "barMaxVisibleRunningApps", "barShowOverflowBadge", "trayUseInlineExpansion", "trayPopupSingleLine", "trayAutoOverflow", "trayMaxVisibleItems", "hideWhenIdle"]; for (var i = 0; i < keys.length; i++) { if (widget[keys[i]] !== undefined) result[keys[i]] = widget[keys[i]]; @@ -1053,6 +1053,8 @@ Item { item.focusedWindowCompactMode = widget.focusedWindowCompactMode; if (widget.focusedWindowSize !== undefined) item.focusedWindowSize = widget.focusedWindowSize; + if (widget.focusedWindowShowIcon !== undefined) + item.focusedWindowShowIcon = widget.focusedWindowShowIcon; if (widget.runningAppsCompactMode !== undefined) item.runningAppsCompactMode = widget.runningAppsCompactMode; if (widget.runningAppsGroupByApp !== undefined) diff --git a/quickshell/Modules/Settings/WidgetsTabSection.qml b/quickshell/Modules/Settings/WidgetsTabSection.qml index b60a88b4c..c3a0d4aa3 100644 --- a/quickshell/Modules/Settings/WidgetsTabSection.qml +++ b/quickshell/Modules/Settings/WidgetsTabSection.qml @@ -1860,7 +1860,7 @@ Column { height: 20 checked: focusedWindowContextMenu.currentWidgetData?.focusedWindowCompactMode ?? SettingsData.focusedWindowCompactMode onToggled: { - root.overflowSettingChanged(focusedWindowContextMenu.sectionId, focusedWindowContextMenu.widgetIndex, "focuswedWindowCompactMode", toggled); + root.overflowSettingChanged(focusedWindowContextMenu.sectionId, focusedWindowContextMenu.widgetIndex, "focusedWindowCompactMode", toggled); } } @@ -1876,6 +1876,65 @@ Column { } } + Rectangle { + width: parent.width + height: 32 + radius: Theme.cornerRadius + color: fwShowIconArea.containsMouse ? Theme.primaryHover : Theme.withAlpha(Theme.primaryHover, 0) + + Row { + anchors.left: parent.left + anchors.leftMargin: Theme.spacingS + anchors.right: fwShowIconToggle.left + anchors.rightMargin: Theme.spacingS + anchors.verticalCenter: parent.verticalCenter + spacing: Theme.spacingS + clip: true + + DankIcon { + name: "visibility" + size: 16 + color: Theme.surfaceText + anchors.verticalCenter: parent.verticalCenter + } + + StyledText { + text: I18n.tr("Show Icon") + font.pixelSize: Theme.fontSizeSmall + color: Theme.surfaceText + font.weight: Font.Normal + anchors.verticalCenter: parent.verticalCenter + elide: Text.ElideRight + maximumLineCount: 1 + width: parent.width - 16 - Theme.spacingS + } + } + + DankToggle { + id: fwShowIconToggle + anchors.right: parent.right + anchors.rightMargin: Theme.spacingS + anchors.verticalCenter: parent.verticalCenter + width: 40 + height: 20 + checked: focusedWindowContextMenu.currentWidgetData?.focusedWindowShowIcon ?? SettingsData.focusedWindowShowIcon + onToggled: { + root.overflowSettingChanged(focusedWindowContextMenu.sectionId, focusedWindowContextMenu.widgetIndex, "focusedWindowShowIcon", toggled); + } + } + + MouseArea { + id: fwShowIconArea + anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + onPressed: { + fwShowIconToggle.checked = !fwShowIconToggle.checked; + root.overflowSettingChanged(focusedWindowContextMenu.sectionId, focusedWindowContextMenu.widgetIndex, "focusedWindowShowIcon", fwShowIconToggle.checked); + } + } + } + Repeater { model: [ { @@ -3275,6 +3334,127 @@ Column { } } } + + Rectangle { + width: parent.width + height: Math.max(18, Theme.fontSizeSmall) + Theme.spacingM * 2 + radius: Theme.cornerRadius + color: batteryPillArea.containsMouse ? Theme.primaryHover : Theme.withAlpha(Theme.primaryHover, 0) + + Row { + anchors.left: parent.left + anchors.leftMargin: Theme.spacingS + anchors.right: batteryPillToggle.left + anchors.rightMargin: Theme.spacingS + anchors.verticalCenter: parent.verticalCenter + spacing: Theme.spacingS + clip: true + + DankIcon { + name: "battery_horiz_075" + size: 18 + color: Theme.outline + anchors.verticalCenter: parent.verticalCenter + } + + StyledText { + text: I18n.tr("Material Battery Style") + font.pixelSize: Theme.fontSizeSmall + color: Theme.surfaceText + font.weight: Font.Normal + anchors.verticalCenter: parent.verticalCenter + elide: Text.ElideRight + maximumLineCount: 1 + width: parent.width - 18 - Theme.spacingS + } + } + + DankToggle { + id: batteryPillToggle + anchors.right: parent.right + anchors.rightMargin: Theme.spacingS + anchors.verticalCenter: parent.verticalCenter + width: 40 + height: 20 + checked: batteryContextMenu.currentWidgetData?.batteryPillStyle ?? SettingsData.batteryPillStyle + onToggled: { + root.overflowSettingChanged(batteryContextMenu.sectionId, batteryContextMenu.widgetIndex, "batteryPillStyle", toggled); + } + } + + MouseArea { + id: batteryPillArea + anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + onPressed: { + batteryPillToggle.checked = !batteryPillToggle.checked; + root.overflowSettingChanged(batteryContextMenu.sectionId, batteryContextMenu.widgetIndex, "batteryPillStyle", batteryPillToggle.checked); + } + } + } + + Rectangle { + width: parent.width + height: Math.max(18, Theme.fontSizeSmall) + Theme.spacingM * 2 + radius: Theme.cornerRadius + color: batteryPillPercentArea.containsMouse && batteryPillToggle.checked ? Theme.primaryHover : Theme.withAlpha(Theme.primaryHover, 0) + opacity: batteryPillToggle.checked ? 1.0 : 0.5 + + Row { + anchors.left: parent.left + anchors.leftMargin: Theme.spacingS + 18 + anchors.right: batteryPillPercentToggle.left + anchors.rightMargin: Theme.spacingS + anchors.verticalCenter: parent.verticalCenter + spacing: Theme.spacingS + clip: true + + DankIcon { + name: "percent" + size: 18 + color: Theme.outline + anchors.verticalCenter: parent.verticalCenter + } + + StyledText { + text: I18n.tr("Show Percentage") + font.pixelSize: Theme.fontSizeSmall + color: Theme.surfaceText + font.weight: Font.Normal + anchors.verticalCenter: parent.verticalCenter + elide: Text.ElideRight + maximumLineCount: 1 + width: parent.width - 18 - Theme.spacingS + } + } + + DankToggle { + id: batteryPillPercentToggle + anchors.right: parent.right + anchors.rightMargin: Theme.spacingS + anchors.verticalCenter: parent.verticalCenter + width: 40 + height: 20 + enabled: batteryPillToggle.checked + checked: batteryContextMenu.currentWidgetData?.batteryPillPercentSign ?? SettingsData.batteryPillPercentSign + onToggled: { + root.overflowSettingChanged(batteryContextMenu.sectionId, batteryContextMenu.widgetIndex, "batteryPillPercentSign", toggled); + } + } + + MouseArea { + id: batteryPillPercentArea + anchors.fill: parent + hoverEnabled: true + enabled: batteryPillToggle.checked + cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor + onPressed: { + batteryPillPercentToggle.checked = !batteryPillPercentToggle.checked; + root.overflowSettingChanged(batteryContextMenu.sectionId, batteryContextMenu.widgetIndex, "batteryPillPercentSign", batteryPillPercentToggle.checked); + } + } + } } } }