Files
Olympus/home-manager/users/nathan/dotfiles/ags/config.js
2025-08-16 18:54:38 -05:00

133 lines
2.9 KiB
JavaScript
Executable File

const hyprland = await Service.import("hyprland")
//const systemtray = await Service.import("systemtray")
import Clock from './clock.js'
import Launcher from './launcher.js'
import Media from './media.js'
import Notification from './notif.js'
import Power from './power.js'
import Workspaces from './workspaces.js'
import Settings, {SettingsWindow} from './settings.js'
import { ConnectedList } from './bluetooth.js'
import { NotificationPopups } from './notification.js'
// widgets can be only assigned as a child in one container
// so to make a reuseable widget, make it a function
// then you can simply instantiate one by calling it
//////////////////////////////////////////////////////////////
// layout of the bar
function Left() {
return Widget.Box({
spacing: 8,
margin_bottom: 5,
children: [
Launcher(),
Workspaces(),
],
})
}
function Center() {
return Widget.Box({
spacing: 8,
margin_bottom: 5,
children: [
Media(),
Clock(),
Notification(),
],
})
}
function Right() {
return Widget.Box({
hpack: "end",
spacing: 8,
margin_bottom: 5,
children: [
ConnectedList(),
Settings(),
Power(),
],
})
}
///////////////////////////////////////////////////////////
//windows
function Bar(monitor = 0) {
return Widget.Window({
name: `bar-${monitor}`, // name has to be unique
class_name: "bar",
monitor,
anchor: ["top", "left", "right"],
height_request: 32,
vexpand: false,
exclusivity: "exclusive",
child: Widget.CenterBox({
start_widget: Left(),
center_widget: Center(),
end_widget: Right(),
}),
})
}
function pickMonitor() {
let n = 0
for(let i = 0; i < hyprland.monitors.length; i++) {
print(hyprland.getMonitor(i).name)
if(hyprland.getMonitor(i).name == 'eDP-1')
n = i
break
}
return n;
}
////////////////////////////////////////////////////////////
//App config
let m = 0
App.config({
style: "/home/nathan/.cache/wal/colors-ags.css",
windows: [
Bar(m),
SettingsWindow(m),
NotificationPopups(m)
// you can call it, for each monitor
// Bar(0),
// Bar(1)
],
})
App.toggleWindow(App.windows[1].name)
// Utils.timeout(100, () => Utils.notify({
// summary: "Notification Popup Example",
// iconName: "info-symbolic",
// body: "Lorem ipsum dolor sit amet, qui minim labore adipisicing "
// + "minim sint cillum sint consectetur cupidatat.",
// actions: {
// "Cool": () => print("pressed Cool"),
// },
// }))
Utils.monitorFile(`/home/nathan/.cache/wal`, () => {
const css = `/home/nathan/.cache/wal/colors-ags.css`
App.resetCss()
App.applyCss(css)
})
export { }