diff --git a/ublue/fastfetch/src/ublue-bling-fastfetch b/ublue/fastfetch/src/ublue-bling-fastfetch new file mode 100755 index 0000000..3a4f9a8 --- /dev/null +++ b/ublue/fastfetch/src/ublue-bling-fastfetch @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +THEME=$(gsettings get org.gnome.desktop.interface accent-color 2>/dev/null || echo "'slate'") +THEME=${THEME//\'/} + +FASTFETCH_COLOR_SET="38;2;53;132;228" +case $THEME in + "blue") + FASTFETCH_COLOR_SET="38;2;53;132;228" + ;; + "green") + FASTFETCH_COLOR_SET="38;2;58;148;74" + ;; + "orange") + FASTFETCH_COLOR_SET="38;2;237;91;0" + ;; + "pink") + FASTFETCH_COLOR_SET="38;2;213;97;153" + ;; + "purple") + FASTFETCH_COLOR_SET="38;2;139;62;165" + ;; + "red") + FASTFETCH_COLOR_SET="38;2;230;45;66" + ;; + "slate") + FASTFETCH_COLOR_SET="38;2;111;131;150" + ;; + "teal") + FASTFETCH_COLOR_SET="38;2;33;144;164" + ;; + "yellow") + FASTFETCH_COLOR_SET="38;2;200;136;0" + ;; +esac + +echo $FASTFETCH_COLOR_SET +exit 0 diff --git a/ublue/fastfetch/src/ublue-fastfetch b/ublue/fastfetch/src/ublue-fastfetch new file mode 100755 index 0000000..72e2536 --- /dev/null +++ b/ublue/fastfetch/src/ublue-fastfetch @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +get_config() { + FASTFETCH_CONFIG_FILE="${FASTFETCH_CONFIG_FILE:-/etc/ublue-os/fastfetch.json}" + QUERY="$1" + FALLBACK="$2" + shift + shift + OUTPUT="$(jq -r "$QUERY" "$FASTFETCH_CONFIG_FILE" 2>/dev/null || echo "$FALLBACK")" + if [ "$OUTPUT" == "null" ] ; then + echo "$FALLBACK" + return + fi + echo "$OUTPUT" +} + +DEFAULT_THEME="$(get_config '."default-theme"' "slate")" +FASTFETCH_CONFIG="$(get_config '."fastfetch-config"' "/usr/share/ublue-os/fastfetch.jsonc")" +SHUFFLE_LOGO="$(get_config '."shuffle-logo"' "false")" +LOGO_DIRECTORY="$(get_config '."logo-directory"' "/usr/share/ublue-os/fastfetch")" + +if [ "$SHUFFLE_LOGO" == "true" ] ; then + FETCH_LOGO="$(/usr/bin/find "$LOGO_DIRECTORY" | /usr/bin/shuf -n 1)" + /usr/bin/fastfetch --logo "$FETCH_LOGO" --color "$(/usr/libexec/ublue-bling-fastfetch)" --config "/usr/share/ublue-os/ublue-os.jsonc" +else + /usr/bin/fastfetch --color "$(/usr/libexec/ublue-bling-fastfetch)" --config "/usr/share/ublue-os/ublue-os.jsonc" +fi + + diff --git a/ublue/fastfetch/src/vendor.fish b/ublue/fastfetch/src/vendor.fish new file mode 100644 index 0000000..daf1b1e --- /dev/null +++ b/ublue/fastfetch/src/vendor.fish @@ -0,0 +1,4 @@ +alias neofetch='/usr/libexec/ublue-fastfetch' +alias neowofetch='/usr/libexec/ublue-fastfetch' +alias hyfetch='/usr/libexec/ublue-fastfetch' +alias fastfetch='/usr/libexec/ublue-fastfetch' diff --git a/ublue/fastfetch/src/vendor.sh b/ublue/fastfetch/src/vendor.sh new file mode 100644 index 0000000..daf1b1e --- /dev/null +++ b/ublue/fastfetch/src/vendor.sh @@ -0,0 +1,4 @@ +alias neofetch='/usr/libexec/ublue-fastfetch' +alias neowofetch='/usr/libexec/ublue-fastfetch' +alias hyfetch='/usr/libexec/ublue-fastfetch' +alias fastfetch='/usr/libexec/ublue-fastfetch' diff --git a/ublue/fastfetch/ublue-fastfetch.spec b/ublue/fastfetch/ublue-fastfetch.spec new file mode 100644 index 0000000..6957d4b --- /dev/null +++ b/ublue/fastfetch/ublue-fastfetch.spec @@ -0,0 +1,34 @@ +%global debug_package %{nil} + +Name: ublue-fastfetch +Version: 0.1.0 +Release: 1%{?dist} +Summary: Fastfetch configuration for Universal Blue systems + +License: Apache-2.0 +URL: https://github.com/ublue-os/packages +VCS: {{{ git_dir_vcs }}} +Source: {{{ git_dir_pack }}} + +Requires: fastfetch + +%description +Fastfetch configuration for Universal Blue systems + +%prep +{{{ git_dir_setup_macro }}} + +%install +install -Dm0755 ./src/%{name} %{buildroot}%{_libexecdir}/%{name} +install -Dm0755 ./src/ublue-bling-fastfetch %{buildroot}%{_libexecdir}/ublue-bling-fastfetch +install -Dm0755 ./src/vendor.sh %{buildroot}%{_sysconfdir}/profile.d/%{name}.sh +install -Dm0755 ./src/vendor.fish %{buildroot}%{_datadir}/fish/vendor_conf.d/%{name}.fish + +%files +%{_libexecdir}/%{name} +%{_libexecdir}/ublue-bling-fastfetch +%{_sysconfdir}/profile.d/%{name}.sh +%{_datadir}/fish/vendor_conf.d/%{name}.fish + +%changelog +%autochangelog