This commit is contained in:
pika 2025-06-19 15:20:20 +02:00
parent 9b3171425d
commit 9117240088
6 changed files with 93 additions and 139 deletions

View file

@ -33,7 +33,7 @@ device {
} }
# ─────────────────< See https://wiki.hyprland.org/Configuring/Keywords/ >─────────────── # ─────────────────< See https://wiki.hyprland.org/Configuring/Keywords/ >───────────────
$SCRIPTS = ~/.config/hypr/.scripts $SCRIPTS = ~/.config/hypr/scripts
# ─< set mod key >──────────────────────────────────────────────────────────────────────── # ─< set mod key >────────────────────────────────────────────────────────────────────────
$mainMod = ALT # Sets "ALT" key as main modifier $mainMod = ALT # Sets "ALT" key as main modifier

View file

@ -28,10 +28,9 @@ source = $confDirHyprland/auto-exec.conf
source = $HOME/.monitors.conf source = $HOME/.monitors.conf
# variable for specialworkspace (has to be configured in .monitors.conf like -> 'workspace = name:x, on-created-empty:$terminal') # variable for specialworkspace (has to be configured in .monitors.conf like -> 'workspace = name:x, on-created-empty:$terminal')
# $terminal = foot # SINGLE MONITOR SETUP:
# $browser = zen-browser
# $secondary = $main # <- Uncomment this, if you only have one monitor # $secondary = $main # <- Uncomment this, if you only have one monitor
# ─< main-workspaces >──────────────────────────────────────────────────────────────────────────── # ─< main-workspaces >────────────────────────────────────────────────────────────────────────────
workspace = 1, monitor:$main, persitent:true workspace = 1, monitor:$main, persitent:true
workspace = 2, monitor:$secondary, persitent:true workspace = 2, monitor:$secondary, persitent:true
@ -106,6 +105,9 @@ windowrule = nodim, initialClass:zen
windowrule = opaque, initialClass:(Zen Browser), class:^(youtube)$ windowrule = opaque, initialClass:(Zen Browser), class:^(youtube)$
windowrule = opaque, initialTitle:(Zen Browser), class:^(twitch)$ windowrule = opaque, initialTitle:(Zen Browser), class:^(twitch)$
# crunchyroll opaque
windowrule = opaque, class:(Crunchyroll)
# https://wiki.hyprland.org/Configuring/Variables/#general # https://wiki.hyprland.org/Configuring/Variables/#general
general { general {
gaps_in = 1 gaps_in = 1

View file

@ -13,53 +13,39 @@ command_exists() {
command -v "$@" >/dev/null 2>&1 command -v "$@" >/dev/null 2>&1
} }
# fallback() { proc-kill-if() {
# if command_exists hyprpanel; then if pgrep "$1"; then
# pkill hyprpanel pkill "$1"
# handle_error $? "pkill hyprpanel" fi
# hyprpanel & }
# handle_error $? "hyprpanel"
# elif command_exists gBar; then
# pkill gBar
# handle_error $? "pkill gBar"
# gBar bar 0 &
# handle_error $? "gBar bar 0"
# elif command_exists waybar; then
# pkill waybar
# handle_error $? "pkill waybar"
# waybar &
# handle_error $? "waybar"
# else
# log_notify "critical" "Error" "No compatible bar found"
# exit 1
# fi
# }
barsetup() { barsetup() {
local bar="${1:-quickshell}" local bar="${1:-quickshell}"
case "$bar" in proc-kill-if "$bar"
hyprpanel)
pkill hyprpanel # case "$bar" in
hyprpanel & # hyprpanel)
;; # pkill hyprpanel
gBar) # hyprpanel &
pkill gBar # ;;
gBar bar 0 & # gBar)
;; # pkill gBar
waybar) # gBar bar 0 &
pkill waybar # ;;
waybar & # waybar)
;; # pkill waybar
quickshell) # waybar &
pkill qs # ;;
qs & # quickshell)
;; # pkill qs
*) # qs &
pkill $bar # ;;
$bar & # *)
;; # pkill $bar
esac # $bar &
# ;;
# esac
} }
if barsetup "$@"; then if barsetup "$@"; then

View file

