nichts/nyx/homes/notashelf/services/wayland/ags/js/utils/swallow.js
2024-04-09 23:11:33 +02:00

25 lines
638 B
JavaScript

import { App, Utils } from "../imports.js";
const { exec, execAsync } = Utils;
function genCommand(arg) {
return ["sh", "-c", `${App.configDir}/bin/hyprctl_swallow ${arg}`];
}
const swallowQuery = genCommand("query");
const swallowToggle = genCommand("toggle");
export const getSwallowStatus = () => {
execAsync(swallowQuery);
let result = exec("hyprctl -j getoption misc:enable_swallow");
return JSON.parse(result).set;
};
export const status = Variable(getSwallowStatus());
export const toggleSwallowStatus = () => {
execAsync(swallowToggle);
// toggle swallow status
status.value = !status.value;
};