From 1ccd248cc125733d76e1cff8c6a8c3657ae82231 Mon Sep 17 00:00:00 2001 From: tux Date: Mon, 9 Jun 2025 23:12:33 +0530 Subject: [PATCH] fix: icons not appearing --- app.ts | 2 +- flake.nix | 56 +++++++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 43 insertions(+), 15 deletions(-) diff --git a/app.ts b/app.ts index ece92db..d94f7d6 100644 --- a/app.ts +++ b/app.ts @@ -3,7 +3,7 @@ import style from "./style.scss"; import windows from "./windows"; import GLib from "gi://GLib?version=2.0"; -const icons = `${GLib.get_current_dir()}/assets/icons`; +const icons = `${GLib.get_user_config_dir()}/tpanel/assets/icons`; App.start({ css: style, diff --git a/flake.nix b/flake.nix index 1a43b3d..bf60847 100644 --- a/flake.nix +++ b/flake.nix @@ -22,21 +22,49 @@ pkgs = nixpkgs.legacyPackages.${system}; in { packages.${system} = { - default = ags.lib.bundle { - inherit pkgs; - src = ./.; - name = "tpanel"; - entry = "app.ts"; - gtk4 = true; + default = let + tpanel = ags.lib.bundle { + inherit pkgs; + src = ./.; + name = "tpanel"; + entry = "app.ts"; + gtk4 = true; - extraPackages = with ags.packages.${system}; [ - hyprland - apps - battery - tray - network - ]; - }; + extraPackages = with ags.packages.${system}; [ + hyprland + apps + battery + tray + network + ]; + }; + in + pkgs.runCommand "tpanel" { + nativeBuildInputs = [pkgs.makeWrapper]; + } '' + mkdir -p $out/bin + + # Copy the bundled app + cp -r ${tpanel}/* $out/ + + mv $out/bin/tpanel $out/bin/.tpanel-unwrapped + + makeWrapper $out/bin/.tpanel-unwrapped $out/bin/tpanel \ + --run 'ICONS_DIR="$HOME/.config/tpanel/assets/icons" + + # Check if icons directory needs to be set up + if [ ! -d "$ICONS_DIR" ]; then + # Create necessary directories + mkdir -p "$ICONS_DIR" + + # Copy icon files if source exists and destination is empty + if [ -d "'"$out"'/share/assets/icons" ]; then + cp -r "'"$out"'/share/assets/icons/"* "$ICONS_DIR/" + echo "Installed tpanel icons to $ICONS_DIR" + fi + fi' + + ''; astal = astal.packages.${system}; };