Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ublue-fastfetch package for shared fastfetch configuration #85

Merged
merged 1 commit into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions ublue/fastfetch/src/ublue-bling-fastfetch
Original file line number Diff line number Diff line change
@@ -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
29 changes: 29 additions & 0 deletions ublue/fastfetch/src/ublue-fastfetch
Original file line number Diff line number Diff line change
@@ -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


4 changes: 4 additions & 0 deletions ublue/fastfetch/src/vendor.fish
Original file line number Diff line number Diff line change
@@ -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'
4 changes: 4 additions & 0 deletions ublue/fastfetch/src/vendor.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
alias neofetch='/usr/libexec/ublue-fastfetch'

Check failure on line 1 in ublue/fastfetch/src/vendor.sh

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

ublue/fastfetch/src/vendor.sh#L1

Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.
alias neowofetch='/usr/libexec/ublue-fastfetch'
alias hyfetch='/usr/libexec/ublue-fastfetch'
alias fastfetch='/usr/libexec/ublue-fastfetch'
34 changes: 34 additions & 0 deletions ublue/fastfetch/ublue-fastfetch.spec
Original file line number Diff line number Diff line change
@@ -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
Loading