Added Power menu and show only the workspaces allocated to monitor

This commit is contained in:
Jas Singh
2024-06-09 18:40:51 -07:00
parent 3579e563b8
commit d695d9aa67
25 changed files with 784 additions and 383 deletions

View File

@@ -7,19 +7,18 @@ import { Volume } from "./volume/index.js";
import { Network } from "./network/index.js";
import { Bluetooth } from "./bluetooth/index.js";
import { BatteryLabel } from "./battery/index.js";
import { Clock } from "./clock/index.js";
import { SysTray } from "./systray/index.js";
import { Clock } from "./clock/index.js"; import { SysTray } from "./systray/index.js";
import { Power } from "./power/index.js";
import { BarItemBox } from "../shared/barItemBox.js";
// layout of the bar
const Left = () => {
const Left = (monitor, wsMap) => {
return Widget.Box({
class_name: "box-left",
hpack: "start",
spacing: 5,
children: [Menu(), BarItemBox(Workspaces()), BarItemBox(ClientTitle())],
children: [Menu(), BarItemBox(Workspaces(monitor, wsMap, 10)), BarItemBox(ClientTitle())],
});
};
@@ -27,7 +26,10 @@ const Center = () => {
return Widget.Box({
class_name: "box-center",
spacing: 5,
children: [BarItemBox(Media()), BarItemBox(Notification())],
children: [
BarItemBox(Media()),
// BarItemBox(Notification())
],
});
};
@@ -48,7 +50,40 @@ const Right = () => {
});
};
const Bar = (monitor = 0) => {
const LeftAlt = (monitor, wsMap) => {
return Widget.Box({
class_name: "box-left",
hpack: "start",
spacing: 5,
children: [Menu(), BarItemBox(Workspaces(monitor, wsMap)), BarItemBox(ClientTitle())],
});
};
const CenterAlt = () => {
return Widget.Box({
class_name: "box-center",
spacing: 5,
children: [
BarItemBox(Media()),
// BarItemBox(Notification())
],
});
};
const RightAlt = () => {
return Widget.Box({
class_name: "box-right",
hpack: "end",
spacing: 5,
children: [
BarItemBox(Volume()),
BarItemBox(Clock()),
BarItemBox(Power()),
],
});
};
const Bar = (monitor = 0, wsMap) => {
return Widget.Window({
name: `bar-${monitor}`,
class_name: "bar",
@@ -56,11 +91,26 @@ const Bar = (monitor = 0) => {
anchor: ["top", "left", "right"],
exclusivity: "exclusive",
child: Widget.CenterBox({
start_widget: Left(),
start_widget: Left(monitor, wsMap),
center_widget: Center(),
end_widget: Right(),
}),
});
};
export { Bar };
const BarAlt = (monitor = 0, wsMap) => {
return Widget.Window({
name: `bar-${monitor}`,
class_name: "bar",
monitor,
anchor: ["top", "left", "right"],
exclusivity: "exclusive",
child: Widget.CenterBox({
start_widget: LeftAlt(monitor, wsMap),
center_widget: CenterAlt(),
end_widget: RightAlt(),
}),
});
};
export { Bar, BarAlt };