bar/workspaces: better scroll
This commit is contained in:
parent
0723153b30
commit
00b5e88a32
2 changed files with 13 additions and 5 deletions
|
|
@ -56,10 +56,11 @@ ColumnLayout {
|
|||
const ch = childAt(width / 2, y) as WrappedLoader;
|
||||
if (ch?.id === "workspaces") {
|
||||
// Workspace scroll
|
||||
const activeWs = Hyprland.activeToplevel?.workspace?.name;
|
||||
if (activeWs?.startsWith("special:"))
|
||||
Hyprland.dispatch(`togglespecialworkspace ${activeWs.slice(8)}`);
|
||||
else if (angleDelta.y < 0 || Hyprland.activeWsId > 1)
|
||||
const mon = (Config.bar.workspaces.perMonitorWorkspaces ? Hyprland.monitorFor(screen) : Hyprland.focusedMonitor);
|
||||
const specialWs = mon?.lastIpcObject.specialWorkspace.name;
|
||||
if (specialWs?.length > 0)
|
||||
Hyprland.dispatch(`togglespecialworkspace ${specialWs.slice(8)}`);
|
||||
else if (angleDelta.y < 0 || (Config.bar.workspaces.perMonitorWorkspaces ? mon.activeWorkspace?.id : Hyprland.activeWsId) > 1)
|
||||
Hyprland.dispatch(`workspace r${angleDelta.y > 0 ? "-" : "+"}1`);
|
||||
} else if (y < screen.height / 2) {
|
||||
// Volume scroll on top half
|
||||
|
|
|
|||
|
|
@ -120,6 +120,7 @@ Item {
|
|||
|
||||
required property HyprlandWorkspace modelData
|
||||
readonly property int size: label.Layout.preferredHeight + (hasWindows ? windows.implicitHeight + Appearance.padding.small : 0)
|
||||
property int wsId
|
||||
property string icon
|
||||
property bool hasWindows
|
||||
|
||||
|
|
@ -129,6 +130,7 @@ Item {
|
|||
spacing: 0
|
||||
|
||||
Component.onCompleted: {
|
||||
wsId = modelData.id;
|
||||
icon = Icons.getSpecialWsIcon(modelData.name);
|
||||
hasWindows = Config.bar.workspaces.showWindows && modelData.lastIpcObject.windows > 0;
|
||||
}
|
||||
|
|
@ -137,6 +139,11 @@ Item {
|
|||
Connections {
|
||||
target: ws.modelData
|
||||
|
||||
function onIdChanged(): void {
|
||||
if (ws.modelData)
|
||||
ws.wsId = ws.modelData.id;
|
||||
}
|
||||
|
||||
function onNameChanged(): void {
|
||||
if (ws.modelData)
|
||||
ws.icon = Icons.getSpecialWsIcon(ws.modelData.name);
|
||||
|
|
@ -222,7 +229,7 @@ Item {
|
|||
|
||||
Repeater {
|
||||
model: ScriptModel {
|
||||
values: Hyprland.toplevels.values.filter(c => c.workspace?.id === ws.modelData.id)
|
||||
values: Hyprland.toplevels.values.filter(c => c.workspace?.id === ws.wsId)
|
||||
}
|
||||
|
||||
MaterialIcon {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue