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, 'bottom left')),
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
App.config({
@@ -70,9 +72,6 @@ App.config({
});
// 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.
// BarCornerTopleft().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);
forMonitors(Bar);
// Bar().catch(print); // Use this to debug the bar. Single monitor only.
+1 -1
View File
@@ -46,7 +46,7 @@ export const Bar = async (monitor = 0) => {
const minHeight = styleContext.get_property('min-height', Gtk.StateFlags.NORMAL);
// execAsync(['bash', '-c', `hyprctl keyword monitor ,addreserved,${minHeight},0,0,0`]).catch(print);
},
startWidget: WindowTitle(),
startWidget: (await WindowTitle()),
centerWidget: Widget.Box({
className: 'spacing-h-4',
children: [
+37 -35
View File
@@ -38,39 +38,41 @@ const WindowTitle = async () => {
}
}
const OptionalWindowTitleInstance = await WindowTitle();
export default () => Widget.EventBox({
onScrollUp: () => {
Indicator.popup(1); // Since the brightness and speaker are both on the same window
Brightness.screen_value += 0.05;
},
onScrollDown: () => {
Indicator.popup(1); // Since the brightness and speaker are both on the same window
Brightness.screen_value -= 0.05;
},
onPrimaryClick: () => {
App.toggleWindow('sideleft');
},
child: Widget.Box({
homogeneous: false,
children: [
Widget.Box({ className: 'bar-corner-spacing' }),
Widget.Overlay({
overlays: [
Widget.Box({ hexpand: true }),
Widget.Box({
className: 'bar-sidemodule', hexpand: true,
children: [Widget.Box({
vertical: true,
className: 'bar-space-button',
children: [
OptionalWindowTitleInstance,
]
})]
}),
]
})
]
})
});
export default async () => {
const optionalWindowTitleInstance = await WindowTitle();
return Widget.EventBox({
onScrollUp: () => {
Indicator.popup(1); // Since the brightness and speaker are both on the same window
Brightness.screen_value += 0.05;
},
onScrollDown: () => {
Indicator.popup(1); // Since the brightness and speaker are both on the same window
Brightness.screen_value -= 0.05;
},
onPrimaryClick: () => {
App.toggleWindow('sideleft');
},
child: Widget.Box({
homogeneous: false,
children: [
Widget.Box({ className: 'bar-corner-spacing' }),
Widget.Overlay({
overlays: [
Widget.Box({ hexpand: true }),
Widget.Box({
className: 'bar-sidemodule', hexpand: true,
children: [Widget.Box({
vertical: true,
className: 'bar-space-button',
children: [
optionalWindowTitleInstance,
]
})]
}),
]
})
]
})
});
}
+21 -20
View File
@@ -9,27 +9,28 @@ import Indicator from '../../../services/indicator.js';
import { StatusIcons } from '../../.commonwidgets/statusicons.js';
import { Tray } from "./tray.js";
const SeparatorDot = () => Widget.Revealer({
transition: 'slide_left',
revealChild: false,
attribute: {
'count': SystemTray.items.length,
'update': (self, diff) => {
self.attribute.count += diff;
self.revealChild = (self.attribute.count > 0);
}
},
child: Widget.Box({
vpack: 'center',
className: 'separator-circle',
}),
setup: (self) => self
.hook(SystemTray, (self) => self.attribute.update(self, 1), 'added')
.hook(SystemTray, (self) => self.attribute.update(self, -1), 'removed')
,
});
export default () => {
const barTray = Tray();
const separatorDot = Widget.Revealer({
transition: 'slide_left',
revealChild: false,
attribute: {
'count': SystemTray.items.length,
'update': (self, diff) => {
self.attribute.count += diff;
self.revealChild = (self.attribute.count > 0);
}
},
child: Widget.Box({
vpack: 'center',
className: 'separator-circle',
}),
setup: (self) => self
.hook(SystemTray, (self) => self.attribute.update(self, 1), 'added')
.hook(SystemTray, (self) => self.attribute.update(self, -1), 'removed')
,
});
const barStatusIcons = StatusIcons({
className: 'bar-statusicons',
setup: (self) => self.hook(App, (self, currentName, visible) => {
@@ -53,7 +54,7 @@ export default () => {
const emptyArea = SpaceRightDefaultClicks(Widget.Box({ hexpand: true, }));
const indicatorArea = SpaceRightDefaultClicks(Widget.Box({
children: [
separatorDot,
SeparatorDot(),
barStatusIcons
],
}));