fix ws.qml
This commit is contained in:
parent
1334152c0e
commit
597970e61b
3 changed files with 38 additions and 25 deletions
30
modules/bar/Mango.qml
Normal file
30
modules/bar/Mango.qml
Normal 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -12,13 +12,6 @@ Rectangle {
|
|||
id: root
|
||||
required property ShellScreen barScreen
|
||||
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
|
||||
color: 'transparent'
|
||||
implicitWidth: wsLayout.implicitWidth
|
||||
|
|
@ -31,24 +24,13 @@ Rectangle {
|
|||
spacing: 0
|
||||
Repeater {
|
||||
id: wsRepeater
|
||||
model: 10
|
||||
model: Hyprland.workspaces
|
||||
delegate: Rectangle {
|
||||
id: wsWrapper
|
||||
required property var modelData
|
||||
|
||||
property int wsId: root.wsIdOffset + modelData + 1
|
||||
|
||||
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
|
||||
property bool active: modelData.active
|
||||
property bool vacant: modelData.toplevels.values.length === 0
|
||||
visible: Hyprland.monitorFor(root.barScreen) === wsWrapper.modelData.monitor
|
||||
|
||||
implicitHeight: root.moduleHeight
|
||||
implicitWidth: 16
|
||||
|
|
@ -58,9 +40,10 @@ Rectangle {
|
|||
|
||||
StyledText {
|
||||
anchors.centerIn: parent
|
||||
text: wsWrapper.modelData + 1
|
||||
color: wsWrapper.active ? Colors.base0D : Colors.base05
|
||||
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.base04
|
||||
opacity: wsWrapper.vacant ? wsWrapper.active ? 1.0 : 0.4 : 1.0
|
||||
font.bold: wsWrapper.active
|
||||
}
|
||||
MouseArea {
|
||||
id: clickHandler
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ Singleton {
|
|||
property url wallpaper: "file:///home/lucy/.walls/frierensuff.png"
|
||||
property bool floating: false
|
||||
property double opacity: 1.0
|
||||
property string primaryMon: "DP-2"
|
||||
property string primaryMon: "eDP-1"
|
||||
Settings {
|
||||
|
||||
location: Qt.resolvedUrl("file:///home/lucy/.config/quickshell/settings/settings.ini")
|
||||
|
|
|
|||
Loading…
Reference in a new issue