some ghostty related fix
This commit is contained in:
@@ -72,27 +72,28 @@ touch "$image"
|
||||
# Copy image to local wallpaper directory
|
||||
|
||||
ext=${image##*.}
|
||||
wallpaper_ext="png"
|
||||
random_name=$(tr -dc 'a-zA-Z0-9' </dev/urandom | head -c 16)
|
||||
current_dir="$HOME/.local/share/wallpaper/current"
|
||||
image_copied="$current_dir/wallpaper-${random_name}.${ext}"
|
||||
wallpaper_image="$current_dir/wallpaper-${random_name}.${wallpaper_ext}"
|
||||
|
||||
mkdir -p "$current_dir" || {
|
||||
echo "Could not create directory $current_dir"
|
||||
exit 1
|
||||
}
|
||||
|
||||
temp_img=$(mktemp --suffix=."$ext") || exit 1
|
||||
temp_img=$(mktemp --suffix=."$wallpaper_ext") || exit 1
|
||||
trap 'rm -f "$temp_img"' EXIT
|
||||
magick "$image" -resize "${screen_width}x${screen_height}^" -gravity center -extent "${screen_width}x${screen_height}" "$temp_img" || {
|
||||
echo "Could not resize and crop image"
|
||||
exit 1
|
||||
}
|
||||
cp "$temp_img" "$image_copied" || exit 1
|
||||
cp "$temp_img" "$wallpaper_image" || exit 1
|
||||
hash="$(md5sum "$image" | awk '{print $1}')-${screen_width}x${screen_height}"
|
||||
|
||||
# Clean up old wallpapers
|
||||
|
||||
find "$current_dir" -type f -name "wallpaper-*" ! -name "$(basename "$image_copied")" -delete
|
||||
find "$current_dir" -type f -name "wallpaper-*" ! -name "$(basename "$wallpaper_image")" -delete
|
||||
|
||||
# Generate blurred wallpaper
|
||||
|
||||
@@ -102,8 +103,8 @@ mkdir -p "$blur_dir" "$blur_cache_dir" || {
|
||||
echo "Could not create cache directory"
|
||||
exit 1
|
||||
}
|
||||
blurred_image="$blur_dir/blurred-${random_name}.$ext"
|
||||
blurred_cache_image="$blur_cache_dir/${hash}.$ext"
|
||||
blurred_image="$blur_dir/blurred-${random_name}.${wallpaper_ext}"
|
||||
blurred_cache_image="$blur_cache_dir/${hash}.${wallpaper_ext}"
|
||||
|
||||
## Time consuming task (magick -blur) in background
|
||||
(
|
||||
@@ -125,7 +126,7 @@ blurred_cache_image="$blur_cache_dir/${hash}.$ext"
|
||||
fi
|
||||
fi
|
||||
|
||||
sigma=$(magick identify -format "%w %h" "$image_copied" | awk -v f=0.01 '{
|
||||
sigma=$(magick identify -format "%w %h" "$wallpaper_image" | awk -v f=0.01 '{
|
||||
m=($1>$2)?$1:$2;
|
||||
s=m*f;
|
||||
if(s<2) s=2;
|
||||
@@ -134,9 +135,9 @@ blurred_cache_image="$blur_cache_dir/${hash}.$ext"
|
||||
}')
|
||||
|
||||
### use a temporary file to avoid incomplete file being used
|
||||
temp_blurred=$(mktemp --suffix=."$ext") || exit 1
|
||||
temp_blurred=$(mktemp --suffix=."$wallpaper_ext") || exit 1
|
||||
trap 'rm -f "${temp_blurred}"' EXIT
|
||||
magick "$image_copied" -blur 0x"$sigma" "$temp_blurred" || {
|
||||
magick "$wallpaper_image" -blur 0x"$sigma" "$temp_blurred" || {
|
||||
echo "Could not create blurred image"
|
||||
exit 1
|
||||
}
|
||||
@@ -163,18 +164,18 @@ blurred_cache_image="$blur_cache_dir/${hash}.$ext"
|
||||
# Apply wallpaper
|
||||
|
||||
if [ "$XDG_CURRENT_DESKTOP" = "Hyprland" ]; then
|
||||
swww img -n background "$image_copied" --transition-type fade --transition-duration 2 >/dev/null 2>/dev/null
|
||||
swww img -n background "$wallpaper_image" --transition-type fade --transition-duration 2 >/dev/null 2>/dev/null
|
||||
|
||||
notify-send -a "change-wallpaper" "Wallpaper Changed" "$image" -i "$image_copied"
|
||||
notify-send -a "change-wallpaper" "Wallpaper Changed" "$image" -i "$wallpaper_image"
|
||||
|
||||
change-colortheme -i "$image_copied" || exit 1
|
||||
change-colortheme -i "$wallpaper_image" || exit 1
|
||||
elif [ "$XDG_CURRENT_DESKTOP" = "niri" ]; then
|
||||
### Handled in wallpaper-daemon
|
||||
# swww img -n background "$image_copied" --transition-type fade --transition-duration 2 > /dev/null 2> /dev/null
|
||||
# swww img -n background "$wallpaper_image" --transition-type fade --transition-duration 2 > /dev/null 2> /dev/null
|
||||
|
||||
notify-send -a "change-wallpaper" "Wallpaper Changed" "$image" -i "$image_copied"
|
||||
notify-send -a "change-wallpaper" "Wallpaper Changed" "$image" -i "$wallpaper_image"
|
||||
|
||||
change-colortheme -i "$image_copied" || exit 1
|
||||
change-colortheme -i "$wallpaper_image" || exit 1
|
||||
else
|
||||
echo "Unsupported desktop environment: $XDG_CURRENT_DESKTOP"
|
||||
exit 1
|
||||
|
||||
1
config/shell/.config/fish/post.d/.gitignore
vendored
1
config/shell/.config/fish/post.d/.gitignore
vendored
@@ -3,3 +3,4 @@
|
||||
!fetch.fish
|
||||
!sshs.fish
|
||||
!alias.fish
|
||||
!ghostty.fish
|
||||
@@ -94,7 +94,7 @@ if type -q git
|
||||
function acp
|
||||
git add . || return 1
|
||||
if test (count $argv) -eq 0
|
||||
git commit -m "too lazy to come up with a helpful commit message :)" || return 1
|
||||
git commit -m "👐 foo: too lazy to come up with a helpful commit message :)" || return 1
|
||||
else
|
||||
git commit -m "$argv" || return 1
|
||||
end
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
if not set -q fetch_logo_type
|
||||
set -g fetch_logo_type "auto"
|
||||
set -g fetch_logo_type auto
|
||||
end
|
||||
|
||||
if not set -q fetch_color
|
||||
set -g fetch_color "#89b4fa"
|
||||
end
|
||||
|
||||
if test "$fetch_logo_type" = "symbols"
|
||||
if test "$fetch_logo_type" = symbols
|
||||
set -g fetch_args "--logo-type raw --logo-width 42 --logo \"$HOME/.config/fastfetch/logo_ros/42x.symbols\" --color \"$fetch_color\""
|
||||
set -g fetch_args_brief "--logo-type raw --logo-width 28 --logo \"$HOME/.config/fastfetch/logo_ros/28x.symbols\" --color \"$fetch_color\""
|
||||
else if test "$fetch_logo_type" = "logo"
|
||||
else if test "$fetch_logo_type" = logo
|
||||
set -g fetch_args "--logo-type builtin"
|
||||
set -g fetch_args_brief "--logo-type small"
|
||||
else if test "$fetch_logo_type" = "sixel"
|
||||
else if test "$fetch_logo_type" = sixel
|
||||
set -g fetch_args "--logo-type raw --logo-width 42 --logo \"$HOME/.config/fastfetch/logo_ros/42x.sixel\" --color \"$fetch_color\""
|
||||
set -g fetch_args_brief "--logo-type raw --logo-width 28 --logo \"$HOME/.config/fastfetch/logo_ros/28x.sixel\" --color \"$fetch_color\""
|
||||
else # "kitty" or "auto" and others
|
||||
@@ -24,15 +24,15 @@ if type -q fastfetch
|
||||
alias ff="fastfetch -c $HOME/.config/fastfetch/config.jsonc $fetch_args"
|
||||
|
||||
if test -f "$HOME/.config/fastfetch/brief.jsonc"
|
||||
alias ff-brief="fastfetch -c $HOME/.config/fastfetch/brief.jsonc $fetch_args_brief"
|
||||
alias ffb="fastfetch -c $HOME/.config/fastfetch/brief.jsonc $fetch_args_brief"
|
||||
else
|
||||
alias ff-brief=ff
|
||||
alias ffb=ff
|
||||
end
|
||||
end
|
||||
|
||||
# add 'set -g no_fetch' somewhere other than post.d to disable fetching
|
||||
if not set -q no_fetch
|
||||
if type -q ff-brief
|
||||
ff-brief
|
||||
if type -q ffb
|
||||
ffb
|
||||
end
|
||||
end
|
||||
|
||||
6
config/shell/.config/fish/post.d/ghostty.fish
Normal file
6
config/shell/.config/fish/post.d/ghostty.fish
Normal file
@@ -0,0 +1,6 @@
|
||||
if string match -q '*ghostty*' $TERM && test $XDG_CURRENT_DESKTOP = niri
|
||||
if test "$ghostty_niri_initialized" != "1"
|
||||
set -xg ghostty_niri_initialized 1
|
||||
niri msg action set-column-width 50%
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user