parent
a41b954216
commit
92efbc61f7
4 changed files with 18 additions and 5 deletions
|
|
@ -11,7 +11,12 @@ StyledRect {
|
||||||
required property Repeater workspaces
|
required property Repeater workspaces
|
||||||
required property Item mask
|
required property Item mask
|
||||||
|
|
||||||
readonly property int currentWsIdx: (activeWsId - 1) % Config.bar.workspaces.shown
|
readonly property int currentWsIdx: {
|
||||||
|
let i = activeWsId - 1;
|
||||||
|
while (i < 0)
|
||||||
|
i += Config.bar.workspaces.shown;
|
||||||
|
return i % Config.bar.workspaces.shown;
|
||||||
|
}
|
||||||
|
|
||||||
property real leading: workspaces.itemAt(currentWsIdx)?.y ?? 0
|
property real leading: workspaces.itemAt(currentWsIdx)?.y ?? 0
|
||||||
property real trailing: workspaces.itemAt(currentWsIdx)?.y ?? 0
|
property real trailing: workspaces.itemAt(currentWsIdx)?.y ?? 0
|
||||||
|
|
|
||||||
|
|
@ -48,8 +48,15 @@ Item {
|
||||||
|
|
||||||
required property var modelData
|
required property var modelData
|
||||||
|
|
||||||
readonly property Workspace start: root.workspaces.itemAt((modelData.start - 1) % Config.bar.workspaces.shown) ?? null
|
readonly property Workspace start: root.workspaces.itemAt(getWsIdx(modelData.start)) ?? null
|
||||||
readonly property Workspace end: root.workspaces.itemAt((modelData.end - 1) % Config.bar.workspaces.shown) ?? null
|
readonly property Workspace end: root.workspaces.itemAt(getWsIdx(modelData.end)) ?? null
|
||||||
|
|
||||||
|
function getWsIdx(ws: int): int {
|
||||||
|
let i = ws - 1;
|
||||||
|
while (i < 0)
|
||||||
|
i += Config.bar.workspaces.shown;
|
||||||
|
return i % Config.bar.workspaces.shown;
|
||||||
|
}
|
||||||
|
|
||||||
anchors.horizontalCenter: root.horizontalCenter
|
anchors.horizontalCenter: root.horizontalCenter
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,8 @@ ColumnLayout {
|
||||||
|
|
||||||
animate: true
|
animate: true
|
||||||
text: {
|
text: {
|
||||||
const label = Config.bar.workspaces.label || root.ws;
|
const ws = Hypr.workspaces.values.find(w => w.id === root.ws);
|
||||||
|
const label = Config.bar.workspaces.label || (!ws || ws.name == root.ws ? root.ws : ws.name[0].toUpperCase());
|
||||||
const occupiedLabel = Config.bar.workspaces.occupiedLabel || label;
|
const occupiedLabel = Config.bar.workspaces.occupiedLabel || label;
|
||||||
const activeLabel = Config.bar.workspaces.activeLabel || (root.isOccupied ? occupiedLabel : label);
|
const activeLabel = Config.bar.workspaces.activeLabel || (root.isOccupied ? occupiedLabel : label);
|
||||||
return root.activeWsId === root.ws ? activeLabel : root.isOccupied ? occupiedLabel : label;
|
return root.activeWsId === root.ws ? activeLabel : root.isOccupied ? occupiedLabel : label;
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ StyledClippingRect {
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: layout
|
anchors.fill: layout
|
||||||
onClicked: event => {
|
onClicked: event => {
|
||||||
const ws = layout.childAt(event.x, event.y).index + root.groupOffset + 1;
|
const ws = layout.childAt(event.x, event.y).ws;
|
||||||
if (Hypr.activeWsId !== ws)
|
if (Hypr.activeWsId !== ws)
|
||||||
Hypr.dispatch(`workspace ${ws}`);
|
Hypr.dispatch(`workspace ${ws}`);
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue