initial commit
This commit is contained in:
parent
c6326a45e6
commit
cebf404919
15 changed files with 757 additions and 0 deletions
129
.scripts/init.sh
Executable file
129
.scripts/init.sh
Executable file
|
@ -0,0 +1,129 @@
|
|||
#!/bin/sh
|
||||
|
||||
pkill swaync
|
||||
|
||||
# Paths and configuration
|
||||
SCRIPTS_DIR="$HOME/.config/hypr/.scripts"
|
||||
|
||||
# Logging helper
|
||||
log_notify() {
|
||||
level="$1" # e.g., low, normal, critical
|
||||
title="$2"
|
||||
message="$3"
|
||||
notify-send -u "$level" "$title" "$message"
|
||||
}
|
||||
|
||||
# Initialize system modules
|
||||
initialize_modules() {
|
||||
# ─< hyprpanel, waybar, gBar >────────────────────────────────────────────────────────────
|
||||
bar="hyprpanel"
|
||||
|
||||
modules="
|
||||
copyq
|
||||
nwg-look
|
||||
swww
|
||||
$bar
|
||||
wob
|
||||
redshift
|
||||
"
|
||||
|
||||
for module in $modules; do
|
||||
if command -v "$module" >/dev/null 2>&1; then
|
||||
log_notify "low" "$module" "Initializing..."
|
||||
case $module in
|
||||
waybar | flameshot)
|
||||
pkill "$module" 2>/dev/null
|
||||
"$module" &
|
||||
;;
|
||||
hyprpanel)
|
||||
hyprpanel &
|
||||
;;
|
||||
copyq)
|
||||
pkill copyq 2>/dev/null
|
||||
copyq --start-server
|
||||
sleep 1
|
||||
if ! pgrep -x copyq >/dev/null; then
|
||||
log_notify "critical" "ERROR" "CopyQ failed to start. Retrying..."
|
||||
copyq --start-server
|
||||
fi
|
||||
;;
|
||||
lxappearance)
|
||||
lxappearance >/dev/null 2>&1 &
|
||||
;;
|
||||
swww)
|
||||
swww-daemon &
|
||||
if ! swww query; then
|
||||
swww init
|
||||
fi
|
||||
;;
|
||||
redshift)
|
||||
pkill redshift 2>/dev/null
|
||||
sh "$SCRIPTS_DIR/redshift.sh"
|
||||
;;
|
||||
wob)
|
||||
fifo="/tmp/$HYPRLAND_INSTANCE_SIGNATURE.wob"
|
||||
rm -f "$fifo"
|
||||
mkfifo "$fifo"
|
||||
tail -f "$fifo" | wob &
|
||||
;;
|
||||
esac
|
||||
else
|
||||
log_notify "critical" "ERROR" "$module not found!"
|
||||
fi
|
||||
sleep 0.5
|
||||
done
|
||||
|
||||
log_notify "normal" "INFO" "System modules initialized."
|
||||
}
|
||||
|
||||
# Start polkit authentication agent
|
||||
initialize_polkit() {
|
||||
agents="
|
||||
/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
|
||||
/usr/lib/polkit-kde-authentication-agent-1
|
||||
/usr/libexec/polkit-gnome-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/polkit-1/polkit-agent-helper-1
|
||||
"
|
||||
|
||||
for agent in $agents; do
|
||||
if [ -x "$agent" ]; then
|
||||
log_notify "normal" "INFO" "Starting Polkit agent: $(basename "$agent")"
|
||||
"$agent" &
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
log_notify "low" "WARNING" "No Polkit authentication agent found. Please install one."
|
||||
return 1
|
||||
}
|
||||
|
||||
# Initialize XDG desktop portals
|
||||
initialize_xdg_portals() {
|
||||
xdg_hyprland="/usr/lib/xdg-desktop-portal-hyprland"
|
||||
xdg_portal="/usr/lib/xdg-desktop-portal"
|
||||
|
||||
if [ -x "$xdg_hyprland" ]; then
|
||||
killall xdg-desktop-portal-hyprland xdg-desktop-portal-wlr xdg-desktop-portal 2>/dev/null
|
||||
sleep 1
|
||||
"$xdg_hyprland" &
|
||||
sleep 1
|
||||
"$xdg_portal" &
|
||||
sleep 1
|
||||
dbus-update-activation-environment --systemd --all &
|
||||
log_notify "normal" "INFO" "XDG desktop portals initialized."
|
||||
else
|
||||
log_notify "low" "WARNING" "xdg-desktop-portal-hyprland not found. Please install it."
|
||||
fi
|
||||
}
|
||||
|
||||
# Main initialization function
|
||||
main() {
|
||||
sleep 0.5
|
||||
initialize_xdg_portals
|
||||
initialize_modules
|
||||
initialize_polkit
|
||||
}
|
||||
|
||||
main
|
Loading…
Add table
Add a link
Reference in a new issue