1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-07 14:05:38 -05:00

Enhancements to launcher and other warning fixes

- Persist grid/list setting
- Alignment improvement
This commit is contained in:
bbedward
2025-07-14 12:46:36 -04:00
parent 603ac51df0
commit 4486e79afe
15 changed files with 322 additions and 282 deletions

View File

@@ -27,6 +27,10 @@ Singleton {
property bool showSystemResources: true
property bool showSystemTray: true
// View mode preferences for launchers
property string appLauncherViewMode: "list"
property string spotlightLauncherViewMode: "list"
Component.onCompleted: loadSettings()
@@ -73,6 +77,8 @@ Singleton {
showClipboard = settings.showClipboard !== undefined ? settings.showClipboard : true
showSystemResources = settings.showSystemResources !== undefined ? settings.showSystemResources : true
showSystemTray = settings.showSystemTray !== undefined ? settings.showSystemTray : true
appLauncherViewMode = settings.appLauncherViewMode !== undefined ? settings.appLauncherViewMode : "list"
spotlightLauncherViewMode = settings.spotlightLauncherViewMode !== undefined ? settings.spotlightLauncherViewMode : "list"
console.log("Loaded settings - themeIndex:", themeIndex, "isDynamic:", themeIsDynamic, "lightMode:", isLightMode, "transparency:", topBarTransparency, "recentApps:", recentlyUsedApps.length)
applyStoredTheme()
@@ -102,7 +108,9 @@ Singleton {
showMusic,
showClipboard,
showSystemResources,
showSystemTray
showSystemTray,
appLauncherViewMode,
spotlightLauncherViewMode
}, null, 2))
console.log("Saving settings - themeIndex:", themeIndex, "isDynamic:", themeIsDynamic, "lightMode:", isLightMode, "transparency:", topBarTransparency, "recentApps:", recentlyUsedApps.length)
}
@@ -257,4 +265,17 @@ Singleton {
showSystemTray = enabled
saveSettings()
}
// View mode setters
function setAppLauncherViewMode(mode) {
console.log("Prefs setAppLauncherViewMode called - appLauncherViewMode:", mode)
appLauncherViewMode = mode
saveSettings()
}
function setSpotlightLauncherViewMode(mode) {
console.log("Prefs setSpotlightLauncherViewMode called - spotlightLauncherViewMode:", mode)
spotlightLauncherViewMode = mode
saveSettings()
}
}

View File

