some changes
This commit is contained in:
parent
8356149c44
commit
032947ab89
1 changed files with 91 additions and 91 deletions
182
.scripts/init.sh
182
.scripts/init.sh
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# ─< Check if the given command exists silently >─────────────────────────────────────────
|
# ─< Check if the given command exists silently >─────────────────────────────────────────
|
||||||
command_exists() {
|
command_exists() {
|
||||||
command -v "$@" >/dev/null 2>&1
|
command -v "$@" >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
pkill swaync
|
pkill swaync
|
||||||
|
@ -12,18 +12,18 @@ SCRIPTS_DIR="$HOME/.config/hypr/.scripts"
|
||||||
|
|
||||||
# Logging helper
|
# Logging helper
|
||||||
log_notify() {
|
log_notify() {
|
||||||
level="$1" # e.g., low, normal, critical
|
level="$1" # e.g., low, normal, critical
|
||||||
title="$2"
|
title="$2"
|
||||||
message="$3"
|
message="$3"
|
||||||
notify-send -u "$level" "$title" "$message"
|
notify-send -u "$level" "$title" "$message"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialize system modules
|
# Initialize system modules
|
||||||
initialize_modules() {
|
initialize_modules() {
|
||||||
# ─< hyprpanel, waybar, gBar >────────────────────────────────────────────────────────────
|
# ─< hyprpanel, waybar, gBar >────────────────────────────────────────────────────────────
|
||||||
bar="hyprpanel"
|
bar="hyprpanel"
|
||||||
|
|
||||||
modules="
|
modules="
|
||||||
copyq
|
copyq
|
||||||
nwg-look
|
nwg-look
|
||||||
swww
|
swww
|
||||||
|
@ -32,58 +32,58 @@ initialize_modules() {
|
||||||
redshift
|
redshift
|
||||||
"
|
"
|
||||||
|
|
||||||
for module in $modules; do
|
for module in $modules; do
|
||||||
if command_exists "$module"; then
|
if command_exists "$module"; then
|
||||||
log_notify "low" "$module" "Initializing..."
|
log_notify "low" "$module" "Initializing..."
|
||||||
case $module in
|
case $module in
|
||||||
waybar | flameshot)
|
waybar | flameshot)
|
||||||
pkill "$module" 2>/dev/null
|
pkill "$module" 2>/dev/null
|
||||||
"$module" &
|
"$module" &
|
||||||
;;
|
;;
|
||||||
hyprpanel)
|
hyprpanel)
|
||||||
hyprpanel &
|
hyprpanel &
|
||||||
;;
|
;;
|
||||||
copyq)
|
copyq)
|
||||||
pkill copyq 2>/dev/null
|
pkill copyq 2>/dev/null
|
||||||
copyq --start-server
|
copyq --start-server
|
||||||
sleep 1
|
sleep 1
|
||||||
if ! pgrep -x copyq >/dev/null; then
|
if ! pgrep -x copyq >/dev/null; then
|
||||||
log_notify "critical" "ERROR" "CopyQ failed to start. Retrying..."
|
log_notify "critical" "ERROR" "CopyQ failed to start. Retrying..."
|
||||||
copyq --start-server
|
copyq --start-server
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
lxappearance)
|
lxappearance)
|
||||||
lxappearance >/dev/null 2>&1 &
|
lxappearance >/dev/null 2>&1 &
|
||||||
;;
|
;;
|
||||||
swww)
|
swww)
|
||||||
swww-daemon &
|
swww-daemon &
|
||||||
if ! swww query; then
|
if ! swww query; then
|
||||||
swww init
|
swww init
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
redshift)
|
redshift)
|
||||||
pkill redshift 2>/dev/null
|
pkill redshift 2>/dev/null
|
||||||
sh "$SCRIPTS_DIR/redshift.sh"
|
sh "$SCRIPTS_DIR/redshift.sh"
|
||||||
;;
|
;;
|
||||||
wob)
|
wob)
|
||||||
fifo="/tmp/$HYPRLAND_INSTANCE_SIGNATURE.wob"
|
foo="/tmp/$HYPRLAND_INSTANCE_SIGNATURE.wob"
|
||||||
rm -f "$fifo"
|
rm -f "$foo"
|
||||||
mkfifo "$fifo"
|
mkfoo "$foo"
|
||||||
tail -f "$fifo" | wob &
|
tail -f "$foo" | wob &
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
log_notify "critical" "ERROR" "$module not found!"
|
log_notify "critical" "ERROR" "$module not found!"
|
||||||
fi
|
fi
|
||||||
sleep 0.5
|
sleep 0.5
|
||||||
done
|
done
|
||||||
|
|
||||||
log_notify "normal" "INFO" "System modules initialized."
|
log_notify "normal" "INFO" "System modules initialized."
|
||||||
}
|
}
|
||||||
|
|
||||||
# Start polkit authentication agent
|
# Start polkit authentication agent
|
||||||
initialize_polkit() {
|
initialize_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
|
||||||
|
@ -92,55 +92,55 @@ initialize_polkit() {
|
||||||
/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" &
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
log_notify "low" "WARNING" "No Polkit authentication agent found. Please install one."
|
log_notify "low" "WARNING" "No Polkit authentication agent found. Please install one."
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialize XDG desktop portals
|
# Initialize XDG desktop portals
|
||||||
initialize_xdg_portals() {
|
initialize_xdg_portals() {
|
||||||
xdg_hyprland="/usr/lib/xdg-desktop-portal-hyprland"
|
xdg_hyprland="/usr/lib/xdg-desktop-portal-hyprland"
|
||||||
xdg_portal="/usr/lib/xdg-desktop-portal"
|
xdg_portal="/usr/lib/xdg-desktop-portal"
|
||||||
|
|
||||||
if [ -x "$xdg_hyprland" ]; then
|
if [ -x "$xdg_hyprland" ]; then
|
||||||
killall xdg-desktop-portal-hyprland xdg-desktop-portal-wlr xdg-desktop-portal 2>/dev/null
|
killall xdg-desktop-portal-hyprland xdg-desktop-portal-wlr xdg-desktop-portal 2>/dev/null
|
||||||
sleep 1
|
sleep 1
|
||||||
"$xdg_hyprland" &
|
"$xdg_hyprland" &
|
||||||
sleep 1
|
sleep 1
|
||||||
"$xdg_portal" &
|
"$xdg_portal" &
|
||||||
sleep 1
|
sleep 1
|
||||||
dbus-update-activation-environment --systemd --all &
|
dbus-update-activation-environment --systemd --all &
|
||||||
log_notify "normal" "INFO" "XDG desktop portals initialized."
|
log_notify "normal" "INFO" "XDG desktop portals initialized."
|
||||||
else
|
else
|
||||||
log_notify "low" "WARNING" "xdg-desktop-portal-hyprland not found. Please install it."
|
log_notify "low" "WARNING" "xdg-desktop-portal-hyprland not found. Please install it."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
envS() {
|
envS() {
|
||||||
terminals="ghostty wezterm kitty"
|
terminals="ghostty wezterm kitty"
|
||||||
for envTerminal in "$terminals"; do
|
for envTerminal in "$terminals"; do
|
||||||
if command_exists $envTerminal; then
|
if command_exists $envTerminal; then
|
||||||
export HYPR_TERMINAL="$envTerminal"
|
export HYPR_TERMINAL="$envTerminal"
|
||||||
log_notify "normal" "Terminal" "..is set to $envTerminal"
|
log_notify "normal" "Terminal" "..is set to $envTerminal"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Main initialization function
|
# Main initialization function
|
||||||
main() {
|
main() {
|
||||||
sleep 0.5
|
sleep 0.5
|
||||||
initialize_xdg_portals
|
initialize_xdg_portals
|
||||||
initialize_modules
|
initialize_modules
|
||||||
initialize_polkit
|
initialize_polkit
|
||||||
envS
|
envS
|
||||||
}
|
}
|
||||||
|
|
||||||
main
|
main
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue