fix ws.qml

This commit is contained in:
lucy 2026-06-02 23:57:12 +02:00
commit 597970e61b
3 changed files with 38 additions and 25 deletions

30
modules/bar/Mango.qml Normal file
View file

@ -0,0 +1,30 @@
import Quickshell
import Quickshell.Io
import QtQuick
import qs
import qs.settings
import qs.widgets
Item {
id: root
property string focusedTitle: ""
property int activeTag: 0
Process {
id: getMangoTags
running: true
command: ["bash", "-c", "mmsg watch all-tags | while read line; do echo $line | jq > /tmp/mango-tags.json; done"]
}
Process {
id: getMangoTitle
running: true
command: ["bash", "-c", "mmsg watch focusing-client | while read line; do echo $line | jq > /tmp/mango-active-window.json; done"]
}
FileView {
id: activeWindowView
path: "/tmp/mango-active-window.json"
adapter: JsonAdapter {
id: activeWindowAdapter
property int id
}
}
}

View file

@ -12,13 +12,6 @@ Rectangle {
id: root id: root
required property ShellScreen barScreen required property ShellScreen barScreen
required property double moduleHeight required property double moduleHeight
property HyprlandMonitor hyprBarScreen: Hyprland.monitorFor(root.barScreen)
// split-monitor-workspaces numbering: each monitor owns `count` (10)
// workspaces. eDP-1 -> ids 1..10, DP-2 -> ids 11..20. The offset is the
// first id on this monitor, minus 1.
property int wsIdOffset: root.barScreen.name != Config.primaryMon ? 10 : 0
radius: Config.rounding radius: Config.rounding
color: 'transparent' color: 'transparent'
implicitWidth: wsLayout.implicitWidth implicitWidth: wsLayout.implicitWidth
@ -31,24 +24,13 @@ Rectangle {
spacing: 0 spacing: 0
Repeater { Repeater {
id: wsRepeater id: wsRepeater
model: 10 model: Hyprland.workspaces
delegate: Rectangle { delegate: Rectangle {
id: wsWrapper id: wsWrapper
required property var modelData required property var modelData
property bool active: modelData.active
property int wsId: root.wsIdOffset + modelData + 1 property bool vacant: modelData.toplevels.values.length === 0
visible: Hyprland.monitorFor(root.barScreen) === wsWrapper.modelData.monitor
property var ws: {
const vals = Hyprland.workspaces.values;
for (let i = 0; i < vals.length; ++i) {
if (vals[i].id === wsWrapper.wsId)
return vals[i];
}
return null;
}
property bool active: wsWrapper.ws ? wsWrapper.ws.active : false
property bool vacant: !wsWrapper.ws || wsWrapper.ws.toplevels.values.length === 0
implicitHeight: root.moduleHeight implicitHeight: root.moduleHeight
implicitWidth: 16 implicitWidth: 16
@ -58,9 +40,10 @@ Rectangle {
StyledText { StyledText {
anchors.centerIn: parent anchors.centerIn: parent
text: wsWrapper.modelData + 1 text: wsWrapper.modelData.id > 10 ? wsWrapper.modelData.id > 20 ? wsWrapper.modelData.id - 20 : wsWrapper.modelData.id - 10 : wsWrapper.modelData.id
color: wsWrapper.active ? Colors.base0D : Colors.base05 color: wsWrapper.active ? Colors.base0D : Colors.base04
opacity: wsWrapper.vacant ? wsWrapper.active ? 1.0 : 0.4 : 1.0 opacity: wsWrapper.vacant ? wsWrapper.active ? 1.0 : 0.4 : 1.0
font.bold: wsWrapper.active
} }
MouseArea { MouseArea {
id: clickHandler id: clickHandler

View file

@ -13,7 +13,7 @@ Singleton {
property url wallpaper: "file:///home/lucy/.walls/frierensuff.png" property url wallpaper: "file:///home/lucy/.walls/frierensuff.png"
property bool floating: false property bool floating: false
property double opacity: 1.0 property double opacity: 1.0
property string primaryMon: "DP-2" property string primaryMon: "eDP-1"
Settings { Settings {
location: Qt.resolvedUrl("file:///home/lucy/.config/quickshell/settings/settings.ini") location: Qt.resolvedUrl("file:///home/lucy/.config/quickshell/settings/settings.ini")