42
42
needs_update=true
43
43
fi
44
44
45
- # Set $REALHOME to the users real home directory
46
- REALHOME=$( getent passwd $UID | cut -d ' :' -f 6)
47
-
48
45
export SNAP_DESKTOP_RUNTIME=$SNAP
49
46
50
47
# Set config folder to local path
@@ -54,9 +51,9 @@ chmod 700 "$XDG_CONFIG_HOME"
54
51
55
52
# If the user has modified their user-dirs settings, force an update
56
53
if [[ -f " $XDG_CONFIG_HOME /user-dirs.dirs.md5sum" ]]; then
57
- if [[ " $( md5sum < " $REALHOME /.config/user-dirs.dirs" ) " != " $( cat " $XDG_CONFIG_HOME /user-dirs.dirs.md5sum" ) " ||
54
+ if [[ " $( md5sum < " $SNAP_REAL_HOME /.config/user-dirs.dirs" ) " != " $( cat " $XDG_CONFIG_HOME /user-dirs.dirs.md5sum" ) " ||
58
55
( -f " $XDG_CONFIG_HOME /user-dirs.locale.md5sum" &&
59
- " $( md5sum < " $REALHOME /.config/user-dirs.locale" ) " ! = " $( cat " $XDG_CONFIG_HOME /user-dirs.locale.md5sum" ) " ) ]]; then
56
+ " $( md5sum < " $SNAP_REAL_HOME /.config/user-dirs.locale" ) " ! = " $( cat " $XDG_CONFIG_HOME /user-dirs.locale.md5sum" ) " ) ]]; then
60
57
needs_update=true
61
58
fi
62
59
else
@@ -326,6 +323,41 @@ if [ -n "$SNAP_DESKTOP_DEBUG" ]; then
326
323
echo " Now running: exec $* "
327
324
fi
328
325
326
+ # #####################################
327
+ # Adjustments to shortcuts and icons #
328
+ # #####################################
329
+
330
+ DESKTOP_PATH=$( grep " XDG_DESKTOP_DIR" $SNAP_REAL_HOME /.config/user-dirs.dirs | cut -d' =' -f2 | sed ' s/"//g' | sed " s#\$ HOME#$SNAP_REAL_HOME #g" )
331
+ ensure_dir_exists $SNAP_REAL_HOME /.local/share/applications/
332
+ ensure_dir_exists $SNAP_REAL_HOME /.local/share/icons/
333
+
334
+ # Copy .desktop of Desktop folder
335
+ if [ -d " $SNAP_USER_COMMON /Desktop" ] && [ ! -L " $SNAP_USER_COMMON /Desktop" ]; then
336
+ for file in " $SNAP_USER_COMMON /Desktop/" * .desktop; do
337
+ if [ -e " $file " ]; then
338
+ cp -f " $file " " $DESKTOP_PATH /"
339
+ fi
340
+ done
341
+ fi
342
+
343
+ # Copy icons folder
344
+ if [ -d " $SNAP_USER_COMMON /.local/share/icons" ] && [ ! -L " $SNAP_USER_COMMON /.local/share/icons" ]; then
345
+ cp -rf " $SNAP_USER_COMMON /.local/share/icons" " $SNAP_REAL_HOME /.local/share/"
346
+ fi
347
+
348
+ # Copy applications folder
349
+ if [ -d " $SNAP_USER_COMMON /.local/share/applications" ] && [ ! -L " $SNAP_USER_COMMON /.local/share/applications" ]; then
350
+ cp -rf " $SNAP_USER_COMMON /.local/share/applications" " $SNAP_REAL_HOME /.local/share/"
351
+ fi
352
+
353
+ rm -r $SNAP_USER_COMMON /Desktop
354
+ rm -r $SNAP_USER_COMMON /.local/share/applications
355
+ rm -r $SNAP_USER_COMMON /.local/share/icons
356
+
357
+ ln -sf " $DESKTOP_PATH " " $SNAP_USER_COMMON /Desktop"
358
+ ln -sf $SNAP_REAL_HOME /.local/share/applications/ $SNAP_USER_COMMON /.local/share/applications
359
+ ln -sf $SNAP_REAL_HOME /.local/share/icons/ $SNAP_USER_COMMON /.local/share/icons
360
+
329
361
# Fix default run command
330
362
# The default works on a system with only the Snap installed, but if they also
331
363
# have the deb then the default command will run the deb instead of the Snap.
@@ -335,13 +367,20 @@ done
335
367
336
368
# Links game icons to host
337
369
find " $SNAP_USER_COMMON /.local/share/icons/hicolor" -type f -name " steam_icon_*.png" | while read -r file; do
338
- dest=" ${file/ $SNAP_USER_COMMON / $REALHOME } "
370
+ dest=" ${file/ $SNAP_USER_COMMON / $SNAP_REAL_HOME } "
339
371
ensure_dir_exists " $( dirname $dest ) "
340
- ln -sf " $file " " $dest "
341
372
done
342
373
343
- # Link .desktop files to host
344
- ln -sf $SNAP_USER_COMMON /.local/share/applications/* $REALHOME /.local/share/applications/
374
+ # GTK theme and behavior modifier
375
+ # Those can impact the theme engine used by Qt as well
376
+ gtk_configs=(gtk-4.0/settings.ini gtk-4.0/gtk.css gtk-4.0/bookmarks gtk-4.0/colors.css gtk-3.0/settings.ini gtk-3.0/gtk.css gtk-3.0/bookmarks gtk-3.0/colors.css gtk-2.0/gtkfilechooser.ini)
377
+ for f in " ${gtk_configs[@]} " ; do
378
+ dest=" $XDG_CONFIG_HOME /$f "
379
+ if [ ! -L " $dest " ]; then
380
+ ensure_dir_exists " $( dirname " $dest " ) "
381
+ ln -s " $SNAP_REAL_HOME /.config/$f " " $dest "
382
+ fi
383
+ done
345
384
346
385
strip_unreachable_dirs XDG_DATA_DIRS
347
386
strip_unreachable_dirs XDG_CONFIG_DIRS
0 commit comments