add niri setup
This commit is contained in:
@@ -32,6 +32,8 @@
|
||||
edit $HOME/.config/wlogout/icons/*.svg
|
||||
|
||||
- fuzzel: edit $HOME/.config/fuzzel/fuzzel.ini
|
||||
|
||||
- niri: edit $HOME/.config/niri/config.kdl
|
||||
'''
|
||||
|
||||
import os
|
||||
@@ -208,6 +210,12 @@ def _change_fuzzel(palette: dict[str, str], flavor: str):
|
||||
replace_placeholders(fuzzel_dist, palette, flavor)
|
||||
|
||||
|
||||
def _change_niri(palette: dict[str, str], flavor: str):
|
||||
niri_template = Path.home().joinpath('.config', 'niri', 'config.kdl.template')
|
||||
niri_dist = copy_template(niri_template, Path.home().joinpath('.config', 'niri'))
|
||||
replace_placeholders(niri_dist, palette, flavor)
|
||||
|
||||
|
||||
apply_theme_funcs: dict[str, Callable[[dict[str, str], str], None]] = {
|
||||
'kvantum': _change_kvantum,
|
||||
# 'nwg-look': _change_nwglook,
|
||||
@@ -220,7 +228,8 @@ apply_theme_funcs: dict[str, Callable[[dict[str, str], str], None]] = {
|
||||
'mako': _change_mako,
|
||||
'yazi': _change_yazi,
|
||||
'wlogout': _change_wlogout,
|
||||
'fuzzel': _change_fuzzel
|
||||
'fuzzel': _change_fuzzel,
|
||||
'niri': _change_niri,
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -16,16 +16,43 @@ temp_img=$(mktemp --suffix=."$ext") || exit 1
|
||||
cp "$image" "$temp_img" || exit 1
|
||||
rm -f "$current_dir"/wallpaper.*
|
||||
cp -f "$temp_img" "$image_copied" || (
|
||||
notify-send "Error" "Could not copy image to $current_dir"
|
||||
rm -f "$temp_img"
|
||||
exit 1
|
||||
)
|
||||
rm -f "$temp_img"
|
||||
|
||||
hyprctl hyprpaper reload ,"$image_copied" || exit 1
|
||||
echo "preload = $image_copied" >"$HOME/.config/hypr/hyprpaper.conf"
|
||||
echo "wallpaper = , $image_copied" >>"$HOME/.config/hypr/hyprpaper.conf"
|
||||
if [ "$XDG_CURRENT_DESKTOP" = "Hyprland" ]; then
|
||||
hyprctl hyprpaper reload ,"$image_copied" || exit 1
|
||||
echo "preload = $image_copied" >"$HOME/.config/hypr/hyprpaper.conf"
|
||||
echo "wallpaper = , $image_copied" >>"$HOME/.config/hypr/hyprpaper.conf"
|
||||
|
||||
notify-send "Wallpaper Changed" "$image"
|
||||
notify-send "Wallpaper Changed" "$image"
|
||||
elif [ "$XDG_CURRENT_DESKTOP" = "niri" ]; then
|
||||
killall swaybg
|
||||
killall swww
|
||||
|
||||
cache_dir="$HOME/.cache/swaybg"
|
||||
mkdir -p "$cache_dir" || (
|
||||
notify-send "Error" "Could not create cache directory"
|
||||
exit 1
|
||||
)
|
||||
blurred_image="$cache_dir/blurred.$ext"
|
||||
|
||||
# blur
|
||||
magick "$image_copied" -blur 0x16 "$blurred_image" || (
|
||||
notify-send "Error" "Could not create blurred image"
|
||||
exit 1
|
||||
)
|
||||
|
||||
(setsid swaybg -i "$blurred_image" -m fill > /dev/null 2> /dev/null &)&
|
||||
disown
|
||||
Q
|
||||
(setsid swww img "$image_copied" --transition-type fade --transition-duration 2 > /dev/null 2> /dev/null &)&
|
||||
disown
|
||||
|
||||
notify-send "Wallpaper Changed" "$image"
|
||||
fi
|
||||
|
||||
notify-send "Extracting colors from wallpaper" "This may take a few seconds..."
|
||||
change-colortheme -i "$image_copied" || exit 1
|
||||
|
||||
21
.scripts/config-switch
Executable file
21
.scripts/config-switch
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
desktop="$XDG_CURRENT_DESKTOP"
|
||||
else
|
||||
desktop="$1"
|
||||
fi
|
||||
|
||||
for item in "waybar" "kitty" "ghostty"; do
|
||||
[ -L "$HOME/.config/$item" ] || exit 1
|
||||
|
||||
rm "$HOME/.config/$item"
|
||||
|
||||
path="$(dirname "$(readlink -f "$0")")"
|
||||
|
||||
if [ "$desktop" = "niri" ]; then
|
||||
ln -s "$path/../$item-niri" "$HOME/.config/$item"
|
||||
else
|
||||
ln -s "$path/../$item" "$HOME/.config/$item"
|
||||
fi
|
||||
done
|
||||
Reference in New Issue
Block a user