mirror of
https://github.com/danbulant/dots-hyprland
synced 2026-05-24 12:22:09 +00:00
feat: add userOptions entry for monitor bar mode
This commit is contained in:
parent
273e545e8e
commit
2428d06b6b
2 changed files with 21 additions and 4 deletions
|
|
@ -221,6 +221,11 @@ let configOptions = {
|
|||
'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
|
||||
|
|
|
|||
|
|
@ -15,11 +15,23 @@ globalThis['openMusicControls'] = showMusicControls;
|
|||
globalThis['openColorScheme'] = showColorScheme;
|
||||
globalThis['mpris'] = Mpris;
|
||||
|
||||
// Mode switching
|
||||
const numberOfMonitors = Gdk.Display.get_default()?.get_n_monitors() || 1;
|
||||
const initialMonitorShellModes = Array.from({ length: numberOfMonitors }, () => 'normal');
|
||||
export const currentShellMode = Variable(initialMonitorShellModes, {}) // normal, focus
|
||||
// load monitor shell modes from userOptions
|
||||
const initialMonitorShellModes = () => {
|
||||
const numberOfMonitors = Gdk.Display.get_default()?.get_n_monitors() || 1;
|
||||
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 newValue = [...monitorShellModes.value];
|
||||
newValue[monitor] = mode;
|
||||
|
|
|
|||
Loading…
Reference in a new issue