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
56
.stversions/bar/SwayWorkspaces~20250509-203451.qml
Normal file
56
.stversions/bar/SwayWorkspaces~20250509-203451.qml
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell.I3
|
||||
import ".."
|
||||
|
||||
RowLayout {
|
||||
property var sortedWorkspaces: {
|
||||
let values = I3.workspaces.values.slice();
|
||||
values.sort(function (a, b) {
|
||||
if (!a?.num)
|
||||
return 1;
|
||||
if (!b?.num)
|
||||
return -1;
|
||||
|
||||
return a.num - b.num;
|
||||
});
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
spacing: 6
|
||||
visible: I3.monitors.values.length != 0
|
||||
|
||||
Repeater {
|
||||
model: parent.sortedWorkspaces
|
||||
|
||||
Rectangle {
|
||||
required property var modelData
|
||||
width: 25
|
||||
height: 12
|
||||
radius: 10
|
||||
|
||||
color: getColor(modelData, workspaceButton.containsMouse)
|
||||
|
||||
MouseArea {
|
||||
id: workspaceButton
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onPressed: I3.dispatch(`workspace number ${parent.modelData.num}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getColor(modelData, isHovered) {
|
||||
if (!modelData?.id || !I3.focusedMonitor?.focusedWorkspace?.num)
|
||||
return ShellGlobals.colors.light;
|
||||
|
||||
if (isHovered)
|
||||
return ShellGlobals.colors.midlight;
|
||||
|
||||
if (I3.focusedMonitor.focusedWorkspace.num == modelData.num)
|
||||
return ShellGlobals.colors.accent;
|
||||
|
||||
return ShellGlobals.colors.light;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue