Various cleanup for first alpha release

This commit is contained in:
Christian Schendel 2025-12-06 12:33:50 +00:00
parent f372d7c3f4
commit 44f46f5829
Signed by: doppelhelix
GPG key ID: 5874D2437CD5BBB3
2 changed files with 29 additions and 17 deletions

View file

@ -1,4 +1,4 @@
VERSION = 0.0.01
VERSION = 0.0.02
PN = night-theme-switcher
PREFIX ?= /usr

View file

@ -5,13 +5,12 @@
set -eo pipefail
## NOTE If KDE Plasma is installed, a patched version of qt6ct is required.
## NOTE A patched version of qt6ct is required.
## NOTE The benefits are
## NOTE KDE color schemes support,KDE QML applications theming support and
## NOTE KDE's icon engine support
## NOTE See https://aur.archlinux.org/pkgbase/qt6ct-kde/
version='@VERSION@'
pkgname='night-theme-switcher'
default_config_file="/usr/share/$pkgname/nts.skel"
@ -23,13 +22,6 @@ homedir=$(echo "$user_name" | cut -d: -f6)
XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$homedir/.config}"
user_config_file=${user_config_file:-$XDG_CONFIG_HOME/$pkgname/$pkgname.conf}
icon_theme_light=
icon_theme_dark=
kcolorscheme_light=
kcolorscheme_dark=
gtk_theme_light=
gtk_theme_dark=
### Begin insert of Arch script
# Avoid any encoding problems
export LANG=C
@ -66,7 +58,7 @@ if ! command -v qt6ct >/dev/null 2>&1; then
-h string:x-canonical-private-synchronous:sys-notify \
-u critical \
-i dialog-error
mesg="qt6ct is required to use this script."
mesg="qt6ct-kde is required to use this script."
echo -e "${red}==> ERROR:${all_off}${bold} ${mesg}${all_off}"
exit 1
fi
@ -87,7 +79,7 @@ check_config() {
if [[ ! -f $default_config_file ]]; then
local mesg="$default_config_file is missing. Reinstall this package to continue."
echo -e "${red}==> ERROR:${all_off}${bold} ${mesg}${all_off}"
# exit 1
exit 1
fi
if [[ ! -f "$user_config_file" ]]; then
echo -e "${bold}------------------------------------------------------------${all_off}"
@ -96,7 +88,7 @@ check_config() {
echo
echo -e "${bold} Edit this file before invoking $pkgname again.${all_off}"
echo -e "${bold}------------------------------------------------------------${all_off}"
#install -Dm644 $default_config_file "$user_config_file"
install -Dm644 $default_config_file "$user_config_file"
exit 0
else
# shellcheck source=nts.skel
@ -113,6 +105,26 @@ check_config() {
echo -e "${red}==> ERROR:${all_off}${bold} ${mesg}${all_off}"
exit 1
fi
if [[ ! -d "/usr/share/icons/$icon_theme_light" ]]; then
local mesg="Invalid icon_theme_light defined in\n ${blue}$user_config_file"
echo -e "${red}==> ERROR:${all_off}${bold} ${mesg}${all_off}"
exit 1
fi
if [[ ! -d "/usr/share/icons/$icon_theme_dark" ]]; then
local mesg="Invalid icon_theme_dark defined in ${blue}$user_config_file"
echo -e "${red}==> ERROR:${all_off}${bold} ${mesg}${all_off}"
exit 1
fi
if [[ ! -d "/usr/share/themes/$gtk_theme_light" ]]; then
local mesg="Invalid gtk_theme_light defined in\n ${blue}$user_config_file"
echo -e "${red}==> ERROR:${all_off}${bold} ${mesg}${all_off}"
exit 1
fi
if [[ ! -d "/usr/share/themes/$gtk_theme_dark" ]]; then
local mesg="Invalid gtk_theme_dark defined in ${blue}$user_config_file"
echo -e "${red}==> ERROR:${all_off}${bold} ${mesg}${all_off}"
exit 1
fi
fi
}
@ -231,21 +243,21 @@ preview() {
echo -e "${bold} Icon Theme"
if [[ -d "/usr/share/icons/$icon_theme_light" ]]; then
echo -en "${bold} Light:"
echo -e "$(tput cr)$(tput cuf 10)${blue}$icon_theme_light${all_off}${bold}${all_off}"
echo -e "$(tput cr)$(tput cuf 10)${blue}/usr/share/icons/$icon_theme_light${all_off}${bold}${all_off}"
fi
if [[ -d "/usr/share/icons/$icon_theme_dark" ]]; then
echo -en "${bold} Dark:"
echo -e "$(tput cr)$(tput cuf 10)${blue}$icon_theme_dark${all_off}${bold}${all_off}"
echo -e "$(tput cr)$(tput cuf 10)${blue}/usr/share/icons/$icon_theme_dark${all_off}${bold}${all_off}"
fi
echo
echo -e "${bold} GTK Theme"
if [[ -d "/usr/share/themes/$gtk_theme_light" ]]; then
echo -en "${bold} Light:"
echo -e "$(tput cr)$(tput cuf 10)${blue}$gtk_theme_light${all_off}${bold}${all_off}"
echo -e "$(tput cr)$(tput cuf 10)${blue}/usr/share/themes/$gtk_theme_light${all_off}${bold}${all_off}"
fi
if [[ -d "/usr/share/themes/$gtk_theme_dark" ]]; then
echo -en "${bold} Dark:"
echo -e "$(tput cr)$(tput cuf 10)${blue}$gtk_theme_dark${all_off}${bold}${all_off}"
echo -e "$(tput cr)$(tput cuf 10)${blue}/usr/share/themes/$gtk_theme_dark${all_off}${bold}${all_off}"
fi
}