mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
Re-add padding as option
This commit is contained in:
@@ -28,6 +28,7 @@ Singleton {
|
||||
property bool showSystemResources: true
|
||||
property bool showSystemTray: true
|
||||
property bool showWorkspaceIndex: false
|
||||
property bool showWorkspacePadding: false
|
||||
property string appLauncherViewMode: "list"
|
||||
property string spotlightLauncherViewMode: "list"
|
||||
property string networkPreference: "auto"
|
||||
@@ -61,6 +62,7 @@ Singleton {
|
||||
showSystemResources = settings.showSystemResources !== undefined ? settings.showSystemResources : true;
|
||||
showSystemTray = settings.showSystemTray !== undefined ? settings.showSystemTray : true;
|
||||
showWorkspaceIndex = settings.showWorkspaceIndex !== undefined ? settings.showWorkspaceIndex : false;
|
||||
showWorkspacePadding = settings.showWorkspacePadding !== undefined ? settings.showWorkspacePadding : false;
|
||||
appLauncherViewMode = settings.appLauncherViewMode !== undefined ? settings.appLauncherViewMode : "list";
|
||||
spotlightLauncherViewMode = settings.spotlightLauncherViewMode !== undefined ? settings.spotlightLauncherViewMode : "list";
|
||||
networkPreference = settings.networkPreference !== undefined ? settings.networkPreference : "auto";
|
||||
@@ -97,6 +99,7 @@ Singleton {
|
||||
"showSystemResources": showSystemResources,
|
||||
"showSystemTray": showSystemTray,
|
||||
"showWorkspaceIndex": showWorkspaceIndex,
|
||||
"showWorkspacePadding": showWorkspacePadding,
|
||||
"appLauncherViewMode": appLauncherViewMode,
|
||||
"spotlightLauncherViewMode": spotlightLauncherViewMode,
|
||||
"networkPreference": networkPreference,
|
||||
@@ -109,6 +112,11 @@ Singleton {
|
||||
saveSettings();
|
||||
}
|
||||
|
||||
function setShowWorkspacePadding(enabled) {
|
||||
showWorkspacePadding = enabled;
|
||||
saveSettings();
|
||||
}
|
||||
|
||||
function applyStoredTheme() {
|
||||
if (typeof Theme !== "undefined") {
|
||||
Theme.isLightMode = isLightMode;
|
||||
|
||||
@@ -18,7 +18,10 @@ PanelWindow {
|
||||
// App management
|
||||
property var categories: AppSearchService.getAllCategories()
|
||||
property string selectedCategory: "All"
|
||||
property var recentApps: Prefs.getRecentApps()
|
||||
property var recentApps: Prefs.recentlyUsedApps.map(recentApp => {
|
||||
var app = AppSearchService.getAppByExec(recentApp.exec);
|
||||
return app && !app.noDisplay ? app : null;
|
||||
}).filter(app => app !== null)
|
||||
property var pinnedApps: ["firefox", "code", "terminal", "file-manager"]
|
||||
property bool showCategories: false
|
||||
property string viewMode: Prefs.appLauncherViewMode // "list" or "grid"
|
||||
@@ -137,7 +140,6 @@ PanelWindow {
|
||||
|
||||
function show() {
|
||||
launcher.isVisible = true;
|
||||
recentApps = Prefs.getRecentApps(); // Refresh recent apps
|
||||
searchDebounceTimer.stop(); // Stop any pending search
|
||||
updateFilteredModel();
|
||||
Qt.callLater(function() {
|
||||
@@ -173,7 +175,6 @@ PanelWindow {
|
||||
return cat !== "All";
|
||||
}));
|
||||
updateFilteredModel();
|
||||
recentApps = Prefs.getRecentApps(); // Load recent apps on startup
|
||||
}
|
||||
|
||||
// Full screen overlay setup for proper focus
|
||||
@@ -221,13 +222,6 @@ PanelWindow {
|
||||
}
|
||||
|
||||
|
||||
Connections {
|
||||
function onRecentlyUsedAppsChanged() {
|
||||
recentApps = Prefs.getRecentApps();
|
||||
}
|
||||
|
||||
target: Prefs
|
||||
}
|
||||
|
||||
Component {
|
||||
id: iconComponent
|
||||
|
||||
@@ -624,6 +624,20 @@ PanelWindow {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Workspace Settings
|
||||
SettingsSection {
|
||||
title: "Workspaces"
|
||||
iconName: "tab"
|
||||
|
||||
content: Column {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingM
|
||||
|
||||
SettingsToggle {
|
||||
text: "Workspace Index Numbers"
|
||||
description: "Show workspace index numbers in the top bar workspace switcher"
|
||||
@@ -633,6 +647,15 @@ PanelWindow {
|
||||
}
|
||||
}
|
||||
|
||||
SettingsToggle {
|
||||
text: "Workspace Padding"
|
||||
description: "Always show a minimum of 3 workspaces, even if fewer are available"
|
||||
checked: Prefs.showWorkspacePadding
|
||||
onToggled: (checked) => {
|
||||
return Prefs.setShowWorkspacePadding(checked);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,7 +9,18 @@ Rectangle {
|
||||
|
||||
property string screenName: ""
|
||||
property int currentWorkspace: getDisplayActiveWorkspace()
|
||||
property var workspaceList: getDisplayWorkspaces()
|
||||
property var workspaceList: {
|
||||
var baseList = getDisplayWorkspaces();
|
||||
return Prefs.showWorkspacePadding ? padWorkspaces(baseList) : baseList;
|
||||
}
|
||||
|
||||
function padWorkspaces(list) {
|
||||
var padded = list.slice();
|
||||
while (padded.length < 3) {
|
||||
padded.push(-1); // Use -1 as a placeholder
|
||||
}
|
||||
return padded;
|
||||
}
|
||||
|
||||
function getDisplayWorkspaces() {
|
||||
if (!NiriWorkspaceService.niriAvailable || NiriWorkspaceService.allWorkspaces.length === 0)
|
||||
@@ -44,7 +55,7 @@ Rectangle {
|
||||
return 1;
|
||||
}
|
||||
|
||||
width: workspaceRow.implicitWidth + Theme.spacingL * 2
|
||||
width: Prefs.showWorkspacePadding ? Math.max(120, workspaceRow.implicitWidth + Theme.spacingL * 2) : workspaceRow.implicitWidth + Theme.spacingL * 2
|
||||
height: 30
|
||||
radius: Theme.cornerRadiusLarge
|
||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.08)
|
||||
@@ -52,7 +63,7 @@ Rectangle {
|
||||
|
||||
Connections {
|
||||
function onAllWorkspacesChanged() {
|
||||
root.workspaceList = root.getDisplayWorkspaces();
|
||||
root.workspaceList = Prefs.showWorkspacePadding ? root.padWorkspaces(root.getDisplayWorkspaces()) : root.getDisplayWorkspaces();
|
||||
root.currentWorkspace = root.getDisplayActiveWorkspace();
|
||||
}
|
||||
|
||||
@@ -62,7 +73,7 @@ Rectangle {
|
||||
|
||||
function onNiriAvailableChanged() {
|
||||
if (NiriWorkspaceService.niriAvailable) {
|
||||
root.workspaceList = root.getDisplayWorkspaces();
|
||||
root.workspaceList = Prefs.showWorkspacePadding ? root.padWorkspaces(root.getDisplayWorkspaces()) : root.getDisplayWorkspaces();
|
||||
root.currentWorkspace = root.getDisplayActiveWorkspace();
|
||||
}
|
||||
}
|
||||
@@ -70,6 +81,18 @@ Rectangle {
|
||||
target: NiriWorkspaceService
|
||||
}
|
||||
|
||||
// Force update when padding preference changes
|
||||
Connections {
|
||||
function onShowWorkspacePaddingChanged() {
|
||||
// Force re-evaluation by updating the property
|
||||
var baseList = root.getDisplayWorkspaces();
|
||||
root.workspaceList = Prefs.showWorkspacePadding ? root.padWorkspaces(baseList) : baseList;
|
||||
}
|
||||
|
||||
target: Prefs
|
||||
}
|
||||
|
||||
|
||||
Row {
|
||||
id: workspaceRow
|
||||
|
||||
@@ -88,13 +111,13 @@ Rectangle {
|
||||
width: isActive ? Theme.spacingXL + Theme.spacingM : Theme.spacingL + Theme.spacingXS
|
||||
height: Theme.spacingL
|
||||
radius: height / 2
|
||||
color: isActive ? Theme.primary : isPlaceholder ? Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.12) : isHovered ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.5) : Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.3)
|
||||
color: isActive ? Theme.primary : isPlaceholder ? Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.06) : isHovered ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.5) : Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.3)
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
hoverEnabled: !isPlaceholder
|
||||
cursorShape: isPlaceholder ? Qt.ArrowCursor : Qt.PointingHandCursor
|
||||
enabled: !isPlaceholder
|
||||
onClicked: {
|
||||
if (!isPlaceholder) {
|
||||
@@ -113,15 +136,6 @@ Rectangle {
|
||||
font.bold: isActive && !isPlaceholder
|
||||
}
|
||||
|
||||
// If not showing index, show a subtle dot for placeholders
|
||||
Rectangle {
|
||||
visible: isPlaceholder && !Prefs.showWorkspaceIndex
|
||||
anchors.centerIn: parent
|
||||
width: Theme.spacingXS
|
||||
height: Theme.spacingXS
|
||||
radius: Theme.spacingXS / 2
|
||||
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.18)
|
||||
}
|
||||
|
||||
Behavior on width {
|
||||
NumberAnimation {
|
||||
|
||||
Reference in New Issue
Block a user