0

I am currently in a learning program. We are asked to download a specific image and then use it as wallpaper, doing so form the command line. The directions given yields nothing:

First we have to download an image, and then we will use the command to make it our background.

$ wget -O ~/Downloads/wallpaper.jpg  "https://raw.githubusercontent.com/hoppersroppers/hoppersroppers.github.io/main/_layouts/constitution.jpg"

$ gsettings set org.gnome.desktop.background picture-uri file:////tmp/wallpaper.jpg

Now your background image should be a picture of a ship! If it didn't work, troubleshoot.

https://linuxhandbook.com/get-file-path/#Use%20The%20Find%20Command%20to%20Get%20The%20Absolute%20File%20Path

https://www.baeldung.com/linux/change-desktop-wallpaper-from-terminal primarily because C/P the commands as given yields no change. I am figuring this is a "test". I don't understand why its directing to tmp if the image is in downloads?

ob@adminbaby:~/Desktop$  wmctrl -m
Name: GNOME Shell
Class: N/A
PID: N/A
Window manager's "showing the desktop" mode: OFF

bob@adminbaby:~/Desktop$ gsettings set org.gnome.desktop.background picture-uri file:////tmp/wallpaper.jpg bob@adminbaby:~/Desktop$ pwd /home/bob/Desktop bob@adminbaby:~/Desktop$ ls first bob@adminbaby:~/Desktop$ sudo gsettings set org.gnome.desktop.background picture-uri file:////tmp/wallpaper.jpg [sudo] password for bob:

(process:2230): dconf-WARNING **: 16:39:33.016: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory) bob@adminbaby:~/Desktop$ gsettings set org.gnome.desktop.background picture-uri file://// ~/Downloads/wallpaper.jpg Usage: gsettings [--schemadir SCHEMADIR] set SCHEMA[:PATH] KEY VALUE

Set the value of KEY to VALUE

Arguments: SCHEMADIR A directory to search for additional schemas SCHEMA The name of the schema PATH The path, for relocatable schemas KEY The key within the schema VALUE The value to set

bob@adminbaby:~/Desktop$ sudo gsettings set org.gnome.desktop.background picture-uri file:////home/bob/Downloads.jpg

(process:2240): dconf-WARNING **: 16:40:57.446: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory) bob@adminbaby:~/Desktop$ gsettings set org.gnome.desktop.background picture-uri file:////home/bob/Downloads/wallpaper.jpg bob@adminbaby:~/Desktop$ sudo gsettings set org.gnome.desktop.background picture-uri file:////tmp/wallpaper.jpg bob@adminbaby:~/Desktop$ wmctrl -m Command 'wmctrl' not found, but can be installed with: sudo apt install wmctrl bob@adminbaby:~/Desktop$ sudo apt install wmctrl Reading package lists... Done Building dependency tree... Done Reading state information... Done The following NEW packages will be installed: wmctrl 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 20.6 kB of archives. After this operation, 63.5 kB of additional disk space will be used. Get:1 http://us.archive.ubuntu.com/ubuntu lunar/universe amd64 wmctrl amd64 1.07-7ubuntu1 [20.6 kB] Fetched 20.6 kB in 0s (62.8 kB/s) Selecting previously unselected package wmctrl. (Reading database ... 203962 files and directories currently installed.) Preparing to unpack .../wmctrl_1.07-7ubuntu1_amd64.deb ... Unpacking wmctrl (1.07-7ubuntu1) ... Setting up wmctrl (1.07-7ubuntu1) ... Processing triggers for man-db (2.11.2-1) ... bob@adminbaby:~/Desktop$ wmctrl -m Name: GNOME Shell Class: N/A PID: N/A Window manager's "showing the desktop" mode: OFF bob@adminbaby:~/Desktop$ realpath -s wallpaper.jpg /home/bob/Desktop/wallpaper.jpg bob@adminbaby:~/Desktop$ sudo gsettings set org.gnome.desktop.background picture-uri file://///home/bob/Desktop/wallpaper.jpg

(process:2829): dconf-WARNING **: 16:53:30.948: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory) bob@adminbaby:~/Desktop$ gsettings set org.gnome.desktop.background picture-uri file:///home/bob/Downloads/wallpaper.jpg bob@adminbaby:~/Desktop$

bob@adminbaby:~/Desktop$ realpath -s wallpaper.jpg /home/bob/Desktop/wallpaper.jpg bob@adminbaby:~/Desktop$ sudo gsettings set org.gnome.desktop.background picture-uri file://///home/bob/Desktop/wallpaper.jpg (process:2829): dconf-WARNING **: 16:53:30.948: failed to commit changes to dconf: Failed to execute child process “dbus-launch” (No such file or directory) bob@adminbaby:~/Desktop$

sotirov
  • 3,169

1 Answers1

0

You used correct commands to change the wallpaper. Except you need not use sudo with gsettings command. The following commands will download and change desktop background.

wget -O ~/Downloads/wallpaper.jpg  "https://raw.githubusercontent.com/hoppersroppers/hoppersroppers.github.io/main/_layouts/constitution.jpg"

gsettings set org.gnome.desktop.background picture-uri file:///$HOME/Downloads/wallpaper.jpg # $HOME will expand to /home/bob

Similar issue was discussed here The gsettings command line tool doesn't change the background.

davidt930
  • 157
  • 5
  • i used sudo because i dont know what im dong and i just tried it after a million other attempts. I ran these commands you gave me and the result is the same. could this have anything to do with it being a VM and some settting or something i didnt check? – bryce colwell Sep 27 '23 at 17:26
  • @brycecolwell I don't think it has to do with VM. What version of Ubuntu are you using( cat /etc/os-release)? 1. Make sure you are using Gnome Desktop Enviroment (echo $XDG_CURRENT_DESKTOP). 2. Ensure you have ~/.config/dconf folder with correct ownership and permissions(see) – davidt930 Sep 28 '23 at 05:47
  • 8 hours later i returned to the machine after it was suspended. the wallpaper was changed. prior i had rebooted several times. is there any explanation for this? im really confused. on another laptop running the prior version of ubuntu but the latest kernel the above commands changed the screen blue. – bryce colwell Sep 28 '23 at 18:37
  • I'm not sure why it's taking a suspend for wallpaper change. It should be immediate. gsettings saves changes to $HOME/.conf/dconf/user database[2]. After changing the wallpaper try running strings $HOME/.config/dconf/user|grep -i uri to make sure picture-uri is set as desired. [2][link](https://unix.stackexchange.com/questions/107402/when-do-changes-to-gsettings-take-place#answer-114706) – davidt930 Sep 30 '23 at 01:35