ags: init basic bar
All checks were successful
flake check / check (push) Successful in 11m1s
fmt check / check (push) Successful in 1m6s
All checks were successful
flake check / check (push) Successful in 11m1s
fmt check / check (push) Successful in 1m6s
This commit is contained in:
parent
320d426206
commit
36bbb8603a
11 changed files with 120 additions and 12 deletions
2
home/ags/config/.gitignore
vendored
Normal file
2
home/ags/config/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
style.css
|
||||||
|
style.css.map
|
|
@ -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({
|
const scss = App.configDir + '/main.scss'
|
||||||
name: 'bar',
|
const css = App.configDir + '/style.css'
|
||||||
anchor: ['top', 'left', 'right'],
|
|
||||||
child: myLabel,
|
|
||||||
})
|
|
||||||
|
|
||||||
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
21
home/ags/config/import.js
Normal 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,
|
||||||
|
};
|
32
home/ags/config/js/main.js
Normal file
32
home/ags/config/js/main.js
Normal 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
|
||||||
|
}
|
18
home/ags/config/js/widgets/time.js
Normal file
18
home/ags/config/js/widgets/time.js
Normal 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
|
||||||
|
}
|
2
home/ags/config/main.scss
Normal file
2
home/ags/config/main.scss
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
@import 'scss/bar.scss';
|
||||||
|
@import 'scss/time.scss';
|
9
home/ags/config/scss/bar.scss
Normal file
9
home/ags/config/scss/bar.scss
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
* {
|
||||||
|
all: unset;
|
||||||
|
margin: 3px;
|
||||||
|
font-family: 'Monaspace Krypton';
|
||||||
|
}
|
||||||
|
|
||||||
|
window {
|
||||||
|
background-color: black;
|
||||||
|
}
|
3
home/ags/config/scss/time.scss
Normal file
3
home/ags/config/scss/time.scss
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
.date {
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
|
@ -1,6 +1,16 @@
|
||||||
_: {
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
configDir = "/home/notoh/snowflake/home/ags/config";
|
||||||
|
in {
|
||||||
programs.ags = {
|
programs.ags = {
|
||||||
enable = true;
|
enable = true;
|
||||||
configDir = ./config;
|
extraPackages = with pkgs; [libsoup_3];
|
||||||
|
};
|
||||||
|
home.packages = with pkgs; [dart-sass];
|
||||||
|
xdg.configFile = {
|
||||||
|
"ags".source = config.lib.file.mkOutOfStoreSymlink "${configDir}";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue