Update FredOS-Gaming.nix
This commit is contained in:
parent
dcc452bf6b
commit
59423f3299
1 changed files with 16 additions and 4 deletions
|
|
@ -26,6 +26,7 @@
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
RemainAfterExit = false;
|
RemainAfterExit = false;
|
||||||
|
Nice = 19; # Run at low priority
|
||||||
};
|
};
|
||||||
|
|
||||||
script = ''
|
script = ''
|
||||||
|
|
@ -33,6 +34,9 @@
|
||||||
DESKTOP_DIR="$HOME/.local/share/applications"
|
DESKTOP_DIR="$HOME/.local/share/applications"
|
||||||
ICON_DIR="$HOME/.local/share/icons/hicolor"
|
ICON_DIR="$HOME/.local/share/icons/hicolor"
|
||||||
|
|
||||||
|
# Wait for system to settle
|
||||||
|
sleep 10
|
||||||
|
|
||||||
# Create icon theme index if it doesn't exist
|
# Create icon theme index if it doesn't exist
|
||||||
if [ ! -f "$ICON_DIR/index.theme" ]; then
|
if [ ! -f "$ICON_DIR/index.theme" ]; then
|
||||||
mkdir -p "$ICON_DIR"
|
mkdir -p "$ICON_DIR"
|
||||||
|
|
@ -65,14 +69,19 @@
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Wait a bit for Steam to create desktop files
|
# Track if we made any changes
|
||||||
sleep 5
|
changes_made=false
|
||||||
|
|
||||||
# Search all desktop files for steam_icon references
|
# Search all desktop files for steam_icon references
|
||||||
${pkgs.gnugrep}/bin/grep -l "Icon=steam_icon_" "$DESKTOP_DIR"/*.desktop 2>/dev/null | while read desktop_file; do
|
${pkgs.gnugrep}/bin/grep -l "Icon=steam_icon_" "$DESKTOP_DIR"/*.desktop 2>/dev/null | while read desktop_file; do
|
||||||
# Extract the app_id from the Icon line
|
# Extract the app_id from the Icon line
|
||||||
app_id=$(${pkgs.gnugrep}/bin/grep "Icon=steam_icon_" "$desktop_file" | ${pkgs.gnused}/bin/sed 's/Icon=steam_icon_//')
|
app_id=$(${pkgs.gnugrep}/bin/grep "Icon=steam_icon_" "$desktop_file" | ${pkgs.gnused}/bin/sed 's/Icon=steam_icon_//')
|
||||||
|
|
||||||
|
# Check if icon already exists
|
||||||
|
if [ -f "$ICON_DIR/256x256/apps/steam_icon_$app_id.png" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
# Find the actual icon file
|
# Find the actual icon file
|
||||||
icon_file=$(find "$STEAM_DIR/appcache/librarycache/$app_id" -name "*.jpg" 2>/dev/null | head -n 1)
|
icon_file=$(find "$STEAM_DIR/appcache/librarycache/$app_id" -name "*.jpg" 2>/dev/null | head -n 1)
|
||||||
|
|
||||||
|
|
@ -83,12 +92,15 @@
|
||||||
cp "$icon_file" "$ICON_DIR/$size/apps/steam_icon_$app_id.png"
|
cp "$icon_file" "$ICON_DIR/$size/apps/steam_icon_$app_id.png"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
changes_made=true
|
||||||
echo "Fixed icon for $(basename "$desktop_file"): App ID $app_id"
|
echo "Fixed icon for $(basename "$desktop_file"): App ID $app_id"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Update icon cache
|
# Only update cache if we made changes
|
||||||
${pkgs.gtk3}/bin/gtk-update-icon-cache -f "$ICON_DIR" 2>/dev/null || true
|
if [ "$changes_made" = true ]; then
|
||||||
|
${pkgs.gtk3}/bin/gtk-update-icon-cache -f "$ICON_DIR" 2>/dev/null || true
|
||||||
|
fi
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue