bar: fix multimonitor (?)

This commit is contained in:
end-4
2024-04-03 17:09:56 +07:00
parent c415fd18ad
commit 21cdcba7c1
4 changed files with 64 additions and 62 deletions
+5 -6
View File
@@ -56,6 +56,8 @@ const Windows = () => [
forMonitors((id) => Corner(id, 'top right')), forMonitors((id) => Corner(id, 'top right')),
forMonitors((id) => Corner(id, 'bottom left')), forMonitors((id) => Corner(id, 'bottom left')),
forMonitors((id) => Corner(id, 'bottom right')), forMonitors((id) => Corner(id, 'bottom right')),
forMonitors(BarCornerTopleft),
forMonitors(BarCornerTopright),
]; ];
const CLOSE_ANIM_TIME = 210; // Longer than actual anim time to make sure widgets animate fully const CLOSE_ANIM_TIME = 210; // Longer than actual anim time to make sure widgets animate fully
App.config({ App.config({
@@ -70,9 +72,6 @@ App.config({
}); });
// Stuff that don't need to be toggled. And they're async so ugh... // Stuff that don't need to be toggled. And they're async so ugh...
Bar().catch(print); // Use this to debug the bar. Single monitor only. forMonitors(Bar);
// BarCornerTopleft().catch(print); // Use this to debug the bar. Single monitor only. // Bar().catch(print); // Use this to debug the bar. Single monitor only.
// BarCornerTopright().catch(print); // Use this to debug the bar. Single monitor only.
// forMonitors(Bar);
forMonitors(BarCornerTopleft);
forMonitors(BarCornerTopright);
+1 -1
View File
@@ -46,7 +46,7 @@ export const Bar = async (monitor = 0) => {
const minHeight = styleContext.get_property('min-height', Gtk.StateFlags.NORMAL); const minHeight = styleContext.get_property('min-height', Gtk.StateFlags.NORMAL);
// execAsync(['bash', '-c', `hyprctl keyword monitor ,addreserved,${minHeight},0,0,0`]).catch(print); // execAsync(['bash', '-c', `hyprctl keyword monitor ,addreserved,${minHeight},0,0,0`]).catch(print);
}, },
startWidget: WindowTitle(), startWidget: (await WindowTitle()),
centerWidget: Widget.Box({ centerWidget: Widget.Box({
className: 'spacing-h-4', className: 'spacing-h-4',
children: [ children: [
+5 -3
View File
@@ -38,9 +38,10 @@ const WindowTitle = async () => {
} }
} }
const OptionalWindowTitleInstance = await WindowTitle();
export default () => Widget.EventBox({ export default async () => {
const optionalWindowTitleInstance = await WindowTitle();
return Widget.EventBox({
onScrollUp: () => { onScrollUp: () => {
Indicator.popup(1); // Since the brightness and speaker are both on the same window Indicator.popup(1); // Since the brightness and speaker are both on the same window
Brightness.screen_value += 0.05; Brightness.screen_value += 0.05;
@@ -65,7 +66,7 @@ export default () => Widget.EventBox({
vertical: true, vertical: true,
className: 'bar-space-button', className: 'bar-space-button',
children: [ children: [
OptionalWindowTitleInstance, optionalWindowTitleInstance,
] ]
})] })]
}), }),
@@ -74,3 +75,4 @@ export default () => Widget.EventBox({
] ]
}) })
}); });
}
+5 -4
View File
@@ -9,9 +9,7 @@ import Indicator from '../../../services/indicator.js';
import { StatusIcons } from '../../.commonwidgets/statusicons.js'; import { StatusIcons } from '../../.commonwidgets/statusicons.js';
import { Tray } from "./tray.js"; import { Tray } from "./tray.js";
export default () => { const SeparatorDot = () => Widget.Revealer({
const barTray = Tray();
const separatorDot = Widget.Revealer({
transition: 'slide_left', transition: 'slide_left',
revealChild: false, revealChild: false,
attribute: { attribute: {
@@ -30,6 +28,9 @@ export default () => {
.hook(SystemTray, (self) => self.attribute.update(self, -1), 'removed') .hook(SystemTray, (self) => self.attribute.update(self, -1), 'removed')
, ,
}); });
export default () => {
const barTray = Tray();
const barStatusIcons = StatusIcons({ const barStatusIcons = StatusIcons({
className: 'bar-statusicons', className: 'bar-statusicons',
setup: (self) => self.hook(App, (self, currentName, visible) => { setup: (self) => self.hook(App, (self, currentName, visible) => {
@@ -53,7 +54,7 @@ export default () => {
const emptyArea = SpaceRightDefaultClicks(Widget.Box({ hexpand: true, })); const emptyArea = SpaceRightDefaultClicks(Widget.Box({ hexpand: true, }));
const indicatorArea = SpaceRightDefaultClicks(Widget.Box({ const indicatorArea = SpaceRightDefaultClicks(Widget.Box({
children: [ children: [
separatorDot, SeparatorDot(),
barStatusIcons barStatusIcons
], ],
})); }));