Update FredOS-Gaming.nix
This commit is contained in:
parent
a09914e195
commit
30c3c615dd
1 changed files with 57 additions and 2 deletions
|
|
@ -31,10 +31,52 @@
|
||||||
script = ''
|
script = ''
|
||||||
STEAM_DIR="$HOME/.local/share/Steam"
|
STEAM_DIR="$HOME/.local/share/Steam"
|
||||||
DESKTOP_DIR="$HOME/.local/share/applications"
|
DESKTOP_DIR="$HOME/.local/share/applications"
|
||||||
|
ICON_DIR="$HOME/.local/share/icons/hicolor"
|
||||||
|
|
||||||
# Wait a bit for Steam to create desktop files
|
# Wait a bit for Steam to create desktop files
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
|
# Create icon theme directories
|
||||||
|
for size in 32x32 48x48 64x64 128x128 256x256; do
|
||||||
|
mkdir -p "$ICON_DIR/$size/apps"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Create index.theme if it doesn't exist
|
||||||
|
if [ ! -f "$ICON_DIR/index.theme" ]; then
|
||||||
|
cat > "$ICON_DIR/index.theme" << 'EOF'
|
||||||
|
[Icon Theme]
|
||||||
|
Name=Hicolor
|
||||||
|
Comment=Fallback icon theme
|
||||||
|
Hidden=true
|
||||||
|
Directories=32x32/apps,48x48/apps,64x64/apps,128x128/apps,256x256/apps
|
||||||
|
|
||||||
|
[32x32/apps]
|
||||||
|
Size=32
|
||||||
|
Context=Applications
|
||||||
|
Type=Threshold
|
||||||
|
|
||||||
|
[48x48/apps]
|
||||||
|
Size=48
|
||||||
|
Context=Applications
|
||||||
|
Type=Threshold
|
||||||
|
|
||||||
|
[64x64/apps]
|
||||||
|
Size=64
|
||||||
|
Context=Applications
|
||||||
|
Type=Threshold
|
||||||
|
|
||||||
|
[128x128/apps]
|
||||||
|
Size=128
|
||||||
|
Context=Applications
|
||||||
|
Type=Threshold
|
||||||
|
|
||||||
|
[256x256/apps]
|
||||||
|
Size=256
|
||||||
|
Context=Applications
|
||||||
|
Type=Threshold
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
# 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
|
||||||
|
|
@ -44,10 +86,23 @@
|
||||||
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)
|
||||||
|
|
||||||
if [ -f "$icon_file" ]; then
|
if [ -f "$icon_file" ]; then
|
||||||
${pkgs.gnused}/bin/sed -i "s|Icon=steam_icon_$app_id|Icon=$icon_file|" "$desktop_file"
|
# Copy icon to all sizes for better quality
|
||||||
echo "Fixed icon for $(basename "$desktop_file"): App ID $app_id"
|
for size in 32x32 48x48 64x64 128x128 256x256; do
|
||||||
|
cp "$icon_file" "$ICON_DIR/$size/apps/steam_icon_$app_id.png"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Copied icons for App ID $app_id"
|
||||||
|
|
||||||
|
# Add StartupWMClass if not present
|
||||||
|
if ! ${pkgs.gnugrep}/bin/grep -q "StartupWMClass" "$desktop_file"; then
|
||||||
|
echo "StartupWMClass=steam_app_$app_id" >> "$desktop_file"
|
||||||
|
echo "Added StartupWMClass for $(basename "$desktop_file")"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Update icon cache
|
||||||
|
${pkgs.gtk3}/bin/gtk-update-icon-cache -f "$ICON_DIR" 2>/dev/null || true
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue