commit 1fbe67bd23dd4c6ae7191adc50730d1338745d12 Author: Tigor Hutasuhut Date: Thu Nov 21 10:01:26 2024 +0700 initial commit diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e25f98e --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +@girs/ +node_modules/ +.direnv diff --git a/app.ts b/app.ts new file mode 100644 index 0000000..83217ef --- /dev/null +++ b/app.ts @@ -0,0 +1,10 @@ +import { App } from "astal/gtk3" +import style from "./style.scss" +import Bar from "./widget/Bar" + +App.start({ + css: style, + main() { + App.get_monitors().map(Bar) + }, +}) diff --git a/env.d.ts b/env.d.ts new file mode 100644 index 0000000..4e7e508 --- /dev/null +++ b/env.d.ts @@ -0,0 +1,21 @@ +const SRC: string + +declare module "inline:*" { + const content: string + export default content +} + +declare module "*.scss" { + const content: string + export default content +} + +declare module "*.blp" { + const content: string + export default content +} + +declare module "*.css" { + const content: string + export default content +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..5e628c1 --- /dev/null +++ b/flake.lock @@ -0,0 +1,70 @@ +{ + "nodes": { + "ags": { + "inputs": { + "astal": "astal", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1731966249, + "narHash": "sha256-9hDeMy6S2q1wWBFGiJic5yUms19zW8LhAX9MlCtuN6k=", + "owner": "aylur", + "repo": "ags", + "rev": "12e0bfefd2051c43d7450123fcb095f655b891e8", + "type": "github" + }, + "original": { + "owner": "aylur", + "repo": "ags", + "type": "github" + } + }, + "astal": { + "inputs": { + "nixpkgs": [ + "ags", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1731952585, + "narHash": "sha256-Sh1E7sJd8JJM3PCU1ZOei/QWz97OLCENIi2rTRoaniw=", + "owner": "aylur", + "repo": "astal", + "rev": "664c7a4ddfcf48c6e8accd3c33bb94424b0e8609", + "type": "github" + }, + "original": { + "owner": "aylur", + "repo": "astal", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1732014248, + "narHash": "sha256-y/MEyuJ5oBWrWAic/14LaIr/u5E0wRVzyYsouYY3W6w=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "23e89b7da85c3640bbc2173fe04f4bd114342367", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "ags": "ags", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..f433d46 --- /dev/null +++ b/flake.nix @@ -0,0 +1,52 @@ +{ + description = "My Awesome Desktop Shell"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + + ags = { + url = "github:aylur/ags"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { + self, + nixpkgs, + ags, + }: let + system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}; + in { + packages.${system} = { + default = ags.lib.bundle { + inherit pkgs; + src = ./.; + name = "my-shell"; + entry = "app.ts"; + + # additional libraries and executables to add to gjs' runtime + extraPackages = [ + # ags.packages.${system}.battery + # pkgs.fzf + ]; + }; + }; + + devShells.${system} = { + default = pkgs.mkShell { + buildInputs = [ + # includes all Astal libraries + # ags.packages.${system}.agsFull + + # includes astal3 astal4 astal-io by default + (ags.packages.${system}.default.override { + extraPackages = [ + # cherry pick packages + ]; + }) + ]; + }; + }; + }; +} diff --git a/style.scss b/style.scss new file mode 100644 index 0000000..9ae9604 --- /dev/null +++ b/style.scss @@ -0,0 +1,20 @@ +// https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gtk/theme/Adwaita/_colors-public.scss +$theme_fg_color: "@theme_fg_color"; +$theme_bg_color: "@theme_bg_color"; + +window.Bar { + background: transparent; + color: #{$theme_bg_color}; + font-weight: bold; + + >centerbox { + background: #{$theme_bg_color}; + border-radius: 10px; + margin: 8px; + } + + button { + border-radius: 8px; + margin: 2px; + } +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..fc32463 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,22 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "compilerOptions": { + "experimentalDecorators": true, + "strict": true, + "target": "ES2022", + "module": "ES2022", + "moduleResolution": "Bundler", + // "checkJs": true, + // "allowJs": true, + "jsx": "react-jsx", + "jsxImportSource": "/nix/store/1pd4fdq90f4vla3zghmfci9axsbvkd3w-astal-gjs/share/astal/gjs/gtk3", + "paths": { + "astal": [ + "/nix/store/1pd4fdq90f4vla3zghmfci9axsbvkd3w-astal-gjs/share/astal/gjs" + ], + "astal/*": [ + "/nix/store/1pd4fdq90f4vla3zghmfci9axsbvkd3w-astal-gjs/share/astal/gjs/*" + ] + }, + } +} diff --git a/widget/Bar.tsx b/widget/Bar.tsx new file mode 100644 index 0000000..ed1d845 --- /dev/null +++ b/widget/Bar.tsx @@ -0,0 +1,29 @@ +import { App, Astal, Gtk, Gdk } from "astal/gtk3" +import { Variable } from "astal" + +const time = Variable("").poll(1000, "date") + +export default function Bar(gdkmonitor: Gdk.Monitor) { + return + + + + + + +}