45 lines
1.5 KiB
QML
45 lines
1.5 KiB
QML
import QtQuick
|
|
import QtQuick.Effects
|
|
import Quickshell
|
|
import Quickshell.Widgets
|
|
import "." as M
|
|
|
|
M.BarSection {
|
|
id: root
|
|
spacing: M.Theme.moduleSpacing
|
|
visible: M.Modules.windowTitle.enable && M.NiriIpc.focusedTitle !== ""
|
|
|
|
onVisibleChanged: console.log("WindowTitle visible=" + visible + " enable=" + M.Modules.windowTitle.enable + " title='" + M.NiriIpc.focusedTitle + "' width=" + width)
|
|
onWidthChanged: if (visible)
|
|
console.log("WindowTitle width=" + width + " centerSection.x would need bar ref")
|
|
|
|
tooltip: M.NiriIpc.focusedAppId ? M.NiriIpc.focusedAppId + "\n" + M.NiriIpc.focusedTitle : M.NiriIpc.focusedTitle
|
|
|
|
readonly property string _iconSource: {
|
|
if (!M.NiriIpc.focusedAppId)
|
|
return "";
|
|
const entry = DesktopEntries.heuristicLookup(M.NiriIpc.focusedAppId);
|
|
return entry ? Quickshell.iconPath(entry.icon) : "";
|
|
}
|
|
|
|
IconImage {
|
|
id: _icon
|
|
visible: root._iconSource !== ""
|
|
source: root._iconSource
|
|
implicitSize: M.Theme.fontSize + 2
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
layer.enabled: true
|
|
layer.effect: MultiEffect {
|
|
colorization: 1.0
|
|
colorizationColor: root.accentColor
|
|
}
|
|
}
|
|
|
|
M.BarLabel {
|
|
label: M.NiriIpc.focusedTitle
|
|
color: root.accentColor
|
|
elide: Text.ElideRight
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
width: root.width - (_icon.visible ? _icon.width + root.spacing : 0)
|
|
}
|
|
}
|