Skip to content

Commit

Permalink
Added configuration for dock position (#78)
Browse files Browse the repository at this point in the history
For those who prefer a different dock position.
  • Loading branch information
freemanjp authored Aug 22, 2018
1 parent 85f6d31 commit b92e71a
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ are shown below):
# The desktop environment to install (gnome / unity / xfce4)
xdesktop_desktop: unity

# The position of the dockbar (applies to gnome only)
xdesktop_dock_position: LEFT

# The format for the desktop clock (applies to xfce4 only)
xdesktop_clock_format:

Expand Down
3 changes: 3 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# The desktop environment to install (gnome / unity / xfce4)
xdesktop_desktop: unity

# The position of the dockbar (applies to gnome only)
xdesktop_dock_position: LEFT

# The format for the desktop clock (applies to xfce4 only)
xdesktop_clock_format:

Expand Down
3 changes: 2 additions & 1 deletion molecule/default/tests/test_gnome.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ def test_for_config_dirs(host, dir_path):
@pytest.mark.parametrize('config_path', [
'/usr/share/X11/xorg.conf.d/60-ansible-screensaver.conf',
'/usr/share/glib-2.0/schemas/20_ansible_screensaver.gschema.override',
'/usr/share/glib-2.0/schemas/20_ansible_lockscreen.gschema.override'
'/usr/share/glib-2.0/schemas/20_ansible_lockscreen.gschema.override',
'/usr/share/glib-2.0/schemas/20_ansible_dock.gschema.override'
])
def test_for_config(host, config_path):
config_file = host.file(config_path)
Expand Down
3 changes: 2 additions & 1 deletion molecule/gnome/tests/test_gnome.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ def test_for_config_dirs(host, dir_path):
@pytest.mark.parametrize('config_path', [
'/usr/share/X11/xorg.conf.d/60-ansible-screensaver.conf',
'/usr/share/glib-2.0/schemas/20_ansible_screensaver.gschema.override',
'/usr/share/glib-2.0/schemas/20_ansible_lockscreen.gschema.override'
'/usr/share/glib-2.0/schemas/20_ansible_lockscreen.gschema.override',
'/usr/share/glib-2.0/schemas/20_ansible_dock.gschema.override'
])
def test_for_config(host, config_path):
config_file = host.file(config_path)
Expand Down
17 changes: 16 additions & 1 deletion tasks/gnome-desktop-configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,21 @@
mode: 'u=rw,go=r'
register: lockscreen_config

- name: assert dock position valid
assert:
that:
- "xdesktop_dock_position in ('LEFT', 'RIGHT', 'BOTTOM')"

- name: write gnome dock config
become: yes
template:
src: dock.gschema.override.j2
dest: '{{ xdesktop_glib_schemas_directory }}/20_ansible_dock.gschema.override'
owner: root
group: root
mode: 'u=rw,go=r'
register: dock_config

- name: apply glib schemas changes
tags:
# Suppress warning: [ANSIBLE0016] Tasks that run when changed should likely be handlers
Expand All @@ -36,4 +51,4 @@
- skip_ansible_lint
become: yes
command: '/usr/bin/glib-compile-schemas {{ xdesktop_glib_schemas_directory }}'
when: screensaver_config.changed or lockscreen_config.changed
when: screensaver_config.changed or lockscreen_config.changed or dock_config.changed
4 changes: 4 additions & 0 deletions templates/dock.gschema.override.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{{ ansible_managed | comment }}

[org.gnome.shell.extensions.dash-to-dock]
dock-position='{{ xdesktop_dock_position }}'

0 comments on commit b92e71a

Please sign in to comment.