aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhongheng Liu <z.liu@outlook.com.gr>2024-08-22 17:07:24 +0800
committerZhongheng Liu <z.liu@outlook.com.gr>2024-08-22 17:07:24 +0800
commit9ac744a8ce8625d4aa6268663272f4de7371e09c (patch)
tree4a3c61f62f2b98cf6a1fd05eda649ac00dddfd8d
parentbc64af1a17592160d3525aa577a55e7261c1875a (diff)
downloadnixos-configuration-9ac744a8ce8625d4aa6268663272f4de7371e09c.tar.gz
nixos-configuration-9ac744a8ce8625d4aa6268663272f4de7371e09c.tar.bz2
nixos-configuration-9ac744a8ce8625d4aa6268663272f4de7371e09c.zip
feat: improve AGS JavaScript definition files
-rw-r--r--home-manager/stvnliu/ags/config/config.js36
-rw-r--r--home-manager/stvnliu/ags/default.nix2
2 files changed, 20 insertions, 18 deletions
diff --git a/home-manager/stvnliu/ags/config/config.js b/home-manager/stvnliu/ags/config/config.js
index 1dfb875..87f5acd 100644
--- a/home-manager/stvnliu/ags/config/config.js
+++ b/home-manager/stvnliu/ags/config/config.js
@@ -12,28 +12,30 @@ const date = Variable("", {
// so to make a reuseable widget, make it a function
// then you can simply instantiate one by calling it
const focusedTitle = Widget.Label({
- label: hyprland.active.client.bind('title'),
- visible: hyprland.active.client.bind('address')
- .as(addr => addr !== "0x"),
+ label: hyprland.active.client.bind('title'),
+ visible: hyprland.active.client.bind('address')
+ .as(addr => addr !== "0x"),
})
const dispatch = ws => hyprland.messageAsync(`dispatch workspace ${ws}`);
const Workspaces = () => Widget.EventBox({
- onScrollUp: () => dispatch('+1'),
- onScrollDown: () => dispatch('-1'),
- child: Widget.Box({
- children: Array.from({ length: 10 }, (_, i) => i + 1).map(i => Widget.Button({
- attribute: i,
- label: `${i}`,
- onClicked: () => dispatch(i),
- })),
-
- // remove this setup hook if you want fixed number of buttons
- setup: self => self.hook(hyprland, () => self.children.forEach(btn => {
- btn.visible = hyprland.workspaces.some(ws => ws.id === btn.attribute);
- })),
- }),
+ onScrollUp: () => dispatch('+1'),
+ onScrollDown: () => dispatch('-1'),
+ child: Widget.Box({
+ children: Array.from({ length: 10 }, (_, i) => i + 1).map(i => Widget.Button({
+ attribute: i,
+ label: `${i}`,
+ onClicked: () => dispatch(i),
+
+ class_name: i === hyprland.active.workspace.id ? "focused" : ""
+ })),
+
+ // remove this setup hook if you want fixed number of buttons
+ setup: self => self.hook(hyprland, () => self.children.forEach(btn => {
+ btn.visible = hyprland.workspaces.some(ws => ws.id === btn.attribute);
+ })),
+ }),
})
function ClientTitle() {
return Widget.Label({
diff --git a/home-manager/stvnliu/ags/default.nix b/home-manager/stvnliu/ags/default.nix
index 0c9c1c7..2980486 100644
--- a/home-manager/stvnliu/ags/default.nix
+++ b/home-manager/stvnliu/ags/default.nix
@@ -12,7 +12,7 @@
home.packages = with pkgs; [ags];
myAutostartCommands = [
#"${pkgs.ags}/bin/ags --init"
- #"${pkgs.ags}/bin/ags"
+ "${pkgs.ags}/bin/ags"
];
};
}