wip
This commit is contained in:
parent
7d6d263d71
commit
f59171268c
6 changed files with 190 additions and 115 deletions
|
@ -23,11 +23,11 @@ initialize_modules() {
|
||||||
# ─< hyprpanel, waybar, gBar >────────────────────────────────────────────────────────────
|
# ─< hyprpanel, waybar, gBar >────────────────────────────────────────────────────────────
|
||||||
# bar="hyprpanel"
|
# bar="hyprpanel"
|
||||||
bash "$HOME/.config/hypr/.scripts/bar"
|
bash "$HOME/.config/hypr/.scripts/bar"
|
||||||
|
bash "$HOME/.config/hypr/.scripts/wallpaper"
|
||||||
|
|
||||||
modules="
|
modules="
|
||||||
copyq
|
copyq
|
||||||
nwg-look
|
nwg-look
|
||||||
swww
|
|
||||||
wob
|
wob
|
||||||
redshift
|
redshift
|
||||||
"
|
"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# ─< scriptdir declaration >──────────────────────────────────────────────────────────────
|
# ─< scriptdir declaration >──────────────────────────────────────────────────────────────
|
||||||
_scripts="$HOME/.config/hypr/.scripts"
|
_scripts="$HOME/.config/hypr/.scripts"
|
||||||
|
@ -8,18 +8,6 @@ command_exists() {
|
||||||
command -v "$@" >/dev/null 2>&1
|
command -v "$@" >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
_wallpaper() {
|
|
||||||
if command -v swww >/dev/null 2>&1; then
|
|
||||||
if [ -e "$_scripts/random_swww.sh" ]; then
|
|
||||||
$_scripts/random_swww.sh
|
|
||||||
else
|
|
||||||
notify-send -u normal "" "script for initializing wallpaper with swww is missing.."
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
notify-send -u low "" "There may be no wallpaper bc swww is missing!"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
_kill_() {
|
_kill_() {
|
||||||
# ─< Kill already running processes >─────────────────────────────────────────────────────
|
# ─< Kill already running processes >─────────────────────────────────────────────────────
|
||||||
hyprpanel="gjs" # since hyprpanel has so many different wordings, making it clear that this is currently the hyprpanel service name
|
hyprpanel="gjs" # since hyprpanel has so many different wordings, making it clear that this is currently the hyprpanel service name
|
||||||
|
@ -95,17 +83,17 @@ _bar() {
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
|
|
||||||
notify-send "low" "terminating main wm elements"
|
# notify-send "low" "terminating main wm elements"
|
||||||
_kill_
|
_kill_
|
||||||
|
|
||||||
# relaunch swaync
|
# relaunch swaync
|
||||||
sleep 0.3
|
sleep 0.3
|
||||||
# swaync >/dev/null 2>&1 &
|
# swaync >/dev/null 2>&1 &
|
||||||
notify-send "low" "bar" "launching.."
|
# notify-send "low" "bar" "launching.."
|
||||||
_bar
|
bash "$scriptdir/bar"
|
||||||
|
|
||||||
notify-send "low" "wallpaper" "loading.."
|
notify-send "low" "wallpaper" "loading.."
|
||||||
_wallpaper
|
bash "$scriptdir/wallpaper"
|
||||||
|
|
||||||
if command_exists redshift; then
|
if command_exists redshift; then
|
||||||
notify-send "low" "redshift" "protecting your eyes from the blue light.."
|
notify-send "low" "redshift" "protecting your eyes from the blue light.."
|
||||||
|
|
|
@ -12,86 +12,149 @@ export SWWW_TRANSITION=center
|
||||||
# │ Nordic, Windoof │
|
# │ Nordic, Windoof │
|
||||||
# ╰───────────────────────────────────────────────────────────────────────────╯
|
# ╰───────────────────────────────────────────────────────────────────────────╯
|
||||||
|
|
||||||
: "${SWWW_EXCLUDED_DIRS:=Anime,Colorful,Gaming,Gifs,Logos,Nordic,Windoof}"
|
init() {
|
||||||
|
# ─< checking for swww >──────────────────────────────────────────────────────────────────
|
||||||
# ─< checking for swww >──────────────────────────────────────────────────────────────────
|
if ! command -v swww >/dev/null 2>&1; then
|
||||||
if ! command -v swww >/dev/null 2>&1; then
|
notify-send "ERROR" "swww was not found on the system"
|
||||||
notify-send "ERROR" "swww was not found on the system"
|
exit 1
|
||||||
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
|
fi
|
||||||
notify-send "SWWW" "started successfully"
|
|
||||||
fi
|
|
||||||
|
|
||||||
_swww() {
|
# ─< Check if swww daemon is running, start if not >─────────────────────────────────────
|
||||||
if [ -z "$1" ]; then
|
if ! pgrep -x "swww-daemon" >/dev/null; then
|
||||||
# ─< random wallpaper selection >─────────────────────────────────────────────────────────
|
notify-send "SWWW" "swww not running - starting it now"
|
||||||
local wall_dir="$HOME/.wallpaper"
|
swww-daemon
|
||||||
|
sleep 1 # Give the daemon a second to start
|
||||||
# ─< Create an array of directories to exclude >──────────────────────────────────────────
|
if ! pgrep -x "swww-daemon" >/dev/null; then
|
||||||
IFS=',' read -ra EXCLUDED_DIRS <<<"$SWWW_EXCLUDED_DIRS"
|
notify-send "ERROR" "seems like swww didn't start as expected"
|
||||||
|
|
||||||
# # ─< 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
|
return 1
|
||||||
fi
|
fi
|
||||||
|
notify-send "SWWW" "started successfully"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# # ─< Check if swww daemon is running, start if not >─────────────────────────────────────
|
randomSwww() {
|
||||||
# if ! pgrep -x "swww-daemon" >/dev/null; then
|
: "${SWWW_EXCLUDED_DIRS:=Anime,Colorful,Gaming,Gifs,Logos,Nordic,Windoof}"
|
||||||
# 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 [ -z "$1" ]; then
|
||||||
# if [[ ! -d "$wall_dir" ]]; then
|
# ─< random wallpaper selection >─────────────────────────────────────────────────────────
|
||||||
# notify-send "ERROR" "$wall_dir path not found"
|
local wall_dir="$HOME/.wallpaper"
|
||||||
# return 1
|
|
||||||
# fi
|
|
||||||
|
|
||||||
|
# ─< 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
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main logic
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
init
|
||||||
|
# No argument given, use the last wallpaper
|
||||||
|
# last_wallpaper_file="$HOME/.last_wallpaper"
|
||||||
|
# if [ -f "$last_wallpaper_file" ]; then
|
||||||
|
# last_wallpaper=$(cat "$last_wallpaper_file")
|
||||||
|
# set_wallpaper "$last_wallpaper"
|
||||||
|
# else
|
||||||
|
# log_notify "critical" "Error" "No last wallpaper found"
|
||||||
|
# exit 1
|
||||||
|
# fi
|
||||||
|
elif [ "$1" == "random" ]; then
|
||||||
|
randomSwww
|
||||||
|
# Use a random wallpaper
|
||||||
|
# wall_dir="$HOME/.wallpaper"
|
||||||
|
# IFS=',' read -ra EXCLUDED_DIRS <<<"$SWWW_EXCLUDED_DIRS"
|
||||||
|
# shopt -s globstar nullglob
|
||||||
|
# pics=()
|
||||||
|
# for pic in "$wall_dir"/**/*.{png,jpg,jpeg,gif}; do
|
||||||
|
# for dir in "${EXCLUDED_DIRS[@]}"; do
|
||||||
|
# [[ $pic == "$wall_dir/$dir/"* ]] && continue 2
|
||||||
|
# done
|
||||||
|
# pics+=("$pic")
|
||||||
|
# done
|
||||||
|
# random_pic=$(printf "%s\n" "${pics[@]}" | shuf -n 1)
|
||||||
|
# if [ -z "$random_pic" ]; then
|
||||||
|
# log_notify "critical" "Error" "No wallpapers found in $wall_dir (excluding: $SWWW_EXCLUDED_DIRS)"
|
||||||
|
# exit 1
|
||||||
|
# fi
|
||||||
|
# set_wallpaper "$random_pic"
|
||||||
|
# echo "$random_pic" >"$HOME/.last_wallpaper"
|
||||||
|
else
|
||||||
|
# Use the specified path
|
||||||
|
if [ -f "$1" ]; then
|
||||||
# ─< executing swww with the random $pic >────────────────────────────────────────────────
|
# ─< 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
|
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 " " "Changed wallpaper to ${pic##*/}"
|
||||||
notify-send " " "Not sourcing from: $SWWW_EXCLUDED_DIRS"
|
notify-send " " "Not sourcing from: $SWWW_EXCLUDED_DIRS"
|
||||||
else
|
else
|
||||||
|
@ -99,21 +162,7 @@ _swww() {
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
log_notify "critical" "Error" "File not found: $1"
|
||||||
# Check if file exists
|
exit 1
|
||||||
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
|
fi
|
||||||
}
|
fi
|
||||||
|
|
||||||
_swww "$@"
|
|
||||||
|
|
|
@ -1,4 +1,42 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
grim /tmp/shot.png
|
# ─< Check if the given command exists silently >─────────────────────────────────────────
|
||||||
magick /tmp/shot.png -blur 0x8 /tmp/shot_blurred.png
|
command_exists() {
|
||||||
wlogout --css $HOME/.config/wlogout/style.css
|
command -v "$@" >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
if ! command_exists wlogout; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Take a screenshot and blur it using ffmpeg
|
||||||
|
take_and_blur_screenshot() {
|
||||||
|
local blurred_path="$HOME/.config/wlogout/tmp.png"
|
||||||
|
|
||||||
|
# Take a screenshot and blur it
|
||||||
|
grim -t ppm - | ffmpeg -f image2pipe -vcodec ppm -i - -vf "gblur=sigma=8" -vframes 1 "$blurred_path"
|
||||||
|
# handle_error $? "grim and ffmpeg"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main logic
|
||||||
|
if ! command_exists wlogout; then
|
||||||
|
# log_notify "critical" "Error" "wlogout not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command_exists grim && command_exists ffmpeg; then
|
||||||
|
take_and_blur_screenshot
|
||||||
|
wlogout --css "$HOME/.config/wlogout/style_blur.css"
|
||||||
|
else
|
||||||
|
# log_notify "critical" "Error" "Required tools (grim, ffmpeg) not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# wlogout
|
||||||
|
|
||||||
|
# if command_exists grim && command_exists magick; then
|
||||||
|
# grim /tmp/shot.png
|
||||||
|
# magick /tmp/shot.png -blur 0x8 $HOME/.config/wlogout/tmp.png
|
||||||
|
# wlogout --css $HOME/.config/wlogout/style_blur.css
|
||||||
|
# else
|
||||||
|
# wlogout
|
||||||
|
# fi
|
||||||
|
|
|
@ -47,7 +47,7 @@ $tofi = pkill tofi || tofi-drun -c $HOME/.config/tofi/config
|
||||||
|
|
||||||
# ─< Set programs that you use >──────────────────────────────────────────────────────────
|
# ─< Set programs that you use >──────────────────────────────────────────────────────────
|
||||||
$menu = $rofi
|
$menu = $rofi
|
||||||
$wallpaper = $scripts/wallpaper
|
$wallpaper = "$scripts/wallpaper random"
|
||||||
$screenshotTool = $scripts/screenshot
|
$screenshotTool = $scripts/screenshot
|
||||||
$test = $scripts/a.sh
|
$test = $scripts/a.sh
|
||||||
|
|
||||||
|
@ -55,7 +55,8 @@ $terminal = foot # kitty --class="shell" -e zsh # wezterm start --always-new-pro
|
||||||
$browser = zen-browser # brave-browser
|
$browser = zen-browser # brave-browser
|
||||||
$fileManager = caja # pcmanfm nautilus cosmic-files caja thunar dolphin
|
$fileManager = caja # pcmanfm nautilus cosmic-files caja thunar dolphin
|
||||||
$lockscreen = swaylock --screenshots --clock --indicator --effect-pixelate 18 --effect-blur 8x8
|
$lockscreen = swaylock --screenshots --clock --indicator --effect-pixelate 18 --effect-blur 8x8
|
||||||
$logout = wlogout
|
# $logout = wlogout
|
||||||
|
$logout = $scripts/wlogout.sh
|
||||||
$notify = swaync-client --open-panel
|
$notify = swaync-client --open-panel
|
||||||
# $screenshotTool = hyprshot --clipboard-only -m region
|
# $screenshotTool = hyprshot --clipboard-only -m region
|
||||||
|
|
||||||
|
|
|
@ -46,10 +46,9 @@ workspace = 69, monitor:$main, persistent:true, allow-tearing:true, gapsin:0, ga
|
||||||
workspace = special:magic, monitor:$main, on-created-empty:$terminal, border:0
|
workspace = special:magic, monitor:$main, on-created-empty:$terminal, border:0
|
||||||
|
|
||||||
# ─< initialisation script >─────────────────────────────────────────────────────────────────
|
# ─< initialisation script >─────────────────────────────────────────────────────────────────
|
||||||
|
exec-once = systemctl --user start hyprpolkitagent
|
||||||
exec-once = $h_conf/.scripts/init.sh
|
exec-once = $h_conf/.scripts/init.sh
|
||||||
|
|
||||||
exec-once = hypridle
|
exec-once = hypridle
|
||||||
|
|
||||||
exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
|
exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
|
||||||
|
|
||||||
# See https://wiki.hyprland.org/Configuring/Environment-variables/
|
# See https://wiki.hyprland.org/Configuring/Environment-variables/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue