wip
This commit is contained in:
parent
9b3171425d
commit
9117240088
6 changed files with 93 additions and 139 deletions
72
scripts/bar
72
scripts/bar
|
@ -13,53 +13,39 @@ command_exists() {
|
|||
command -v "$@" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# fallback() {
|
||||
# if command_exists hyprpanel; then
|
||||
# pkill hyprpanel
|
||||
# handle_error $? "pkill hyprpanel"
|
||||
# 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
|
||||
# }
|
||||
proc-kill-if() {
|
||||
if pgrep "$1"; then
|
||||
pkill "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
barsetup() {
|
||||
local bar="${1:-quickshell}"
|
||||
|
||||
case "$bar" in
|
||||
hyprpanel)
|
||||
pkill hyprpanel
|
||||
hyprpanel &
|
||||
;;
|
||||
gBar)
|
||||
pkill gBar
|
||||
gBar bar 0 &
|
||||
;;
|
||||
waybar)
|
||||
pkill waybar
|
||||
waybar &
|
||||
;;
|
||||
quickshell)
|
||||
pkill qs
|
||||
qs &
|
||||
;;
|
||||
*)
|
||||
pkill $bar
|
||||
$bar &
|
||||
;;
|
||||
esac
|
||||
proc-kill-if "$bar"
|
||||
|
||||
# case "$bar" in
|
||||
# hyprpanel)
|
||||
# pkill hyprpanel
|
||||
# hyprpanel &
|
||||
# ;;
|
||||
# gBar)
|
||||
# pkill gBar
|
||||
# gBar bar 0 &
|
||||
# ;;
|
||||
# waybar)
|
||||
# pkill waybar
|
||||
# waybar &
|
||||
# ;;
|
||||
# quickshell)
|
||||
# pkill qs
|
||||
# qs &
|
||||
# ;;
|
||||
# *)
|
||||
# pkill $bar
|
||||
# $bar &
|
||||
# ;;
|
||||
# esac
|
||||
}
|
||||
|
||||
if barsetup "$@"; then
|
||||
|
|
37
scripts/init
37
scripts/init
|
@ -16,7 +16,7 @@ kill-all() {
|
|||
done
|
||||
}
|
||||
|
||||
SCRIPTS="$HOME/.config/hypr/.scripts"
|
||||
SCRIPTS="$HOME/.config/hypr/scripts"
|
||||
|
||||
# Logging helper
|
||||
log_notify() {
|
||||
|
@ -53,16 +53,14 @@ setup-desktop() {
|
|||
|
||||
case $module in
|
||||
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
|
||||
if ! pgrep copyq; then
|
||||
copyq --start-server
|
||||
fi
|
||||
;;
|
||||
lxappearance)
|
||||
lxappearance >/dev/null 2>&1 &
|
||||
if ! pgrep lxappearance; then
|
||||
lxappearance >/dev/null 2>&1 &
|
||||
fi
|
||||
;;
|
||||
'nwg-look')
|
||||
nwg-look -a >/dev/null 2>&1 &
|
||||
|
@ -75,8 +73,7 @@ setup-desktop() {
|
|||
# fi
|
||||
# ;;
|
||||
redshift)
|
||||
pkill redshift 2>/dev/null
|
||||
bash -c "$SCRIPTS/redshift.sh"
|
||||
. "$SCRIPTS/redshift.sh"
|
||||
;;
|
||||
wob)
|
||||
local fifo="/tmp/$HYPRLAND_INSTANCE_SIGNATURE.wob"
|
||||
|
@ -91,16 +88,16 @@ setup-desktop() {
|
|||
|
||||
# Start polkit authentication agent
|
||||
init-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
|
||||
"
|
||||
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
|
||||
for agent in "${agents[@]}"; do
|
||||
if [ -x "$agent" ]; then
|
||||
log_notify "normal" "INFO" "Starting Polkit agent: $(basename "$agent")"
|
||||
"$agent" &
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# ─< scriptdir declaration >──────────────────────────────────────────────────────────────
|
||||
SCRIPTS="$HOME/.config/hypr/.scripts"
|
||||
SCRIPTS="$HOME/.config/hypr/scripts"
|
||||
|
||||
# ─< Check if the given command exists silently >─────────────────────────────────────────
|
||||
command_exists() {
|
||||
|
@ -20,67 +20,9 @@ _kill_() {
|
|||
}
|
||||
|
||||
_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() {
|
||||
|
||||
# notify-send "low" "terminating main wm elements"
|
||||
|
|
|
@ -32,12 +32,29 @@ init() {
|
|||
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() {
|
||||
: "${SWWW_EXCLUDED_DIRS:=Anime,Colorful,Gaming,Gifs,Logos,Nordic,Windoof}"
|
||||
|
||||
# if [ -z "$1" ]; then
|
||||
# ─< 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 >──────────────────────────────────────────
|
||||
IFS=',' read -ra EXCLUDED_DIRS <<<"$SWWW_EXCLUDED_DIRS"
|
||||
|
@ -57,6 +74,7 @@ randomSwww() {
|
|||
# local pic=$(eval "$find_cmd" | shuf -n 1)
|
||||
# Alternative approach using shopt
|
||||
shopt -s globstar nullglob
|
||||
|
||||
local pics=()
|
||||
for pic in "$wall_dir"/**/*.{png,jpg,jpeg,gif}; do
|
||||
# Skip excluded directories
|
||||
|
@ -118,6 +136,17 @@ randomSwww() {
|
|||
# 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
|
||||
if [ -z "$1" ]; then
|
||||
init
|
||||
|
@ -131,7 +160,11 @@ if [ -z "$1" ]; then
|
|||
# exit 1
|
||||
# fi
|
||||
elif [ "$1" == "random" ]; then
|
||||
randomSwww
|
||||
if ! randomSwww; then
|
||||
if ! pgrep swww; then
|
||||
swww-daemon && randomSwww
|
||||
fi
|
||||
fi
|
||||
# Use a random wallpaper
|
||||
# wall_dir="$HOME/.wallpaper"
|
||||
# IFS=',' read -ra EXCLUDED_DIRS <<<"$SWWW_EXCLUDED_DIRS"
|
||||
|
@ -153,16 +186,10 @@ elif [ "$1" == "random" ]; then
|
|||
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
|
||||
if ! swww-path "$1"; then
|
||||
if ! pgrep swww; then
|
||||
swww-daemon && swww-path "$1"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
log_notify "critical" "Error" "File not found: $1"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue