Skip to main content

View / Edit on GitHub: home/.chezmoiscripts_disabled/disabled/run_onchange_after_99-restart-gnome.sh.tmpl

GNOME Restart

Reloads gnome-shell so that the theme is properly loaded

Overview

This script reloads the gnome-shell so that the theme is properly loaded without having to reboot. This only runs when the HEADLESS_INSTALL variable is passed because, unless you are provisioning the session headlessly, you probably want to retain the terminal window that initialized the provisioning process since it contains all the logs.

Logs

Regardless of whether or not this script runs, you can access the provisioning logs by browsing through ${XDG_DATA_HOME:-$HOME/.local/share}/megabyte-labs/betelgeuse.$(date +%s).log

Source Code

{{- if eq .host.distro.family "linux" -}}
#!/usr/bin/env bash
# @file GNOME Restart
# @brief Reloads `gnome-shell` so that the theme is properly loaded
# @description
# This script reloads the `gnome-shell` so that the theme is properly loaded without having to reboot. This
# only runs when the `HEADLESS_INSTALL` variable is passed because, unless you are provisioning the session headlessly,
# you probably want to retain the terminal window that initialized the provisioning process since it contains
# all the logs.
#
# ## Logs
#
# Regardless of whether or not this script runs, you can access the provisioning logs by browsing through
# `${XDG_DATA_HOME:-$HOME/.local/share}/megabyte-labs/betelgeuse.$(date +%s).log`

{{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }}

### Restart GNOME if `HEADLESS_INSTALL` is defined and `gnome-shell` is available
if [ -n "$HEADLESS_INSTALL" ] && command -v gnome-shell > /dev/null; then
logg info 'Reloading gnome-shell'
killall -3 gnome-shell
else
logg info 'Manually reload gnome-shell to see changes'
fi

{{ end -}}