mirror of
https://github.com/kossLAN/dots.git
synced 2025-11-05 06:59:50 -05:00
Initial commit
This commit is contained in:
commit
05cd51b54e
148 changed files with 10112 additions and 0 deletions
66
bar/HyprWorkspaces.qml
Normal file
66
bar/HyprWorkspaces.qml
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell.Hyprland
|
||||
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
|
||||
visible: Hyprland.monitors.values.length != 0
|
||||
|
||||
Repeater {
|
||||
model: parent.sortedWorkspaces
|
||||
|
||||
Rectangle {
|
||||
required property var modelData
|
||||
|
||||
radius: height / 2
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
Layout.preferredHeight: 12
|
||||
Layout.preferredWidth: {
|
||||
if (Hyprland.focusedMonitor.activeWorkspace.id == modelData.id)
|
||||
return 25;
|
||||
|
||||
return 12;
|
||||
}
|
||||
|
||||
color: {
|
||||
let value = Qt.color(ShellSettings.settings.colors["secondary"]).darker(2);
|
||||
|
||||
if (!modelData?.id || !Hyprland.focusedMonitor?.activeWorkspace?.id)
|
||||
return value;
|
||||
|
||||
if (workspaceButton.containsMouse) {
|
||||
value = ShellSettings.settings.colors["on_primary"];
|
||||
} else if (Hyprland.focusedMonitor.activeWorkspace.id == modelData.id) {
|
||||
value = ShellSettings.settings.colors["primary"];
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
Behavior on Layout.preferredWidth {
|
||||
SmoothedAnimation {
|
||||
duration: 150
|
||||
velocity: 200
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: workspaceButton
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onPressed: Hyprland.dispatch(`workspace ${parent.modelData.id}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue