mirror of
https://github.com/kossLAN/dots.git
synced 2025-11-04 22:49:50 -05:00
49 lines
1.1 KiB
QML
49 lines
1.1 KiB
QML
import QtQuick
|
|
import QtQuick.Layouts
|
|
import Quickshell.Hyprland
|
|
import Quickshell.Io
|
|
import ".."
|
|
|
|
RowLayout {
|
|
property var sortedWorkspaces: {
|
|
let values = Hyprland.workspaces.values.slice();
|
|
values.sort(function(a, b) { return a.id - b.id; });
|
|
|
|
return values;
|
|
};
|
|
|
|
spacing: 6;
|
|
|
|
Repeater {
|
|
model: sortedWorkspaces;
|
|
|
|
Rectangle {
|
|
required property var modelData;
|
|
width: 25;
|
|
height: 12;
|
|
radius: 10;
|
|
|
|
color: {
|
|
let value = ShellGlobals.colors.light;
|
|
|
|
if (!modelData?.id || !Hyprland.focusedMonitor?.activeWorkspace?.id)
|
|
return value;
|
|
|
|
if (workspaceButton.containsMouse) {
|
|
value = ShellGlobals.colors.midlight;
|
|
} else if (Hyprland.focusedMonitor.activeWorkspace.id == modelData.id) {
|
|
value = ShellGlobals.colors.highlight;
|
|
}
|
|
|
|
return value;
|
|
}
|
|
|
|
MouseArea {
|
|
id: workspaceButton;
|
|
anchors.fill: parent;
|
|
hoverEnabled: true;
|
|
onPressed: Hyprland.dispatch('workspace ' + modelData.id);
|
|
}
|
|
}
|
|
}
|
|
}
|