Compare commits

..

No commits in common. "a1a8d0cf24b9ef8c5d5fb16d1a83f45b92b76ab1" and "50cbbf6665a770cfc012316132bc7e81f9770dc2" have entirely different histories.

3 changed files with 8 additions and 38 deletions

View file

@ -50,7 +50,7 @@ PanelWindow {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
spacing: M.Theme.barSpacing spacing: M.Theme.barSpacing
M.Workspaces { bar: bar; visible: M.Modules.workspaces } M.Workspaces { visible: M.Modules.workspaces }
M.Tray { M.Tray {
bar: bar bar: bar
visible: M.Modules.tray visible: M.Modules.tray

View file

@ -1,23 +1,17 @@
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.BarSection { M.BarLabel {
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 {
@ -62,23 +56,4 @@ M.BarSection {
} }
} }
} }
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
}
} }

View file

@ -1,5 +1,4 @@
import QtQuick import QtQuick
import Quickshell
import Quickshell.Io import Quickshell.Io
import "." as M import "." as M
@ -7,12 +6,8 @@ Row {
id: root id: root
spacing: 4 spacing: 4
required property var bar property var _workspaces: []
property var _allWorkspaces: []
property int _activeId: -1 property int _activeId: -1
readonly property string _output: bar.screen?.name ?? ""
readonly property var _workspaces: _allWorkspaces.filter(w => w.output === root._output)
// Initial state // Initial state
Process { Process {
@ -23,7 +18,7 @@ Row {
onStreamFinished: { onStreamFinished: {
try { try {
const ws = JSON.parse(text); const ws = JSON.parse(text);
root._allWorkspaces = ws.sort((a, b) => a.idx - b.idx); root._workspaces = ws.sort((a, b) => a.idx - b.idx);
for (const w of ws) { for (const w of ws) {
if (w.is_focused) if (w.is_focused)
root._activeId = w.id; root._activeId = w.id;
@ -44,7 +39,7 @@ Row {
try { try {
const ev = JSON.parse(line); const ev = JSON.parse(line);
if (ev.WorkspacesChanged !== undefined) { if (ev.WorkspacesChanged !== undefined) {
root._allWorkspaces = ev.WorkspacesChanged.workspaces root._workspaces = ev.WorkspacesChanged.workspaces
.sort((a, b) => a.idx - b.idx); .sort((a, b) => a.idx - b.idx);
} else if (ev.WorkspaceActivated !== undefined) { } else if (ev.WorkspaceActivated !== undefined) {
if (ev.WorkspaceActivated.focused) if (ev.WorkspaceActivated.focused)