284 lines
13 KiB
YAML
284 lines
13 KiB
YAML
---
|
|
# GNOME settings, extensions, and setup.
|
|
|
|
# Temporarily removed while it's broken:
|
|
# , 'com.vscodium.codium.desktop', 'codium.desktop'
|
|
- name: Workstation | Account Management | GNOME | Facts
|
|
set_fact:
|
|
# Only do multiple entries per line if they are for the same exact program.
|
|
gnome_favorites: "[ 'org.gnome.Terminal.desktop'
|
|
, 'org.gnome.Console.desktop'
|
|
, 'gnome-system-monitor.desktop', 'org.gnome.SystemMonitor.desktop'
|
|
, 'org.gnome.Nautilus.desktop'
|
|
, 'io.gitlab.librewolf-community.desktop', 'librewolf.desktop'
|
|
, 'org.mozilla.firefox.desktop', 'firefox.desktop'
|
|
, 'org.signal.Signal.desktop', 'signal-desktop.desktop'
|
|
, 'im.riot.Riot.desktop'
|
|
, 'org.telegram.desktop.desktop'
|
|
, 'com.discordapp.Discord.desktop'
|
|
, 'com.vscodium.codium.desktop'
|
|
, 'com.google.AndroidStudio.desktop'
|
|
, 'org.shotcut.Shotcut.desktop'
|
|
, 'io.lmms.LMMS.desktop'
|
|
, 'io.lbry.lbry-app.desktop', 'lbry.desktop'
|
|
, 'com.valvesoftware.Steam.desktop'
|
|
]"
|
|
dconf_terminal: gnome-terminal
|
|
dconf_theme: Adwaita-dark
|
|
dconf_icons: Adwaita
|
|
# 2024-01-28 Not currently using local email clients.
|
|
#, 'org.gnome.Evolution.desktop'
|
|
#, 'chat.delta.desktop.desktop', 'deltachat.desktop'
|
|
#, 'org.gnome.Geary.desktop'
|
|
#, 'org.mozilla.Thunderbird.desktop'
|
|
# 2025-01-01
|
|
# Reduce the amount of icons on the sidebar, things that may get added back.
|
|
#, 'com.visualstudio.code-oss.desktop', 'code-oss.desktop'
|
|
#, 'org.godotengine.Godot.desktop'
|
|
|
|
- name: Workstation | Account Management | GNOME | Facts (NixOS)
|
|
set_fact:
|
|
dconf_terminal: kgx
|
|
when: ansible_distribution in ("NixOS")
|
|
|
|
- name: Workstation | Account Management | GNOME | Facts (Ubuntu)
|
|
set_fact:
|
|
dconf_theme: Yaru-purple-dark
|
|
dconf_icons: Yaru-purple-dark
|
|
when: ansible_distribution in ("Ubuntu")
|
|
|
|
# Make sure Gnome-Tweaks is installed
|
|
- name: Workstation | Account Management | GNOME | Install Dependencies
|
|
package:
|
|
name:
|
|
- "{{ gnome_tweaks }}"
|
|
- "{{ dconf_editor }}"
|
|
- "{{ psutil }}"
|
|
state: present
|
|
when: ansible_distribution not in ("NixOS")
|
|
|
|
## Dash to Dock Extension ##
|
|
# Note: Validate DtD by checking /org/gnome/shell/enabled-extensions for dash-to-dock@micxgx.gmail.com
|
|
|
|
- name: Workstation | Account Management | GNOME | Dash To Dock
|
|
block:
|
|
|
|
- name: Workstation | Account Management | GNOME | Dash To Dock | Check
|
|
shell: "cd ~/.local/share/gnome-shell/extensions/dash-to-dock@micxgx.gmail.com/"
|
|
become_user: "{{ user }}"
|
|
register: dash_to_dock_exists
|
|
|
|
# Install #
|
|
# https://micheleg.github.io/dash-to-dock/download.html
|
|
|
|
- name: Workstation | Account Management | GNOME | Dash To Dock | Install | Clone Repo
|
|
git:
|
|
repo: https://github.com/micheleg/dash-to-dock.git
|
|
dest: "~/TRASH/dash-to-dock/"
|
|
clone: yes
|
|
force: no
|
|
version: master
|
|
become_user: "{{ user }}"
|
|
when: ansible_distribution not in ("Ubuntu") and dash_to_dock_exists.failed
|
|
|
|
- name: Workstation | Account Management | GNOME | Dash To Dock | Install | Dependencies
|
|
package:
|
|
name:
|
|
- "{{ make }}"
|
|
- "{{ msgfmt }}"
|
|
- "{{ sassc }}"
|
|
state: present
|
|
when: ansible_distribution not in ("Ubuntu") and dash_to_dock_exists.failed
|
|
|
|
- name: Workstation | Account Management | GNOME | Dash To Dock | Install | Make
|
|
shell: "cd ~/TRASH/dash-to-dock/; {{ make }}; {{ make }} install"
|
|
become_user: "{{ user }}"
|
|
when: ansible_distribution not in ("Ubuntu") and dash_to_dock_exists.failed
|
|
|
|
- name: Workstation | Account Management | GNOME | Dash To Dock | Read Enabled Extension Array
|
|
dconf:
|
|
key: /org/gnome/shell/enabled-extensions
|
|
state: read
|
|
become_user: "{{ user }}"
|
|
register: gnome_enabled_extensions
|
|
when: ansible_distribution not in ("Ubuntu") and dash_to_dock_exists.failed
|
|
|
|
- name: Workstation | Account Management | GNOME | Dash To Dock | dconf Return Object
|
|
debug:
|
|
var: gnome_enabled_extensions
|
|
when: ansible_distribution not in ("Ubuntu") and dash_to_dock_exists.failed
|
|
|
|
# https://ansible-docs.readthedocs.io/zh/stable-2.0/rst/playbooks_filters.html#filters-for-formatting-data
|
|
|
|
- name: Workstation | Account Management | GNOME | Dash To Dock | Variables 1
|
|
set_fact:
|
|
gnome_enabled_extensions: "{{ gnome_enabled_extensions.value | replace('@as ', '') }}"
|
|
dash_to_dock_ext_comma: ""
|
|
when: ansible_distribution not in ("Ubuntu") and dash_to_dock_exists.failed
|
|
|
|
- name: Workstation | Account Management | GNOME | Dash To Dock | After replace()
|
|
debug:
|
|
var: gnome_enabled_extensions
|
|
when: ansible_distribution not in ("Ubuntu") and dash_to_dock_exists.failed
|
|
|
|
- name: Workstation | Account Management | GNOME | Dash To Dock | Variables 2
|
|
set_fact:
|
|
dash_to_dock_ext_comma: ", "
|
|
when: ansible_distribution not in ("Ubuntu") and dash_to_dock_exists.failed and gnome_enabled_extensions not in ("[]", [], "None")
|
|
|
|
- name: Workstation | Account Management | GNOME | Dash To Dock | Variables 3
|
|
set_fact:
|
|
dash_to_dock_ext_name: "{{ dash_to_dock_ext_comma }}'dash-to-dock@micxgx.gmail.com']"
|
|
when: ansible_distribution not in ("Ubuntu") and dash_to_dock_exists.failed
|
|
|
|
- name: Workstation | Account Management | GNOME | Dash To Dock | Variables 4
|
|
set_fact:
|
|
gnome_enabled_extensions: "[]"
|
|
when: ansible_distribution not in ("Ubuntu") and dash_to_dock_exists.failed and gnome_enabled_extensions == "None"
|
|
|
|
- name: Workstation | Account Management | GNOME | Dash To Dock | Print Value To Append With
|
|
debug:
|
|
var: dash_to_dock_ext_name
|
|
when: ansible_distribution not in ("Ubuntu") and dash_to_dock_exists.failed
|
|
|
|
- name: Workstation | Account Management | GNOME | Dash To Dock | Print Value To Append To
|
|
debug:
|
|
var: gnome_enabled_extensions
|
|
when: ansible_distribution not in ("Ubuntu") and dash_to_dock_exists.failed
|
|
|
|
- name: Workstation | Account Management | GNOME | Dash To Dock | Print Combined Value
|
|
debug:
|
|
msg: "{{ gnome_enabled_extensions | replace(']', dash_to_dock_ext_name) }}"
|
|
when: ansible_distribution not in ("Ubuntu") and dash_to_dock_exists.failed
|
|
|
|
- name: Workstation | Account Management | GNOME | Dash To Dock | Enable
|
|
dconf:
|
|
key: /org/gnome/shell/enabled-extensions
|
|
value: "{{ gnome_enabled_extensions | replace(']', dash_to_dock_ext_name) }}"
|
|
state: present
|
|
become_user: "{{ user }}"
|
|
when: ansible_distribution not in ("Ubuntu") and dash_to_dock_exists.failed
|
|
|
|
when: ansible_distribution not in ("NixOS")
|
|
ignore_errors: yes
|
|
# End block for Dash To Dock.
|
|
|
|
# Apply dconf settings through RC files due to distros without working psutil.
|
|
- name: Workstation | Account Management | GNOME | Settings
|
|
blockinfile:
|
|
path: "{{ user_user.home }}/{{ item }}"
|
|
block: |
|
|
## Temporary Variables + Functions ##
|
|
|
|
dconf_count=1
|
|
function inc_dconf() {
|
|
dconf_count=$(( dconf_count + 1 ))
|
|
}
|
|
|
|
## Dash to Dock ##
|
|
|
|
dconf write /org/gnome/shell/extensions/dash-to-dock/dock-position "'LEFT'" && inc_dconf &&
|
|
dconf write /org/gnome/shell/extensions/dash-to-dock/dock-fixed true && inc_dconf &&
|
|
dconf write /org/gnome/shell/extensions/dash-to-dock/dash-max-icon-size 24 && inc_dconf &&
|
|
|
|
dconf write /org/gnome/shell/favorite-apps "{{ gnome_favorites }}" && inc_dconf &&
|
|
|
|
## Generic ##
|
|
|
|
dconf write /org/gnome/desktop/interface/color-scheme "'prefer-dark'" && inc_dconf &&
|
|
dconf write /org/gnome/desktop/interface/gtk-theme "'{{ dconf_theme }}'" && inc_dconf &&
|
|
dconf write /org/gnome/desktop/interface/icon-theme "'{{ dconf_icons }}'" && inc_dconf &&
|
|
|
|
dconf write /org/gnome/desktop/interface/clock-show-date true && inc_dconf &&
|
|
dconf write /org/gnome/desktop/interface/clock-format "'24h'" && inc_dconf &&
|
|
dconf write /org/gnome/desktop/interface/clock-show-seconds true && inc_dconf &&
|
|
dconf write /org/gnome/desktop/interface/clock-show-weekday true && inc_dconf &&
|
|
dconf write /org/gnome/desktop/calendar/show-weekdate true && inc_dconf &&
|
|
|
|
dconf write /org/gnome/desktop/interface/show-battery-percentage true && inc_dconf &&
|
|
|
|
dconf write /org/gnome/desktop/wm/preferences/button-layout "'appmenu:minimize,maximize,close'" && inc_dconf &&
|
|
|
|
dconf write /org/gnome/desktop/wm/preferences/num-workspaces 1 && inc_dconf &&
|
|
dconf write /org/gnome/mutter/dynamic-workspaces false && inc_dconf &&
|
|
|
|
dconf write /org/gnome/mutter/edge-tiling true && inc_dconf &&
|
|
dconf write /org/gnome/desktop/interface/enable-hot-corners false && inc_dconf &&
|
|
|
|
dconf write /org/gnome/mutter/center-new-windows true && inc_dconf &&
|
|
|
|
dconf write /org/gnome/desktop/notifications/show-banners false && inc_dconf &&
|
|
dconf write /org/gnome/desktop/notifications/application/org-gnome-evolution-alarm-notify/enable-sound-alerts false && inc_dconf &&
|
|
dconf write /org/gnome/desktop/notifications/application/org-gnome-evolution-alarm-notify/enable false && inc_dconf &&
|
|
dconf write /org/gnome/desktop/notifications/application/org-gnome-evolution/enable-sound-alerts false && inc_dconf &&
|
|
dconf write /org/gnome/desktop/notifications/application/org-gnome-evolution/enable false && inc_dconf &&
|
|
|
|
dconf write /org/gnome/settings-daemon/plugins/color/night-light-enabled true
|
|
dconf write /org/gnome/settings-daemon/plugins/color/night-light-schedule-automatic false
|
|
dconf write /org/gnome/settings-daemon/plugins/color/night-light-temperature "uint32 3170"
|
|
dconf write /org/gnome/settings-daemon/plugins/color/night-light-schedule-from 2.0
|
|
dconf write /org/gnome/settings-daemon/plugins/color/night-light-schedule-to 1.99
|
|
|
|
## Keyboard Shortcuts ##
|
|
|
|
dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/binding \
|
|
"'<Control><Alt>t'" && inc_dconf &&
|
|
dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/command \
|
|
"'{{ dconf_terminal }}'" && inc_dconf &&
|
|
dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/name \
|
|
"'Open Terminal'" && inc_dconf &&
|
|
|
|
dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/binding \
|
|
"'<Super>t'" && inc_dconf &&
|
|
dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/command \
|
|
"'{{ dconf_terminal }}'" && inc_dconf &&
|
|
dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/name \
|
|
"'Open Terminal 2'" && inc_dconf &&
|
|
|
|
dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings "
|
|
[ '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/'
|
|
, '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/'
|
|
]" && inc_dconf &&
|
|
|
|
## Privacy ##
|
|
|
|
dconf write /org/gnome/desktop/privacy/disable-camera true && inc_dconf &&
|
|
dconf write /org/gnome/desktop/privacy/disable-microphone true && inc_dconf &&
|
|
|
|
dconf write /org/gnome/desktop/privacy/recent-files-max-age 7 && inc_dconf &&
|
|
dconf write /org/gnome/desktop/privacy/remember-recent-files false && inc_dconf &&
|
|
|
|
dconf write /org/gnome/desktop/privacy/old-files-age "uint32 14" && inc_dconf &&
|
|
dconf write /org/gnome/desktop/privacy/remove-old-trash-files true && inc_dconf &&
|
|
dconf write /org/gnome/desktop/privacy/remove-old-temp-files true && inc_dconf &&
|
|
|
|
dconf write /org/gnome/desktop/notifications/show-in-lock-screen false && inc_dconf &&
|
|
dconf write /org/gnome/desktop/screensaver/lock-enabled true && inc_dconf &&
|
|
dconf write /org/gnome/desktop/screensaver/lock-delay "uint32 0" && inc_dconf &&
|
|
dconf write /org/gnome/desktop/session/idle-delay "uint32 900" && inc_dconf &&
|
|
dconf write /org/gnome/settings-daemon/plugins/power/sleep-inactive-ac-type "'nothing'" && inc_dconf &&
|
|
dconf write /org/gnome/settings-daemon/plugins/power/power-button-action "'nothing'" && inc_dconf &&
|
|
|
|
dconf write /org/gnome/desktop/media-handling/autorun-never true && inc_dconf &&
|
|
|
|
## Success ##
|
|
|
|
sleep 0 ||
|
|
|
|
## Error Catch ##
|
|
|
|
echo "ERROR: DConf setting# $dconf_count failed!"
|
|
|
|
## Cleanup ##
|
|
|
|
unset -f inc_dconf
|
|
unset dconf_count
|
|
marker: '# {mark} MANAGED BY ANSIBLE | NixOS GNOME Settings'
|
|
state: present
|
|
create: yes
|
|
backup: yes
|
|
become_user: "{{ user }}"
|
|
loop:
|
|
- .bashrc
|
|
- .zshrc
|