Skip to content

Instantly share code, notes, and snippets.

@Hammster
Last active February 12, 2020 19:54
Show Gist options
  • Save Hammster/666e5a03269d64bf07d3bef9b38f89dc to your computer and use it in GitHub Desktop.
Save Hammster/666e5a03269d64bf07d3bef9b38f89dc to your computer and use it in GitHub Desktop.
Gnome Loginscreen wallpaper replacement bashscript useage: sh login-background.sh PATH_TO_IMG
#!/usr/bin/sh
if [ "$IMAGE" = "" ]; then
IMAGE=$(
dbus-launch gsettings get org.gnome.desktop.screensaver picture-uri |
sed -e "s/'//g" |
sed -e "s/^file:\/\///g"
)
fi
if [ ! -f $IMAGE ]; then
echo "unknown IMAGE $IMAGE"
exit 1
fi
echo ''
echo 'using the following image as login background:'
echo $IMAGE
echo ''
if [ -d ~/tmp ]; then
CREATED_TMP="0"
else
mkdir -p ~/tmp
CREATED_TMP="1"
fi
WORKDIR=~/tmp/gdm-login-background
GST=/usr/share/gnome-shell/gnome-shell-theme.gresource
GSTRES=$(basename $GST)
mkdir -p $WORKDIR
cd $WORKDIR
mkdir theme
for r in `gresource list $GST`; do
gresource extract $GST $r >$WORKDIR$(echo $r | sed -e 's/^\/org\/gnome\/shell\//\//g')
done
cd theme
cp "$IMAGE" ./
echo "
#lockDialogGroup {
background: #2e3436 url(resource:///org/gnome/shell/theme/$(basename $IMAGE));
background-size: cover;
background-repeat: no-repeat;
}" >>gnome-shell.css
echo '<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/shell/theme">' >"${GSTRES}.xml"
for r in `ls *.*`; do
echo " <file>$r</file>" >>"${GSTRES}.xml"
done
echo ' </gresource>
</gresources>' >>"${GSTRES}.xml"
glib-compile-resources "${GSTRES}.xml"
sudo mv "/usr/share/gnome-shell/$GSTRES" "/usr/share/gnome-shell/${GSTRES}.backup"
sudo mv "$GSTRES" /usr/share/gnome-shell/
rm -r $WORKDIR
if [ "$CREATED_TMP" = "1" ]; then
rm -r ~/tmp
fi
@Hammster
Copy link
Author

Hammster commented Sep 9, 2016

Addition gimp script for bluring the login image.
create ~/.gimp-2.x/scripts/anyname.scm

; ------------------------------------------------------------------------------
; Created by Hans Koch
; @2016 - better late then never
; ------------------------------------------------------------------------------
; function definition
(define (simple-unsharp-mask filename
                             filenameb
                             horizontal
                             vertical)

      ; create image and drawable canvas
      (let* ((image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
          (drawable (car (gimp-image-get-active-layer image))))

      ; Blur
      (plug-in-gauss-rle2 RUN-NONINTERACTIVE
                          image
                          drawable
                          horizontal
                          vertical)

      ; Re-blur for effect
      (plug-in-gauss-rle2 RUN-NONINTERACTIVE
                          image
                          drawable
                          horizontal
                          vertical)

      ; save and clear
      (gimp-file-save RUN-NONINTERACTIVE image drawable filenameb filenameb)
      (gimp-image-delete image)))

run: gimp -i -b '(simple-unsharp-mask "wallpaper.png" "wallpaper_blured.png" 10.0 10.0)' -b '(gimp-quit 0)'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment