current app icon

This commit is contained in:
Damocles 2026-04-12 15:41:03 +02:00
parent f6e61ffa3b
commit a1a8d0cf24

View file

@ -1,17 +1,23 @@
import QtQuick import QtQuick
import QtQuick.Effects
import Quickshell
import Quickshell.Io import Quickshell.Io
import Quickshell.Widgets
import "." as M import "." as M
M.BarLabel { M.BarSection {
id: root id: root
spacing: M.Theme.moduleSpacing
label: root._title
color: M.Theme.base05
tooltip: root._appId ? root._appId + "\n" + root._title : root._title tooltip: root._appId ? root._appId + "\n" + root._title : root._title
elide: Text.ElideRight
property string _title: "" property string _title: ""
property string _appId: "" property string _appId: ""
readonly property string _iconSource: {
if (!root._appId) return "";
const entry = DesktopEntries.heuristicLookup(root._appId);
return entry ? Quickshell.iconPath(entry.icon) : "";
}
// Initial state niri event-stream doesn't replay current focus // Initial state niri event-stream doesn't replay current focus
Process { Process {
@ -56,4 +62,23 @@ M.BarLabel {
} }
} }
} }
IconImage {
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: M.Theme.base05
}
}
M.BarLabel {
label: root._title
color: M.Theme.base05
elide: Text.ElideRight
anchors.verticalCenter: parent.verticalCenter
}
} }