some changes within scripts
This commit is contained in:
parent
643eaa2f9e
commit
7d6d263d71
6 changed files with 229 additions and 20 deletions
83
.scripts/bar
Executable file
83
.scripts/bar
Executable file
|
@ -0,0 +1,83 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Logging helper
|
||||
log_notify() {
|
||||
level="$1" # e.g., low, normal, critical
|
||||
title="$2"
|
||||
message="$3"
|
||||
notify-send -u "$level" "$title" "$message"
|
||||
}
|
||||
|
||||
# Check if the given command exists silently
|
||||
command_exists() {
|
||||
command -v "$@" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# Function to handle errors
|
||||
handle_error() {
|
||||
local exit_code=$1
|
||||
local command_name=$2
|
||||
if [ $exit_code -ne 0 ]; then
|
||||
log_notify "critical" "Error" "Failed to execute $command_name"
|
||||
exit $exit_code
|
||||
fi
|
||||
}
|
||||
|
||||
# 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
|
||||
# }
|
||||
|
||||
barsetup() {
|
||||
local bar="${1:-hyprpanel}"
|
||||
|
||||
case "$bar" in
|
||||
hyprpanel)
|
||||
pkill hyprpanel
|
||||
# handle_error $? "pkill hyprpanel"
|
||||
hyprpanel &
|
||||
handle_error $? "hyprpanel"
|
||||
;;
|
||||
gBar)
|
||||
pkill gBar
|
||||
handle_error $? "pkill gBar"
|
||||
gBar bar 0 &
|
||||
handle_error $? "gBar bar 0"
|
||||
;;
|
||||
waybar)
|
||||
pkill waybar
|
||||
handle_error $? "pkill waybar"
|
||||
waybar &
|
||||
handle_error $? "waybar"
|
||||
;;
|
||||
*)
|
||||
pkill $bar
|
||||
# handle_error $? "pkill $bar"
|
||||
$bar &
|
||||
handle_error $? "$bar"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
if barsetup "$@"; then
|
||||
log_notify "normal" "Status-Bar" "initialized $bar"
|
||||
else
|
||||
log_notify "critical" "Status-Bar" "Something went wrong, your bar is probably not up.. sorry.."
|
||||
fi
|
|
@ -21,13 +21,13 @@ log_notify() {
|
|||
# Initialize system modules
|
||||
initialize_modules() {
|
||||
# ─< hyprpanel, waybar, gBar >────────────────────────────────────────────────────────────
|
||||
bar="hyprpanel"
|
||||
# bar="hyprpanel"
|
||||
bash "$HOME/.config/hypr/.scripts/bar"
|
||||
|
||||
modules="
|
||||
copyq
|
||||
nwg-look
|
||||
swww
|
||||
$bar
|
||||
wob
|
||||
redshift
|
||||
"
|
||||
|
@ -36,13 +36,6 @@ initialize_modules() {
|
|||
if command_exists "$module"; 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
|
||||
|
@ -78,6 +71,8 @@ initialize_modules() {
|
|||
sleep 0.5
|
||||
done
|
||||
|
||||
# bash "$HOME/.config/hypr/.scripts/wallpaper"
|
||||
|
||||
log_notify "normal" "INFO" "System modules initialized."
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
#!/usr/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# ─< Check if the given command exists silently >─────────────────────────────────────────
|
||||
command_exists() {
|
||||
command -v "$@" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
if command_exists hyprshot; then
|
||||
notify-send -u low "screenshot" "Using hyprshot"
|
||||
hyprshot --clipboard-only -m region
|
||||
elif command_exists grim; then
|
||||
notify-send -u low "screenshot" "Using grim"
|
||||
grim -g "$(slurp)" -o $HOME/.config/screenshots/ - | wl-copy -t image/png
|
||||
notify-send "Screenshot copied to clipboard"
|
||||
fi
|
||||
|
|
119
.scripts/wallpaper
Executable file
119
.scripts/wallpaper
Executable file
|
@ -0,0 +1,119 @@
|
|||
#!/usr/bin/env bash
|
||||
# ╭───────────────╮
|
||||
# │ SWWW-settings │
|
||||
# ╰───────────────╯
|
||||
export SWWW_TRANSITION_FPS=60
|
||||
export SWWW_TRANSITION_STEP=60
|
||||
export SWWW_TRANSITION=center
|
||||
|
||||
# ╭───────────────────────────────────────────────────────────────────────────╮
|
||||
# │ Set default excluded directories if SWWW_EXCLUDED_DIRS is not already set │
|
||||
# │ Dirs to exclude: Anime, Colorful, Gaming, Gifs, Gruvbox, Logos, Muted, │
|
||||
# │ Nordic, Windoof │
|
||||
# ╰───────────────────────────────────────────────────────────────────────────╯
|
||||
|
||||
: "${SWWW_EXCLUDED_DIRS:=Anime,Colorful,Gaming,Gifs,Logos,Nordic,Windoof}"
|
||||
|
||||
# ─< checking for swww >──────────────────────────────────────────────────────────────────
|
||||
if ! command -v swww >/dev/null 2>&1; then
|
||||
notify-send "ERROR" "swww was not found on the system"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ─< Check if swww daemon is running, start if not >─────────────────────────────────────
|
||||
if ! pgrep -x "swww-daemon" >/dev/null; then
|
||||
notify-send "SWWW" "swww not running - starting it now"
|
||||
swww-daemon
|
||||
sleep 1 # Give the daemon a second to start
|
||||
if ! pgrep -x "swww-daemon" >/dev/null; then
|
||||
notify-send "ERROR" "seems like swww didn't start as expected"
|
||||
return 1
|
||||
fi
|
||||
notify-send "SWWW" "started successfully"
|
||||
fi
|
||||
|
||||
_swww() {
|
||||
if [ -z "$1" ]; then
|
||||
# ─< random wallpaper selection >─────────────────────────────────────────────────────────
|
||||
local wall_dir="$HOME/.wallpaper"
|
||||
|
||||
# ─< Create an array of directories to exclude >──────────────────────────────────────────
|
||||
IFS=',' read -ra EXCLUDED_DIRS <<<"$SWWW_EXCLUDED_DIRS"
|
||||
|
||||
# # ─< Build the find command with exclusions >─────────────────────────────────────────────
|
||||
# local find_cmd="find \"$wall_dir\" -type f \( -iname \"*.png\" -o -iname \"*.jpg\" -o -iname \"*.jpeg\" -o -iname \"*.gif\" \)"
|
||||
#
|
||||
# # Add directory exclusions
|
||||
# for dir in "${EXCLUDED_DIRS[@]}"; do
|
||||
# find_cmd+=" -not \( -path \"$wall_dir/$dir/*\" -prune \)"
|
||||
# done
|
||||
#
|
||||
# # Add final exclusions
|
||||
# find_cmd+=" -not -path \"*/\.git/*\""
|
||||
#
|
||||
# # ─< Select a random picture >────────────────────────────────────────────────────────────
|
||||
# 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
|
||||
for dir in "${EXCLUDED_DIRS[@]}"; do
|
||||
[[ $pic == "$wall_dir/$dir/"* ]] && continue 2
|
||||
done
|
||||
pics+=("$pic")
|
||||
done
|
||||
|
||||
local pic=$(printf "%s\n" "${pics[@]}" | shuf -n 1)
|
||||
# Check if we found any picture
|
||||
# notify-send "pic" "$pic"
|
||||
if [ -z "$pic" ]; then
|
||||
notify-send "ERROR" "No wallpapers found in $wall_dir (excluding: $SWWW_EXCLUDED_DIRS)"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# # ─< Check if swww daemon is running, start if not >─────────────────────────────────────
|
||||
# if ! pgrep -x "swww-daemon" >/dev/null; then
|
||||
# notify-send "SWWW" "swww not running - starting it now"
|
||||
# swww-daemon
|
||||
# sleep 1 # Give the daemon a second to start
|
||||
# if ! pgrep -x "swww" >/dev/null; then
|
||||
# notify-send "ERROR" "seems like swww didn't start as expected"
|
||||
# return 0
|
||||
# fi
|
||||
# notify-send "SWWW" "started successfully"
|
||||
# fi
|
||||
|
||||
# ─< checking the wall_dir variable >─────────────────────────────────────────────────────
|
||||
# if [[ ! -d "$wall_dir" ]]; then
|
||||
# notify-send "ERROR" "$wall_dir path not found"
|
||||
# return 1
|
||||
# fi
|
||||
|
||||
# ─< executing swww with the random $pic >────────────────────────────────────────────────
|
||||
if swww img "$pic" --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
|
||||
|
||||
# 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 "$@"
|
11
hotkeys.conf
11
hotkeys.conf
|
@ -46,17 +46,18 @@ $rofi = pkill rofi || rofi -show drun -modi drun,filebrowser,run,window,ssh
|
|||
$tofi = pkill tofi || tofi-drun -c $HOME/.config/tofi/config
|
||||
|
||||
# ─< Set programs that you use >──────────────────────────────────────────────────────────
|
||||
$menu = $rofi
|
||||
$wallpaper = $scripts/wallpaper
|
||||
$screenshotTool = $scripts/screenshot
|
||||
$test = $scripts/a.sh
|
||||
|
||||
$terminal = foot # kitty --class="shell" -e zsh # wezterm start --always-new-process zsh #bash ghostty kitty --class="shell" -e zsh
|
||||
$browser = zen-browser # brave-browser
|
||||
$fileManager = caja # pcmanfm nautilus cosmic-files caja thunar dolphin
|
||||
$menu = $rofi
|
||||
$lockscreen = swaylock --screenshots --clock --indicator --effect-pixelate 18 --effect-blur 8x8
|
||||
$logout = wlogout
|
||||
$wallpaper = $scripts/random_swww.sh
|
||||
$notify = swaync-client --open-panel
|
||||
$test = $scripts/a.sh
|
||||
# $screenshotTool = $scripts/screenshot_area
|
||||
$screenshotTool = hyprshot --clipboard-only -m region
|
||||
# $screenshotTool = hyprshot --clipboard-only -m region
|
||||
|
||||
# ─< exit hyprland >──────────────────────────────────────────────────────────────────────
|
||||
bind = $mainMod, M, exit,
|
||||
|
|
|
@ -5,18 +5,18 @@ general {
|
|||
}
|
||||
|
||||
listener {
|
||||
timeout = 1200
|
||||
timeout = 1800
|
||||
on-timeout = brightnessctl -s set 10
|
||||
on-resume = brightnessctl -r
|
||||
}
|
||||
|
||||
listener {
|
||||
timeout = 1200
|
||||
timeout = 1800
|
||||
on-timeout = loginctl lock-session
|
||||
}
|
||||
|
||||
listener {
|
||||
timeout = 1200
|
||||
timeout = 1800
|
||||
on-timeout = hyprctl dispatch dpms off
|
||||
on-resume = hyprctl dispatch dpms on
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue