1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-05-12 07:19:41 -04:00

feat(IPC): Add dbar toggleReveal logic for autohide modes

This commit is contained in:
purian23
2026-05-09 23:49:25 -04:00
parent c6a1473d2f
commit 1ec0311086
5 changed files with 62 additions and 3 deletions

View File

@@ -83,6 +83,7 @@ const DMS_ACTIONS = [
{ id: "spawn dms ipc call bar toggle index 0", label: "Bar: Toggle (Primary)" },
{ id: "spawn dms ipc call bar reveal index 0", label: "Bar: Reveal (Primary)" },
{ id: "spawn dms ipc call bar hide index 0", label: "Bar: Hide (Primary)" },
{ id: "spawn dms ipc call bar toggleReveal index 0", label: "Bar: Toggle Autohide Reveal (Primary)" },
{ id: "spawn dms ipc call bar toggleAutoHide index 0", label: "Bar: Toggle Auto-Hide (Primary)" },
{ id: "spawn dms ipc call bar autoHide index 0", label: "Bar: Enable Auto-Hide (Primary)" },
{ id: "spawn dms ipc call bar manualHide index 0", label: "Bar: Disable Auto-Hide (Primary)" },

View File

@@ -721,6 +721,7 @@ Singleton {
property bool displayProfileAutoSelect: false
property bool displayShowDisconnected: false
property bool displaySnapToEdge: true
property var barIpcRevealStates: ({})
property var barConfigs: [
{
@@ -2002,6 +2003,33 @@ Singleton {
return barConfigs.find(cfg => cfg.id === barId) || null;
}
function isBarIpcRevealed(barId) {
if (!barId)
return false;
return !!barIpcRevealStates[barId];
}
function setBarIpcReveal(barId, revealed) {
if (!barId)
return;
const nextRevealed = !!revealed;
if (!!barIpcRevealStates[barId] === nextRevealed)
return;
const states = Object.assign({}, barIpcRevealStates);
if (nextRevealed) {
states[barId] = true;
} else {
delete states[barId];
}
barIpcRevealStates = states;
}
function toggleBarIpcReveal(barId) {
const revealed = !isBarIpcRevealed(barId);
setBarIpcReveal(barId, revealed);
return revealed;
}
function addBarConfig(config) {
const configs = JSON.parse(JSON.stringify(barConfigs));
configs.push(config);
@@ -2017,6 +2045,8 @@ Singleton {
if (index === -1)
return;
const positionChanged = updates.position !== undefined && configs[index].position !== updates.position;
if (updates.autoHide === false || updates.visible === false)
setBarIpcReveal(barId, false);
Object.assign(configs[index], updates);
barConfigs = _sanitizeBarConfigsForConnectedFrame(configs).configs;
@@ -2078,6 +2108,7 @@ Singleton {
delete nextBackups[barId];
connectedFrameBarStyleBackups = nextBackups;
}
setBarIpcReveal(barId, false);
updateBarConfigs();
}