This commit is contained in:
pika 2025-05-04 20:29:34 +02:00
parent 7d6d263d71
commit f59171268c
6 changed files with 190 additions and 115 deletions

View file

@ -23,11 +23,11 @@ initialize_modules() {
# ─< hyprpanel, waybar, gBar >──────────────────────────────────────────────────────────── # ─< hyprpanel, waybar, gBar >────────────────────────────────────────────────────────────
# bar="hyprpanel" # bar="hyprpanel"
bash "$HOME/.config/hypr/.scripts/bar" bash "$HOME/.config/hypr/.scripts/bar"
bash "$HOME/.config/hypr/.scripts/wallpaper"
modules=" modules="
copyq copyq
nwg-look nwg-look
swww
wob wob
redshift redshift
" "

View file

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# ─< scriptdir declaration >────────────────────────────────────────────────────────────── # ─< scriptdir declaration >──────────────────────────────────────────────────────────────
_scripts="$HOME/.config/hypr/.scripts" _scripts="$HOME/.config/hypr/.scripts"
@ -8,18 +8,6 @@ command_exists() {
command -v "$@" >/dev/null 2>&1 command -v "$@" >/dev/null 2>&1
} }
_wallpaper() {
if command -v swww >/dev/null 2>&1; then
if [ -e "$_scripts/random_swww.sh" ]; then
$_scripts/random_swww.sh
else
notify-send -u normal "" "script for initializing wallpaper with swww is missing.."
fi
else
notify-send -u low "" "There may be no wallpaper bc swww is missing!"
fi
}
_kill_() { _kill_() {
# ─< Kill already running processes >───────────────────────────────────────────────────── # ─< Kill already running processes >─────────────────────────────────────────────────────
hyprpanel="gjs" # since hyprpanel has so many different wordings, making it clear that this is currently the hyprpanel service name hyprpanel="gjs" # since hyprpanel has so many different wordings, making it clear that this is currently the hyprpanel service name
@ -95,17 +83,17 @@ _bar() {
main() { main() {
notify-send "low" "terminating main wm elements" # notify-send "low" "terminating main wm elements"
_kill_ _kill_
# relaunch swaync # relaunch swaync
sleep 0.3 sleep 0.3
# swaync >/dev/null 2>&1 & # swaync >/dev/null 2>&1 &
notify-send "low" "bar" "launching.." # notify-send "low" "bar" "launching.."
_bar bash "$scriptdir/bar"
notify-send "low" "wallpaper" "loading.." notify-send "low" "wallpaper" "loading.."
_wallpaper bash "$scriptdir/wallpaper"
if command_exists redshift; then if command_exists redshift; then
notify-send "low" "redshift" "protecting your eyes from the blue light.." notify-send "low" "redshift" "protecting your eyes from the blue light.."

View file

@ -12,16 +12,15 @@ export SWWW_TRANSITION=center
# │ Nordic, Windoof │ # │ Nordic, Windoof │
# ╰───────────────────────────────────────────────────────────────────────────╯ # ╰───────────────────────────────────────────────────────────────────────────╯
: "${SWWW_EXCLUDED_DIRS:=Anime,Colorful,Gaming,Gifs,Logos,Nordic,Windoof}" init() {
# ─< checking for swww >──────────────────────────────────────────────────────────────────
# ─< checking for swww >────────────────────────────────────────────────────────────────── if ! command -v swww >/dev/null 2>&1; then
if ! command -v swww >/dev/null 2>&1; then
notify-send "ERROR" "swww was not found on the system" notify-send "ERROR" "swww was not found on the system"
exit 1 exit 1
fi fi
# ─< Check if swww daemon is running, start if not >───────────────────────────────────── # ─< Check if swww daemon is running, start if not >─────────────────────────────────────
if ! pgrep -x "swww-daemon" >/dev/null; then if ! pgrep -x "swww-daemon" >/dev/null; then
notify-send "SWWW" "swww not running - starting it now" notify-send "SWWW" "swww not running - starting it now"
swww-daemon swww-daemon
sleep 1 # Give the daemon a second to start sleep 1 # Give the daemon a second to start
@ -30,10 +29,13 @@ if ! pgrep -x "swww-daemon" >/dev/null; then
return 1 return 1
fi fi
notify-send "SWWW" "started successfully" notify-send "SWWW" "started successfully"
fi fi
}
_swww() { randomSwww() {
if [ -z "$1" ]; then : "${SWWW_EXCLUDED_DIRS:=Anime,Colorful,Gaming,Gifs,Logos,Nordic,Windoof}"
# if [ -z "$1" ]; then
# ─< random wallpaper selection >───────────────────────────────────────────────────────── # ─< random wallpaper selection >─────────────────────────────────────────────────────────
local wall_dir="$HOME/.wallpaper" local wall_dir="$HOME/.wallpaper"
@ -98,22 +100,69 @@ _swww() {
notify-send "ERROR" "Failed to set wallpaper: $pic" notify-send "ERROR" "Failed to set wallpaper: $pic"
return 1 return 1
fi fi
else # else
#
# Check if file exists # # Check if file exists
if [[ ! -f "$1" ]]; then # if [[ ! -f "$1" ]]; then
notify-send "ERROR" "File not found: $1" # notify-send "ERROR" "File not found: $1"
return 1 # return 1
fi # fi
#
# ─< executing swww with the random $pic >──────────────────────────────────────────────── # # ─< executing swww with the random $pic >────────────────────────────────────────────────
if swww img "$1" --transition-fps "$SWWW_TRANSITION_FPS" --transition-step "$SWWW_TRANSITION_STEP" --transition-type "$SWWW_TRANSITION"; then # if swww img "$1" --transition-fps "$SWWW_TRANSITION_FPS" --transition-step "$SWWW_TRANSITION_STEP" --transition-type "$SWWW_TRANSITION"; then
notify-send "󰸉 " "Changed wallpaper to ${1##*/}" # notify-send "󰸉 " "Changed wallpaper to ${1##*/}"
else # else
notify-send "ERROR" "Failed to set wallpaper: $1" # notify-send "ERROR" "Failed to set wallpaper: $1"
return 1 # return 1
fi # fi
fi # fi
} }
_swww "$@" # Main logic
if [ -z "$1" ]; then
init
# No argument given, use the last wallpaper
# last_wallpaper_file="$HOME/.last_wallpaper"
# if [ -f "$last_wallpaper_file" ]; then
# last_wallpaper=$(cat "$last_wallpaper_file")
# set_wallpaper "$last_wallpaper"
# else
# log_notify "critical" "Error" "No last wallpaper found"
# exit 1
# fi
elif [ "$1" == "random" ]; then
randomSwww
# Use a random wallpaper
# wall_dir="$HOME/.wallpaper"
# IFS=',' read -ra EXCLUDED_DIRS <<<"$SWWW_EXCLUDED_DIRS"
# shopt -s globstar nullglob
# pics=()
# for pic in "$wall_dir"/**/*.{png,jpg,jpeg,gif}; do
# for dir in "${EXCLUDED_DIRS[@]}"; do
# [[ $pic == "$wall_dir/$dir/"* ]] && continue 2
# done
# pics+=("$pic")
# done
# random_pic=$(printf "%s\n" "${pics[@]}" | shuf -n 1)
# if [ -z "$random_pic" ]; then
# log_notify "critical" "Error" "No wallpapers found in $wall_dir (excluding: $SWWW_EXCLUDED_DIRS)"
# exit 1
# fi
# set_wallpaper "$random_pic"
# echo "$random_pic" >"$HOME/.last_wallpaper"
else
# Use the specified path
if [ -f "$1" ]; then
# ─< executing swww with the random $pic >────────────────────────────────────────────────
if swww img "$1" --transition-fps "$SWWW_TRANSITION_FPS" --transition-step "$SWWW_TRANSITION_STEP" --transition-type "$SWWW_TRANSITION"; then
notify-send "󰸉 " "Changed wallpaper to ${pic##*/}"
notify-send " " "Not sourcing from: $SWWW_EXCLUDED_DIRS"
else
notify-send "ERROR" "Failed to set wallpaper: $pic"
return 1
fi
else
log_notify "critical" "Error" "File not found: $1"
exit 1
fi
fi

View file

@ -1,4 +1,42 @@
#!/bin/bash #!/usr/bin/env bash
grim /tmp/shot.png # ─< Check if the given command exists silently >─────────────────────────────────────────
magick /tmp/shot.png -blur 0x8 /tmp/shot_blurred.png command_exists() {
wlogout --css $HOME/.config/wlogout/style.css command -v "$@" >/dev/null 2>&1
}
if ! command_exists wlogout; then
exit 1
fi
# Take a screenshot and blur it using ffmpeg
take_and_blur_screenshot() {
local blurred_path="$HOME/.config/wlogout/tmp.png"
# Take a screenshot and blur it
grim -t ppm - | ffmpeg -f image2pipe -vcodec ppm -i - -vf "gblur=sigma=8" -vframes 1 "$blurred_path"
# handle_error $? "grim and ffmpeg"
}
# Main logic
if ! command_exists wlogout; then
# log_notify "critical" "Error" "wlogout not found"
exit 1
fi
if command_exists grim && command_exists ffmpeg; then
take_and_blur_screenshot
wlogout --css "$HOME/.config/wlogout/style_blur.css"
else
# log_notify "critical" "Error" "Required tools (grim, ffmpeg) not found"
exit 1
fi
# wlogout
# if command_exists grim && command_exists magick; then
# grim /tmp/shot.png
# magick /tmp/shot.png -blur 0x8 $HOME/.config/wlogout/tmp.png
# wlogout --css $HOME/.config/wlogout/style_blur.css
# else
# wlogout
# fi

View file

@ -47,7 +47,7 @@ $tofi = pkill tofi || tofi-drun -c $HOME/.config/tofi/config
# ─< Set programs that you use >────────────────────────────────────────────────────────── # ─< Set programs that you use >──────────────────────────────────────────────────────────
$menu = $rofi $menu = $rofi
$wallpaper = $scripts/wallpaper $wallpaper = "$scripts/wallpaper random"
$screenshotTool = $scripts/screenshot $screenshotTool = $scripts/screenshot
$test = $scripts/a.sh $test = $scripts/a.sh
@ -55,7 +55,8 @@ $terminal = foot # kitty --class="shell" -e zsh # wezterm start --always-new-pro
$browser = zen-browser # brave-browser $browser = zen-browser # brave-browser
$fileManager = caja # pcmanfm nautilus cosmic-files caja thunar dolphin $fileManager = caja # pcmanfm nautilus cosmic-files caja thunar dolphin
$lockscreen = swaylock --screenshots --clock --indicator --effect-pixelate 18 --effect-blur 8x8 $lockscreen = swaylock --screenshots --clock --indicator --effect-pixelate 18 --effect-blur 8x8
$logout = wlogout # $logout = wlogout
$logout = $scripts/wlogout.sh
$notify = swaync-client --open-panel $notify = swaync-client --open-panel
# $screenshotTool = hyprshot --clipboard-only -m region # $screenshotTool = hyprshot --clipboard-only -m region

View file

@ -46,10 +46,9 @@ workspace = 69, monitor:$main, persistent:true, allow-tearing:true, gapsin:0, ga
workspace = special:magic, monitor:$main, on-created-empty:$terminal, border:0 workspace = special:magic, monitor:$main, on-created-empty:$terminal, border:0
# ─< initialisation script >───────────────────────────────────────────────────────────────── # ─< initialisation script >─────────────────────────────────────────────────────────────────
exec-once = systemctl --user start hyprpolkitagent
exec-once = $h_conf/.scripts/init.sh exec-once = $h_conf/.scripts/init.sh
exec-once = hypridle exec-once = hypridle
exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
# See https://wiki.hyprland.org/Configuring/Environment-variables/ # See https://wiki.hyprland.org/Configuring/Environment-variables/