diff --git a/bin/omarchy b/bin/omarchy index eda79a74..c23a6457 100755 --- a/bin/omarchy +++ b/bin/omarchy @@ -29,6 +29,7 @@ declare -A GROUP_DESCRIPTIONS GROUP_DESCRIPTIONS[ac]="AC power detection" GROUP_DESCRIPTIONS[battery]="Battery status helpers" GROUP_DESCRIPTIONS[branch]="Omarchy git branch management" +GROUP_DESCRIPTIONS[branding]="About and screensaver branding" GROUP_DESCRIPTIONS[brightness]="Display and keyboard brightness" GROUP_DESCRIPTIONS[capture]="Screenshots and screen recording" GROUP_DESCRIPTIONS[channel]="Omarchy release channel management" diff --git a/bin/omarchy-branding-about b/bin/omarchy-branding-about new file mode 100755 index 00000000..aca234de --- /dev/null +++ b/bin/omarchy-branding-about @@ -0,0 +1,28 @@ +#!/bin/bash + +# omarchy:summary=Edit, set, or reset About branding +# omarchy:group=branding +# omarchy:name=about +# omarchy:args= +# 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 " >&2 + exit 1 + ;; +esac diff --git a/bin/omarchy-branding-screensaver b/bin/omarchy-branding-screensaver new file mode 100755 index 00000000..57012af8 --- /dev/null +++ b/bin/omarchy-branding-screensaver @@ -0,0 +1,28 @@ +#!/bin/bash + +# omarchy:summary=Edit, set, or reset screensaver branding +# omarchy:group=branding +# omarchy:name=screensaver +# omarchy:args= +# 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 " >&2 + exit 1 + ;; +esac diff --git a/bin/omarchy-menu b/bin/omarchy-menu index 117ff6c0..1495d3b7 100755 --- a/bin/omarchy-menu +++ b/bin/omarchy-menu @@ -255,35 +255,29 @@ show_style_menu() { *Background*) show_background_menu ;; *Hyprland*) open_in_editor ~/.config/hypr/looknfeel.conf ;; *Screensaver*) show_screensaver_menu ;; - *About*) open_in_editor ~/.config/omarchy/branding/about.txt ;; + *About*) show_about_menu ;; *) show_main_menu ;; 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() { case $(menu "Screensaver" " Edit Text\n Set From Image\n Restore Default") in - *Text*) edit_screensaver_text ;; - *Image*) set_screensaver_from_image ;; - *Default*) restore_default_screensaver ;; + *Text*) omarchy-branding-screensaver text ;; + *Image*) omarchy-branding-screensaver image ;; + *Default*) omarchy-branding-screensaver reset ;; *) show_style_menu ;; 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() { omarchy-launch-walker -m menus:omarchythemes --width 800 --minheight 400 } diff --git a/bin/omarchy-screensaver-logo b/bin/omarchy-transcode-ascii similarity index 78% rename from bin/omarchy-screensaver-logo rename to bin/omarchy-transcode-ascii index 1c51a648..933452d7 100755 --- a/bin/omarchy-screensaver-logo +++ b/bin/omarchy-transcode-ascii @@ -1,18 +1,18 @@ #!/bin/bash -# omarchy:summary=Set the screensaver logo text from an SVG/PNG or the default -# omarchy:args= [--width ] [--height ] [--mode ] [--threshold ] [--invert] [--stdout] -# omarchy:examples=omarchy screensaver logo ~/logo.svg | omarchy screensaver logo default | omarchy screensaver logo ~/logo.png --width 80 --mode block --stdout +# omarchy:summary=Transcode an image into ASCII/Unicode art text +# omarchy:group=transcode +# omarchy:name=ascii +# omarchy:args= [--width ] [--height ] [--mode ] [--threshold ] [--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 usage() { cat <<'EOF' -Usage: omarchy-screensaver-logo [options] +Usage: omarchy-transcode-ascii [options] -Sets the screensaver logo text from an image. -Pass "default" instead of an image path to restore the Omarchy default. -By default, writes to ~/.config/omarchy/branding/screensaver.txt. +Transcodes an image into ASCII/Unicode art text. Options: -w, --width Maximum output width in terminal columns (default: 80) @@ -21,7 +21,6 @@ Options: -t, --threshold Pixel threshold from 0-100 (default: 50) --invert Treat light pixels as the logo instead of dark pixels --no-trim Preserve surrounding whitespace/background - --stdout Print converted text instead of writing the screensaver file --help Show this help EOF } @@ -32,9 +31,8 @@ mode=braille threshold=50 invert=false trim=true -output_path="$HOME/.config/omarchy/branding/screensaver.txt" image_path="" -reset_default=false +output_path="" while (($# > 0)); do case "$1" in @@ -98,9 +96,6 @@ while (($# > 0)); do --no-trim) trim=false ;; - --stdout) - output_path="-" - ;; --) shift break @@ -111,10 +106,10 @@ while (($# > 0)); do exit 1 ;; *) - if [[ $1 == "default" && -z $image_path ]]; then - reset_default=true - elif [[ -z $image_path ]]; then + if [[ -z $image_path ]]; then image_path="$1" + elif [[ -z $output_path ]]; then + output_path="$1" else echo "Unexpected argument: $1" >&2 usage >&2 @@ -127,10 +122,10 @@ done if (($# > 0)); then while (($# > 0)); do - if [[ $1 == "default" && -z $image_path ]]; then - reset_default=true - elif [[ -z $image_path ]]; then + if [[ -z $image_path ]]; then image_path="$1" + elif [[ -z $output_path ]]; then + output_path="$1" else echo "Unexpected argument: $1" >&2 usage >&2 @@ -140,29 +135,7 @@ if (($# > 0)); then done fi -if [[ $reset_default == "true" ]]; 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 +if [[ -z $image_path || -z $output_path ]]; then usage >&2 exit 1 fi @@ -375,10 +348,6 @@ if [[ ! -s $tmp_output ]]; then exit 1 fi -if [[ $output_path == "-" ]]; then - cat "$tmp_output" -else - mkdir -p "$(dirname "$output_path")" - cp "$tmp_output" "$output_path" - echo "Wrote screensaver logo text to $output_path" -fi +mkdir -p "$(dirname "$output_path")" +cp "$tmp_output" "$output_path" +echo "Wrote ASCII art to $output_path"