Work on new AGS config and switch to zen browser

main
kalle 2025-01-23 17:38:18 +01:00
parent cdae8c4207
commit 25ea289fcd
25 changed files with 232 additions and 33 deletions

View File

@ -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",

View File

@ -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";

View File

@ -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
];
};

2
modules/ags/config/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
node_modules/
@girs/

10
modules/ags/config/app.ts Normal file
View File

@ -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)
},
})

21
modules/ags/config/env.d.ts vendored Normal file
View File

@ -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
}

View File

@ -0,0 +1,6 @@
{
"name": "astal-shell",
"dependencies": {
"astal": "/nix/store/hd98qfcisszjr5prmb9dz0wd7fq74ffn-astal-gjs/share/astal/gjs"
}
}

View File

@ -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;
}
}
}

View File

@ -1,18 +1,14 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "ES2022",
"lib": [
"ES2022"
],
"allowJs": true,
"checkJs": true,
"strict": true,
"noImplicitAny": false,
"baseUrl": ".",
"typeRoots": [
"./types"
],
"skipLibCheck": true
}
}
"$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",
}
}

View File

@ -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 <window
className="Bar"
gdkmonitor={gdkmonitor}
exclusivity={Astal.Exclusivity.EXCLUSIVE}
anchor={TOP | LEFT | RIGHT}
application={App}>
<centerbox>
<box halign={Gtk.Align.START}>
<button
onClicked="echo hello"
>
Welcome to AGS!
</button>
</box>
<box halign={Gtk.Align.CENTER}>
</box>
<box halign={Gtk.Align.END}>
<label label={time()} />
</box>
</centerbox>
</window>
}

View File

@ -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 <window
className="LeftBar Bar"
gdkmonitor={gdkmonitor}
exclusivity={Astal.Exclusivity.EXCLUSIVE}
anchor={TOP | LEFT | RIGHT}
application={App}>
<centerbox>
<Left />
<Center />
<Right />
</centerbox>
</window>
}
function Left() {
return <box halign={Gtk.Align.START}>
</box>
}
function Center() {
return <box halign={Gtk.Align.CENTER}>
</box>
}
function Right() {
return <box halign={Gtk.Align.END}>
<Systray />
</box>
}

View File

@ -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 <box>
{tray.get_items().map(item => <SystrayItem item={item} />)}
</box>
}
function SystrayItem({ item }: { item: Tray.TrayItem }) {
return <Button
onClick={() => item.activate(0, 0) /* NOTE: Figure out what these numbers do */}
tooltipMarkup={bind(item, "tooltip_markup")}
>
<Icon gicon={bind(item, "gicon")} />
</Button>
}

View File

@ -0,0 +1,18 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "ES2022",
"lib": [
"ES2022"
],
"allowJs": true,
"checkJs": true,
"strict": true,
"noImplicitAny": false,
"baseUrl": ".",
"typeRoots": [
"./types"
],
"skipLibCheck": true
}
}