@@ -455,8 +455,8 @@ QtObject {
property color surfaceVariant: isDynamicTheme ? Colors.surfaceVariant : getCurrentTheme().surfaceVariant
property color surfaceVariantText: isDynamicTheme ? Colors.surfaceVariantText : getCurrentTheme().surfaceVariantText
property color surfaceTint: isDynamicTheme ? Colors.surfaceTint : getCurrentTheme().surfaceTint
property color background: isDynamicTheme ? Colors.background : getCurrentTheme().background
property color backgroundText: isDynamicTheme ? Colors.backgroundText : getCurrentTheme().backgroundText
property color background: isDynamicTheme ? Colors.bg : getCurrentTheme().background
property color backgroundText: isDynamicTheme ? Colors.surfaceText : getCurrentTheme().backgroundText
property color outline: isDynamicTheme ? Colors.outline : getCurrentTheme().outline
property color surfaceContainer: isDynamicTheme ? Colors.surfaceContainer : getCurrentTheme().surfaceContainer
property color surfaceContainerHigh: isDynamicTheme ? Colors.surfaceContainerHigh : getCurrentTheme().surfaceContainerHigh

View File

@@ -56,7 +56,7 @@ Singleton {
root.focusedAppId = windowData.app_id || ""
root.focusedWindowTitle = windowData.title || ""
root.focusedAppName = getDisplayName(windowData.app_id || "")
root.focusedWindowId = windowData.id || -1
root.focusedWindowId = parseInt(windowData.id) || -1
} catch (e) {
console.warn("FocusedWindowService: Failed to parse focused window data:", e)
clearFocusedWindow()

View File

@@ -36,7 +36,7 @@ PanelWindow {
property var recentApps: Prefs.getRecentApps()
property var pinnedApps: ["firefox", "code", "terminal", "file-manager"]
property bool showCategories: false
property string viewMode: "list" // "list" or "grid"
property string viewMode: Prefs.appLauncherViewMode // "list" or "grid"
property int selectedIndex: 0
// Search debouncing
@@ -625,7 +625,10 @@ PanelWindow {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: viewMode = "list"
onClicked: {
viewMode = "list"
Prefs.setAppLauncherViewMode("list")
}
}
}
@@ -650,7 +653,10 @@ PanelWindow {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: viewMode = "grid"
onClicked: {
viewMode = "grid"
Prefs.setAppLauncherViewMode("grid")
}
}
}
}
@@ -721,18 +727,18 @@ PanelWindow {
GridView {
id: appGrid
width: parent.width
anchors.fill: parent
anchors.margins: Theme.spacingS
// Responsive cell sizes based on screen width
property int baseCellWidth: Math.max(100, Math.min(140, width / 8))
// Responsive cell sizes based on screen width - 4 columns
property int columnsCount: 4
property int baseCellWidth: (width - Theme.spacingS * 2) / columnsCount
property int baseCellHeight: baseCellWidth + 20
cellWidth: baseCellWidth
cellHeight: baseCellHeight
// Center the grid content
property int columnsCount: Math.floor(width / cellWidth)
property int remainingSpace: width - (columnsCount * cellWidth)
leftMargin: Math.max(Theme.spacingS, remainingSpace / 2)
rightMargin: leftMargin
@@ -983,7 +989,7 @@ PanelWindow {
Text {
anchors.horizontalCenter: parent.horizontalCenter
width: 88
width: appGrid.cellWidth - 12
text: model.name
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText

View File

@@ -70,9 +70,7 @@ PanelWindow {
// Main row with widgets and calendar
let widgetHeight = 160 // Media widget always present
if (weather?.available) {
widgetHeight += (weather ? 140 : 80) + theme.spacingM
}
widgetHeight += (weather ? 140 : 80) + theme.spacingM // Weather widget always present
let calendarHeight = 300
let mainRowHeight = Math.max(widgetHeight, calendarHeight)
@@ -169,9 +167,7 @@ PanelWindow {
width: parent.width
height: {
let widgetHeight = 160 // Media widget always present
if (weather?.available) {
widgetHeight += (weather ? 140 : 80) + theme.spacingM
}
widgetHeight += (weather ? 140 : 80) + theme.spacingM // Weather widget always present
let calendarHeight = 300
return Math.max(widgetHeight, calendarHeight)
}
@@ -186,7 +182,7 @@ PanelWindow {
visible: hasAnyWidgets
anchors.top: parent.top
property bool hasAnyWidgets: true || weather?.available // Always show media widget
property bool hasAnyWidgets: true // Always show media widget and weather widget
MediaPlayerWidget {
visible: true // Always visible - shows placeholder when no media
@@ -196,7 +192,7 @@ PanelWindow {
}
WeatherWidget {
visible: weather?.available
visible: true // Always visible - shows placeholder when no weather
width: parent.width
height: weather ? 140 : 80
theme: centerCommandCenter.theme

View File

@@ -75,22 +75,13 @@ Rectangle {
}
}
Item {
anchors.fill: parent
anchors.margins: theme.spacingL
Column {
anchors.fill: parent
spacing: theme.spacingM
// Header - always visible when widget is shown
Item {
width: parent.width
height: headerRow.height
Row {
id: headerRow
width: parent.width
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: theme.spacingL
spacing: theme.spacingS
Text {
@@ -112,15 +103,8 @@ Rectangle {
anchors.verticalCenter: parent.verticalCenter
}
}
}
// Content area
Rectangle {
anchors.fill: parent
anchors.margins: theme.spacingL
color: "transparent"
// No events placeholder - absolutely centered in this gray container
// No events placeholder - centered in entire widget (not just content area)
Column {
anchors.centerIn: parent
spacing: theme.spacingXS
@@ -141,15 +125,17 @@ Rectangle {
font.weight: Font.Normal
anchors.horizontalCenter: parent.horizontalCenter
}
}
// Events list
// Events list - positioned below header when there are events
ListView {
id: eventsList
anchors.fill: parent
anchors.margins: theme.spacingM
anchors.topMargin: theme.spacingM + 2
anchors.top: headerRow.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.margins: theme.spacingL
anchors.topMargin: theme.spacingM
visible: hasEvents
clip: true
spacing: theme.spacingS
@@ -313,6 +299,3 @@ Rectangle {
}
}
}
}
}
}

View File

@@ -27,17 +27,7 @@ Rectangle {
shadowOpacity: 0.1
}
Column {
anchors.fill: parent
anchors.margins: theme.spacingL
spacing: theme.spacingM
// Show different content based on whether we have weather data
Item {
width: parent.width
height: 60
// Placeholder when no weather
// Placeholder when no weather - centered in entire widget
Column {
anchors.centerIn: parent
spacing: theme.spacingS
@@ -59,11 +49,21 @@ Rectangle {
}
}
// Normal weather info when available
// Weather content when available - original Column structure
Column {
anchors.fill: parent
anchors.margins: theme.spacingL
spacing: theme.spacingS
visible: weather && weather.available && weather.temp !== 0
// Weather header info
Item {
width: parent.width
height: 60
Row {
anchors.fill: parent
spacing: theme.spacingL
visible: weather && weather.available && weather.temp !== 0
// Weather icon
Text {
@@ -108,7 +108,6 @@ Rectangle {
columns: 2
spacing: theme.spacingM
anchors.horizontalCenter: parent.horizontalCenter
visible: weather && weather.available && weather.temp !== 0
Row {
spacing: theme.spacingXS

View File

@@ -836,6 +836,17 @@ PanelWindow {
console.warn("ClipboardHistory: Failed to load clipboard history")
}
}
// Handle keyboard shortcuts
Keys.onPressed: (event) => {
if (event.key === Qt.Key_Escape) {
clipboardHistory.hide()
}
}
Component.onCompleted: {
focus = true
}
}
Process {
@@ -874,11 +885,6 @@ PanelWindow {
}
}
Keys.onPressed: (event) => {
if (event.key === Qt.Key_Escape) {
hide()
}
}
IpcHandler {
target: "clipboard"

View File

@@ -153,7 +153,7 @@ PanelWindow {
color: "transparent"
border.color: Qt.rgba(0, 0, 0, 0.15) // Subtle dark outline
border.width: 1
visible: hasImage
visible: parent.hasImage
}
// Highlight ring to make it pop
@@ -164,7 +164,7 @@ PanelWindow {
color: "transparent"
border.color: Qt.rgba(255, 255, 255, 0.1) // Subtle light ring
border.width: 1
visible: hasImage
visible: parent.hasImage
}
// Fallback icon for no profile picture (generic person)
@@ -173,7 +173,7 @@ PanelWindow {
text: "person"
font.family: Theme.iconFont
font.pixelSize: Theme.iconSize + 8
color: Theme.onPrimary
color: Theme.primaryText
visible: Prefs.profileImage === ""
}
@@ -183,7 +183,7 @@ PanelWindow {
text: "warning"
font.family: Theme.iconFont
font.pixelSize: Theme.iconSize + 8
color: Theme.onPrimary
color: Theme.primaryText
visible: Prefs.profileImage !== "" && profileImage.status === Image.Error
}
}

View File

@@ -144,7 +144,7 @@ PanelWindow {
Text {
text: "Confirm"
font.pixelSize: Theme.fontSizeMedium
color: Theme.onPrimary
color: Theme.primaryText
font.weight: Font.Medium
anchors.centerIn: parent
}

View File

@@ -245,8 +245,7 @@ PanelWindow {
Row {
id: columnHeaders
Layout.fillWidth: true
anchors.left: parent.left
anchors.leftMargin: 8
Layout.leftMargin: 8
spacing: 8
// Icon placeholder + Process name
@@ -466,8 +465,8 @@ PanelWindow {
}
// Material 3 animations
opacity: menuVisible ? 1.0 : 0.0
scale: menuVisible ? 1.0 : 0.85
opacity: processContextMenuWindow.menuVisible ? 1.0 : 0.0
scale: processContextMenuWindow.menuVisible ? 1.0 : 0.85
Behavior on opacity {
NumberAnimation {

View File

@@ -217,7 +217,7 @@ PanelWindow {
text: profileImageInput.text === "" ? "person" : "warning"
font.family: Theme.iconFont
font.pixelSize: Theme.iconSize + 8
color: Theme.onPrimary
color: Theme.primaryText
visible: !avatarBox.hasImage
}

View File

@@ -80,7 +80,7 @@ Rectangle {
radius: 10
anchors.verticalCenter: parent.verticalCenter
x: root.checked ? parent.width - width - 2 : 2
color: root.checked ? Theme.onPrimary : Theme.surfaceText
color: root.checked ? Theme.primaryText : Theme.surfaceText
Behavior on x {
NumberAnimation {

View File

@@ -22,7 +22,7 @@ PanelWindow {
return result.concat(allCategories.filter(cat => cat !== "All"))
}
property string selectedCategory: "All"
property string viewMode: "list" // "list" or "grid"
property string viewMode: Prefs.spotlightLauncherViewMode // "list" or "grid"
// Search debouncing
Timer {
@@ -510,7 +510,10 @@ PanelWindow {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: viewMode = "list"
onClicked: {
viewMode = "list"
Prefs.setSpotlightLauncherViewMode("list")
}
}
}
@@ -537,7 +540,10 @@ PanelWindow {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: viewMode = "grid"
onClicked: {
viewMode = "grid"
Prefs.setSpotlightLauncherViewMode("grid")
}
}
}
}
@@ -598,19 +604,35 @@ PanelWindow {
anchors.margins: Theme.spacingM
spacing: Theme.spacingL
Rectangle {
Item {
width: 40
height: 40
radius: Theme.cornerRadius
color: Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.1)
border.color: Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.2)
border.width: 1
anchors.verticalCenter: parent.verticalCenter
IconImage {
id: listIconImg
anchors.fill: parent
anchors.margins: 4
source: model.icon ? Quickshell.iconPath(model.icon, "") : ""
smooth: true
asynchronous: true
visible: status === Image.Ready
}
Rectangle {
anchors.fill: parent
visible: !listIconImg.visible
color: Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.10)
radius: Theme.cornerRadiusLarge
border.width: 1
border.color: Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.20)
Text {
anchors.centerIn: parent
text: (model.name && model.name.length > 0) ? model.name.charAt(0).toUpperCase() : "A"
font.pixelSize: 20
color: Theme.primary
font.weight: Font.Bold
}
}
}
@@ -650,33 +672,37 @@ PanelWindow {
ScrollBar.vertical: ScrollBar { policy: ScrollBar.AlwaysOn }
}
// Grid view
// Grid view scroll container
ScrollView {
anchors.fill: parent
clip: true
visible: viewMode === "grid"
ScrollBar.vertical.policy: ScrollBar.AsNeeded
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
GridView {
id: resultsGrid
// Center the grid within the parent space
anchors.centerIn: parent
width: Math.min(parent.width, baseCellWidth * 6 + 16) // Optimal width for 6 columns plus spacing
height: parent.height
visible: viewMode === "grid"
anchors.fill: parent
anchors.margins: Theme.spacingS
model: filteredModel
clip: true
focus: spotlightOpen
interactive: true
flickDeceleration: 8000
maximumFlickVelocity: 15000
// Optimized cell sizes for maximum space efficiency - 6 columns
property int baseCellWidth: Math.max(85, Math.min(100, width / 6))
property int baseCellHeight: baseCellWidth + 30
// Responsive cell sizes based on screen width - wider cells for better fill
property int baseCellWidth: Math.max(120, Math.min(160, width / 6))
property int baseCellHeight: baseCellWidth + 20
cellWidth: baseCellWidth
cellHeight: baseCellHeight
// Use full width with minimal 2px right margin for scrollbar
leftMargin: 0
rightMargin: 2
topMargin: Theme.spacingXS
bottomMargin: Theme.spacingXS
// Center the grid content with better fill
property int columnsCount: Math.floor(width / cellWidth)
property int remainingSpace: width - (columnsCount * cellWidth)
leftMargin: Math.max(Theme.spacingXS, remainingSpace / 2)
rightMargin: leftMargin
// Make mouse wheel scrolling more responsive
property real wheelStepSize: 60
@@ -720,24 +746,36 @@ PanelWindow {
height: iconSize
anchors.horizontalCenter: parent.horizontalCenter
IconImage {
id: iconImg
anchors.fill: parent
source: model.icon ? Quickshell.iconPath(model.icon, "") : ""
smooth: true
asynchronous: true
visible: status === Image.Ready
}
Rectangle {
anchors.fill: parent
radius: Theme.cornerRadius
color: Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.1)
border.color: Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.2)
visible: !iconImg.visible
color: Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.10)
radius: Theme.cornerRadiusLarge
border.width: 1
border.color: Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.20)
IconImage {
anchors.fill: parent
anchors.margins: 4
source: model.icon ? Quickshell.iconPath(model.icon, "") : ""
Text {
anchors.centerIn: parent
text: (model.name && model.name.length > 0) ? model.name.charAt(0).toUpperCase() : "A"
font.pixelSize: Math.min(24, parent.width * 0.5)
color: Theme.primary
font.weight: Font.Bold
}
}
}
Text {
anchors.horizontalCenter: parent.horizontalCenter
width: resultsGrid.cellWidth - 16
width: resultsGrid.cellWidth - 12
text: model.name
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText
@@ -759,8 +797,7 @@ PanelWindow {
onClicked: launchApp(model)
}
}
ScrollBar.vertical: ScrollBar { policy: ScrollBar.AsNeeded }
}
}
}
}

View File

@@ -320,13 +320,6 @@ ShellRoot {
onClipboardRequested: {
clipboardHistoryPopup.toggle()
}
onShowTrayMenuChanged: root.showTrayMenu = showTrayMenu
onCurrentTrayMenuChanged: root.currentTrayMenu = currentTrayMenu
onCurrentTrayItemChanged: root.currentTrayItem = currentTrayItem
onTrayMenuXChanged: root.trayMenuX = trayMenuX
onTrayMenuYChanged: root.trayMenuY = trayMenuY
}
}