First of all, make sure the file path is correct. Execute this line in a terminal:
ls / home / user / Pictures / wallpapers / X
Make sure that you know where the gsettings
command is. In the terminal, run:
which gsettings
Let's say the path is /usr/bin/gsettings
.
Try to execute this in a terminal:
/usr/bin / gsettings set org.gnome.desktop.background picture - uri / home / user / Pictures / wallpapers / X
Try this:
import os
os.system("gsettings set org.gnome.desktop.background picture-uri file:/home/user/Pictures/wallpapers/picture_name")
Try this one:
import subprocess
subprocess.Popen("DISPLAY=:0 GSETTINGS_BACKEND=dconf /usr/bin/gsettings set org.gnome.desktop.background picture-uri file://{0}".format(picture_path), shell = True)
also you could try the following commands:
feh--bg - fill picture_path
hsetroot - extend picture_path
To set a specific wallpaper, the command is:
gsettings set org.gnome.desktop.background picture - uri 'file:///home/user/Pictures/wallpapers/apple.jpg'
The command to see (get) what is the current wallpaper:
gsettings get org.gnome.desktop.background picture - uri
I want to change my wallpaper in Ubuntu 11.10 (with Unity) in a small Python script. I found the possibility to change it via the gconf-editor in /desktop/gnome/background/picture_filename. With python-gconf, I'm able to change the necessary values.,Unfortunately, gconf doesn't really clean up after itself very well. That's and old setting. With GNOME3 and Unity in 11.10, the desktop background setting is now stored in dconf. With dconf-editor you can find the setting at org.gnome.desktop.background.picture-uri , 2 Just saw that 'commands' is deprecated. w = "/usr/share/backgrounds/warty-final-ubuntu.png"; c = 'gsettings set org.gnome.desktop.background picture-uri "file://%s"' % w; import subprocess; subprocess.call(c.split()) – dirkk0 Jan 2, 2017 at 6:38 ,Apparently, the gconf string is not read out. If I change it (either via a script or via gconf-editor), the wallpaper remains and in the menu of "Change wallpaper", the old wallpaper is shown.
Here's a quick example showing how to change the background with python, GTK, and GObject Introspection:
#! /usr/bin/python
from gi.repository
import Gtk, Gio
class BackgroundChanger(Gtk.Window):
SCHEMA = 'org.gnome.desktop.background'
KEY = 'picture-uri'
def __init__(self):
Gtk.Window.__init__(self, title = "Background Changer")
box = Gtk.Box(spacing = 6)
self.add(box)
button1 = Gtk.Button("Set Background Image")
button1.connect("clicked", self.on_file_clicked)
box.add(button1)
def on_file_clicked(self, widget):
gsettings = Gio.Settings.new(self.SCHEMA)
dialog = Gtk.FileChooserDialog("Please choose a file", self,
Gtk.FileChooserAction.OPEN,
(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
Gtk.STOCK_OPEN, Gtk.ResponseType.OK))
self.add_filters(dialog)
response = dialog.run()
if response == Gtk.ResponseType.OK:
background = dialog.get_filename()
gsettings.set_string(self.KEY, "file://" + background)
elif response == Gtk.ResponseType.CANCEL:
pass
dialog.destroy()
def add_filters(self, dialog):
filter_image = Gtk.FileFilter()
filter_image.set_name("Image files")
filter_image.add_mime_type("image/*")
dialog.add_filter(filter_image)
filter_any = Gtk.FileFilter()
filter_any.set_name("Any files")
filter_any.add_pattern("*")
dialog.add_filter(filter_any)
win = BackgroundChanger()
win.connect("delete-event", Gtk.main_quit)
win.show_all()
Gtk.main()
Here you go
#! /usr/bin/python import os os.system("gsettings set org.gnome.desktop.background picture-uri file:///home/user/Pictures/wallpaper/Stairslwallpaper.png")
Maybe not the best but the easiest solution:
import commands
command = 'gsettings set org.gnome.desktop.background picture-uri "file:///home/user/test.png"'
status, output = commands.getstatusoutput(command)
To set a specific wallpaper, the command is: gsettings set org.gnome.desktop.background picture-uri 'file:///home/jacob/Thema/Bureaublad4/Frog.jpg' ,We can make the script restore the original wallpaper if it has changed.,You could make a small script to run in the background that checks every x seconds if the current wallpaper is still the wallpaper that you set in the first place.,The command to see (get) what is the current wallpaper: gsettings get org.gnome.desktop.background picture-uri If you run this in a terminal, you will get an output looking like: 'file:///home/jacob/Thema/Bureaublad4/Frog.jpg'
The command to see (get) what is the current wallpaper:
gsettings get org.gnome.desktop.background picture - uri
If you run this in a terminal, you will get an output looking like:
'file:///home/jacob/Thema/Bureaublad4/Frog.jpg'
To set a specific wallpaper, the command is:
gsettings set org.gnome.desktop.background picture - uri 'file:///home/jacob/Thema/Bureaublad4/Frog.jpg'
The command to see (get) what is the current wallpaper:
gsettings get org.gnome.desktop.background picture - uri
If you run this in a terminal, you will get an output looking like:
'file:///home/jacob/Thema/Bureaublad4/Frog.jpg'
To set a specific wallpaper, the command is:
gsettings set org.gnome.desktop.background picture - uri 'file:///home/jacob/Thema/Bureaublad4/Frog.jpg'
The only difference for 12.04 is the shebang: 12.04 does not come with python3 by default, so the shebang should be:
#!/usr/bin/env python
run it by the command:
python3 / path / to / something.py
run it by the command:
python3 / path / to / something.py
or (12.04)
python / path / to / something.py
We will actually use the packages provided by Ubuntu Mate team to easily install MATE desktop environment in Ubuntu 18.04 and other versions. Please note that the same method MAY NOT applicable for installing MATE in Linux Mint.,Recently I wrote about installing Cinnamon in Ubuntu. In this tutorial, we’ll see how to install MATE desktop in Ubuntu.,You can guess the popularity of MATE desktop from the fact that Ubuntu MATE is one of the official Ubuntu flavors. Even Linux Mint has a MATE version.,Once you have installed MATE desktop, log out of the system. On the login screen, click on Ubuntu sign, besides the username, to choose a desktop environment.
You should ensure that our system is fully updated before installing a new Desktop Environment.
sudo apt update && sudo apt upgrade - y sudo apt install ubuntu - mate - desktop
Okay! so you tried MATE and you did not like it. Now, how to uninstall MATE from Ubuntu? To do that, we shall be using the apt remove commands as follows:
sudo apt remove - y ubuntu - mate - desktop mate - * ubuntu - mate - * plymouth - theme - ubuntu - mate - * lightdm
sudo apt autoremove - y
sudo apt install--reinstall - y gdm3
It sounds like you might have managed to uninstall your desktop environment. (Unless Karmic has replaced GDM, which I doubt.),If you were using GNOME, you probably installed Karmic with the ubuntu-desktop. You'll want to reinstall that:,That should pull in any missing packages. Once you've reinstalled, you should be able to run,Now, restart your system and see if gdm automatically starts or not. This is where everything should fall into place. However, sometimes things aren't that simple.
If you were using GNOME, you probably installed Karmic with the ubuntu-desktop. You'll want to reinstall that:
sudo apt - get install ubuntu - desktop
...or possibly
sudo apt - get--reinstall install ubuntu - desktop
That should pull in any missing packages. Once you've reinstalled, you should be able to run
sudo / etc / init.d / gdm restart
My solution has been to edit the file /etc/lxdm/default.conf
and set the server section this way
[server] # # arg used to start xserver, not fully function arg = /usr/bin / X - background vt1
Purged unity-greeter which was the default lightdm greeter for my unity desktop:
sudo apt - get remove--purge unity - greeter
Then I installed lightdm-gtk-greeter:
sudo apt - get - y install lightdm - gtk - greeter
Removed lightdm-gtk-greeter:
sudo apt - get remove--purge lightdm - gtk - greeter
Installed unity-greeter:
sudo apt - get - y install unity - greeter