fix: icons not appearing

This commit is contained in:
tux
2025-06-09 23:12:33 +05:30
parent 2009178b38
commit 1ccd248cc1
2 changed files with 43 additions and 15 deletions

2
app.ts
View File

@@ -3,7 +3,7 @@ import style from "./style.scss";
import windows from "./windows"; import windows from "./windows";
import GLib from "gi://GLib?version=2.0"; 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({ App.start({
css: style, css: style,

View File

@@ -22,21 +22,49 @@
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
in { in {
packages.${system} = { packages.${system} = {
default = ags.lib.bundle { default = let
inherit pkgs; tpanel = ags.lib.bundle {
src = ./.; inherit pkgs;
name = "tpanel"; src = ./.;
entry = "app.ts"; name = "tpanel";
gtk4 = true; entry = "app.ts";
gtk4 = true;
extraPackages = with ags.packages.${system}; [ extraPackages = with ags.packages.${system}; [
hyprland hyprland
apps apps
battery battery
tray tray
network 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}; astal = astal.packages.${system};
}; };