mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-05 23:09:26 -05:00
feat: add userOptions entry for monitor bar mode
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user