Chad 742f225de1
General Enhancements (#51)
* Fix website not being trashed during reseed.

* Fix port flags.

* Fix errors about comments by being sneaky.

* Add `encfs`.

* Leave the audio alone when compressing videos unless explicitly requested.

* ffmpeg seems to default to 128k audio, raise it to 192k.

* Handle `time` not being installed more gracefully.

* Add audio normlization per Cahlen Lee.

* Try preventing directories from being renamed.

* Add ability to resize videos, similar to process-video in my Termux project's bashrc.

* Add an -A parameter similar to compress_image.sh.

* Handle uppercase extensions, use TRASH for old compressed copies if it exists, print the FFMPEG command.

* Add datestamps around the conversion.

* Maxrate has been working well in Termux project, use it on desktop too, but don't worry about 2-pass.

* Automatically source Docker environment for using manage.sh if user is root and file exists.

* Add android studio.

* Add missing pipes.

* Stop including Nix, inclue TTT, add git stash to reset.
2024-05-16 10:00:49 -07:00

280 lines
12 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.Nautilus.desktop'
, 'io.gitlab.librewolf-community.desktop', 'librewolf.desktop'
, 'org.mozilla.firefox.desktop', 'firefox.desktop'
, 'com.visualstudio.code-oss.desktop', 'code-oss.desktop'
, 'com.google.AndroidStudio.desktop'
, 'org.godotengine.Godot.desktop'
, 'org.shotcut.Shotcut.desktop'
, 'io.lbry.lbry-app.desktop', 'lbry.desktop'
, 'org.signal.Signal.desktop', 'signal-desktop.desktop'
, 'im.riot.Riot.desktop'
, 'org.telegram.desktop.desktop'
, 'com.discordapp.Discord.desktop'
, 'com.valvesoftware.Steam.desktop'
]"
dconf_terminal: gnome-terminal
dconf_theme: Adwaita-dark
dconf_icons: Adwaita
# 2024-01-28 No longer using local email clients.
#, 'org.gnome.Evolution.desktop'
#, 'chat.delta.desktop.desktop', 'deltachat.desktop'
#, 'org.gnome.Geary.desktop'
#, 'org.mozilla.Thunderbird.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