forked from Shinonome/dots-hyprland
feat: change shell mode per monitor
Multimonitor improvement
This commit is contained in:
@@ -101,8 +101,7 @@ export const Bar = async (monitor = 0) => {
|
|||||||
'nothing': nothingContent,
|
'nothing': nothingContent,
|
||||||
},
|
},
|
||||||
setup: (self) => self.hook(currentShellMode, (self) => {
|
setup: (self) => self.hook(currentShellMode, (self) => {
|
||||||
self.shown = currentShellMode.value;
|
self.shown = currentShellMode.value[monitor];
|
||||||
|
|
||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -16,17 +16,27 @@ globalThis['openColorScheme'] = showColorScheme;
|
|||||||
globalThis['mpris'] = Mpris;
|
globalThis['mpris'] = Mpris;
|
||||||
|
|
||||||
// Mode switching
|
// Mode switching
|
||||||
export const currentShellMode = Variable('normal', {}) // normal, focus
|
const numberOfMonitors = Gdk.Display.get_default()?.get_n_monitors() || 1;
|
||||||
|
const initialMonitorShellModes = Array.from({ length: numberOfMonitors }, () => 'normal');
|
||||||
|
export const currentShellMode = Variable(initialMonitorShellModes, {}) // normal, focus
|
||||||
|
|
||||||
|
const updateMonitorShellMode = (monitorShellModes, monitor, mode) => {
|
||||||
|
const newValue = [...monitorShellModes.value];
|
||||||
|
newValue[monitor] = mode;
|
||||||
|
monitorShellModes.value = newValue;
|
||||||
|
}
|
||||||
globalThis['currentMode'] = currentShellMode;
|
globalThis['currentMode'] = currentShellMode;
|
||||||
globalThis['cycleMode'] = () => {
|
globalThis['cycleMode'] = () => {
|
||||||
if (currentShellMode.value === 'normal') {
|
const monitor = Hyprland.active.monitor.id || 0;
|
||||||
currentShellMode.value = 'focus';
|
|
||||||
|
if (currentShellMode.value[monitor] === 'normal') {
|
||||||
|
updateMonitorShellMode(currentShellMode, monitor, 'focus')
|
||||||
}
|
}
|
||||||
else if (currentShellMode.value === 'focus') {
|
else if (currentShellMode.value[monitor] === 'focus') {
|
||||||
currentShellMode.value = 'nothing';
|
updateMonitorShellMode(currentShellMode, monitor, 'nothing')
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
currentShellMode.value = 'normal';
|
updateMonitorShellMode(currentShellMode, monitor, 'normal')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user