feat: created AGS configuration for multiple bars

AGS config using multiple monitor ids
GRUB extra boot menu entries
Fix issue with Foot terminal starting
This commit is contained in:
Zhongheng Liu 2024-09-19 19:53:40 +03:00
commit dde872db67
No known key found for this signature in database
5 changed files with 19 additions and 58 deletions

View file

@ -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 { }

View file

@ -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" : ""

View file

@ -0,0 +1,3 @@
function MonitorWidget() {
}

View file

@ -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
[

View file

@ -73,9 +73,12 @@ in {
fsIdentifier = "label";
devices = ["nodev"];
extraEntries = ''
menuentry "Reboot" {
reboot
}
menuentry "UEFI Firmware Settings" {
fwsetup
}
menuentry "Reboot" {
reboot
}
menuentry "Poweroff" {
halt
}