@ -16,7 +16,7 @@ kill-all() {
done done
} }
SCRIPTS="$HOME/.config/hypr/.scripts" SCRIPTS="$HOME/.config/hypr/scripts"
# Logging helper # Logging helper
log_notify() { log_notify() {
@ -53,16 +53,14 @@ setup-desktop() {
case $module in case $module in
copyq) copyq)
# pkill copyq 2>/dev/null if ! pgrep copyq; then
copyq --start-server copyq --start-server
# sleep 1 fi
# if ! pgrep -x copyq >/dev/null; then
# # log_notify "critical" "ERROR" "CopyQ failed to start. Retrying..."
# copyq --start-server
# fi
;; ;;
lxappearance) lxappearance)
if ! pgrep lxappearance; then
lxappearance >/dev/null 2>&1 & lxappearance >/dev/null 2>&1 &
fi
;; ;;
'nwg-look') 'nwg-look')
nwg-look -a >/dev/null 2>&1 & nwg-look -a >/dev/null 2>&1 &
@ -75,8 +73,7 @@ setup-desktop() {
# fi # fi
# ;; # ;;
redshift) redshift)
pkill redshift 2>/dev/null . "$SCRIPTS/redshift.sh"
bash -c "$SCRIPTS/redshift.sh"
;; ;;
wob) wob)
local fifo="/tmp/$HYPRLAND_INSTANCE_SIGNATURE.wob" local fifo="/tmp/$HYPRLAND_INSTANCE_SIGNATURE.wob"
@ -91,16 +88,16 @@ setup-desktop() {
# Start polkit authentication agent # Start polkit authentication agent
init-polkit() { init-polkit() {
agents=" agents=(
/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 "/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1"
/usr/lib/polkit-kde-authentication-agent-1 "/usr/lib/polkit-kde-authentication-agent-1"
/usr/libexec/polkit-gnome-authentication-agent-1 "/usr/libexec/polkit-gnome-authentication-agent-1"
/usr/lib/x86_64-linux-gnu/libexec/polkit-kde-authentication-agent-1 "/usr/lib/x86_64-linux-gnu/libexec/polkit-kde-authentication-agent-1"
/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 "/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1"
/usr/lib/polkit-1/polkit-agent-helper-1 "/usr/lib/polkit-1/polkit-agent-helper-1"
" )
for agent in $agents; do for agent in "${agents[@]}"; do
if [ -x "$agent" ]; then if [ -x "$agent" ]; then
log_notify "normal" "INFO" "Starting Polkit agent: $(basename "$agent")" log_notify "normal" "INFO" "Starting Polkit agent: $(basename "$agent")"
"$agent" & "$agent" &

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# ─< scriptdir declaration >────────────────────────────────────────────────────────────── # ─< scriptdir declaration >──────────────────────────────────────────────────────────────
SCRIPTS="$HOME/.config/hypr/.scripts" SCRIPTS="$HOME/.config/hypr/scripts"
# ─< Check if the given command exists silently >───────────────────────────────────────── # ─< Check if the given command exists silently >─────────────────────────────────────────
command_exists() { command_exists() {
@ -20,67 +20,9 @@ _kill_() {
} }
_redshift() { _redshift() {
. $SCRIPTS/redshift.sh && notify-send -u low "󰴅" "Redshift active" . "$SCRIPTS/redshift.sh"
} }
# ─< Relaunch waybar >────────────────────────────────────────────────────────────────────
pywall_waybar() {
notify-send -u low "Bar" "waybar is launching with wal.."
waybar --style $HOME/.config/waybar/pywal_style.css
}
_hyprpanel() {
notify-send -u low "Bar" "hyprpanel is loading.."
hyprpanel &
}
_waybar() {
if command_exists wal; then
pywall_waybar
else
notify-send -u normal "Bar" "waybar is loading.."
waybar --config $HOME/.config/waybar/ai_config.jsonc --style $HOME/.config/waybar/ai_style.css &
fi
}
# ─< Relaunch gBar >──────────────────────────────────────────────────────────────────────
_gBar() {
notify-send -u low "Bar" "gBar is loading.."
gBar bar 0 &
gBar bar 1 &
}
_bar() {
if command_exists hyprpanel; then
_hyprpanel
elif command_exists gBar; then
_gBar
elif command_exists waybar; then
_waybar
else
notify-send -u critical "ERROR" "No 'bar'-provider found! Install either hyprpanel, gBar or waybar!"
fi
}
# # for cava-pywal (note, need to manually restart cava once wallpaper changes)
# # ln -sf "$HOME/.cache/wal/cava-colors" "$HOME/.config/cava/config" || true
# if [ -d "$HOME/.cache/wal/" ]; then
# ln -sf "$HOME/.cache/wal/colors-rofi-dark.rasi" "$HOME/.config/rofi/pywal-color/pywal-theme.rasi" || true
# if [ -e "$HOME/.config/waybar/pywal.css" ]; then
# rm $HOME/.config/waybar/pywal.css
# command cat $HOME/.cache/wal/colors.css >$HOME/.config/waybar/pywal.css
# # pywall_waybar || _waybar
# _gBar
# else
# # _waybar
# _gBar
# fi
# else
# # _waybar
# _gBar
# notify-send -u critical "ERROR" "critical failure! wal is not present!!"
# fi
main() { main() {
# notify-send "low" "terminating main wm elements" # notify-send "low" "terminating main wm elements"

View file

@ -32,12 +32,29 @@ init() {
fi fi
} }
get-wall-dir() {
local dirs=()
dirs=(
"$HOME/.wallpapers"
"$HOME/.wallpaper"
)
for d in "${dirs[@]}"; do
if [ -d "$d" ]; then
echo "$d"
break
fi
done
}
randomSwww() { randomSwww() {
: "${SWWW_EXCLUDED_DIRS:=Anime,Colorful,Gaming,Gifs,Logos,Nordic,Windoof}" : "${SWWW_EXCLUDED_DIRS:=Anime,Colorful,Gaming,Gifs,Logos,Nordic,Windoof}"
# if [ -z "$1" ]; then # if [ -z "$1" ]; then
# ─< random wallpaper selection >───────────────────────────────────────────────────────── # ─< random wallpaper selection >─────────────────────────────────────────────────────────
local wall_dir="$HOME/.wallpaper" # local wall_dir="$HOME/.wallpaper"
local wall_dir="$(get-wall-dir)"
# ─< Create an array of directories to exclude >────────────────────────────────────────── # ─< Create an array of directories to exclude >──────────────────────────────────────────
IFS=',' read -ra EXCLUDED_DIRS <<<"$SWWW_EXCLUDED_DIRS" IFS=',' read -ra EXCLUDED_DIRS <<<"$SWWW_EXCLUDED_DIRS"
@ -57,6 +74,7 @@ randomSwww() {
# local pic=$(eval "$find_cmd" | shuf -n 1) # local pic=$(eval "$find_cmd" | shuf -n 1)
# Alternative approach using shopt # Alternative approach using shopt
shopt -s globstar nullglob shopt -s globstar nullglob
local pics=() local pics=()
for pic in "$wall_dir"/**/*.{png,jpg,jpeg,gif}; do for pic in "$wall_dir"/**/*.{png,jpg,jpeg,gif}; do
# Skip excluded directories # Skip excluded directories
@ -118,6 +136,17 @@ randomSwww() {
# fi # fi
} }
swww-path() {
# ─< 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
}
# Main logic # Main logic
if [ -z "$1" ]; then if [ -z "$1" ]; then
init init
@ -131,7 +160,11 @@ if [ -z "$1" ]; then
# exit 1 # exit 1
# fi # fi
elif [ "$1" == "random" ]; then elif [ "$1" == "random" ]; then
randomSwww if ! randomSwww; then
if ! pgrep swww; then
swww-daemon && randomSwww
fi
fi
# Use a random wallpaper # Use a random wallpaper
# wall_dir="$HOME/.wallpaper" # wall_dir="$HOME/.wallpaper"
# IFS=',' read -ra EXCLUDED_DIRS <<<"$SWWW_EXCLUDED_DIRS" # IFS=',' read -ra EXCLUDED_DIRS <<<"$SWWW_EXCLUDED_DIRS"
@ -153,16 +186,10 @@ elif [ "$1" == "random" ]; then
else else
# Use the specified path # Use the specified path
if [ -f "$1" ]; then if [ -f "$1" ]; then
# ─< executing swww with the random $pic >──────────────────────────────────────────────── if ! swww-path "$1"; then
if swww img "$1" --transition-fps "$SWWW_TRANSITION_FPS" --transition-step "$SWWW_TRANSITION_STEP" --transition-type "$SWWW_TRANSITION"; then if ! pgrep swww; then
notify-send "󰸉 " "Changed wallpaper to ${pic##*/}" swww-daemon && swww-path "$1"
notify-send " " "Not sourcing from: $SWWW_EXCLUDED_DIRS" fi
else fi
notify-send "ERROR" "Failed to set wallpaper: $pic"
return 1
fi
else
log_notify "critical" "Error" "File not found: $1"
exit 1
fi fi
fi fi