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 >────────────────────────────────────────────────────────────
# bar="hyprpanel"
bash "$HOME/.config/hypr/.scripts/bar"
bash "$HOME/.config/hypr/.scripts/wallpaper"
modules="
copyq
nwg-look
swww
wob
redshift
"

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# ─< scriptdir declaration >──────────────────────────────────────────────────────────────
_scripts="$HOME/.config/hypr/.scripts"
@ -8,18 +8,6 @@ command_exists() {
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 already running processes >─────────────────────────────────────────────────────
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() {
notify-send "low" "terminating main wm elements"
# notify-send "low" "terminating main wm elements"
_kill_
# relaunch swaync
sleep 0.3
# swaync >/dev/null 2>&1 &
notify-send "low" "bar" "launching.."
_bar
# notify-send "low" "bar" "launching.."
bash "$scriptdir/bar"
notify-send "low" "wallpaper" "loading.."
_wallpaper
bash "$scriptdir/wallpaper"
if command_exists redshift; then
notify-send "low" "redshift" "protecting your eyes from the blue light.."

View file

@ -12,8 +12,7 @@ export SWWW_TRANSITION=center
# │ Nordic, Windoof │
# ╰───────────────────────────────────────────────────────────────────────────╯
: "${SWWW_EXCLUDED_DIRS:=Anime,Colorful,Gaming,Gifs,Logos,Nordic,Windoof}"
init() {
# ─< checking for swww >──────────────────────────────────────────────────────────────────
if ! command -v swww >/dev/null 2>&1; then
notify-send "ERROR" "swww was not found on the system"
@ -31,9 +30,12 @@ if ! pgrep -x "swww-daemon" >/dev/null; then
fi
notify-send "SWWW" "started successfully"
fi
}
_swww() {
if [ -z "$1" ]; then
randomSwww() {
: "${SWWW_EXCLUDED_DIRS:=Anime,Colorful,Gaming,Gifs,Logos,Nordic,Windoof}"
# if [ -z "$1" ]; then
# ─< random wallpaper selection >─────────────────────────────────────────────────────────
local wall_dir="$HOME/.wallpaper"
@ -98,22 +100,69 @@ _swww() {
notify-send "ERROR" "Failed to set wallpaper: $pic"
return 1
fi
else
# Check if file exists
if [[ ! -f "$1" ]]; then
notify-send "ERROR" "File not found: $1"
return 1
fi
# ─< 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 ${1##*/}"
else
notify-send "ERROR" "Failed to set wallpaper: $1"
return 1
fi
fi
# else
#
# # Check if file exists
# if [[ ! -f "$1" ]]; then
# notify-send "ERROR" "File not found: $1"
# return 1
# fi
#
# # ─< 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 ${1##*/}"
# else
# notify-send "ERROR" "Failed to set wallpaper: $1"
# return 1
# 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
grim /tmp/shot.png
magick /tmp/shot.png -blur 0x8 /tmp/shot_blurred.png
wlogout --css $HOME/.config/wlogout/style.css
#!/usr/bin/env bash
# ─< Check if the given command exists silently >─────────────────────────────────────────
command_exists() {
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 >──────────────────────────────────────────────────────────
$menu = $rofi
$wallpaper = $scripts/wallpaper
$wallpaper = "$scripts/wallpaper random"
$screenshotTool = $scripts/screenshot
$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
$fileManager = caja # pcmanfm nautilus cosmic-files caja thunar dolphin
$lockscreen = swaylock --screenshots --clock --indicator --effect-pixelate 18 --effect-blur 8x8
$logout = wlogout
# $logout = wlogout
$logout = $scripts/wlogout.sh
$notify = swaync-client --open-panel
# $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
# ─< initialisation script >─────────────────────────────────────────────────────────────────
exec-once = systemctl --user start hyprpolkitagent
exec-once = $h_conf/.scripts/init.sh
exec-once = hypridle
exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
# See https://wiki.hyprland.org/Configuring/Environment-variables/