diff --git a/.config/ags/modules/.commonwidgets/statusicons.js b/.config/ags/modules/.commonwidgets/statusicons.js index fbfe7a86..eacc444f 100644 --- a/.config/ags/modules/.commonwidgets/statusicons.js +++ b/.config/ags/modules/.commonwidgets/statusicons.js @@ -277,15 +277,24 @@ const OptionalKeyboardLayout = async () => { return null; } }; -const optionalKeyboardLayoutInstance = await OptionalKeyboardLayout(); +const createKeyboardLayoutInstances = async () => { + const Hyprland = (await import('resource:///com/github/Aylur/ags/service/hyprland.js')).default; + const monitorsCount = Hyprland.monitors.length + const instances = await Promise.all( + Array.from({ length: monitorsCount }, () => OptionalKeyboardLayout()) + ); -export const StatusIcons = (props = {}) => Widget.Box({ + return instances; +}; +const optionalKeyboardLayoutInstances = await createKeyboardLayoutInstances() + +export const StatusIcons = (props = {}, monitor = 0) => Widget.Box({ ...props, child: Widget.Box({ className: 'spacing-h-15', children: [ MicMuteIndicator(), - optionalKeyboardLayoutInstance, + optionalKeyboardLayoutInstances[monitor], NotificationIndicator(), NetworkIndicator(), Widget.Box({ diff --git a/.config/ags/modules/bar/main.js b/.config/ags/modules/bar/main.js index 952fb3fb..2a0d6e68 100644 --- a/.config/ags/modules/bar/main.js +++ b/.config/ags/modules/bar/main.js @@ -58,7 +58,7 @@ export const Bar = async (monitor = 0) => { SideModule([System()]), ] }), - endWidget: Indicators(), + endWidget: Indicators(monitor), }); const focusedBarContent = Widget.CenterBox({ className: 'bar-bg-focus', diff --git a/.config/ags/modules/bar/normal/spaceright.js b/.config/ags/modules/bar/normal/spaceright.js index cdb92c99..62666389 100644 --- a/.config/ags/modules/bar/normal/spaceright.js +++ b/.config/ags/modules/bar/normal/spaceright.js @@ -29,7 +29,7 @@ const SeparatorDot = () => Widget.Revealer({ , }); -export default () => { +export default (monitor = 0) => { const barTray = Tray(); const barStatusIcons = StatusIcons({ className: 'bar-statusicons', @@ -38,7 +38,7 @@ export default () => { self.toggleClassName('bar-statusicons-active', visible); } }), - }); + }, monitor); const SpaceRightDefaultClicks = (child) => Widget.EventBox({ onHover: () => { barStatusIcons.toggleClassName('bar-statusicons-hover', true) }, onHoverLost: () => { barStatusIcons.toggleClassName('bar-statusicons-hover', false) },