From 925c62ea95eccdc936f8bb74bbef6e161cbc9dc1 Mon Sep 17 00:00:00 2001 From: Tigor Hutasuhut Date: Thu, 21 Nov 2024 22:45:00 +0700 Subject: [PATCH] update --- app.ts | 17 ++++++++-------- flake.nix | 8 +++++++- widget/Agenda.tsx | 19 ++++++++++++++++++ widget/Bar.tsx | 49 ++++++++++++++++++++++++----------------------- 4 files changed, 60 insertions(+), 33 deletions(-) create mode 100644 widget/Agenda.tsx diff --git a/app.ts b/app.ts index 83217ef..f1aaa3e 100644 --- a/app.ts +++ b/app.ts @@ -1,10 +1,11 @@ -import { App } from "astal/gtk3" -import style from "./style.scss" -import Bar from "./widget/Bar" +import { App } from "astal/gtk3"; +import style from "./style.scss"; +import Bar from "./widget/Bar"; +import Agenda from "./widget/Agenda"; App.start({ - css: style, - main() { - App.get_monitors().map(Bar) - }, -}) + css: style, + main() { + App.get_monitors().map(Agenda); + }, +}); diff --git a/flake.nix b/flake.nix index 21f31c9..dac0a54 100644 --- a/flake.nix +++ b/flake.nix @@ -24,7 +24,7 @@ pane name="command" pane command="bash" { name "ags" - args "-c" "ags run ./app.ts" + args "-c" "wgo -file=.ts -file=.tsx -xfile=.d.ts -file=.scss ags run ./app.ts" } } } @@ -33,8 +33,10 @@ zellij --layout ${layout} attach --create ags ''; devStopScript = pkgs.writeShellScriptBin "dev-stop" '' + killall gjs || true zellij delete-session --force ags || true ''; + agsPkg = ags.packages.${system}; in { packages.${system} = { @@ -46,6 +48,7 @@ # additional libraries and executables to add to gjs' runtime extraPackages = [ + agsPkg.hyprland # ags.packages.${system}.battery # pkgs.fzf ]; @@ -58,12 +61,15 @@ devRunScript devStopScript pkgs.zellij + pkgs.typescript + pkgs.wgo # includes all Astal libraries # ags.packages.${system}.agsFull # includes astal3 astal4 astal-io by default (ags.packages.${system}.default.override { extraPackages = [ + agsPkg.hyprland # cherry pick packages ]; }) diff --git a/widget/Agenda.tsx b/widget/Agenda.tsx new file mode 100644 index 0000000..d43da4c --- /dev/null +++ b/widget/Agenda.tsx @@ -0,0 +1,19 @@ +import { App, Astal, Gtk, Gdk } from "astal/gtk3"; +import { exec, Variable } from "astal"; + +const agenda = exec(["gcalcli", "agenda", "--tsv", "--details=end"]); + +export default function Agenda(gdkmonitor: Gdk.Monitor) { + agenda.split("\n").map(console.log); + return ( + + {agenda} + + ); +} diff --git a/widget/Bar.tsx b/widget/Bar.tsx index ed1d845..baa3412 100644 --- a/widget/Bar.tsx +++ b/widget/Bar.tsx @@ -1,29 +1,30 @@ -import { App, Astal, Gtk, Gdk } from "astal/gtk3" -import { Variable } from "astal" +import { App, Astal, Gtk, Gdk } from "astal/gtk3"; +import { Variable } from "astal"; -const time = Variable("").poll(1000, "date") +const time = Variable("").poll(1000, "date"); export default function Bar(gdkmonitor: Gdk.Monitor) { - return - - - - - + return ( + + + + + + + ); }