├── config ├── custom.css └── set-gdm-theme.conf ├── completions └── fish │ ├── gnomeconf2gdm.fish │ └── set-gdm-theme.fish ├── libalpm ├── hooks │ └── gdm-tools-set-gdm-theme.hook └── scripts │ └── gdm-tools-set-gdm-theme ├── uninstall.sh ├── install.sh ├── bin ├── gnomeconf2gdm └── set-gdm-theme ├── README.md ├── man1 └── set-gdm-theme.1 └── LICENSE /config/custom.css: -------------------------------------------------------------------------------- 1 | /* 2 | * You can put your custom CSS here. It will be appended 3 | * to every theme before it gets set as GDM theme. 4 | */ 5 | 6 | /* Login Screen */ 7 | #lockDialogGroup { 8 | } 9 | 10 | /* Top Panel of login screen*/ 11 | #panel.login-screen { 12 | } 13 | -------------------------------------------------------------------------------- /completions/fish/gnomeconf2gdm.fish: -------------------------------------------------------------------------------- 1 | set -l all_subcmds -r reset -h help --help 2 | complete -x -c gnomeconf2gdm -n "not __fish_seen_subcommand_from $all_subcmds" -a "-r reset" -r -d "Reset GDM Settings" 3 | complete -x -c gnomeconf2gdm -n "not __fish_seen_subcommand_from $all_subcmds" -a "-h --help help" -r -d "Show Help Message" 4 | -------------------------------------------------------------------------------- /libalpm/hooks/gdm-tools-set-gdm-theme.hook: -------------------------------------------------------------------------------- 1 | [Trigger] 2 | Type = Path 3 | Operation = Install 4 | Operation = Upgrade 5 | Target = usr/share/gnome-shell/gnome-shell-theme.gresource 6 | 7 | [Action] 8 | Description = Re-applying GDM theme and background... 9 | When = PostTransaction 10 | Exec = /usr/share/libalpm/scripts/gdm-tools-set-gdm-theme 11 | -------------------------------------------------------------------------------- /libalpm/scripts/gdm-tools-set-gdm-theme: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | currentThemeFile=/etc/gdm-tools/currentTheme # File to store name of the current GDM theme 3 | currentBackgroundFile=/etc/gdm-tools/currentBackground # File to store type of the current GDM background 4 | if [ -f $currentThemeFile ] || [ -f $currentBackgroundFile ]; then 5 | set-gdm-theme set --background 6 | fi 7 | -------------------------------------------------------------------------------- /config/set-gdm-theme.conf: -------------------------------------------------------------------------------- 1 | # This file can be used to set variables used by set-gdm-theme 2 | # Use this file with caution. It may break program 'set-gdm-theme'. 3 | 4 | # Sometimes distros like Manjaro put the default gresource file with a different name 5 | # and put their custom/modified theme's gresource file as the default gresource file. 6 | # Following variable tells set-gdm-theme to use provided gresource file as default instead 7 | # of what is present at the default location. 8 | # On Manjaro (with Manjaro Branding) it will be 9 | #defaultGresource=/usr/share/gnome-shell/gnome-shell-theme.gresource.old 10 | 11 | # Most of Gnome-Shell/GDM themes are incomplete (some resources e.g. icons; are missing). This 12 | # option allows chosen theme to be an overlay on top of the default theme; so that if a 13 | # resource is missing, the default one could be used. 14 | # Possible values: none, resources, full 15 | # Default value: resources 16 | #overlayMode=resources 17 | -------------------------------------------------------------------------------- /uninstall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | [ -z "$DESTDIR" ] && DESTDIR=/ 3 | [ -z "$PREFIX" ] && PREFIX="/usr/local" 4 | 5 | currentDir="$(realpath "$(dirname "$0")")" 6 | binDir="$(realpath -m "$DESTDIR"/"$PREFIX"/bin)" 7 | manDir="$(realpath -m "$DESTDIR"/"$PREFIX"/man)" 8 | fishComp="$(realpath -m "$DESTDIR"/"$PREFIX"/share/fish/vendor_completions.d)" 9 | confDir="$(realpath -m "$DESTDIR"/etc/gdm-tools)" 10 | 11 | helpMsg(){ 12 | echo "Usage: ./uninstall.sh [OPTION]" 13 | echo "" 14 | echo "Options" 15 | echo " -h, --help Show this help message" 16 | echo " -p, --purge Also delete config files" 17 | echo "" 18 | echo "Environment Variables" 19 | echo " DESTDIR Target Root Directory" 20 | echo " PREFIX Install Prefix e.g. /usr, /usr/local or ~/.local" 21 | } 22 | 23 | case "$1" in 24 | -h|--help|h|help) 25 | helpMsg 26 | exit 27 | ;; 28 | -p|--purge) 29 | purge=true 30 | ;; 31 | '') 32 | echo -n 33 | ;; 34 | *) 35 | echo "Invalide option! Run './uninstall.sh -h' for help." 36 | exit 1 37 | ;; 38 | esac 39 | 40 | installedFiles=( 41 | "$binDir"/{{set-,}gdm-theme,gnomeconf2gdm} 42 | "$manDir"/man1/{set-,}gdm-theme.1.gz 43 | "$fishComp"/{{set-,}gdm-theme,gnomeconf2gdm}.fish 44 | ) 45 | 46 | configFiles=( 47 | "$confDir"/custom.css 48 | "$confDir"/set-gdm-theme.conf 49 | 50 | # Legacy config files 51 | "$confDir"/{set-,}gdm-theme 52 | ) 53 | 54 | dir1ToCheck="$(realpath -m "$DESTDIR")" 55 | dir2ToCheck="$(realpath -m "$PREFIX")" 56 | if [ -d "$DESTDIR"/"$PREFIX" ]; then 57 | if [ -w "$dir1ToCheck" ] && [ -w "$dir1ToCheck"/"$dir2ToCheck" ]; then 58 | rootNeeded=false 59 | fi 60 | 61 | if [ $UID = '0' ] || [ "$rootNeeded" = false ] ; then 62 | echo -e 'uninstalling gdm-tools ...\n' 63 | if [ "$purge" = true ]; then 64 | for file in "${installedFiles[@]}" "${configFiles[@]}"; do 65 | rm -v "$file" 2>/dev/null 66 | done 67 | else 68 | for file in "${installedFiles[@]}"; do 69 | rm -v "$file" 2>/dev/null 70 | done 71 | fi 72 | echo -e '\n'done. 73 | else 74 | sudo --preserve-env=DESTDIR,PREFIX "$0" "$@" 75 | fi 76 | else 77 | echo "You requested to uninstall from '$(realpath -m "$DESTDIR"/"$PREFIX")'." 78 | echo "But that directory does not exist." 79 | echo "Check if DESTDIR and PREFIX environment variables are set properly." 80 | fi 81 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | [ -z "$DESTDIR" ] && DESTDIR=/ 3 | [ -z "$PREFIX" ] && PREFIX="/usr/local" 4 | 5 | currentDir="$(realpath "$(dirname "$0")")" 6 | binDir="$(realpath -m "$DESTDIR"/"$PREFIX"/bin)" 7 | manDir="$(realpath -m "$DESTDIR"/"$PREFIX"/man)" 8 | fishComp="$(realpath -m "$DESTDIR"/"$PREFIX"/share/fish/vendor_completions.d)" 9 | confDir="$(realpath -m "$DESTDIR"/etc/gdm-tools)" 10 | 11 | NoAsk=false 12 | 13 | helpMsg(){ 14 | echo "Usage: ./install.sh [OPTION]" 15 | echo "" 16 | echo "Options" 17 | echo " -h, --help Show this help message" 18 | echo " --no-ask Perform a non-interactive install" 19 | echo "" 20 | echo "Environment Variables" 21 | echo " DESTDIR Target Root Directory" 22 | echo " PREFIX Install Prefix e.g. /usr, /usr/local or ~/.local" 23 | } 24 | 25 | case "$1" in 26 | -h|--help|h|help) 27 | helpMsg 28 | exit 29 | ;; 30 | --no-ask) 31 | NoAsk=true 32 | ;; 33 | '') 34 | echo -n 35 | ;; 36 | *) 37 | echo "Invalide option! Run './install.sh -h' for help." 38 | exit 1 39 | ;; 40 | esac 41 | 42 | if $NoAsk; then 43 | AptOptions='-y' 44 | PacmanOptions='--noconfirm' 45 | CpOptions='-n' 46 | else 47 | CpOptions='-i' 48 | fi 49 | 50 | depMsg() { 51 | echo "This script needs '$depName' in order to work. But it is not installed." > /dev/stderr 52 | echo "Please, install it first in order to install gdm-tools" 53 | echo "Its package name may be $pkgNames depending on your distro." 54 | exit 1 55 | } 56 | 57 | if ! which glib-compile-resources gresource &> /dev/null; then 58 | depName='GLib (developer edition)' 59 | pkgNames="'glib2', 'glib2-devel', 'libglib2.0-dev', or straight up 'glib', etc. " 60 | if which apt &> /dev/null; then 61 | sudo apt install $AptOptions libglib2.0-dev || depMsg 62 | elif which pacman &> /dev/null; then 63 | sudo pacman -S $PacmanOptions glib2 || depMsg 64 | else 65 | depMsg 66 | fi 67 | fi 68 | 69 | if ! which dconf &> /dev/null; then 70 | depName='DConf (CommandLine Version)' 71 | pkgNames="'dconf-cli', or 'dconf'" 72 | if which apt &> /dev/null; then 73 | sudo apt install $AptOptions dconf-cli || depMsg 74 | elif which pacman &> /dev/null; then 75 | sudo pacman -S $PacmanOptions dconf || depMsg 76 | else 77 | depMsg 78 | fi 79 | fi 80 | 81 | dir1ToCheck="$(realpath -m "$DESTDIR")" 82 | dir2ToCheck="$(realpath -m "$PREFIX")" 83 | if mkdir -p "$dir1ToCheck" "$dir1ToCheck"/"$dir2ToCheck" 2>/dev/null && [ -w "$dir1ToCheck" ] && [ -w "$dir1ToCheck"/"$dir2ToCheck" ]; then 84 | rootNeeded=false 85 | fi 86 | 87 | if [ $UID = '0' ] || [ "$rootNeeded" = false ] ; then 88 | echo 'installing gdm-tools ...' 89 | echo '' 90 | mkdir -p "$binDir" "$manDir"/man1 "$fishComp" "$confDir" 91 | gzip -fk "$currentDir"/man1/* 92 | mv -vf "$currentDir"/man1/*.gz "$manDir"/man1/ 93 | install -vDm755 "$currentDir"/bin/* "$binDir"/ 94 | install -vDm644 "$currentDir"/completions/fish/* "$fishComp"/ 95 | cp -v $CpOptions "$currentDir"/config/* "$confDir"/ 96 | echo '' 97 | echo 'done.' 98 | else 99 | sudo --preserve-env=DESTDIR,PREFIX "$0" "$@" 100 | fi 101 | -------------------------------------------------------------------------------- /completions/fish/set-gdm-theme.fish: -------------------------------------------------------------------------------- 1 | set -l all_subcmds -l list -s set -r reset -b backup -x extract -h --help help -m manual -e examples 2 | set -l themelist (set-gdm-theme list) 3 | set -l colorlist (set-gdm-theme list-colors) 4 | set -l backup_actions -u -r update restore 5 | 6 | complete -x -c set-gdm-theme -n "__fish_seen_subcommand_from set -s; and not __fish_seen_subcommand_from $themelist -b --background" -a "$themelist" -r -d "GDM Theme" 7 | complete -x -c set-gdm-theme -n "__fish_seen_subcommand_from set -s; and not __fish_seen_subcommand_from $themelist -b --background" -a "-b --background" -r -d "Change background only" 8 | #complete -c set-gdm-theme -n "__fish_seen_subcommand_from $themelist -b --background" -e -a "$themelist" 9 | complete -F -c set-gdm-theme -n "__fish_seen_subcommand_from set -s; and __fish_seen_subcommand_from $themelist -b --background" -a "none" -d "No background" 10 | complete -F -c set-gdm-theme -n "__fish_seen_subcommand_from set -s; and __fish_seen_subcommand_from $themelist -b --background" -a "$colorlist" -d "Background Color" 11 | complete -x -c set-gdm-theme -n "__fish_seen_subcommand_from backup -b; and not __fish_seen_subcommand_from $backup_actions -s set" -a 'update' -d "Update Backup" 12 | complete -x -c set-gdm-theme -n "__fish_seen_subcommand_from backup -b; and not __fish_seen_subcommand_from $backup_actions -s set" -s u -d "Update Backup" 13 | complete -x -c set-gdm-theme -n "__fish_seen_subcommand_from backup -b; and not __fish_seen_subcommand_from $backup_actions -s set" -a "restore" -d "Restore Backup" 14 | complete -x -c set-gdm-theme -n "__fish_seen_subcommand_from backup -b; and not __fish_seen_subcommand_from $backup_actions -s set" -s r -d "Restore Backup" 15 | 16 | complete -f -c set-gdm-theme -n "not __fish_seen_subcommand_from $all_subcmds" -a "list" -d "List GDM themes" 17 | complete -f -c set-gdm-theme -n "not __fish_seen_subcommand_from $all_subcmds" -s l -d "List GDM themes" 18 | complete -x -c set-gdm-theme -n "not __fish_seen_subcommand_from $all_subcmds" -a "set" -d "Set GDM theme/background" 19 | complete -x -c set-gdm-theme -n "not __fish_seen_subcommand_from $all_subcmds" -s s -d "Set GDM theme/background" 20 | complete -x -c set-gdm-theme -n "not __fish_seen_subcommand_from $all_subcmds" -a "backup" -d "Manage Backup" 21 | complete -x -c set-gdm-theme -n "not __fish_seen_subcommand_from $all_subcmds" -s b -d "Manage Backup" 22 | complete -f -c set-gdm-theme -n "not __fish_seen_subcommand_from $all_subcmds" -a "help" -d "Display Help" 23 | complete -f -c set-gdm-theme -n "not __fish_seen_subcommand_from $all_subcmds" -s h -l help -d "Display Help" 24 | complete -f -c set-gdm-theme -n "not __fish_seen_subcommand_from $all_subcmds" -a "manual" -d "Show Manual" 25 | complete -f -c set-gdm-theme -n "not __fish_seen_subcommand_from $all_subcmds" -s m -d "Show Manual" 26 | complete -f -c set-gdm-theme -n "not __fish_seen_subcommand_from $all_subcmds" -a "examples" -d "Show command examples" 27 | complete -f -c set-gdm-theme -n "not __fish_seen_subcommand_from $all_subcmds" -s e -d "Show command examples" 28 | complete -c set-gdm-theme -n "not __fish_seen_subcommand_from $all_subcmds" -a "extract" -d "Extract default theme" 29 | complete -c set-gdm-theme -n "not __fish_seen_subcommand_from $all_subcmds" -s x -d "Extract default theme" 30 | 31 | -------------------------------------------------------------------------------- /bin/gnomeconf2gdm: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mainTempDir='/tmp/gdm-tools' # Temprary Directory for 'gdm-tools' 4 | tmpDir="$mainTempDir/gnomeconf2gdm" # Temprary Directory for this script 5 | conf='99-gnomeconf2gdm' # Name for the GDM configuration file 6 | confDir='/etc/dconf/db/gdm.d' # Directory for GDM configuration file 7 | profileDir='/etc/dconf/profile' # Directory for GDM DConf profile 8 | # Contents of GDM DConf profile 9 | profileData='user-db:user 10 | system-db:gdm 11 | file-db:/usr/share/gdm/greeter-dconf-defaults' 12 | 13 | help() { 14 | echo 'gdm-tools: gnomeconf2gdm 15 | A script that gets Settings from Gnome Desktop and applies them to GDM 16 | Usage: gnomeconf2gdm [options] 17 | Options: 18 | {no options} Apply Settings to GDM 19 | -r,reset Reset GDM settings to default 20 | -h,help,--help Print this help message' 21 | } 22 | 23 | printHeader() { 24 | local schema="$1" 25 | local name="$2" 26 | local lenSchema="$(echo -n "$schema" | wc -m)" 27 | local lenName="$(echo -n "$name" | wc -m)" 28 | local lenDiff=$((lenSchema - lenName)) 29 | local lenDiffHalf=$((lenDiff / 2)) 30 | echo -n '#' 31 | local i 32 | for ((i=$((1-(lenDiff%2)));i /dev/null 115 | sudo mv -T ${tmpDir}/${conf} ${confDir}/${conf} 116 | sudo dconf update 117 | } 118 | 119 | cleanTemp(){ 120 | rm -rf "$tmpDir"/ 121 | rmdir "$mainTempDir" &> /dev/null 122 | } 123 | 124 | reset(){ 125 | if [ -f "${confDir}/${conf}" ]; then 126 | sudo rm ${confDir}/${conf} 127 | sudo dconf update 128 | echo "Settings restored" 129 | else 130 | echo "Already restored" 131 | fi 132 | } 133 | 134 | main(){ 135 | if [ "$UID" != 0 ]; then 136 | case "$1" in 137 | '') 138 | nonRootWork 139 | rootWork 140 | cleanTemp 141 | echo Successful! 142 | ;; 143 | reset | -r ) 144 | reset 145 | ;; 146 | help | --help | -h ) 147 | help 148 | ;; 149 | *) 150 | echo "Please type 'gnomeconf2gdm -h' for help" > /dev/stderr 151 | status=2 152 | ;; 153 | esac 154 | else 155 | echo 'Please run as a non-root user' > /dev/stderr 156 | status=1 157 | fi 158 | } 159 | 160 | status=0 161 | main "$@" 162 | exit $status 163 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # gdm-tools 2 | 3 | This is a set of tools for Gnome's Display/Login Manager (GDM). 4 | 5 | Currently, it includes only 'set-gdm-theme' tool and 'gnomeconf2gdm'. 6 | 7 | ### Caution!!! ⚠️ 8 | 9 | **gdm-tools** is not being actively maintained anymore. There may be *small* bug fixes and other 10 | changes here and there but don't expect any new features or even bug fixes if they require too much 11 | fiddling around in the code. 12 | 13 | [**GDM Settings**](https://gdm-settings.github.io) app is a GUI alternative to gdm-tools. It is 14 | being actively maintained and has much more settings and customization options. 15 | 16 | ## gnomeconf2gdm 17 | 18 | A script that gets Settings from Gnome Desktop and applies them to GDM 19 | 20 | ## set-gdm-theme 21 | 22 | This is a command-line program which provides a nice interface to set GDM theme and background image. 23 | 24 | #### Features: 25 | 26 | - Set GDM theme and background 27 | - Manage backup of the default GDM theme 28 | - Extract default theme to be able to use it in weird gnome sessions such as Ubuntu 29 | - Reset everything to its original form 30 | 31 | # Installation 32 | 33 | ## Arch Linux and Arch-Based distros 34 | 35 | This program is available as [gdm-tools](https://aur.archlinux.org/packages/gdm-tools) and [gdm-tools-git](https://aur.archlinux.org/packages/gdm-tools-git) in the AUR. Use your favourite AUR helper to install it. 36 | 37 | **Example:** 38 | 39 | ```bash 40 | yay -S gdm-tools 41 | ``` 42 | 43 | ## Others 44 | 45 | Before installing this program, make sure you have installed all the dependencies stated below in **Dependencies** section. 46 | 47 | ### Method 1: 48 | 49 | 1. Download the [zip file](https://github.com/realmazharhussain/gdm-tools/archive/refs/heads/main.zip) (or [tar.gz file](https://github.com/realmazharhussain/gdm-tools/archive/refs/heads/main.tar.gz)) 50 | 2. Extract it somewhere on your system 51 | 3. Open the extracted folder in terminal 52 | 4. Type `./install` and press Enter 53 | 5. Now type your password and press Enter. 54 | 55 | ### Method 2: 56 | 57 | First, make sure you have installed git. On Debian-like systems that can be done by running the command `sudo apt install git` in terminal. 58 | 59 | Then, run following commands in terminal. 60 | 61 | ```bash 62 | git clone --depth=1 --single-branch https://github.com/realmazharhussain/gdm-tools.git 63 | cd gdm-tools 64 | ./install.sh 65 | ``` 66 | 67 | ## Dependencies 68 | 69 | set-gdm-tools depends on following package: 70 | 71 | 1. GLib 2.0 (Developer Edition) 72 | 73 | it has different package names in different distros\ 74 | Debian/Ubuntu: libglib2.0-dev\ 75 | Arch/Manjaro: glib2\ 76 | Fedora/CentOS: glib2-devel 77 | 78 | 2. DConf (Command-Line Version) 79 | 80 | it has different package names in different distros\ 81 | Debian/Ubuntu: dconf-cli\ 82 | Arch/Manjaro: dconf\ 83 | Fedora/CentOS: dconf 84 | 85 | You can install these dependencies using package manager on terminal. 86 | 87 | For example, on Debian, Ubuntu and derivatives, you will need to run the following command in order to install the dependencies 88 | 89 | ```bash 90 | sudo apt install libglib2.0-dev dconf-cli 91 | ``` 92 | 93 | On Arch/Manjaro 94 | 95 | ```bash 96 | sudo pacman -S glib2 dconf 97 | ``` 98 | 99 | 100 | 101 | ## Usage 102 | 103 | ### gnomeconf2gdm 104 | 105 | gnomeconf2gdm can be used as follows: 106 | 107 | ```bash 108 | gnomeconf2gdm [option] 109 | ``` 110 | 111 | where option is one of the following: 112 | 113 | | Option | Function | 114 | | ---------------- | ----------------------------- | 115 | | {no option} | Apply settings to GDM | 116 | | -r, reset | Reset GDM settings to default | 117 | | -h, help, --help | Show help message | 118 | 119 | ### set-gdm-theme 120 | 121 | You can use set-gdm-theme as follows: 122 | 123 | ```bash 124 | set-gdm-theme {Option} [theme] [image] 125 | ``` 126 | 127 | where option is one of the following: 128 | 129 | | Option | Function | 130 | | :--------------- | :--------------------------------------------- | 131 | | -l, list | List all available valid GDM themes | 132 | | -s, set | Set a specific theme and/or background | 133 | | -r, reset | Reset everything to the original state | 134 | | -b, backup | Manage backup of the default GDM theme | 135 | | -x, extract | Extract default GDM theme for use inside gnome | 136 | | -h, help, --help | Display a short help message | 137 | | -e, examples | Explain the commands with examples | 138 | 139 | #### Examples: 140 | 141 | ```bash 142 | set-gdm-theme list 143 | set-gdm-theme set 144 | set-gdm-theme -s default ~/cat.jpg 145 | set-gdm-theme set Yaru-dark 146 | set-gdm-theme reset 147 | set-gdm-theme -b update 148 | set-gdm-theme backup restore 149 | set-gdm-theme extract 150 | ``` 151 | 152 | ## FAQ: 153 | 154 | 1. Why can't I apply/set GDM themes downloaded from gnome-look.org or other pling.com like websites? 155 | 156 | **Ans:** Themes available in `GDM Themes` section of those websites are for old versions of GDM and current versions of GDM don't use that kind of themes. Newer versions of GDM use a compiled gnome-shell theme as their theme. Download and install (system-wide) themes available in `Gnome Shell Themes` section of those websites. They will work on newer versions of GDM and are supported by `set-gdm-theme` command. 157 | 158 | 2. When I try to set default GDM theme using `set-gdm-theme` tool, it sets some other theme instead of the default theme. What should I do? 159 | 160 | **Ans:** You should reinstall the package `gnome-shell-common` (if that's not available, then `gome-shell`) and then run the command `set-gdm-theme set --background; set-gdm-theme backup update`. This should fix the issue. 161 | 162 | 3. Why does that happen? 163 | 164 | **Ans:** That could happen if you use some other program to set GDM theme before using `set-gdm-theme` tool. More information is available in *WARNING* section of `set-gdm-theme(1)` man page. To read it, install `gdm-tools` and then run the command `man 1 set-gdm-theme` on the terminal. When man page shows up, type `/warning` and press enter. This will take you straight to the warning section of man page. 165 | 166 | ## Contribute 167 | 168 | If you like the project and want to contribute, you can do so by providing feedback or directly contributing code to it. To provide feedback, you can open an issue on github. If you don't know how to do that you can email me directly at realmazharhussain@gmail.com. 169 | 170 | You can also contribute on [Patreon](https://www.patreon.com/mazharhussain). 171 | 172 | -------------------------------------------------------------------------------- /man1/set-gdm-theme.1: -------------------------------------------------------------------------------- 1 | .TH SET\-set\-gdm\-theme 1 2021\-01\-07 "Script v1.0" "GDM Tools" 2 | .SH NAME 3 | set\-gdm\-theme \- a utility to set GDM theme and background 4 | .SH SYNOPSIS 5 | \fBset\-gdm\-theme \-e\fR|\fB\-h\fR|\fB\-l\fR|\fB\-lc\fR|\fB\-m\fR|\fB\-r\fR 6 | .sp 7 | \fBset\-gdm\-theme examples\fR|\fBhelp\fR|\fBlist\fR|\fBlist\-colors\fR|\fBmanual\fR|\fBreset\fR 8 | .sp 9 | \fBset\-gdm\-theme \-s\fR|\fBset\fR [\fItheme\fR] [\fIimage\fR|\fIcolor\fR] 10 | .sp 11 | \fBset\-gdm\-theme \-b\fR|\fBbackup \-u\fR|\fBupdate\fR|\fB\-r\fR|\fBrestore\fR 12 | .sp 13 | \fBset\-gdm\-theme \-x\fR|\fBextract\fR [\fIlocation\fR] [\fBdefault\fR|\fBdistro\-default\fR] 14 | .SH DESCRIPTION 15 | List available theme options for Gnome Dislplay Manager (GDM), and set GDM theme and background image. A theme, to be a valid theme for this program, should be located in \fI/usr/share/themes/\fR and contain a subdirectory for \fIgnome-shell\fR. In simple words, a theme has to be a valid \fIgnome-shell\fR theme located in \fI/usr/share/themes\fR in order to be a valid GDM theme. 16 | .sp 17 | \fIset\-gdm\-theme(1)\fR has a smart backup system which backs up the default GDM theme (/usr/share/gnome-shell/gnome-shell-theme.gresource) because the file needs to be overwritten in order for other themes to be applied. It is a bit complicated and is discussed in detail in \fBWARNING\fR section. 18 | .SH SUBCOMMANDS 19 | .SS 20 | \fB\-l\fR,\fBlist\fR 21 | list available GDM themes. A theme has to be either the default \fIgnome-shell\fR theme or a valid \fIgnome-shell\fR theme stored in \fI/usr/share/themes\fR in order to show up in the list. A valid \fIgnome-shell\fR theme is a theme which has a subdirectory named \fIgnome-shell\fR with \fIgnome-shell.css\fR file present in it. This option will always show \fIdefault\fR theme as the first in the list. 22 | . 23 | .SS 24 | \fB\-lc\fR,\fBlist\-colors\fR 25 | list names of the colors that are accepted as GDM background. 26 | . 27 | .SS 28 | \fB-s\fR,\fBset \fR[\fItheme\fR] [\fIimage\fR|\fIcolor\fR] 29 | if provided, set [\fItheme\fR] as GDM theme and [\fIimage\fR] as GDM background image or [\fIcolor\fR] as GDM background, where [\fItheme\fR] is the name of the theme, [\fIimage\fR] is path to an image file and [\fIcolor\fR] is either the name of a color e.g. red, green, violet, etc or a color code like '#00F' or '#0a4d90' (qoutes are important). 30 | .sp 31 | Your choices for theme are '\fBdefault\fR', all system-wide gnome-shell themes, and \fI-b\fR or \fI--background\fR. Your choices for an image are /path/to/image and '\fBnone\fR'. Both theme and image arguments are optional. 32 | .sp 33 | A list of acceptable color names can be obtained by running '\fBset\-gdm\-theme list\-colors\fR'. 34 | .sp 35 | If you provide name of a theme, it will be set as GDM theme. If you type \fI-b\fR or \fI--background\fR instead of a theme name, only GDM background will change. Similarly, if you provide a path to an image file, it will be used as GDM background. If you type '\fBnone\fR' instead of path to an image file, GDM background image will be removed and the background will be set according to the theme (usually a solid color). 36 | .sp 37 | If you don't provide anything after \fB\-s\fR or \fBset\fR, \fIset\-gdm\-theme(1)\fR will provide you with a numbered list of all valid GDM themes on the system and you can choose a theme by typing its number. When you press Enter, \fIset\-gdm\-theme(1)\fR will set the theme with that number. 38 | .sp 39 | \fBExamples:\fR 40 | .sp 41 | \fBset\-gdm\-theme set \fIYaru\-dark\fR 42 | .RS 43 | will set \fIYaru-dark\fR as GDM theme 44 | .RE 45 | . 46 | \fBset\-gdm\-theme \-s default \fI~/Pictures/Sunset.jpg\fR 47 | .RS 48 | will set \fIdefault\fR GDM theme with \fI~/Pictures/Sunset.jpg\fR as background 49 | .RE 50 | . 51 | \fBset\-gdm\-theme set \-b \fI~/Pictures/Cat.jpg\fR 52 | .RS 53 | will set \fI~/Pictures/Cat.jpg\fR as GDM background 54 | .RE 55 | . 56 | \fBset\-gdm\-theme \-s \fIMateria \fBnone\fR 57 | .RS 58 | will set \fIMateria\fR as GDM theme with no background image 59 | .RE 60 | . 61 | \fBset\-gdm\-theme \-s \-b \fIblue\fR 62 | .RS 63 | will set GDM background to color 'blue' 64 | .RE 65 | . 66 | \fBset\-gdm\-theme \-s \-b '\fI#aa442d\fR' 67 | .RS 68 | will set GDM background to color with color-code '\fI#aa442d\fR' 69 | .RE 70 | . 71 | \fBset\-gdm\-theme set\fR 72 | .RS 73 | will provide you with a list of themes to choose from and then set what you choose 74 | .RE 75 | . 76 | .SS 77 | \fB\-r\fR,\fBreset\fR 78 | reset everything to the way it was before the use of \fIset\-gdm\-theme(1)\fR except for removing the backup it created. This option sets unmodified \fIdefault\fR GDM theme (\fI/usr/share/gnome-shell/gnome-shell-theme.gresource.default\fR) as GDM theme by moving it to its original place (\fI/usr/share/gnome-shell/gnome-shell-theme.gresource\fR), removes GDM background image file (/usr/share/gnome-shell/theme/gdm-background) which was created by \fIset\-gdm\-theme(1)\fR, and sets \fIset\-gdm\-theme.gresource\fR name in \fIupdate-alternatives(1)\fR to auto. 79 | . 80 | .SS 81 | \fB\-b\fR,\fBbackup \fR{\fIaction\fR} 82 | update or restore backup of the default GDM theme. This additional backup can be very helpful if some other program or a bug in \fBset\-gdm\-theme(1)\fR messes up the default GDM theme. This option requires at least one action. The action choices are \fBupdate\fR and \fBrestore\fR or their short forms \fB\-u\fR and \fB\-r\fR. For example, 83 | .sp 84 | \fBset\-gdm\-theme \-b update\fR 85 | .RS 86 | will update backup to the newest version of default GDM theme 87 | .RE 88 | . 89 | \fBset\-gdm\-theme backup \-r\fR 90 | .RS 91 | will restore default GDM theme from the backup 92 | .RE 93 | . 94 | .SS 95 | \fB\-x\fR,\fBextract\fR [\fIlocation\fR] [\fBdefault\fR|\fBdistro\-default\fR] 96 | extract the \fBdefault\fR or \fBdistro\-default\fR GDM theme to specified \fIlocation\fR if provided. If no \fIlocation\fR is provided, it is extracted to system-wide themes directory \fI/usr/share/themes\fR. If a theme name ('\fBdefault\fR' or '\fBdistro\-default\fR') is provided after the location, provided theme is extracted to provided location. But, the 2nd argument to this option is practical only if your distro ships custom GDM theme as default and places actual default theme as something else (see /etc/gdm\-tools/set\-gdm\-theme). 97 | .sp 98 | This can be helpful when you use some \fIweird Gnome session\fR such as \fIubuntu-session\fR whose \fIdefault\fR gnome-shell theme is not the actual \fIdefault\fR gnome-shell theme provided by gnome. You cannot set \fIdefault\fR gnome-shell theme in \fIUbuntu\fR unless you install '\fIgnome-session\fR' and log in to \fIGnome (session)\fR instead of \fIUbuntu (session)\fR. With this option, you will be able to set gnome-shell theme to the actual \fIdefault\fR gnome-shell theme even when in \fIUbuntu (session)\fR. It will be presented as '\fIDefault-extracted\fR' in gnome-tweaks app. 99 | . 100 | .SS 101 | \fB\-h\fR,\fB\-\-help\fR,\fBhelp\fR 102 | print a short help message which provides program name, a short description of the program, and command options with a little description of each option too. 103 | . 104 | .SS 105 | \fB\-m\fR,\fBmanual\fR 106 | show this manual page 107 | . 108 | .SS 109 | \fB\-e\fR,\fBexamples\fR 110 | explain the usage of \fIset\-gdm\-theme(1)\fR with examples. 111 | .SH WARNING 112 | GDM uses the file /usr/share/gnome\-shell/gnome\-shell\-theme.gresource as its theme. We are going to call this file the 'default gresource file' for now. In order to set a theme as GDM theme, the \fIdefault\fR gresource file has to be replaced by the \fIcustom\fR theme's gresource file. The \fIdefault\fR gresource file has to be \fIbacked up\fR first if it is ever needed to be reused and it will surely be needed in future because user would want to set the default GDM theme at some point. 113 | .sp 114 | Other programs (that set and change GDM theme) \fIbackup\fR the \fIdefault\fR gresource file only on the first run if they \fIback\fR it \fIup\fR at all. When user sets \fIdefault\fR theme using any of those programs, they set that \fIbackup\fR as GDM theme. If Gnome gets upgraded, custom theme's gresource file is replaced with newer version of the \fIdefault\fR gresource file. Then you change GDM theme again to your preference. Since there is already a \fIbackup\fR present on the system, those programs do not \fIbackup\fR the newer version of \fIdefault\fR gresource file. Instead, they just replace it with a custom gresource file and keep using the old \fIbackup\fR as \fIdefault\fR theme. When a major version upgrade happens to Gnome, it breaks compatibility with older version of \fIdefault\fR theme. But those programs keep using the incompatible, old \fIbackup\fR of \fIdefault\fR theme(gresource file). In the end, their version of the default theme does not work correctly anymore. 115 | .sp 116 | To tackle the problem stated above, \fIset\-gdm\-theme(1)\fR uses a dual backup system i.e it keeps two backups of the default gresource. One backup is managed automatically by \fIset\-gdm\-theme(1)\fR (We will call it smart backup), and the other is created once on the first run and then managed manually with \fB-b\fR,\fBbackup\fR option of \fIset\-gdm\-theme(1)\fR (We will call it manual backup). Whenever the word "backup" is used without specifying the type, manual backup is intended. 117 | .sp 118 | Smart backup is used as 'default' GDM theme in \fIset\-gdm\-theme(1)\fR. \fIset\-gdm\-theme(1)\fR marks the theme it sets with a \fIspecial file\fR i.e. it packs the special file inside gresource file of that theme. The special file is used to distinguish a custom theme's gresource file from the \fIdefault\fR gresource file. So, if currently set gresource file does not have that \fIspecial file\fR, it is understood to be the \fIdefault\fR gresource file. Whenever \fIset\-gdm\-theme(1)\fR finds such a gresource file, it replaces the old \fIsmart backup\fR with that file. As a result, when \fIset\-gdm\-theme(1)\fR runs after an upgrade to Gnome, \fI smart backup\fR gets upgraded too. Therefore, the \fIsmart backup\fR is always up-to-date. 119 | .sp 120 | This \fIsmart backup\fR comes with its \fBlimitations\fR though. Since the other programs do not mark the theme they set with \fIspecial identification file\fR like \fIset\-gdm\-theme(1)\fR does, the file they replace default gresource with is recognized by \fIset\-gdm\-theme(1)\fR as a newer version of the \fIdefault\fR gresource file. Hence, it replaces the \fIsmart backup\fR with that file and the theme set by other program is treated as the \fIdefault\fR theme. In this situation, the command '\fBset\-gdm\-theme set \fIdefault\fR' will set that theme as GDM theme instead of the actual \fIdefault\fR GDM theme. Manual backup is present there to help in such situations. 121 | .sp 122 | To avoid this situation, you can opt to use only one program to set GDM theme instead of using multiple programs on the system. If you don't like the program you are currently using or want to check out some other program, then before using the new program, you should use the previous program to set the \fIdefault\fR GDM theme. The other thing you can do is to \fIbackup\fR the \fIdefault\fR gresource file by yourself before using any GDM theme changer. In this way, you will always have a \fIbackup\fR of the \fIdefault\fR GDM theme even if some program messes up its \fIbackup\fR. To do so, copy the default gresource file somewhere you won't accidently delete or forget. When some program messes up the \fIdefault\fR gresource file, you will just need to replace it with your own \fIbackup\fR. \fIset\-gdm\-theme(1)\fR will automatically detect that as \fIdefault\fR gresource file and everything will be fine again. 123 | .sp 124 | In case you used some other program to set GDM theme, then installed and used \fIset\-gdm\-theme(1)\fR to set GDM theme, now \fIset\-gdm\-theme(1)\fR sets some other theme when you try to set the \fIdefault\fR GDM theme, the other program does not provide any way to set the \fIdefault\fR GDM theme, and you never \fIbacked up\fR the \fIdefault\fR GDM theme manually; You can solve this problem by \fIreinstalling\fR the package '\fIgnome\-shell\-common\fR' (and if that package is not available, then '\fIgnome\-shell\fR') and then updating \fIset\-gdm\-theme(1)\fR's smart-backup by running '\fBset\-gdm\-theme set \-\-background\fR' and manual backup by running '\fBset\-gdm\-theme \-b update\fR'. This will \fIfix everything\fR. If you face the same problem again in future, just run the command '\fBset\-gdm\-theme \-b restore\fR' and that should fix it. 125 | .sp 126 | \fBNote:\fR In Debian/Ubuntu and derivatives, you can reinstall '\fIgnome\-shell\-common\fR' by running the command '\fBsudo apt reinstall \fIgnome\-shell\-common\fR'. 127 | .sp 128 | However, if you only use \fIset\-gdm\-theme(1)\fR for changing GDM theme or background, no such problem is supposed to occur. 129 | .SH FILES 130 | \fB/etc/gdm\-tools/set\-gdm\-theme.conf\fR - The configuration file for set-gdm-theme command 131 | .sp 132 | \fB/etc/gdm\-tools/custom.css\fR - Custom CSS to apply to every theme before setting it as GDM theme 133 | .SH SEE ALSO 134 | \fBset\-gdm\-theme \fI\-\-help\fR 135 | .sp 136 | \fBset\-gdm\-theme \fIexamples\fR 137 | -------------------------------------------------------------------------------- /bin/set-gdm-theme: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script compiles and sets given 4 | # gnome-shell theme as GDM3 theme 5 | 6 | bold=$(tput bold) # make text bold 7 | underlined=$(tput smul) # make text underlined 8 | normal=$(tput sgr0) # restore text to normal 9 | 10 | # Here are some variables to be used in the script 11 | ProgName=$(basename "$0") # Program's Name 12 | setVars(){ 13 | declare -g ThemesDir=/usr/share/themes # Directory that contains themes 14 | declare -g tempDir="$(mktemp -d)" # Directory for storing temprary files 15 | declare -g tempThemeDir=$tempDir/theme # Directory to temprarily store theme files for processing 16 | declare -g tempExtractedDir=$tempDir/extracted # Directory to temprarily store theme files extracted from some gresource file 17 | declare -g gnomeShellDir=/usr/share/gnome-shell # Directory that contains gnome-shell and GDM related files 18 | declare -g gdmGresourceFile=$gnomeShellDir/gnome-shell-theme.gresource # Gresource file to be used by GDM 19 | declare -g ubuntuGresourceFile=$gnomeShellDir/gdm-theme.gresource # Gresource file to be used by GDM on Ubuntu and derivatives 20 | declare -g ubuntuGresourceFile_Old=$gnomeShellDir/gdm3-theme.gresource # Gresource file to be used by GDM on Ubuntu (21.04 and older) and derivatives 21 | declare -g gdmGresourceManualBackup=$gdmGresourceFile.bak # Manual Backup of distro default or official GDM gresource file 22 | declare -g gdmGresourceAutoBackup=$gdmGresourceFile.default # Automatic Backup of original/default GDM gresource file 23 | declare -g deprecatedGresourceBackups=$gdmGresourceFile.original # Files that were previously used as backup but now they don't 24 | declare -g distroDefaultGresourceFile=$gdmGresourceFile.distro-default # File to store distro default gresource file 25 | declare -g currentThemeFile=/etc/gdm-tools/currentTheme # File to store name of the current GDM theme 26 | declare -g currentBackgroundFile=/etc/gdm-tools/currentBackground # File to store type of the current GDM background 27 | declare -g gdm3css=/etc/alternatives/gdm3.css # Symlink used by update-alternatives program to provide gdm3.css file 28 | declare -g customCSS=/etc/gdm-tools/custom.css # User's custom CSS to apply to every theme 29 | declare -g gresource=gnome-shell-theme.gresource # Short alias/name for a long file name 30 | declare -g customThemeIdentity=custom-theme # File that will be used to distinguish gresource file generated by this script from original/default gresource file 31 | # Names of the supported colors 32 | declare -g colorNames=( 33 | black 34 | silver 35 | gray 36 | white 37 | maroon 38 | red 39 | purple 40 | fuchsia 41 | green 42 | lime 43 | olive 44 | yellow 45 | navy 46 | blue 47 | teal 48 | aqua 49 | 50 | aliceblue 51 | antiquewhite 52 | aqua 53 | aquamarine 54 | azure 55 | beige 56 | bisque 57 | black 58 | blanchedalmond 59 | blue 60 | blueviolet 61 | brown 62 | burlywood 63 | cadetblue 64 | chartreuse 65 | chocolate 66 | coral 67 | cornflowerblue 68 | cornsilk 69 | crimson 70 | cyan 71 | darkblue 72 | darkcyan 73 | darkgoldenrod 74 | darkgray 75 | darkgreen 76 | darkgrey 77 | darkkhaki 78 | darkmagenta 79 | darkolivegreen 80 | darkorange 81 | darkorchid 82 | darkred 83 | darksalmon 84 | darkseagreen 85 | darkslateblue 86 | darkslategray 87 | darkslategrey 88 | darkturquoise 89 | darkviolet 90 | deeppink 91 | deepskyblue 92 | dimgray 93 | dimgrey 94 | dodgerblue 95 | firebrick 96 | floralwhite 97 | forestgreen 98 | fuchsia 99 | gainsboro 100 | ghostwhite 101 | gold 102 | goldenrod 103 | gray 104 | green 105 | greenyellow 106 | grey 107 | honeydew 108 | hotpink 109 | indianred 110 | indigo 111 | ivory 112 | khaki 113 | lavender 114 | lavenderblush 115 | lawngreen 116 | lemonchiffon 117 | lightblue 118 | lightcoral 119 | lightcyan 120 | lightgoldenrodyellow 121 | lightgray 122 | lightgreen 123 | lightgrey 124 | lightpink 125 | lightsalmon 126 | lightseagreen 127 | lightskyblue 128 | lightslategray 129 | lightslategrey 130 | lightsteelblue 131 | lightyellow 132 | lime 133 | limegreen 134 | linen 135 | magenta 136 | maroon 137 | mediumaquamarine 138 | mediumblue 139 | mediumorchid 140 | mediumpurple 141 | mediumseagreen 142 | mediumslateblue 143 | mediumspringgreen 144 | mediumturquoise 145 | mediumvioletred 146 | midnightblue 147 | mintcream 148 | mistyrose 149 | moccasin 150 | navajowhite 151 | navy 152 | oldlace 153 | olive 154 | olivedrab 155 | orange 156 | orangered 157 | orchid 158 | palegoldenrod 159 | palegreen 160 | paleturquoise 161 | palevioletred 162 | papayawhip 163 | peachpuff 164 | peru 165 | pink 166 | plum 167 | powderblue 168 | purple 169 | red 170 | rosybrown 171 | royalblue 172 | saddlebrown 173 | salmon 174 | sandybrown 175 | seagreen 176 | seashell 177 | sienna 178 | silver 179 | skyblue 180 | slateblue 181 | slategray 182 | slategrey 183 | snow 184 | springgreen 185 | steelblue 186 | tan 187 | teal 188 | thistle 189 | tomato 190 | turquoise 191 | violet 192 | wheat 193 | white 194 | whitesmoke 195 | yellow 196 | yellowgreen 197 | ) 198 | 199 | 200 | 201 | ################################### 202 | # Variables read from configFile # 203 | ################################### 204 | 205 | # Location of the file where your distro puts default gresource file instead of the default location 206 | if [ -z "$defaultGresource" ] || isNotDefaultGresource "$defaultGresource"; then 207 | declare -g defaultGresource="$gdmGresourceFile" 208 | elif [ "$defaultGresource" != "$gdmGresourceFile" ]; then 209 | declare -g customDefaultGresource=true 210 | fi 211 | 212 | # Overlay mode 213 | declare -g overlayMode=${overlayMode:-resources} 214 | } 215 | 216 | getCurrentTheme(){ 217 | declare -g currentTheme="$(cat "$currentThemeFile" 2>/dev/null)" 218 | [ -z "$currentTheme" ] && currentTheme=default 219 | } 220 | 221 | printCurrentTheme(){ 222 | [ -z "$currentTheme" ] && getCurrentTheme 223 | echo "$currentTheme" 224 | } 225 | 226 | saveCurrentTheme(){ 227 | [ -z "$currentTheme" ] && CurrentTheme=default 228 | printCurrentTheme > "$currentThemeFile" 229 | } 230 | 231 | getCurrentBackground(){ 232 | declare -g currentBackground="$(cat "$currentBackgroundFile" 2>/dev/null)" 233 | case "$currentBackground" in 234 | 'image') 235 | currentBackground=/usr/share/gnome-shell/theme/gdm-background 236 | ;; 237 | '') 238 | currentBackground=none 239 | ;; 240 | esac 241 | } 242 | 243 | printCurrentBackground(){ 244 | [ -z "$currentBackground" ] && getCurrentBackground 245 | echo "$currentBackground" 246 | } 247 | 248 | saveCurrentBackground(){ 249 | printCurrentBackground > "$currentBackgroundFile" 250 | } 251 | 252 | printBackgroundCSS(){ 253 | imgBgr=" 254 | #lockDialogGroup { 255 | background-image: url('resource:///org/gnome/shell/theme/background'); 256 | background-size: cover; 257 | background-repeat: no-repeat; 258 | background-attachment: fixed; 259 | background-position: center; 260 | }" 261 | colorBgr=" 262 | #lockDialogGroup { 263 | background-color: $currentBackground; 264 | }" 265 | 266 | 267 | case "$(background-type "$currentBackground")" in 268 | (image) 269 | echo "$imgBgr" 270 | ;; 271 | (color) 272 | echo "$colorBgr" 273 | ;; 274 | esac 275 | } 276 | 277 | initFun(){ 278 | if [ -r "/etc/gdm-tools/${ProgName}" ]; then 279 | configFile=/etc/gdm-tools/${ProgName} 280 | echo "${bold}Warning:${normal} Configuration file '${configFile}' is deprecated. Use '${configFile}.conf' instead" >&2 281 | elif [ -r "/etc/gdm-tools/${ProgName}.conf" ]; then 282 | configFile=/etc/gdm-tools/${ProgName}.conf 283 | fi 284 | [ -r $configFile ] && source $configFile 285 | setVars 286 | getCurrentTheme 287 | getCurrentBackground 288 | case $1 in 289 | -s | set ) 290 | if ! which glib-compile-resources gresource > /dev/null; then 291 | echo "This script needs GLib (developer edition) in order to work. But it was not found." > /dev/stderr 292 | exit 4 293 | fi 294 | ;; 295 | esac 296 | 297 | if [ $UID != 0 ]; then 298 | local rootNeeded 299 | case $1 in 300 | -r | reset | -s | set | -b | backup ) 301 | rootNeeded=true 302 | ;; 303 | -x | extract) 304 | rootNeeded=true 305 | if [ -n "$2" ];then 306 | local dirToCheck="$(realpath -m "$2")" 307 | if mkdir -p "$dirToCheck" 2>/dev/null && [ -w "$dirToCheck" ]; then 308 | rootNeeded=false 309 | fi 310 | fi 311 | ;; 312 | *) 313 | rootNeeded=false 314 | ;; 315 | esac 316 | 317 | if [[ $rootNeeded = true ]]; then 318 | # check if user has sudo installed 319 | if which sudo &> /dev/null; then 320 | # run this script with sudo 321 | sudo "$0" "$@" 322 | exit $? 323 | elif which su &> /dev/null; then 324 | # run this script as root 325 | su -c "$0 $@" 326 | exit $? 327 | else 328 | echo "Plz, run this program as root" > /dev/stderr 329 | exit 1 330 | fi 331 | fi 332 | fi 333 | } 334 | 335 | notRecognized() { 336 | echo "action '$1' was not recogninzed, use -h, [--]help for help" > /dev/stderr && exit 2 337 | } 338 | 339 | help() { 340 | echo -en "${ProgName}: a program to change gnome login theme and background 341 | Usage: ${ProgName}