From dde872db67f4db33239555033372796d4ea47568 Mon Sep 17 00:00:00 2001 From: Zhongheng Liu Date: Thu, 19 Sep 2024 19:53:40 +0300 Subject: [PATCH] feat: created AGS configuration for multiple bars AGS config using multiple monitor ids GRUB extra boot menu entries Fix issue with Foot terminal starting --- home-manager/stvnliu/ags/config/config.js | 59 +++---------------- .../stvnliu/ags/config/hyprworkspaces.js | 4 +- .../stvnliu/ags/config/monitorWidget.js | 3 + home-manager/stvnliu/hypr/hyprland.nix | 2 +- nixos/bootloader.nix | 9 ++- 5 files changed, 19 insertions(+), 58 deletions(-) create mode 100644 home-manager/stvnliu/ags/config/monitorWidget.js diff --git a/home-manager/stvnliu/ags/config/config.js b/home-manager/stvnliu/ags/config/config.js index 2197887..a34d23a 100644 --- a/home-manager/stvnliu/ags/config/config.js +++ b/home-manager/stvnliu/ags/config/config.js @@ -1,5 +1,6 @@ +import { Workspaces } from "./hyprworkspaces.js"; +import { NetworkIndicator } from "./indicators.js"; const hyprland = await Service.import("hyprland") -const network = await Service.import("network") // const notifications = await Service.import("notifications") const mpris = await Service.import("mpris") const audio = await Service.import("audio") @@ -17,56 +18,12 @@ const focusedTitle = Widget.Label({ visible: hyprland.active.client.bind('address') .as(addr => addr !== "0x"), }) -const wsSymbols = ["壹", "貳", "叁", "肆", "伍", "陸", "柒", "捌", "玖", "拾"] -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: `${wsSymbols[i - 1]}`, - 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({ class_name: "client-title", label: hyprland.active.client.bind("title").as(title => title.length <= 30 ? title : `${title.substring(0, 29)}...`), }) } -const WifiIndicator = () => Widget.Box({ - children: [ - Widget.Icon({ - icon: network.wifi.bind('icon_name'), - }), - Widget.Label({ - label: network.wifi.bind('ssid') - .as(ssid => ssid || 'Unknown'), - }), - ], -}) - -const WiredIndicator = () => Widget.Icon({ - icon: network.wired.bind('icon_name'), -}) - -const NetworkIndicator = () => Widget.Stack({ - children: { - wifi: WifiIndicator(), - wired: WiredIndicator(), - }, - shown: network.bind('primary').as(p => p || 'wifi'), -}) function Clock() { const calendar = Widget.Calendar({ showDayNames: true, @@ -287,15 +244,13 @@ const cpuProgress = Widget.Label({ const ramProgress = Widget.Label({ label: ram.bind().as(usage => `${(usage * 100).toPrecision(4)}%`) }) + +const bars = hyprland.monitors.map((value, index, arr) => { + return Bar(value.id); +}) App.config({ style: "./style.css", - windows: [ - Bar(), - - // you can call it, for each monitor - // Bar(0), - // Bar(1) - ], + windows: bars, }) export { } diff --git a/home-manager/stvnliu/ags/config/hyprworkspaces.js b/home-manager/stvnliu/ags/config/hyprworkspaces.js index 4504d7c..2043133 100644 --- a/home-manager/stvnliu/ags/config/hyprworkspaces.js +++ b/home-manager/stvnliu/ags/config/hyprworkspaces.js @@ -1,14 +1,14 @@ const hyprland = await Service.import("hyprland") const dispatch = ws => hyprland.messageAsync(`dispatch workspace ${ws}`); - +const wsSymbols = ["壹", "貳", "叁", "肆", "伍", "陸", "柒", "捌", "玖", "拾"] 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}`, + label: `${wsSymbols[i-1]}`, onClicked: () => dispatch(i), class_name: i === hyprland.active.workspace.id ? "focused" : "" diff --git a/home-manager/stvnliu/ags/config/monitorWidget.js b/home-manager/stvnliu/ags/config/monitorWidget.js new file mode 100644 index 0000000..2a7163b --- /dev/null +++ b/home-manager/stvnliu/ags/config/monitorWidget.js @@ -0,0 +1,3 @@ +function MonitorWidget() { + +} diff --git a/home-manager/stvnliu/hypr/hyprland.nix b/home-manager/stvnliu/hypr/hyprland.nix index b5199fd..4a61d7e 100644 --- a/home-manager/stvnliu/hypr/hyprland.nix +++ b/home-manager/stvnliu/hypr/hyprland.nix @@ -56,7 +56,7 @@ ", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" ]; bind = let - terminalCmd = "${pkgs.foot}/bin/foot -f 'BlexMono Nerd Font:size=16' -o colors.alpha=0.85 ${config.myShells.defaultShell}"; + terminalCmd = "${pkgs.foot}/bin/foot -f 'BlexMono Nerd Font:size=16' -o colors.alpha=0.85"; screenshotLocation = "/home/${config.myUserName}/Screenshots/$(date '+%Y-%m-%d-%H-%M-%S').png"; in [ diff --git a/nixos/bootloader.nix b/nixos/bootloader.nix index e534ec7..ef40bf5 100644 --- a/nixos/bootloader.nix +++ b/nixos/bootloader.nix @@ -73,9 +73,12 @@ in { fsIdentifier = "label"; devices = ["nodev"]; extraEntries = '' - menuentry "Reboot" { - reboot - } + menuentry "UEFI Firmware Settings" { + fwsetup + } + menuentry "Reboot" { + reboot + } menuentry "Poweroff" { halt }