diff --git a/users/configs/ags/default.nix b/users/configs/ags/default.nix new file mode 100644 index 0000000..f81b847 --- /dev/null +++ b/users/configs/ags/default.nix @@ -0,0 +1,15 @@ +{ user ? throw "user argument is required" }: { config, lib, pkgs, ... }: + +let + agsConfig = (import ./src { inherit pkgs; }); +in +{ + home-manager.users."${user.name}" = { + home.packages = with pkgs; [ ags ]; + + xdg.configFile.ags = { + source = "${agsConfig}/share/config.js"; + target = "ags/config.js"; + }; + }; +} diff --git a/users/configs/ags/src/.gitignore b/users/configs/ags/src/.gitignore new file mode 100644 index 0000000..eb20dbf --- /dev/null +++ b/users/configs/ags/src/.gitignore @@ -0,0 +1,3 @@ +node_modules +types +bun.lockb diff --git a/users/configs/ags/src/default.nix b/users/configs/ags/src/default.nix new file mode 100644 index 0000000..4e39b8c --- /dev/null +++ b/users/configs/ags/src/default.nix @@ -0,0 +1,24 @@ +{ pkgs ? import { }, ... }: + +pkgs.stdenv.mkDerivation { + name = "ags-config"; + src = ./.; + + nativeBuildInputs = with pkgs; [ bun ]; + + phases = [ + "buildPhase" + "installPhase" + ]; + + buildPhase = '' + bun build $src/index.ts --outfile=index.js \ + --external="file://$src/*" \ + --external="gi://*" + ''; + + installPhase = '' + mkdir -p $out/share + cp index.js $out/share/config.js + ''; +} diff --git a/users/configs/ags/src/index.ts b/users/configs/ags/src/index.ts new file mode 100644 index 0000000..aef1989 --- /dev/null +++ b/users/configs/ags/src/index.ts @@ -0,0 +1,12 @@ +import Gtk from "gi://Gtk?version=3.0" +import Gdk from "gi://Gdk" +import { range } from "./lib"; + +const forMonitors = (widget: (monitor: number) => Gtk.Window) => { + const n = Gdk.Display.get_default()?.get_n_monitors() || 1; + return range(n, 0).flatMap(widget) +} + +App.config({ + windows: [] +}) diff --git a/users/configs/ags/src/lib.ts b/users/configs/ags/src/lib.ts new file mode 100644 index 0000000..f952b55 --- /dev/null +++ b/users/configs/ags/src/lib.ts @@ -0,0 +1,3 @@ +export const range = (length: number, start = 1) => { + return Array.from({ length }, (_, i) => i + start) +} diff --git a/users/configs/ags/src/package.json b/users/configs/ags/src/package.json new file mode 100644 index 0000000..3af9c41 --- /dev/null +++ b/users/configs/ags/src/package.json @@ -0,0 +1,11 @@ +{ + "name": "ags", + "module": "index.ts", + "type": "module", + "devDependencies": { + "@types/bun": "latest" + }, + "peerDependencies": { + "typescript": "^5.0.0" + } +} diff --git a/users/configs/ags/src/tsconfig.json b/users/configs/ags/src/tsconfig.json new file mode 100644 index 0000000..f42c8bc --- /dev/null +++ b/users/configs/ags/src/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, + } +} diff --git a/users/configs/hyprland/default.nix b/users/configs/hyprland/default.nix index 2a408de..a32b637 100644 --- a/users/configs/hyprland/default.nix +++ b/users/configs/hyprland/default.nix @@ -61,15 +61,6 @@ in "$mod_SHIFT, right, movewindow, r" "$mod_SHIFT, l, movewindow, r" - "$mod_CTRL, left, resizeactive, -20 0" - "$mod_CTRL, h, resizeactive, -20 0" - "$mod_CTRL, down, resizeactive, 0 20" - "$mod_CTRL, j, resizeactive, 0 20" - "$mod_CTRL, up, resizeactive, 0 -20" - "$mod_CTRL, k, resizeactive, 0 -20" - "$mod_CTRL, right, resizeactive, 20 0" - "$mod_CTRL, l, resizeactive, 20 0" - "$mod, Tab, cyclenext" "$mod, Tab, bringactivetotop" "$mod_SHIFT, Tab, cyclenext, prev" @@ -85,6 +76,17 @@ in "CTRL_ALT, Delete, exit" ]; + binde = [ + "$mod_CTRL, left, resizeactive, -20 0" + "$mod_CTRL, h, resizeactive, -20 0" + "$mod_CTRL, down, resizeactive, 0 20" + "$mod_CTRL, j, resizeactive, 0 20" + "$mod_CTRL, up, resizeactive, 0 -20" + "$mod_CTRL, k, resizeactive, 0 -20" + "$mod_CTRL, right, resizeactive, 20 0" + "$mod_CTRL, l, resizeactive, 20 0" + ]; + bindm = [ "$mod, mouse:272, movewindow" "$mod, mouse:273, resizewindow" diff --git a/users/configs/vscode/default.nix b/users/configs/vscode/default.nix index 6905981..8d3edbe 100644 --- a/users/configs/vscode/default.nix +++ b/users/configs/vscode/default.nix @@ -21,6 +21,7 @@ "editor.smoothScrolling" = true; "editor.stickyScroll.enabled" = true; "editor.suggestSelection" = "first"; + "editor.tabSize" = 2; "editor.unicodeHighlight.includeComments" = true; "editor.unicodeHighlight.nonBasicASCII" = true; "explorer.confirmDelete" = false; diff --git a/users/nick/default.nix b/users/nick/default.nix index 4418de7..9b81f74 100644 --- a/users/nick/default.nix +++ b/users/nick/default.nix @@ -11,6 +11,7 @@ in (import ../configs/firefox { inherit user; }) (import ../configs/hyprland { inherit user; }) (import ../configs/hyprshot { inherit user; }) + (import ../configs/ags { inherit user; }) (import ../configs/wev { inherit user; }) (import ../configs/brightnessctl { inherit user; }) (import ../configs/pavucontrol { inherit user; })