mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-07 22:15:38 -05:00
fix some topbar issues
This commit is contained in:
@@ -374,16 +374,14 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (!SettingsData.topBarLeftWidgets
|
// Only set defaults if widgets have never been configured (null/undefined, not empty array)
|
||||||
|| SettingsData.topBarLeftWidgets.length === 0)
|
if (!SettingsData.topBarLeftWidgets)
|
||||||
SettingsData.setTopBarLeftWidgets(defaultLeftWidgets)
|
SettingsData.setTopBarLeftWidgets(defaultLeftWidgets)
|
||||||
|
|
||||||
if (!SettingsData.topBarCenterWidgets
|
if (!SettingsData.topBarCenterWidgets)
|
||||||
|| SettingsData.topBarCenterWidgets.length === 0)
|
|
||||||
SettingsData.setTopBarCenterWidgets(defaultCenterWidgets)
|
SettingsData.setTopBarCenterWidgets(defaultCenterWidgets)
|
||||||
|
|
||||||
if (!SettingsData.topBarRightWidgets
|
if (!SettingsData.topBarRightWidgets)
|
||||||
|| SettingsData.topBarRightWidgets.length === 0)
|
|
||||||
SettingsData.setTopBarRightWidgets(defaultRightWidgets)
|
SettingsData.setTopBarRightWidgets(defaultRightWidgets)
|
||||||
|
|
||||||
["left", "center", "right"].forEach(sectionId => {
|
["left", "center", "right"].forEach(sectionId => {
|
||||||
|
|||||||
@@ -3,18 +3,44 @@ import qs.Common
|
|||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
|
||||||
Rectangle {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property bool isActive: false
|
property bool isActive: false
|
||||||
property string section: "left" // Which section this button is in
|
property string section: "left"
|
||||||
property var popupTarget: null // Reference to the popup to position
|
property var popupTarget: null
|
||||||
property var parentScreen: null // The screen this button is on
|
property var parentScreen: null
|
||||||
|
|
||||||
signal clicked
|
signal clicked
|
||||||
|
|
||||||
width: 40
|
width: 40
|
||||||
height: 30
|
height: 30
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: launcherArea
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
z: 1000
|
||||||
|
preventStealing: true
|
||||||
|
propagateComposedEvents: false
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (popupTarget && popupTarget.setTriggerPosition) {
|
||||||
|
var globalPos = mapToGlobal(0, 0)
|
||||||
|
var currentScreen = parentScreen || Screen
|
||||||
|
var screenX = currentScreen.x || 0
|
||||||
|
var relativeX = globalPos.x - screenX
|
||||||
|
popupTarget.setTriggerPosition(relativeX,
|
||||||
|
Theme.barHeight + Theme.spacingXS,
|
||||||
|
width, section, currentScreen)
|
||||||
|
}
|
||||||
|
root.clicked()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
color: {
|
color: {
|
||||||
const baseColor = launcherArea.containsMouse
|
const baseColor = launcherArea.containsMouse
|
||||||
@@ -41,30 +67,11 @@ Rectangle {
|
|||||||
color: Theme.surfaceText
|
color: Theme.surfaceText
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: launcherArea
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
onClicked: {
|
|
||||||
if (popupTarget && popupTarget.setTriggerPosition) {
|
|
||||||
var globalPos = mapToGlobal(0, 0)
|
|
||||||
var currentScreen = parentScreen || Screen
|
|
||||||
var screenX = currentScreen.x || 0
|
|
||||||
var relativeX = globalPos.x - screenX
|
|
||||||
popupTarget.setTriggerPosition(relativeX,
|
|
||||||
Theme.barHeight + Theme.spacingXS,
|
|
||||||
width, section, currentScreen)
|
|
||||||
}
|
|
||||||
root.clicked()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on color {
|
Behavior on color {
|
||||||
ColorAnimation {
|
ColorAnimation {
|
||||||
duration: Theme.shortDuration
|
duration: Theme.shortDuration
|
||||||
easing.type: Theme.standardEasing
|
easing.type: Theme.standardEasing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -184,8 +184,9 @@ Rectangle {
|
|||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
enabled: root.playerAvailable && root.opacity > 0 && root.width > 0 && textContainer.visible
|
||||||
cursorShape: Qt.PointingHandCursor
|
hoverEnabled: enabled
|
||||||
|
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (root.popupTarget && root.popupTarget.setTriggerPosition) {
|
if (root.popupTarget && root.popupTarget.setTriggerPosition) {
|
||||||
var globalPos = mapToGlobal(0, 0)
|
var globalPos = mapToGlobal(0, 0)
|
||||||
@@ -226,8 +227,9 @@ Rectangle {
|
|||||||
id: prevArea
|
id: prevArea
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
enabled: root.playerAvailable && root.width > 0
|
||||||
cursorShape: Qt.PointingHandCursor
|
hoverEnabled: enabled
|
||||||
|
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (activePlayer)
|
if (activePlayer)
|
||||||
activePlayer.previous()
|
activePlayer.previous()
|
||||||
@@ -256,8 +258,9 @@ Rectangle {
|
|||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
enabled: root.playerAvailable && root.width > 0
|
||||||
cursorShape: Qt.PointingHandCursor
|
hoverEnabled: enabled
|
||||||
|
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (activePlayer)
|
if (activePlayer)
|
||||||
activePlayer.togglePlaying()
|
activePlayer.togglePlaying()
|
||||||
@@ -285,8 +288,9 @@ Rectangle {
|
|||||||
id: nextArea
|
id: nextArea
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
enabled: root.playerAvailable && root.width > 0
|
||||||
cursorShape: Qt.PointingHandCursor
|
hoverEnabled: enabled
|
||||||
|
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (activePlayer)
|
if (activePlayer)
|
||||||
activePlayer.next()
|
activePlayer.next()
|
||||||
|
|||||||
@@ -82,6 +82,19 @@ PanelWindow {
|
|||||||
root.updateGpuTempConfig()
|
root.updateGpuTempConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onWidgetDataChanged() {
|
||||||
|
Qt.callLater(() => {
|
||||||
|
leftSection.visible = false
|
||||||
|
centerSection.visible = false
|
||||||
|
rightSection.visible = false
|
||||||
|
Qt.callLater(() => {
|
||||||
|
leftSection.visible = true
|
||||||
|
centerSection.visible = true
|
||||||
|
rightSection.visible = true
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
target: SettingsData
|
target: SettingsData
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ Singleton {
|
|||||||
root.focusedAppName = getDisplayName(focusedWindow.app_id || "")
|
root.focusedAppName = getDisplayName(focusedWindow.app_id || "")
|
||||||
root.focusedWindowId = parseInt(focusedWindow.id) || -1
|
root.focusedWindowId = parseInt(focusedWindow.id) || -1
|
||||||
} else {
|
} else {
|
||||||
clearFocusedWindow()
|
setWorkspaceFallback()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,9 +37,29 @@ Singleton {
|
|||||||
root.focusedAppId = ""
|
root.focusedAppId = ""
|
||||||
root.focusedAppName = ""
|
root.focusedAppName = ""
|
||||||
root.focusedWindowTitle = ""
|
root.focusedWindowTitle = ""
|
||||||
|
root.focusedWindowId = -1
|
||||||
|
}
|
||||||
|
|
||||||
|
function setWorkspaceFallback() {
|
||||||
|
if (NiriService.focusedWorkspaceIndex >= 0 && NiriService.allWorkspaces.length > 0) {
|
||||||
|
const workspace = NiriService.allWorkspaces[NiriService.focusedWorkspaceIndex]
|
||||||
|
if (workspace) {
|
||||||
|
root.focusedAppId = "niri"
|
||||||
|
root.focusedAppName = "niri"
|
||||||
|
if (workspace.name && workspace.name.length > 0) {
|
||||||
|
root.focusedWindowTitle = workspace.name
|
||||||
|
} else {
|
||||||
|
root.focusedWindowTitle = "Workspace " + (workspace.idx + 1)
|
||||||
|
}
|
||||||
|
root.focusedWindowId = -1
|
||||||
|
} else {
|
||||||
|
clearFocusedWindow()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
clearFocusedWindow()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert app_id to a more user-friendly display name
|
|
||||||
function getDisplayName(appId) {
|
function getDisplayName(appId) {
|
||||||
if (!appId)
|
if (!appId)
|
||||||
return ""
|
return ""
|
||||||
@@ -62,7 +82,7 @@ Singleton {
|
|||||||
function onFocusedWindowIdChanged() {
|
function onFocusedWindowIdChanged() {
|
||||||
const focusedWindowId = NiriService.focusedWindowId
|
const focusedWindowId = NiriService.focusedWindowId
|
||||||
if (!focusedWindowId) {
|
if (!focusedWindowId) {
|
||||||
clearFocusedWindow()
|
setWorkspaceFallback()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,7 +94,7 @@ Singleton {
|
|||||||
root.focusedAppName = getDisplayName(focusedWindow.app_id || "")
|
root.focusedAppName = getDisplayName(focusedWindow.app_id || "")
|
||||||
root.focusedWindowId = parseInt(focusedWindow.id) || -1
|
root.focusedWindowId = parseInt(focusedWindow.id) || -1
|
||||||
} else {
|
} else {
|
||||||
clearFocusedWindow()
|
setWorkspaceFallback()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user