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