workspace view rework
This commit is contained in:
7
quickshell/bar/widgets/workspace/HyprlandClient.qml
Normal file
7
quickshell/bar/widgets/workspace/HyprlandClient.qml
Normal file
@@ -0,0 +1,7 @@
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
|
||||
Item {
|
||||
property string initialClass: "";
|
||||
property string initialTitle: "";
|
||||
}
|
||||
29
quickshell/bar/widgets/workspace/HyprlandWindowTracker.qml
Normal file
29
quickshell/bar/widgets/workspace/HyprlandWindowTracker.qml
Normal file
@@ -0,0 +1,29 @@
|
||||
pragma Singleton
|
||||
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
import Quickshell.Io
|
||||
import Quickshell.Hyprland
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
// property string aaaa: "";
|
||||
property list<HyprlandClient> meow;
|
||||
property Hyprland hyprland: Hyprland;
|
||||
|
||||
Process {
|
||||
id: dateProc
|
||||
|
||||
command: ["hyprctl", "clients"]
|
||||
running: true
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: parseClients(this.text)
|
||||
}
|
||||
}
|
||||
function parseClients(text) {
|
||||
hyprland.refreshToplevels();
|
||||
var meow = hyprland.activeToplevel.lastIpcObject;
|
||||
console.log(meow.class);
|
||||
}
|
||||
}
|
||||
90
quickshell/bar/widgets/workspace/WorkspaceWidget.qml
Normal file
90
quickshell/bar/widgets/workspace/WorkspaceWidget.qml
Normal file
@@ -0,0 +1,90 @@
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell.Widgets
|
||||
import Quickshell.Hyprland
|
||||
import "root:/bar/widgets/common" as Common
|
||||
|
||||
RowLayout {
|
||||
id: root
|
||||
spacing: 10
|
||||
Layout.fillHeight: true
|
||||
|
||||
Repeater {
|
||||
model: Hyprland.workspaces
|
||||
delegate: Item {
|
||||
id: root2
|
||||
required property HyprlandWorkspace modelData
|
||||
implicitWidth: 35 + appIconContainer.implicitWidth
|
||||
Layout.fillHeight: true
|
||||
Item {
|
||||
visible: root2.modelData.toplevels.values[0] != undefined
|
||||
id: appIconContainer
|
||||
implicitWidth: row.implicitWidth
|
||||
implicitHeight: 25
|
||||
x: 30
|
||||
anchors.verticalCenter: root2.verticalCenter
|
||||
Rectangle {
|
||||
x: -10
|
||||
radius: 7
|
||||
color: "black"
|
||||
implicitWidth: row.width + 20
|
||||
implicitHeight: 25
|
||||
}
|
||||
RowLayout {
|
||||
x: 5
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
id: row
|
||||
spacing: 15
|
||||
Repeater {
|
||||
model: root2.modelData.toplevels
|
||||
delegate: Item {
|
||||
required property HyprlandToplevel modelData
|
||||
width: icon.implicitWidth
|
||||
height: icon.implicitHeight
|
||||
Text {
|
||||
id: icon
|
||||
color: "white"
|
||||
font.pointSize: 13
|
||||
// long-ass oneliner for "if there is no class icon, go to fallback"
|
||||
text: (Common.Icons.appIcons[(modelData.lastIpcObject.class)] != undefined ) ? Common.Icons.appIcons[(modelData.lastIpcObject.class)] : Common.Icons.appIcons["fallback"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Item {
|
||||
width: 30
|
||||
height: 30
|
||||
MouseArea {
|
||||
width: 30
|
||||
height: 30
|
||||
onPressed: event => {
|
||||
modelData.activate();
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
width: 30
|
||||
height: 30
|
||||
radius: 10
|
||||
color: modelData.focused ? "grey" : "black"
|
||||
}
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: modelData.id
|
||||
color: "white"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Timer {
|
||||
id: updateTimer
|
||||
running: true
|
||||
interval: 1000 // 10secs
|
||||
repeat: true
|
||||
onTriggered: {
|
||||
Hyprland.refreshToplevels()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user