mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-07 22:15:38 -05:00
Add FocusedApp compact mode and fix SystemTray to use IconImage
This commit is contained in:
@@ -42,6 +42,7 @@ Singleton {
|
|||||||
property bool showWorkspacePadding: false
|
property bool showWorkspacePadding: false
|
||||||
property var workspaceNameIcons: ({})
|
property var workspaceNameIcons: ({})
|
||||||
property bool clockCompactMode: false
|
property bool clockCompactMode: false
|
||||||
|
property bool focusedWindowCompactMode: false
|
||||||
property string clockDateFormat: "ddd d"
|
property string clockDateFormat: "ddd d"
|
||||||
property string lockDateFormat: "dddd, MMMM d"
|
property string lockDateFormat: "dddd, MMMM d"
|
||||||
property int mediaSize: 1
|
property int mediaSize: 1
|
||||||
@@ -329,6 +330,11 @@ Singleton {
|
|||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setFocusedWindowCompactMode(enabled) {
|
||||||
|
focusedWindowCompactMode = enabled;
|
||||||
|
saveSettings();
|
||||||
|
}
|
||||||
|
|
||||||
function setClockDateFormat(format) {
|
function setClockDateFormat(format) {
|
||||||
clockDateFormat = format;
|
clockDateFormat = format;
|
||||||
saveSettings();
|
saveSettings();
|
||||||
|
|||||||
@@ -593,6 +593,8 @@ Item {
|
|||||||
SettingsData.setClockCompactMode(value)
|
SettingsData.setClockCompactMode(value)
|
||||||
} else if (widgetId === "music") {
|
} else if (widgetId === "music") {
|
||||||
SettingsData.setMediaSize(value)
|
SettingsData.setMediaSize(value)
|
||||||
|
} else if (widgetId === "focusedWindow") {
|
||||||
|
SettingsData.setFocusedWindowCompactMode(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onGpuSelectionChanged: (sectionId, widgetIndex, selectedIndex) => {
|
onGpuSelectionChanged: (sectionId, widgetIndex, selectedIndex) => {
|
||||||
@@ -636,6 +638,8 @@ Item {
|
|||||||
SettingsData.setClockCompactMode(value)
|
SettingsData.setClockCompactMode(value)
|
||||||
} else if (widgetId === "music") {
|
} else if (widgetId === "music") {
|
||||||
SettingsData.setMediaSize(value)
|
SettingsData.setMediaSize(value)
|
||||||
|
} else if (widgetId === "focusedWindow") {
|
||||||
|
SettingsData.setFocusedWindowCompactMode(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onGpuSelectionChanged: (sectionId, widgetIndex, selectedIndex) => {
|
onGpuSelectionChanged: (sectionId, widgetIndex, selectedIndex) => {
|
||||||
@@ -679,6 +683,8 @@ Item {
|
|||||||
SettingsData.setClockCompactMode(value)
|
SettingsData.setClockCompactMode(value)
|
||||||
} else if (widgetId === "music") {
|
} else if (widgetId === "music") {
|
||||||
SettingsData.setMediaSize(value)
|
SettingsData.setMediaSize(value)
|
||||||
|
} else if (widgetId === "focusedWindow") {
|
||||||
|
SettingsData.setFocusedWindowCompactMode(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onGpuSelectionChanged: (sectionId, widgetIndex, selectedIndex) => {
|
onGpuSelectionChanged: (sectionId, widgetIndex, selectedIndex) => {
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ Column {
|
|||||||
|
|
||||||
Row {
|
Row {
|
||||||
spacing: Theme.spacingXS
|
spacing: Theme.spacingXS
|
||||||
visible: modelData.id === "clock" || modelData.id === "music"
|
visible: modelData.id === "clock" || modelData.id === "music" || modelData.id === "focusedWindow"
|
||||||
|
|
||||||
DankActionButton {
|
DankActionButton {
|
||||||
id: smallSizeButton
|
id: smallSizeButton
|
||||||
@@ -279,12 +279,24 @@ Column {
|
|||||||
DankActionButton {
|
DankActionButton {
|
||||||
id: compactModeButton
|
id: compactModeButton
|
||||||
buttonSize: 28
|
buttonSize: 28
|
||||||
visible: modelData.id === "clock"
|
visible: modelData.id === "clock" || modelData.id === "focusedWindow"
|
||||||
iconName: SettingsData.clockCompactMode ? "zoom_out" : "zoom_in"
|
iconName: {
|
||||||
|
if (modelData.id === "clock") return SettingsData.clockCompactMode ? "zoom_out" : "zoom_in"
|
||||||
|
if (modelData.id === "focusedWindow") return SettingsData.focusedWindowCompactMode ? "zoom_out" : "zoom_in"
|
||||||
|
return "zoom_in"
|
||||||
|
}
|
||||||
iconSize: 16
|
iconSize: 16
|
||||||
iconColor: SettingsData.clockCompactMode ? Theme.primary : Theme.outline
|
iconColor: {
|
||||||
|
if (modelData.id === "clock") return SettingsData.clockCompactMode ? Theme.primary : Theme.outline
|
||||||
|
if (modelData.id === "focusedWindow") return SettingsData.focusedWindowCompactMode ? Theme.primary : Theme.outline
|
||||||
|
return Theme.outline
|
||||||
|
}
|
||||||
onClicked: {
|
onClicked: {
|
||||||
root.compactModeChanged("clock", !SettingsData.clockCompactMode)
|
if (modelData.id === "clock") {
|
||||||
|
root.compactModeChanged("clock", !SettingsData.clockCompactMode)
|
||||||
|
} else if (modelData.id === "focusedWindow") {
|
||||||
|
root.compactModeChanged("focusedWindow", !SettingsData.focusedWindowCompactMode)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import qs.Widgets
|
|||||||
Rectangle {
|
Rectangle {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property bool compactMode: false
|
property bool compactMode: SettingsData.focusedWindowCompactMode
|
||||||
property int availableWidth: 400
|
property int availableWidth: 400
|
||||||
readonly property int baseWidth: contentRow.implicitWidth + Theme.spacingS * 2
|
readonly property int baseWidth: contentRow.implicitWidth + Theme.spacingS * 2
|
||||||
readonly property int maxNormalWidth: 456
|
readonly property int maxNormalWidth: 456
|
||||||
@@ -48,6 +48,7 @@ Rectangle {
|
|||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
maximumLineCount: 1
|
maximumLineCount: 1
|
||||||
width: Math.min(implicitWidth, compactMode ? 80 : 180)
|
width: Math.min(implicitWidth, compactMode ? 80 : 180)
|
||||||
|
visible: !compactMode && text.length > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
@@ -55,7 +56,7 @@ Rectangle {
|
|||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
color: Theme.outlineButton
|
color: Theme.outlineButton
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
visible: appText.text && titleText.text
|
visible: !compactMode && appText.text && titleText.text
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
@@ -68,7 +69,7 @@ Rectangle {
|
|||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
maximumLineCount: 1
|
maximumLineCount: 1
|
||||||
width: Math.min(implicitWidth, compactMode ? 180 : 250)
|
width: Math.min(implicitWidth, compactMode ? 280 : 250)
|
||||||
visible: text.length > 0
|
visible: text.length > 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Services.SystemTray
|
import Quickshell.Services.SystemTray
|
||||||
|
import Quickshell.Widgets
|
||||||
import qs.Common
|
import qs.Common
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
@@ -74,14 +75,14 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Image {
|
IconImage {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
width: 18
|
width: 18
|
||||||
height: 18
|
height: 18
|
||||||
source: parent.iconSource
|
source: parent.iconSource
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
smooth: true
|
smooth: true
|
||||||
fillMode: Image.PreserveAspectFit
|
mipmap: true
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
|||||||
@@ -651,7 +651,6 @@ PanelWindow {
|
|||||||
id: focusedWindowComponent
|
id: focusedWindowComponent
|
||||||
|
|
||||||
FocusedApp {
|
FocusedApp {
|
||||||
compactMode: topBarContent.spacingTight
|
|
||||||
availableWidth: topBarContent.leftToMediaGap
|
availableWidth: topBarContent.leftToMediaGap
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user