mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-08 06:25:37 -05:00
qmlfmt with 4 space
This commit is contained in:
@@ -17,11 +17,13 @@ Rectangle {
|
||||
property Item windowRoot: (Window.window ? Window.window.contentItem : null)
|
||||
readonly property int windowCount: NiriService.windows.length
|
||||
readonly property int calculatedWidth: {
|
||||
if (windowCount === 0) return 0;
|
||||
if (windowCount === 0)
|
||||
return 0
|
||||
if (SettingsData.runningAppsCompactMode) {
|
||||
return windowCount * 24 + (windowCount - 1) * Theme.spacingXS + Theme.spacingS * 2;
|
||||
return windowCount * 24 + (windowCount - 1) * Theme.spacingXS + Theme.spacingS * 2
|
||||
} else {
|
||||
return windowCount * (24 + Theme.spacingXS + 120) + (windowCount - 1) * Theme.spacingXS + Theme.spacingS * 2;
|
||||
return windowCount * (24 + Theme.spacingXS + 120)
|
||||
+ (windowCount - 1) * Theme.spacingXS + Theme.spacingS * 2
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,10 +34,11 @@ Rectangle {
|
||||
clip: false
|
||||
color: {
|
||||
if (windowCount === 0)
|
||||
return "transparent";
|
||||
return "transparent"
|
||||
|
||||
const baseColor = Theme.secondaryHover;
|
||||
return Qt.rgba(baseColor.r, baseColor.g, baseColor.b, baseColor.a * Theme.widgetTransparency);
|
||||
const baseColor = Theme.secondaryHover
|
||||
return Qt.rgba(baseColor.r, baseColor.g, baseColor.b,
|
||||
baseColor.a * Theme.widgetTransparency)
|
||||
}
|
||||
|
||||
Row {
|
||||
@@ -52,17 +55,19 @@ Rectangle {
|
||||
delegate: Item {
|
||||
id: delegateItem
|
||||
|
||||
property bool isFocused: String(modelData.id) === String(NiriService.focusedWindowId)
|
||||
property bool isFocused: String(modelData.id) === String(
|
||||
NiriService.focusedWindowId)
|
||||
property string appId: modelData.app_id || ""
|
||||
property string windowTitle: modelData.title || "(Unnamed)"
|
||||
property int windowId: modelData.id
|
||||
property string tooltipText: {
|
||||
var appName = "Unknown";
|
||||
var appName = "Unknown"
|
||||
if (appId) {
|
||||
var desktopEntry = DesktopEntries.byId(appId);
|
||||
appName = desktopEntry && desktopEntry.name ? desktopEntry.name : appId;
|
||||
var desktopEntry = DesktopEntries.byId(appId)
|
||||
appName = desktopEntry
|
||||
&& desktopEntry.name ? desktopEntry.name : appId
|
||||
}
|
||||
return appName + (windowTitle ? " • " + windowTitle : "");
|
||||
return appName + (windowTitle ? " • " + windowTitle : "")
|
||||
}
|
||||
|
||||
width: SettingsData.runningAppsCompactMode ? 24 : (24 + Theme.spacingXS + 120)
|
||||
@@ -73,9 +78,21 @@ Rectangle {
|
||||
radius: Theme.cornerRadius
|
||||
color: {
|
||||
if (isFocused)
|
||||
return mouseArea.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.3) : Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.2);
|
||||
return mouseArea.containsMouse ? Qt.rgba(
|
||||
Theme.primary.r,
|
||||
Theme.primary.g,
|
||||
Theme.primary.b,
|
||||
0.3) : Qt.rgba(
|
||||
Theme.primary.r,
|
||||
Theme.primary.g,
|
||||
Theme.primary.b,
|
||||
0.2)
|
||||
else
|
||||
return mouseArea.containsMouse ? Qt.rgba(Theme.primaryHover.r, Theme.primaryHover.g, Theme.primaryHover.b, 0.1) : "transparent";
|
||||
return mouseArea.containsMouse ? Qt.rgba(
|
||||
Theme.primaryHover.r,
|
||||
Theme.primaryHover.g,
|
||||
Theme.primaryHover.b,
|
||||
0.1) : "transparent"
|
||||
}
|
||||
|
||||
Behavior on color {
|
||||
@@ -83,9 +100,7 @@ Rectangle {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// App icon
|
||||
@@ -99,14 +114,17 @@ Rectangle {
|
||||
height: 18
|
||||
source: {
|
||||
if (!appId)
|
||||
return "";
|
||||
return ""
|
||||
|
||||
var desktopEntry = DesktopEntries.byId(appId);
|
||||
var desktopEntry = DesktopEntries.byId(appId)
|
||||
if (desktopEntry && desktopEntry.icon) {
|
||||
var iconPath = Quickshell.iconPath(desktopEntry.icon, SettingsData.iconTheme === "System Default" ? "" : SettingsData.iconTheme);
|
||||
return iconPath;
|
||||
var iconPath = Quickshell.iconPath(
|
||||
desktopEntry.icon,
|
||||
SettingsData.iconTheme
|
||||
=== "System Default" ? "" : SettingsData.iconTheme)
|
||||
return iconPath
|
||||
}
|
||||
return "";
|
||||
return ""
|
||||
}
|
||||
smooth: true
|
||||
mipmap: true
|
||||
@@ -122,13 +140,13 @@ Rectangle {
|
||||
visible: !iconImg.visible
|
||||
text: {
|
||||
if (!appId)
|
||||
return "?";
|
||||
return "?"
|
||||
|
||||
var desktopEntry = DesktopEntries.byId(appId);
|
||||
var desktopEntry = DesktopEntries.byId(appId)
|
||||
if (desktopEntry && desktopEntry.name)
|
||||
return desktopEntry.name.charAt(0).toUpperCase();
|
||||
return desktopEntry.name.charAt(0).toUpperCase()
|
||||
|
||||
return appId.charAt(0).toUpperCase();
|
||||
return appId.charAt(0).toUpperCase()
|
||||
}
|
||||
font.pixelSize: 10
|
||||
color: Theme.surfaceText
|
||||
@@ -158,32 +176,33 @@ Rectangle {
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
NiriService.focusWindow(windowId);
|
||||
NiriService.focusWindow(windowId)
|
||||
}
|
||||
onEntered: {
|
||||
root.hoveredItem = delegateItem;
|
||||
var globalPos = delegateItem.mapToGlobal(delegateItem.width / 2, delegateItem.height);
|
||||
tooltipLoader.active = true;
|
||||
root.hoveredItem = delegateItem
|
||||
var globalPos = delegateItem.mapToGlobal(
|
||||
delegateItem.width / 2, delegateItem.height)
|
||||
tooltipLoader.active = true
|
||||
if (tooltipLoader.item) {
|
||||
var tooltipY = Theme.barHeight + SettingsData.topBarSpacing + Theme.spacingXS;
|
||||
tooltipLoader.item.showTooltip(delegateItem.tooltipText, globalPos.x, tooltipY, root.parentScreen);
|
||||
var tooltipY = Theme.barHeight
|
||||
+ SettingsData.topBarSpacing + Theme.spacingXS
|
||||
tooltipLoader.item.showTooltip(
|
||||
delegateItem.tooltipText, globalPos.x,
|
||||
tooltipY, root.parentScreen)
|
||||
}
|
||||
}
|
||||
onExited: {
|
||||
if (root.hoveredItem === delegateItem) {
|
||||
root.hoveredItem = null;
|
||||
root.hoveredItem = null
|
||||
if (tooltipLoader.item)
|
||||
tooltipLoader.item.hideTooltip();
|
||||
tooltipLoader.item.hideTooltip()
|
||||
|
||||
tooltipLoader.active = false;
|
||||
tooltipLoader.active = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loader {
|
||||
@@ -191,9 +210,6 @@ Rectangle {
|
||||
|
||||
active: false
|
||||
|
||||
sourceComponent: RunningAppsTooltip {
|
||||
}
|
||||
|
||||
sourceComponent: RunningAppsTooltip {}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user