mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-05 23:09:26 -05:00
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,
|
||||
},
|
||||
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;
|
||||
|
||||
// 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['cycleMode'] = () => {
|
||||
if (currentShellMode.value === 'normal') {
|
||||
currentShellMode.value = 'focus';
|
||||
}
|
||||
else if (currentShellMode.value === 'focus') {
|
||||
currentShellMode.value = 'nothing';
|
||||
const monitor = Hyprland.active.monitor.id || 0;
|
||||
|
||||
if (currentShellMode.value[monitor] === 'normal') {
|
||||
updateMonitorShellMode(currentShellMode, monitor, 'focus')
|
||||
}
|
||||
else if (currentShellMode.value[monitor] === 'focus') {
|
||||
updateMonitorShellMode(currentShellMode, monitor, 'nothing')
|
||||
}
|
||||
else {
|
||||
currentShellMode.value = 'normal';
|
||||
updateMonitorShellMode(currentShellMode, monitor, 'normal')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user