forked from Shinonome/dots-hyprland
feat: add userOptions entry for monitor bar mode
This commit is contained in:
@@ -221,6 +221,11 @@ let configOptions = {
|
|||||||
'cycleTab': "Ctrl+Tab",
|
'cycleTab': "Ctrl+Tab",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
'bar': {
|
||||||
|
// Array of bar styles for each monitor.
|
||||||
|
// Example for four monitors: ["normal", "focus", "normal", "nothing"]
|
||||||
|
'monitors': ["normal"]
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Override defaults with user's options
|
// Override defaults with user's options
|
||||||
|
|||||||
@@ -15,11 +15,23 @@ globalThis['openMusicControls'] = showMusicControls;
|
|||||||
globalThis['openColorScheme'] = showColorScheme;
|
globalThis['openColorScheme'] = showColorScheme;
|
||||||
globalThis['mpris'] = Mpris;
|
globalThis['mpris'] = Mpris;
|
||||||
|
|
||||||
// Mode switching
|
// load monitor shell modes from userOptions
|
||||||
const numberOfMonitors = Gdk.Display.get_default()?.get_n_monitors() || 1;
|
const initialMonitorShellModes = () => {
|
||||||
const initialMonitorShellModes = Array.from({ length: numberOfMonitors }, () => 'normal');
|
const numberOfMonitors = Gdk.Display.get_default()?.get_n_monitors() || 1;
|
||||||
export const currentShellMode = Variable(initialMonitorShellModes, {}) // normal, focus
|
const monitorBarConfigs = [];
|
||||||
|
for (let i = 0; i < numberOfMonitors; i++) {
|
||||||
|
if (userOptions.bar.monitors[i]) {
|
||||||
|
monitorBarConfigs.push(userOptions.bar.monitors[i])
|
||||||
|
} else {
|
||||||
|
monitorBarConfigs.push('normal')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return monitorBarConfigs;
|
||||||
|
|
||||||
|
}
|
||||||
|
export const currentShellMode = Variable(initialMonitorShellModes(), {}) // normal, focus
|
||||||
|
|
||||||
|
// Mode switching
|
||||||
const updateMonitorShellMode = (monitorShellModes, monitor, mode) => {
|
const updateMonitorShellMode = (monitorShellModes, monitor, mode) => {
|
||||||
const newValue = [...monitorShellModes.value];
|
const newValue = [...monitorShellModes.value];
|
||||||
newValue[monitor] = mode;
|
newValue[monitor] = mode;
|
||||||
|
|||||||
Reference in New Issue
Block a user