Skip to content

Commit

Permalink
fix some errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kotontrion authored and fufexan committed Dec 28, 2023
1 parent 34e1a8e commit 2471d83
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 25 deletions.
6 changes: 5 additions & 1 deletion home/services/ags/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const css = App.configDir + "/style.css";
Utils.exec(`sass ${scss} ${css}`);

App.connect("config-parsed", () => print("config parsed"));

export default {
style: css,
closeWindowDelay: {
Expand All @@ -30,7 +31,10 @@ function addWindows(windows) {
windows.forEach((win) => App.addWindow(win));
}

Utils.idle(() =>
//timeout to wait for Hyprland service to be fully
//initialized. Maybe connect to Hyprland signal like
//notify::worksapces for more consistant results?
Utils.timeout(100, () =>
addWindows(
[
Bar(),
Expand Down
12 changes: 6 additions & 6 deletions home/services/ags/windows/bar/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const SystemInfo = () =>
},
);

const Start = Widget.Box({
const Start = () => Widget.Box({
hexpand: true,
hpack: "start",
children: [
Expand All @@ -39,13 +39,13 @@ const Start = Widget.Box({
],
});

const Center = Widget.Box({
const Center = () => Widget.Box({
children: [
Music(),
],
});

const End = Widget.Box({
const End = () => Widget.Box({
hexpand: true,
hpack: "end",

Expand All @@ -67,8 +67,8 @@ export default () =>
child: Widget.CenterBox({
className: "bar",

startWidget: Start,
centerWidget: Center,
endWidget: End,
startWidget: Start(),
centerWidget: Center(),
endWidget: End(),
}),
});
4 changes: 2 additions & 2 deletions home/services/ags/windows/osd/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Brightness.connect("screen-changed", () => {

let lastMonitor;

const child = Widget.Box({
const child = () => Widget.Box({
hexpand: true,
visible: false,
className: "osd",
Expand Down Expand Up @@ -72,7 +72,7 @@ export default () =>
PopupWindow({
name: "osd",
monitor: 0,
child,
child: child(),
revealerSetup: (self) =>
self
.hook(Indicators, (revealer, _, visible) => {
Expand Down
20 changes: 10 additions & 10 deletions home/services/ags/windows/system-menu/battery_info.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,38 @@ const batteryEnergy = () => {
return Battery.energyRate > 0.1 ? `${Battery.energyRate.toFixed(1)} W ` : "";
};

const BatteryIcon = Widget.Icon()
const BatteryIcon = () => Widget.Icon()
.bind("icon", Battery, "percent", () => Battery.iconName)
.bind("tooltip-text", Battery, "energy-rate", batteryEnergy);

const BatteryPercent = Widget.Label()
const BatteryPercent = () => Widget.Label()
.bind(
"label",
Battery,
"percent",
(percent) => `${percent}%`,
);

const BatteryTime = Widget.Label({
const BatteryTime = () => Widget.Label({
className: "time",
vexpand: true,
vpack: "center",
})
.bind("label", Battery, "charging", batteryTime)
.bind("label", Battery, "energy-rate", batteryTime);

const BatteryBox = Widget.Box({
const BatteryBox = () => Widget.Box({
className: "battery-box",
visible: Battery.available,

children: [
BatteryIcon,
BatteryPercent,
BatteryTime,
BatteryIcon(),
BatteryPercent(),
BatteryTime(),
],
});

const PowerButton = Widget.Button({
const PowerButton = () => Widget.Button({
className: "button disabled",
hexpand: true,
hpack: "end",
Expand All @@ -54,7 +54,7 @@ export default () =>
className: "battery-info",

children: [
BatteryBox,
PowerButton,
BatteryBox(),
PowerButton(),
],
});
4 changes: 2 additions & 2 deletions home/services/ags/windows/system-menu/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import PowerProfiles from "./powerprofiles.js";
// import Sliders from "./sliders.js";
import BatteryInfo from "./battery_info.js";

const SystemMenuBox = Widget.Box({
const SystemMenuBox = () => Widget.Box({
className: "system-menu",
vertical: true,

Expand All @@ -23,5 +23,5 @@ export default () =>
monitor: 0,
anchor: ["top", "right"],
name: "system-menu",
child: SystemMenuBox,
child: SystemMenuBox(),
});
8 changes: 4 additions & 4 deletions home/services/ags/windows/system-menu/powerprofiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const makeProfiles = (profiles) =>
})
);

const ActiveProfile = Profile({
const ActiveProfile = () => Profile({
props: {
className: "current-profile",
},
Expand All @@ -50,7 +50,7 @@ const ActiveProfile = Profile({
self.bind("label", PowerProfiles, "active-profile", prettyName),
});

const ProfileRevealer = Widget.Revealer({
const ProfileRevealer = () => Widget.Revealer({
revealChild: false,
transition: "slide_down",

Expand All @@ -76,8 +76,8 @@ export default () =>
Widget.Box({
vertical: true,
children: [
ActiveProfile,
ProfileRevealer,
ActiveProfile(),
ProfileRevealer(),
],
}),
],
Expand Down

0 comments on commit 2471d83

Please sign in to comment.