Workspaces are now handled properly for scrolling when there are no rules defined for them. (#112)
* Workspaces are now handled properly for scrolling when there are no rules defined for them. * Discard spaces that were added by formatting... or something? * Another whitespace revert
This commit is contained in:
@@ -67,6 +67,14 @@ const Workspaces = (monitor = -1, ws = 8) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const goToNextWS = (): void => {
|
const goToNextWS = (): void => {
|
||||||
|
if (currentMonitorWorkspaces.value === undefined) {
|
||||||
|
let nextIndex = hyprland.active.workspace.id + 1;
|
||||||
|
if (nextIndex > workspaces.value) {
|
||||||
|
nextIndex = 0;
|
||||||
|
}
|
||||||
|
hyprland.messageAsync(`dispatch workspace ${nextIndex}`)
|
||||||
|
|
||||||
|
} else {
|
||||||
const curWorkspace = hyprland.active.workspace.id;
|
const curWorkspace = hyprland.active.workspace.id;
|
||||||
const indexOfWs = currentMonitorWorkspaces.value.indexOf(curWorkspace);
|
const indexOfWs = currentMonitorWorkspaces.value.indexOf(curWorkspace);
|
||||||
let nextIndex = indexOfWs + 1;
|
let nextIndex = indexOfWs + 1;
|
||||||
@@ -76,8 +84,17 @@ const Workspaces = (monitor = -1, ws = 8) => {
|
|||||||
|
|
||||||
hyprland.messageAsync(`dispatch workspace ${currentMonitorWorkspaces.value[nextIndex]}`)
|
hyprland.messageAsync(`dispatch workspace ${currentMonitorWorkspaces.value[nextIndex]}`)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const goToPrevWS = (): void => {
|
const goToPrevWS = (): void => {
|
||||||
|
if (currentMonitorWorkspaces.value === undefined) {
|
||||||
|
let prevIndex = hyprland.active.workspace.id - 1;
|
||||||
|
|
||||||
|
if (prevIndex <= 0) {
|
||||||
|
prevIndex = workspaces.value;
|
||||||
|
}
|
||||||
|
hyprland.messageAsync(`dispatch workspace ${prevIndex}`)
|
||||||
|
} else {
|
||||||
const curWorkspace = hyprland.active.workspace.id;
|
const curWorkspace = hyprland.active.workspace.id;
|
||||||
const indexOfWs = currentMonitorWorkspaces.value.indexOf(curWorkspace);
|
const indexOfWs = currentMonitorWorkspaces.value.indexOf(curWorkspace);
|
||||||
let prevIndex = indexOfWs - 1;
|
let prevIndex = indexOfWs - 1;
|
||||||
@@ -87,6 +104,7 @@ const Workspaces = (monitor = -1, ws = 8) => {
|
|||||||
|
|
||||||
hyprland.messageAsync(`dispatch workspace ${currentMonitorWorkspaces.value[prevIndex]}`)
|
hyprland.messageAsync(`dispatch workspace ${currentMonitorWorkspaces.value[prevIndex]}`)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function throttle<T extends (...args: any[]) => void>(func: T, limit: number): T {
|
function throttle<T extends (...args: any[]) => void>(func: T, limit: number): T {
|
||||||
let inThrottle: boolean;
|
let inThrottle: boolean;
|
||||||
|
|||||||
Reference in New Issue
Block a user