nova-shell/modules/WindowTitle.qml

39 lines
1.1 KiB
QML

import QtQuick
import QtQuick.Effects
import Quickshell
import Quickshell.Widgets
import "." as M
M.BarSection {
id: root
spacing: M.Theme.moduleSpacing
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)
}
}