From 25ea289fcdeeabe40f18a889edd4e7e19281200c Mon Sep 17 00:00:00 2001 From: Kalle Struik Date: Thu, 23 Jan 2025 17:38:18 +0100 Subject: [PATCH] Work on new AGS config and switch to zen browser --- flake.lock | 37 ++++++++++++++++++- flake.nix | 3 ++ hosts/kalle-pc/default.nix | 32 ++++++++-------- modules/ags/config/.gitignore | 2 + modules/ags/config/app.ts | 10 +++++ modules/ags/config/env.d.ts | 21 +++++++++++ modules/ags/config/package.json | 6 +++ modules/ags/config/style.scss | 18 +++++++++ modules/ags/config/tsconfig.json | 30 +++++++-------- modules/ags/config/widget/Bar.tsx | 30 +++++++++++++++ modules/ags/config/widget/LeftBar.tsx | 35 ++++++++++++++++++ modules/ags/config/widget/Systray.tsx | 23 ++++++++++++ modules/ags/{config => config_old}/bar/Bar.js | 0 .../ags/{config => config_old}/bar/Clock.js | 0 .../ags/{config => config_old}/bar/Systray.js | 0 modules/ags/{config => config_old}/colors.css | 0 modules/ags/{config => config_old}/config.js | 0 .../ags/{config => config_old}/constants.js | 0 .../ags/{config => config_old}/media/Media.js | 0 .../{config => config_old}/media/style.css | 0 .../notifications/Notifications.js | 0 .../notifications/style.css | 0 modules/ags/{config => config_old}/style.css | 0 modules/ags/config_old/tsconfig.json | 18 +++++++++ modules/ags/{config => config_old}/types | 0 25 files changed, 232 insertions(+), 33 deletions(-) create mode 100644 modules/ags/config/.gitignore create mode 100644 modules/ags/config/app.ts create mode 100644 modules/ags/config/env.d.ts create mode 100644 modules/ags/config/package.json create mode 100644 modules/ags/config/style.scss create mode 100644 modules/ags/config/widget/Bar.tsx create mode 100644 modules/ags/config/widget/LeftBar.tsx create mode 100644 modules/ags/config/widget/Systray.tsx rename modules/ags/{config => config_old}/bar/Bar.js (100%) rename modules/ags/{config => config_old}/bar/Clock.js (100%) rename modules/ags/{config => config_old}/bar/Systray.js (100%) rename modules/ags/{config => config_old}/colors.css (100%) rename modules/ags/{config => config_old}/config.js (100%) rename modules/ags/{config => config_old}/constants.js (100%) rename modules/ags/{config => config_old}/media/Media.js (100%) rename modules/ags/{config => config_old}/media/style.css (100%) rename modules/ags/{config => config_old}/notifications/Notifications.js (100%) rename modules/ags/{config => config_old}/notifications/style.css (100%) rename modules/ags/{config => config_old}/style.css (100%) create mode 100644 modules/ags/config_old/tsconfig.json rename modules/ags/{config => config_old}/types (100%) diff --git a/flake.lock b/flake.lock index 1ba7066..3c143cd 100644 --- a/flake.lock +++ b/flake.lock @@ -457,6 +457,22 @@ "type": "github" } }, + "nixpkgs_3": { + "locked": { + "lastModified": 1735471104, + "narHash": "sha256-0q9NGQySwDQc7RhAV2ukfnu7Gxa5/ybJ2ANT8DQrQrs=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "88195a94f390381c6afcdaa933c2f6ff93959cb4", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "plugin-harpoon1": { "flake": false, "locked": { @@ -538,7 +554,8 @@ "nixpkgs": "nixpkgs_2", "plugin-harpoon1": "plugin-harpoon1", "plugin-rainbow-delimiters-nvim": "plugin-rainbow-delimiters-nvim", - "plugin-undotree-nvim": "plugin-undotree-nvim" + "plugin-undotree-nvim": "plugin-undotree-nvim", + "zen-browser": "zen-browser" } }, "rust-overlay": { @@ -617,6 +634,24 @@ "repo": "xdg-desktop-portal-hyprland", "type": "github" } + }, + "zen-browser": { + "inputs": { + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1737573247, + "narHash": "sha256-qYr17CTrtmudrwcDXBZjgZM6E8elQ8O7SfMhmZj7x00=", + "owner": "0xc000022070", + "repo": "zen-browser-flake", + "rev": "c3ea41c78e72866919a46116a5231c4e92062327", + "type": "github" + }, + "original": { + "owner": "0xc000022070", + "repo": "zen-browser-flake", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index f88a633..693efd2 100644 --- a/flake.nix +++ b/flake.nix @@ -9,6 +9,9 @@ home-manager.url = "github:nix-community/home-manager/master"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; + # Zen browser + zen-browser.url = "github:0xc000022070/zen-browser-flake"; + # AGS ags.url = "github:Aylur/ags"; ags.inputs.nixpkgs.follows = "nixpkgs"; diff --git a/hosts/kalle-pc/default.nix b/hosts/kalle-pc/default.nix index e6d8b11..f53f7b6 100644 --- a/hosts/kalle-pc/default.nix +++ b/hosts/kalle-pc/default.nix @@ -59,32 +59,33 @@ width = 1920; height = 1080; refreshRate = 144; - x = 0; - y = 1080; + x = 1080; + y = 420; vrr = 1; } - { - name = "HDMI-A-1"; - width = 1920; - height = 1080; - x = 1500; - y = 0; - } - { name = "HDMI-A-2"; width = 1920; height = 1080; - x = 1920; - y = 1080; + x = 0; + y = 0; transform = 3; } + + { + name = "HDMI-A-1"; + width = 1920; + height = 1080; + x = 1080 + 1920; + y = 0; + transform = 1; + } ]; autoStart = [ "${pkgs.ags}/bin/ags" - (mkUwsmApp pkgs.firefox "firefox") + (mkUwsmApp inputs.zen-browser.packages.x86_64-linux.default "zen") (mkUwsmApp pkgs.discord "discord") ]; @@ -112,8 +113,8 @@ windowRules = { # Auto workspace - firefox = [ "workspace 1 silent" ]; - discord = [ "workspace name:HDMI-A-2" ]; + zen = [ "workspace 1 silent" ]; + discord = [ "workspace name:HDMI-A-1" ]; }; windowRulesV2 = { @@ -146,6 +147,7 @@ vlc feishin cachix + inputs.zen-browser.packages.x86_64-linux.default ]; }; diff --git a/modules/ags/config/.gitignore b/modules/ags/config/.gitignore new file mode 100644 index 0000000..298eb4d --- /dev/null +++ b/modules/ags/config/.gitignore @@ -0,0 +1,2 @@ +node_modules/ +@girs/ diff --git a/modules/ags/config/app.ts b/modules/ags/config/app.ts new file mode 100644 index 0000000..ab85dba --- /dev/null +++ b/modules/ags/config/app.ts @@ -0,0 +1,10 @@ +import { App } from "astal/gtk3" +import style from "./style.scss" +import LeftBar from "./widget/LeftBar" + +App.start({ + css: style, + main() { + App.get_monitors().map(LeftBar) + }, +}) diff --git a/modules/ags/config/env.d.ts b/modules/ags/config/env.d.ts new file mode 100644 index 0000000..467c0a4 --- /dev/null +++ b/modules/ags/config/env.d.ts @@ -0,0 +1,21 @@ +declare 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/modules/ags/config/package.json b/modules/ags/config/package.json new file mode 100644 index 0000000..c03d968 --- /dev/null +++ b/modules/ags/config/package.json @@ -0,0 +1,6 @@ +{ + "name": "astal-shell", + "dependencies": { + "astal": "/nix/store/hd98qfcisszjr5prmb9dz0wd7fq74ffn-astal-gjs/share/astal/gjs" + } +} diff --git a/modules/ags/config/style.scss b/modules/ags/config/style.scss new file mode 100644 index 0000000..904eb3b --- /dev/null +++ b/modules/ags/config/style.scss @@ -0,0 +1,18 @@ +// https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gtk/theme/Adwaita/_colors-public.scss +$fg-color: #{"@theme_fg_color"}; +$bg-color: #{"@theme_bg_color"}; + +window.Bar { + background: transparent; + color: $fg-color; + + >centerbox { + background: $bg-color; + border-radius: 5px; + margin: 8px; + + >box { + margin: 4px; + } + } +} diff --git a/modules/ags/config/tsconfig.json b/modules/ags/config/tsconfig.json index f03f2d1..9471e35 100644 --- a/modules/ags/config/tsconfig.json +++ b/modules/ags/config/tsconfig.json @@ -1,18 +1,14 @@ { - "compilerOptions": { - "target": "ES2022", - "module": "ES2022", - "lib": [ - "ES2022" - ], - "allowJs": true, - "checkJs": true, - "strict": true, - "noImplicitAny": false, - "baseUrl": ".", - "typeRoots": [ - "./types" - ], - "skipLibCheck": true - } -} \ No newline at end of file + "$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": "astal/gtk3", + } +} diff --git a/modules/ags/config/widget/Bar.tsx b/modules/ags/config/widget/Bar.tsx new file mode 100644 index 0000000..2cbd442 --- /dev/null +++ b/modules/ags/config/widget/Bar.tsx @@ -0,0 +1,30 @@ +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) { + const { TOP, LEFT, RIGHT } = Astal.WindowAnchor + + return + + + + + + + + + + +} diff --git a/modules/ags/config/widget/LeftBar.tsx b/modules/ags/config/widget/LeftBar.tsx new file mode 100644 index 0000000..38736a9 --- /dev/null +++ b/modules/ags/config/widget/LeftBar.tsx @@ -0,0 +1,35 @@ +import { App, Astal, Gdk, Gtk } from "astal/gtk3"; +import Systray from "./Systray"; + +export default function LeftBar(gdkmonitor: Gdk.Monitor) { + const { TOP, LEFT, RIGHT } = Astal.WindowAnchor; + + return + + +
+ + + +} + +function Left() { + return + +} + +function Center() { + return + +} + +function Right() { + return + + +} diff --git a/modules/ags/config/widget/Systray.tsx b/modules/ags/config/widget/Systray.tsx new file mode 100644 index 0000000..4da0941 --- /dev/null +++ b/modules/ags/config/widget/Systray.tsx @@ -0,0 +1,23 @@ +import { bind } from "astal" +import { Button, Icon } from "astal/gtk3/widget" +import Tray from "gi://AstalTray" + +const tray = Tray.get_default() + +export default function Systray() { + for (const item of tray.get_items()) { + print(item.title) + } + return + {tray.get_items().map(item => )} + +} + +function SystrayItem({ item }: { item: Tray.TrayItem }) { + return +} diff --git a/modules/ags/config/bar/Bar.js b/modules/ags/config_old/bar/Bar.js similarity index 100% rename from modules/ags/config/bar/Bar.js rename to modules/ags/config_old/bar/Bar.js diff --git a/modules/ags/config/bar/Clock.js b/modules/ags/config_old/bar/Clock.js similarity index 100% rename from modules/ags/config/bar/Clock.js rename to modules/ags/config_old/bar/Clock.js diff --git a/modules/ags/config/bar/Systray.js b/modules/ags/config_old/bar/Systray.js similarity index 100% rename from modules/ags/config/bar/Systray.js rename to modules/ags/config_old/bar/Systray.js diff --git a/modules/ags/config/colors.css b/modules/ags/config_old/colors.css similarity index 100% rename from modules/ags/config/colors.css rename to modules/ags/config_old/colors.css diff --git a/modules/ags/config/config.js b/modules/ags/config_old/config.js similarity index 100% rename from modules/ags/config/config.js rename to modules/ags/config_old/config.js diff --git a/modules/ags/config/constants.js b/modules/ags/config_old/constants.js similarity index 100% rename from modules/ags/config/constants.js rename to modules/ags/config_old/constants.js diff --git a/modules/ags/config/media/Media.js b/modules/ags/config_old/media/Media.js similarity index 100% rename from modules/ags/config/media/Media.js rename to modules/ags/config_old/media/Media.js diff --git a/modules/ags/config/media/style.css b/modules/ags/config_old/media/style.css similarity index 100% rename from modules/ags/config/media/style.css rename to modules/ags/config_old/media/style.css diff --git a/modules/ags/config/notifications/Notifications.js b/modules/ags/config_old/notifications/Notifications.js similarity index 100% rename from modules/ags/config/notifications/Notifications.js rename to modules/ags/config_old/notifications/Notifications.js diff --git a/modules/ags/config/notifications/style.css b/modules/ags/config_old/notifications/style.css similarity index 100% rename from modules/ags/config/notifications/style.css rename to modules/ags/config_old/notifications/style.css diff --git a/modules/ags/config/style.css b/modules/ags/config_old/style.css similarity index 100% rename from modules/ags/config/style.css rename to modules/ags/config_old/style.css diff --git a/modules/ags/config_old/tsconfig.json b/modules/ags/config_old/tsconfig.json new file mode 100644 index 0000000..f03f2d1 --- /dev/null +++ b/modules/ags/config_old/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "ES2022", + "lib": [ + "ES2022" + ], + "allowJs": true, + "checkJs": true, + "strict": true, + "noImplicitAny": false, + "baseUrl": ".", + "typeRoots": [ + "./types" + ], + "skipLibCheck": true + } +} \ No newline at end of file diff --git a/modules/ags/config/types b/modules/ags/config_old/types similarity index 100% rename from modules/ags/config/types rename to modules/ags/config_old/types