Skip to content
This repository has been archived by the owner on Sep 12, 2022. It is now read-only.

Use XFCE or Gnome commands to change background #151

Merged
merged 2 commits into from
May 24, 2018

Conversation

calvinmclean
Copy link
Contributor

Description

I noticed that our new CentOS 7 image did not get the correct desktop background change. This is because it uses XFCE desktop while the Ansible role expected CentOS instances to be using Gnome. This fix checks if XFCE commands are available on the instance, and if not, it uses Gnome commands instead.

This is a fix for CentOS 7, but it is also a big improvement to the task because it uses the correct commands to change the desktop background for XFCE instead of replacing the original background file with our own. It also gets rid of the specific checks for Ubuntu 14 and Ubuntu 16+.

@calvinmclean calvinmclean force-pushed the fix-background branch 2 times, most recently from f3a1bb7 to a8d8f45 Compare May 17, 2018 22:07
- name: Change desktop background
become: yes
become_user: '{{ ATMOUSERNAME }}'
shell: 'export $(dbus-launch); DISPLAY=:{{ item }} {{ change_background_cmd }} "{{ background_dest }}"'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you can remove the with_items here. If you wouldn't mind throwing a comment in to say why dbus-launch is required. If DISPLAY must be set i think we can just use :0.

@calvinmclean
Copy link
Contributor Author

Works great without $DISPLAY. Rebased and pushed the changes. Thanks for your help and D-bus research!

@cdosborn
Copy link
Contributor

Looks good. Whoever is looking at this code is going to wonder why dbus-launch is being used. You can either throw a comment above that line, or put a few sentences in your first commit.

@calvinmclean
Copy link
Contributor Author

Added a comment


# dbus-launch is used here to launch the dbus-daemon and appropriate dekstop session and gather the environment variables that it creates.
# dbus-launch is generally run as part of user login, but that has not happened yet so it is necessary here.
- name: Change desktop background
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically launching dbus is the wrong thing to do here-its definitely a hack. You need to explain not that we're launching dbus nor what dbus does, but that its a hack and why the hack is necessary. I realize that you may not have the holistic reason why its a hack.

We're creating a rogue dbus just so that gsettings will be satisfied. This is the wrong way to use gsettings, because an existing user session + windows would have its own dbus, and never see our updated setting. However, it's okay in this instance, because we nuke the users' desktop. The new desktop will get the updated settings from a file.

@calvinmclean calvinmclean changed the title Use XFCE or Gnome commands to change background WIP: Use XFCE or Gnome commands to change background May 18, 2018
@calvinmclean calvinmclean changed the title WIP: Use XFCE or Gnome commands to change background Use XFCE or Gnome commands to change background May 24, 2018
@calvinmclean
Copy link
Contributor Author

Finished testing latest changes

@cdosborn cdosborn merged commit cf68cc8 into cyverse:master May 24, 2018
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants