mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-01 20:28:16 +02:00
Add About screen branding and make everything generic and available through cli
This commit is contained in:
@@ -29,6 +29,7 @@ declare -A GROUP_DESCRIPTIONS
|
|||||||
GROUP_DESCRIPTIONS[ac]="AC power detection"
|
GROUP_DESCRIPTIONS[ac]="AC power detection"
|
||||||
GROUP_DESCRIPTIONS[battery]="Battery status helpers"
|
GROUP_DESCRIPTIONS[battery]="Battery status helpers"
|
||||||
GROUP_DESCRIPTIONS[branch]="Omarchy git branch management"
|
GROUP_DESCRIPTIONS[branch]="Omarchy git branch management"
|
||||||
|
GROUP_DESCRIPTIONS[branding]="About and screensaver branding"
|
||||||
GROUP_DESCRIPTIONS[brightness]="Display and keyboard brightness"
|
GROUP_DESCRIPTIONS[brightness]="Display and keyboard brightness"
|
||||||
GROUP_DESCRIPTIONS[capture]="Screenshots and screen recording"
|
GROUP_DESCRIPTIONS[capture]="Screenshots and screen recording"
|
||||||
GROUP_DESCRIPTIONS[channel]="Omarchy release channel management"
|
GROUP_DESCRIPTIONS[channel]="Omarchy release channel management"
|
||||||
|
|||||||
Executable
+28
@@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# omarchy:summary=Edit, set, or reset About branding
|
||||||
|
# omarchy:group=branding
|
||||||
|
# omarchy:name=about
|
||||||
|
# omarchy:args=<image|text|reset>
|
||||||
|
# omarchy:examples=omarchy branding about image | omarchy branding about text | omarchy branding about reset
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
case "${1:-}" in
|
||||||
|
image)
|
||||||
|
image=$(omarchy-menu-file "Logo image" "$HOME" "svg png")
|
||||||
|
if [[ -n $image ]] && omarchy-transcode-ascii "$image" ~/.config/omarchy/branding/about.txt --width 54 --height 26 --mode block; then
|
||||||
|
omarchy-launch-about >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
text)
|
||||||
|
omarchy-launch-editor ~/.config/omarchy/branding/about.txt >/dev/null 2>&1 && omarchy-launch-about >/dev/null 2>&1
|
||||||
|
;;
|
||||||
|
reset)
|
||||||
|
cp "$OMARCHY_PATH/icon.txt" ~/.config/omarchy/branding/about.txt && omarchy-launch-about >/dev/null 2>&1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: omarchy-branding-about <image|text|reset>" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
Executable
+28
@@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# omarchy:summary=Edit, set, or reset screensaver branding
|
||||||
|
# omarchy:group=branding
|
||||||
|
# omarchy:name=screensaver
|
||||||
|
# omarchy:args=<image|text|reset>
|
||||||
|
# omarchy:examples=omarchy branding screensaver image | omarchy branding screensaver text | omarchy branding screensaver reset
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
case "${1:-}" in
|
||||||
|
image)
|
||||||
|
image=$(omarchy-menu-file "Logo image" "$HOME" "svg png")
|
||||||
|
if [[ -n $image ]] && omarchy-transcode-ascii "$image" ~/.config/omarchy/branding/screensaver.txt; then
|
||||||
|
omarchy-launch-screensaver force >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
text)
|
||||||
|
omarchy-launch-editor ~/.config/omarchy/branding/screensaver.txt >/dev/null 2>&1 && omarchy-launch-screensaver force >/dev/null 2>&1
|
||||||
|
;;
|
||||||
|
reset)
|
||||||
|
cp "$OMARCHY_PATH/logo.txt" ~/.config/omarchy/branding/screensaver.txt && omarchy-launch-screensaver force >/dev/null 2>&1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: omarchy-branding-screensaver <image|text|reset>" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
+13
-19
@@ -255,35 +255,29 @@ show_style_menu() {
|
|||||||
*Background*) show_background_menu ;;
|
*Background*) show_background_menu ;;
|
||||||
*Hyprland*) open_in_editor ~/.config/hypr/looknfeel.conf ;;
|
*Hyprland*) open_in_editor ~/.config/hypr/looknfeel.conf ;;
|
||||||
*Screensaver*) show_screensaver_menu ;;
|
*Screensaver*) show_screensaver_menu ;;
|
||||||
*About*) open_in_editor ~/.config/omarchy/branding/about.txt ;;
|
*About*) show_about_menu ;;
|
||||||
*) show_main_menu ;;
|
*) show_main_menu ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
show_about_menu() {
|
||||||
|
case $(menu "About" " Edit Text\n Set From Image\n Restore Default") in
|
||||||
|
*Text*) omarchy-branding-about text ;;
|
||||||
|
*Image*) omarchy-branding-about image ;;
|
||||||
|
*Default*) omarchy-branding-about reset ;;
|
||||||
|
*) show_style_menu ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
show_screensaver_menu() {
|
show_screensaver_menu() {
|
||||||
case $(menu "Screensaver" " Edit Text\n Set From Image\n Restore Default") in
|
case $(menu "Screensaver" " Edit Text\n Set From Image\n Restore Default") in
|
||||||
*Text*) edit_screensaver_text ;;
|
*Text*) omarchy-branding-screensaver text ;;
|
||||||
*Image*) set_screensaver_from_image ;;
|
*Image*) omarchy-branding-screensaver image ;;
|
||||||
*Default*) restore_default_screensaver ;;
|
*Default*) omarchy-branding-screensaver reset ;;
|
||||||
*) show_style_menu ;;
|
*) show_style_menu ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
edit_screensaver_text() {
|
|
||||||
omarchy-launch-editor ~/.config/omarchy/branding/screensaver.txt && omarchy-launch-screensaver force
|
|
||||||
}
|
|
||||||
|
|
||||||
restore_default_screensaver() {
|
|
||||||
omarchy-screensaver-logo default && omarchy-launch-screensaver force
|
|
||||||
}
|
|
||||||
|
|
||||||
set_screensaver_from_image() {
|
|
||||||
local image=$(omarchy-menu-file "Logo image" "$HOME" "svg png")
|
|
||||||
if [[ -n $image ]] && omarchy-screensaver-logo "$image"; then
|
|
||||||
omarchy-launch-screensaver force
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
show_theme_menu() {
|
show_theme_menu() {
|
||||||
omarchy-launch-walker -m menus:omarchythemes --width 800 --minheight 400
|
omarchy-launch-walker -m menus:omarchythemes --width 800 --minheight 400
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# omarchy:summary=Set the screensaver logo text from an SVG/PNG or the default
|
# omarchy:summary=Transcode an image into ASCII/Unicode art text
|
||||||
# omarchy:args=<default|path-to-logo.svg|png> [--width <columns>] [--height <rows>] [--mode <braille|block>] [--threshold <percent>] [--invert] [--stdout]
|
# omarchy:group=transcode
|
||||||
# omarchy:examples=omarchy screensaver logo ~/logo.svg | omarchy screensaver logo default | omarchy screensaver logo ~/logo.png --width 80 --mode block --stdout
|
# omarchy:name=ascii
|
||||||
|
# omarchy:args=<input-image.svg|png> <output-path> [--width <columns>] [--height <rows>] [--mode <braille|block>] [--threshold <percent>] [--invert]
|
||||||
|
# omarchy:examples=omarchy transcode ascii ~/logo.svg /tmp/logo.txt | omarchy transcode ascii ~/logo.png ~/.config/omarchy/branding/screensaver.txt --width 80
|
||||||
|
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
cat <<'EOF'
|
cat <<'EOF'
|
||||||
Usage: omarchy-screensaver-logo <default|path-to-logo.svg|png> [options]
|
Usage: omarchy-transcode-ascii <input-image.svg|png> <output-path> [options]
|
||||||
|
|
||||||
Sets the screensaver logo text from an image.
|
Transcodes an image into ASCII/Unicode art text.
|
||||||
Pass "default" instead of an image path to restore the Omarchy default.
|
|
||||||
By default, writes to ~/.config/omarchy/branding/screensaver.txt.
|
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-w, --width <columns> Maximum output width in terminal columns (default: 80)
|
-w, --width <columns> Maximum output width in terminal columns (default: 80)
|
||||||
@@ -21,7 +21,6 @@ Options:
|
|||||||
-t, --threshold <percent> Pixel threshold from 0-100 (default: 50)
|
-t, --threshold <percent> Pixel threshold from 0-100 (default: 50)
|
||||||
--invert Treat light pixels as the logo instead of dark pixels
|
--invert Treat light pixels as the logo instead of dark pixels
|
||||||
--no-trim Preserve surrounding whitespace/background
|
--no-trim Preserve surrounding whitespace/background
|
||||||
--stdout Print converted text instead of writing the screensaver file
|
|
||||||
--help Show this help
|
--help Show this help
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
@@ -32,9 +31,8 @@ mode=braille
|
|||||||
threshold=50
|
threshold=50
|
||||||
invert=false
|
invert=false
|
||||||
trim=true
|
trim=true
|
||||||
output_path="$HOME/.config/omarchy/branding/screensaver.txt"
|
|
||||||
image_path=""
|
image_path=""
|
||||||
reset_default=false
|
output_path=""
|
||||||
|
|
||||||
while (($# > 0)); do
|
while (($# > 0)); do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@@ -98,9 +96,6 @@ while (($# > 0)); do
|
|||||||
--no-trim)
|
--no-trim)
|
||||||
trim=false
|
trim=false
|
||||||
;;
|
;;
|
||||||
--stdout)
|
|
||||||
output_path="-"
|
|
||||||
;;
|
|
||||||
--)
|
--)
|
||||||
shift
|
shift
|
||||||
break
|
break
|
||||||
@@ -111,10 +106,10 @@ while (($# > 0)); do
|
|||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [[ $1 == "default" && -z $image_path ]]; then
|
if [[ -z $image_path ]]; then
|
||||||
reset_default=true
|
|
||||||
elif [[ -z $image_path ]]; then
|
|
||||||
image_path="$1"
|
image_path="$1"
|
||||||
|
elif [[ -z $output_path ]]; then
|
||||||
|
output_path="$1"
|
||||||
else
|
else
|
||||||
echo "Unexpected argument: $1" >&2
|
echo "Unexpected argument: $1" >&2
|
||||||
usage >&2
|
usage >&2
|
||||||
@@ -127,10 +122,10 @@ done
|
|||||||
|
|
||||||
if (($# > 0)); then
|
if (($# > 0)); then
|
||||||
while (($# > 0)); do
|
while (($# > 0)); do
|
||||||
if [[ $1 == "default" && -z $image_path ]]; then
|
if [[ -z $image_path ]]; then
|
||||||
reset_default=true
|
|
||||||
elif [[ -z $image_path ]]; then
|
|
||||||
image_path="$1"
|
image_path="$1"
|
||||||
|
elif [[ -z $output_path ]]; then
|
||||||
|
output_path="$1"
|
||||||
else
|
else
|
||||||
echo "Unexpected argument: $1" >&2
|
echo "Unexpected argument: $1" >&2
|
||||||
usage >&2
|
usage >&2
|
||||||
@@ -140,29 +135,7 @@ if (($# > 0)); then
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $reset_default == "true" ]]; then
|
if [[ -z $image_path || -z $output_path ]]; then
|
||||||
if [[ -n $image_path ]]; then
|
|
||||||
echo "default does not accept an image path" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
default_path="${OMARCHY_PATH:-$HOME/.local/share/omarchy}/logo.txt"
|
|
||||||
if [[ ! -f $default_path ]]; then
|
|
||||||
echo "Default screensaver logo text not found: $default_path" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $output_path == "-" ]]; then
|
|
||||||
cat "$default_path"
|
|
||||||
else
|
|
||||||
mkdir -p "$(dirname "$output_path")"
|
|
||||||
cp "$default_path" "$output_path"
|
|
||||||
echo "Restored default screensaver logo text to $output_path"
|
|
||||||
fi
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -z $image_path ]]; then
|
|
||||||
usage >&2
|
usage >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -375,10 +348,6 @@ if [[ ! -s $tmp_output ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $output_path == "-" ]]; then
|
mkdir -p "$(dirname "$output_path")"
|
||||||
cat "$tmp_output"
|
cp "$tmp_output" "$output_path"
|
||||||
else
|
echo "Wrote ASCII art to $output_path"
|
||||||
mkdir -p "$(dirname "$output_path")"
|
|
||||||
cp "$tmp_output" "$output_path"
|
|
||||||
echo "Wrote screensaver logo text to $output_path"
|
|
||||||
fi
|
|
||||||
Reference in New Issue
Block a user