aboutsummaryrefslogtreecommitdiffstats
path: root/config/ags/modules/overview/actions.js
blob: 766cf454205b9253ff44aa16ec7dd614ee578d51 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import * as Utils from 'resource:///com/github/Aylur/ags/utils.js';
import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';

function moveClientToWorkspace(address, workspace) {
    Utils.execAsync(['bash', '-c', `hyprctl dispatch movetoworkspacesilent ${workspace},address:${address} &`]);
}

export function dumpToWorkspace(from, to) {
    if (from == to) return;
    Hyprland.clients.forEach(client => {
        if (client.workspace.id == from) {
            moveClientToWorkspace(client.address, to);
        }
    });
}

export function swapWorkspace(workspaceA, workspaceB) {
    if (workspaceA == workspaceB) return;
    const clientsA = [];
    const clientsB = [];
    Hyprland.clients.forEach(client => {
        if (client.workspace.id == workspaceA) clientsA.push(client.address);
        if (client.workspace.id == workspaceB) clientsB.push(client.address);
    });

    clientsA.forEach((address) => moveClientToWorkspace(address, workspaceB));
    clientsB.forEach((address) => moveClientToWorkspace(address, workspaceA));
}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage