ags: init basic bar
All checks were successful
flake check / check (push) Successful in 11m1s
fmt check / check (push) Successful in 1m6s

This commit is contained in:
notohh 2024-01-01 21:29:18 -05:00
parent 320d426206
commit 36bbb8603a
Signed by: notohh
GPG key ID: BD47506D475EE86D
11 changed files with 120 additions and 12 deletions

2
home/ags/config/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
style.css
style.css.map

View file

@ -1,13 +1,24 @@
import Widget from 'resource:///com/github/Aylur/ags/widget.js';
import { App, Utils } from './import.js';
import { Bar } from './js/main.js'
const myLabel = Widget.Label({
label: 'some example content',
})
const myBar = Widget.Window({
name: 'bar',
anchor: ['top', 'left', 'right'],
child: myLabel,
})
const scss = App.configDir + '/main.scss'
const css = App.configDir + '/style.css'
export default { windows: [myBar] }
Utils.exec(`sass ${scss} ${css}`);
function reloadCss() {
console.log("scss updating");
Utils.exec(`sass ${scss} ${css}`);
App.resetCss();
App.applyCss(css);
}
Utils.monitorFile(`${App.configDir}/scss`, reloadCss, "directory");
export default {
style: css,
windows: [
Bar(2)
]
}

21
home/ags/config/import.js Normal file
View file

@ -0,0 +1,21 @@
import App from "resource:///com/github/Aylur/ags/app.js";
import * as Utils from "resource:///com/github/Aylur/ags/utils.js";
import Service from "resource:///com/github/Aylur/ags/service.js";
import Variable from "resource:///com/github/Aylur/ags/variable.js";
import Widget from "resource:///com/github/Aylur/ags/widget.js";
import Audio from "resource:///com/github/Aylur/ags/service/audio.js";
import Hyprland from "resource:///com/github/Aylur/ags/service/hyprland.js";
import Network from "resource:///com/github/Aylur/ags/service/network.js";
import SystemTray from "resource:///com/github/Aylur/ags/service/systemtray.js";
export {
App,
Audio,
Hyprland,
Network,
Service,
SystemTray,
Utils,
Variable,
Widget,
};

View file

@ -0,0 +1,32 @@
import { Widget } from '../import.js';
import { Time } from './widgets/time.js'
const Start = () => Widget.Box({
hpack: "start",
children: []
})
const Center = () => Widget.Box({
children: []
})
const End = () => Widget.Box({
hpack: "end",
children: [
Time()
]
})
const Bar = (monitor) => Widget.Window({
monitor,
name: `bar-${monitor}`,
anchor: ['top', 'left', 'right'],
exclusivity: 'exclusive',
child: Widget.CenterBox({
startWidget: Start(),
centerWidget: Center(),
endWidget: End(),
}),
})
export {
Bar
}

View file

@ -0,0 +1,18 @@
import { Widget, Utils } from '../../import.js';
const Time = () => Widget.EventBox({
child: Widget.Label({
className: "date"
}).poll(
1000,
(self) =>
Utils.execAsync(["date", "+%a %b %d %H:%M"]).then((time) =>
self.label = time
),
),
})
export {
Time
}

View file

@ -0,0 +1,2 @@
@import 'scss/bar.scss';
@import 'scss/time.scss';

View file

@ -0,0 +1,9 @@
* {
all: unset;
margin: 3px;
font-family: 'Monaspace Krypton';
}
window {
background-color: black;
}

View file

@ -0,0 +1,3 @@
.date {
color: #ffffff;
}

View file

@ -1,6 +1,16 @@
_: {
{
pkgs,
config,
...
}: let
configDir = "/home/notoh/snowflake/home/ags/config";
in {
programs.ags = {
enable = true;
configDir = ./config;
extraPackages = with pkgs; [libsoup_3];
};
home.packages = with pkgs; [dart-sass];
xdg.configFile = {
"ags".source = config.lib.file.mkOutOfStoreSymlink "${configDir}";
};
}