Skip to content

Instantly share code, notes, and snippets.

@raphaelbs
Created February 19, 2019 20:58
Show Gist options
  • Save raphaelbs/1688d3043535819cedf3ecbd3304290c to your computer and use it in GitHub Desktop.
Save raphaelbs/1688d3043535819cedf3ecbd3304290c to your computer and use it in GitHub Desktop.
Set Himawari as dekstop and lockscreen
#!/bin/bash
# http://bit.ly/2ines3u
# Wallpaper's directory.
dir="${HOME}/.cache/himawaripy/"
# export DBUS_SESSION_BUS_ADDRESS environment variable
PID=$(pgrep gnome-session)
export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ | cut -d= -f2-)
# Random wallpaper.
wallpaper=`find "${dir}" -type f | shuf -n1`
echo "Set wallpaper: ${wallpaper}"
# Change wallpaper.
# http://bit.ly/HYEU9H
gsettings set org.gnome.desktop.background picture-options "scaled"
gsettings set org.gnome.desktop.background picture-uri "file://${wallpaper}"
gsettings set org.gnome.desktop.background primary-color "#000000"
gsettings set org.gnome.desktop.background secondary-color "#000000"
gsettings set org.gnome.desktop.background color-shading-type "solid"
gsettings set org.gnome.desktop.screensaver picture-options "scaled"
gsettings set org.gnome.desktop.screensaver picture-uri "file://${wallpaper}"
gsettings set org.gnome.desktop.screensaver primary-color "#000000"
gsettings set org.gnome.desktop.screensaver secondary-color "#000000"
gsettings set org.gnome.desktop.screensaver color-shading-type "solid"
cp $wallpaper /usr/share/backgrounds/himawari.png
@raphaelbs
Copy link
Author

raphaelbs commented Feb 23, 2019

Also, edit the file

sudo gedit /usr/share/gnome-shell/theme/ubuntu.css

and change #lockDialogGroup css to:

#lockDialogGroup {
  background: #000000 url(file:///usr/share/backgrounds/himawari.png);
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
}

Note 1: You may need to give access to /usr/share/backgrounds/ folder:

sudo chmod 777 /usr/share/backgrounds/

Note 2: You may need to add path variable to crontab:

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