From 25fbd43f5d7cb097fa2673961ddfd50f3d203692 Mon Sep 17 00:00:00 2001 From: ahwx Date: Thu, 26 Feb 2026 00:31:12 +0100 Subject: [PATCH] feat: adds darwin-specific scripts --- .../home/scripts/scripts/change-wallpaper.sh | 18 ++++++++++++++++++ .../home/scripts/scripts/focus-kitty-picker.sh | 11 +++++++++++ modules/home/scripts/scripts/image-preview.sh | 10 ++++++++++ 3 files changed, 39 insertions(+) create mode 100644 modules/home/scripts/scripts/change-wallpaper.sh create mode 100644 modules/home/scripts/scripts/focus-kitty-picker.sh create mode 100644 modules/home/scripts/scripts/image-preview.sh diff --git a/modules/home/scripts/scripts/change-wallpaper.sh b/modules/home/scripts/scripts/change-wallpaper.sh new file mode 100644 index 0000000..633f1d7 --- /dev/null +++ b/modules/home/scripts/scripts/change-wallpaper.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +# focus-kitty-picker $1 + +selected_wallpaper=$( + eza -1 -X --no-quotes --absolute ~/Pictures/wallpapers/ | fzf --preview="wallpaper-preview {}" \ + --color=fg+:#b8bb26 \ + --color=hl:#fb4934,hl+:#fb4934,info:#83a598,marker:#fe8019 \ + --color=prompt:#fb4934,spinner:#fb4934,pointer:#fe8019,header:#b8bb26 \ + --color=border:#fe8019,scrollbar:#fabd2f,label:#fe8019 \ + --color=query:#b8bb26 \ + --color=preview-border:#fe8019 \ + --border="rounded" --border-label-pos="0" --preview-window="border-rounded" +) + +if [ ! -z "${selected_wallpaper}" ]; then + osascript -e "tell application \"System Events\" to tell every desktop to set picture to POSIX file \"$selected_wallpaper\"" +fi diff --git a/modules/home/scripts/scripts/focus-kitty-picker.sh b/modules/home/scripts/scripts/focus-kitty-picker.sh new file mode 100644 index 0000000..7b0eeb8 --- /dev/null +++ b/modules/home/scripts/scripts/focus-kitty-picker.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +if [ "$1" = "kitty-picker" ]; then + while :; do + window_id=$(aerospace list-windows --all --format %{window-id}%{app-name} --json | jq ".[] | select(.\"app-name\" == \"kitty\") | .\"window-id\"") + if [ ! -z "${window_id}" ]; then + $(aerospace focus --window-id "${window_id}") + break + fi + done +fi diff --git a/modules/home/scripts/scripts/image-preview.sh b/modules/home/scripts/scripts/image-preview.sh new file mode 100644 index 0000000..9aa6ee4 --- /dev/null +++ b/modules/home/scripts/scripts/image-preview.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +dim=${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES} + +if [[ $KITTY_WINDOW_ID ]] || [[ $GHOSTTY_RESOURCES_DIR ]] && command -v kitten >/dev/null; then + kitten icat --clear --transfer-mode=memory --unicode-placeholder --stdin=no --place="$dim@0x0" "$1" | sed '$d' | sed $'$s/$/\e[m/' +else + chafa -s "$dim" "$1" + echo +fi