addet scripts
This commit is contained in:
parent
55101b6ba2
commit
9b3171425d
16 changed files with 25 additions and 9 deletions
3
scripts/a.sh
Executable file
3
scripts/a.sh
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash --norc
|
||||
|
||||
notify-send "TEST" "This is supposed to be a rather long testmessage, for testing stlying, and size configs for swaync. The notification daemon."
|
69
scripts/bar
Executable file
69
scripts/bar
Executable file
|
@ -0,0 +1,69 @@
|
|||
#!/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
|
||||
}
|
||||
|
||||
# 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:-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
|
||||
}
|
||||
|
||||
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
|
148
scripts/init
Executable file
148
scripts/init
Executable file
|
@ -0,0 +1,148 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# ─< Check if the given command exists silently >─────────────────────────────────────────
|
||||
command-exists() {
|
||||
command -v "$@" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
kill-all() {
|
||||
# ─< Kill already running processes >─────────────────────────────────────────────────────
|
||||
hyprpanel="gjs" # since hyprpanel has so many different wordings, making it clear that this is currently the hyprpanel service name
|
||||
_ps=(swaync gBar rofi fuzzel wofi swaync waybar $hyprpanel)
|
||||
for _prs in "${_ps[@]}"; do
|
||||
if pidof "${_prs}" >/dev/null; then
|
||||
pkill "${_prs}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
SCRIPTS="$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"
|
||||
}
|
||||
|
||||
setup-desktop() {
|
||||
# if command-exists qs; then
|
||||
# qs
|
||||
# else
|
||||
bash -c "$SCRIPTS/bar"
|
||||
log_notify low "Bar" "Initializing.."
|
||||
# fi
|
||||
|
||||
bash "$SCRIPTS/wallpaper"
|
||||
log_notify low "Wallpaper" "Initializing.."
|
||||
|
||||
local modules
|
||||
|
||||
modules=(
|
||||
"copyq"
|
||||
"nwg-look"
|
||||
"lxappearance"
|
||||
"wob"
|
||||
"redshift"
|
||||
)
|
||||
|
||||
for module in "${modules[@]}"; do
|
||||
if command-exists $module; then
|
||||
log_notify low "$module" "Initializing.."
|
||||
|
||||
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
|
||||
;;
|
||||
lxappearance)
|
||||
lxappearance >/dev/null 2>&1 &
|
||||
;;
|
||||
'nwg-look')
|
||||
nwg-look -a >/dev/null 2>&1 &
|
||||
;;
|
||||
# handled in $SCRIPTS/bar
|
||||
# swww)
|
||||
# swww-daemon &
|
||||
# if ! swww query; then
|
||||
# swww init
|
||||
# fi
|
||||
# ;;
|
||||
redshift)
|
||||
pkill redshift 2>/dev/null
|
||||
bash -c "$SCRIPTS/redshift.sh"
|
||||
;;
|
||||
wob)
|
||||
local fifo="/tmp/$HYPRLAND_INSTANCE_SIGNATURE.wob"
|
||||
rm -f "$fifo"
|
||||
mkfifo "$fifo"
|
||||
tail -f "$fifo" | wob &
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# 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
|
||||
"
|
||||
|
||||
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
|
||||
init-xdg-portal() {
|
||||
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() {
|
||||
kill-all
|
||||
sleep 0.3
|
||||
setup-desktop
|
||||
|
||||
if [ -x "/usr/lib/hyprpolkitagent" ]; then
|
||||
systemctl --user start hyprpolkitagent
|
||||
else
|
||||
init-polkit
|
||||
fi
|
||||
|
||||
init-xdg-portal
|
||||
}
|
||||
|
||||
main
|
143
scripts/init.sh.bak
Normal file
143
scripts/init.sh.bak
Normal file
|
@ -0,0 +1,143 @@
|
|||
#!/bin/sh
|
||||
|
||||
# ─< Check if the given command exists silently >─────────────────────────────────────────
|
||||
command_exists() {
|
||||
command -v "$@" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
if command_exists swaync; then
|
||||
pkill swaync
|
||||
fi
|
||||
|
||||
# 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"
|
||||
bash "$HOME/.config/hypr/.scripts/bar"
|
||||
bash "$HOME/.config/hypr/.scripts/wallpaper"
|
||||
|
||||
modules="
|
||||
copyq
|
||||
nwg-look
|
||||
wob
|
||||
redshift
|
||||
"
|
||||
|
||||
for module in $modules; do
|
||||
if command_exists "$module"; then
|
||||
log_notify "low" "$module" "Initializing..."
|
||||
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
|
||||
;;
|
||||
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)
|
||||
foo="/tmp/$HYPRLAND_INSTANCE_SIGNATURE.wob"
|
||||
rm -f "$foo"
|
||||
mkfoo "$foo"
|
||||
tail -f "$foo" | wob &
|
||||
;;
|
||||
esac
|
||||
else
|
||||
log_notify "critical" "ERROR" "$module not found!"
|
||||
fi
|
||||
sleep 0.5
|
||||
done
|
||||
|
||||
# bash "$HOME/.config/hypr/.scripts/wallpaper"
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
envS() {
|
||||
terminals="ghostty wezterm kitty"
|
||||
for envTerminal in "$terminals"; do
|
||||
if command_exists $envTerminal; then
|
||||
export HYPR_TERMINAL="$envTerminal"
|
||||
log_notify "normal" "Terminal" "..is set to $envTerminal"
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Main initialization function
|
||||
main() {
|
||||
sleep 0.5
|
||||
initialize_xdg_portals
|
||||
initialize_modules
|
||||
initialize_polkit
|
||||
envS
|
||||
}
|
||||
|
||||
main
|
38
scripts/looking-glass.sh
Executable file
38
scripts/looking-glass.sh
Executable file
|
@ -0,0 +1,38 @@
|
|||
#!/bin/sh
|
||||
# ─< Check if the user is root and set sudo variable if necessary >───────────────────────
|
||||
check_root() {
|
||||
_sudo=""
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
if command_exists sudo; then
|
||||
notify-send "looking-glass script" "User is not root. Using sudo for privileged operations."
|
||||
_sudo="sudo"
|
||||
else
|
||||
notify-send "looking-glass script" "No sudo found and you're not root! Can't install packages."
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
notify-send "looking-glass script" "Root access confirmed."
|
||||
_sudo=""
|
||||
fi
|
||||
}
|
||||
|
||||
# Define the name of your VM
|
||||
VM_NAME="win11"
|
||||
connect="looking-glass-client -f /dev/shm/looking-glass -F -S input:rawMouse=yes -k"
|
||||
|
||||
# Check if the VM is running
|
||||
if pgrep -f "qemu.*$VM_NAME" >/dev/null; then
|
||||
notify-send "win11" "VM is already there, connecting now.."
|
||||
sleep 1.5
|
||||
$connect
|
||||
else
|
||||
notify-send "win11" "VM is currently DOWN. Starting it and connecting then.. Be patient.."
|
||||
# Start the VM (adjust the command according to your setup)
|
||||
# Example for starting with libvirt:
|
||||
$_sudo virsh start "$VM_NAME"
|
||||
# Example for starting with a direct QEMU command:
|
||||
# qemu-system-x86_64 -enable-kvm -m 4G -cpu host -smp 4 -hda /path/to/win11.img &
|
||||
|
||||
# Wait a moment to ensure the VM starts properly
|
||||
sleep 5 && $connect
|
||||
fi
|
46
scripts/quickshell
Executable file
46
scripts/quickshell
Executable file
|
@ -0,0 +1,46 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# ─< Check if the given command exists silently >─────────────────────────────────────────
|
||||
command-exists() {
|
||||
command -v "$@" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
check-env() {
|
||||
local dir bin
|
||||
|
||||
bin=quickshell
|
||||
dir="$HOME/.config/quickshell"
|
||||
|
||||
if command-exists $bin; then
|
||||
return 0
|
||||
else
|
||||
return 69
|
||||
fi
|
||||
|
||||
if [ -d "${dir}" ]; then
|
||||
return 0
|
||||
else
|
||||
return 69
|
||||
fi
|
||||
}
|
||||
|
||||
check-env
|
||||
|
||||
init-quickshell() {
|
||||
local modules
|
||||
local dir="$HOME/.config/quickshell"
|
||||
|
||||
modules=(
|
||||
"activate-linux"
|
||||
)
|
||||
|
||||
for mod in "${modules[@]}"; do
|
||||
module="${dir}/${mod}.qml"
|
||||
|
||||
if [ -f "$module" ]; then
|
||||
quickshell -p "$module" &
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
init-quickshell
|
124
scripts/random_swww.sh
Executable file
124
scripts/random_swww.sh
Executable file
|
@ -0,0 +1,124 @@
|
|||
#!/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}"
|
||||
|
||||
_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
|
||||
|
||||
# swww img "$pic" --transition-fps "$SWWW_TRANSITION_FPS" --transition-step "$SWWW_TRANSITION_STEP" --transition-type "$SWWW_TRANSITION"
|
||||
# ─< checking for swww >──────────────────────────────────────────────────────────────────
|
||||
if ! command -v swww >/dev/null 2>&1; then
|
||||
notify-send "ERROR" "swww was not found on the system"
|
||||
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
|
||||
if ! command -v swww >/dev/null 2>&1; then
|
||||
notify-send "ERROR" "swww was not found on the system"
|
||||
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-daemon" >/dev/null; then
|
||||
notify-send "ERROR" "seems like swww didn't start as expected"
|
||||
return 1
|
||||
fi
|
||||
notify-send "SWWW" "started successfully"
|
||||
fi
|
||||
|
||||
# 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 "$@"
|
44
scripts/redshift.sh
Executable file
44
scripts/redshift.sh
Executable file
|
@ -0,0 +1,44 @@
|
|||
#!/bin/bash --norc
|
||||
|
||||
# Check if the given command exists silently
|
||||
command_exists() {
|
||||
command -v "$@" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
_rdshft() {
|
||||
# color temperature for redshift
|
||||
local temp="5200"
|
||||
|
||||
if command_exists redshift; then
|
||||
pkill redshift redshift || {
|
||||
sleep 1
|
||||
pkill redshift redshift-gtk &&
|
||||
redshift -P -O "$temp"
|
||||
# redshift -P -O "$temp"
|
||||
|
||||
# Check if redshift is running
|
||||
sleep 2
|
||||
if ! pgrep -x redshift-gtk >/dev/null && ! pgrep -x redshift >/dev/null; then
|
||||
notify-send -u critical "ERROR" "Redshift failed to start. Please check your configuration."
|
||||
else
|
||||
notify-send -u normal "INFO" "Redshift started successfully."
|
||||
fi
|
||||
}
|
||||
sleep 1
|
||||
pkill redshift redshift-gtk &&
|
||||
redshift -P -O "$temp"
|
||||
# redshift -P -O "$temp"
|
||||
|
||||
# Check if redshift is running
|
||||
sleep 2
|
||||
if ! pgrep -x redshift-gtk >/dev/null && ! pgrep -x redshift >/dev/null; then
|
||||
notify-send -u critical "ERROR" "Redshift failed to start. Please check your configuration."
|
||||
else
|
||||
notify-send -u normal "INFO" "Redshift started successfully."
|
||||
fi
|
||||
else
|
||||
notify-send -u critical "ERROR" "Redshift is not installed. Please install it for better screen color management."
|
||||
fi
|
||||
}
|
||||
|
||||
_rdshft
|
110
scripts/refresh
Executable file
110
scripts/refresh
Executable file
|
@ -0,0 +1,110 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# ─< scriptdir declaration >──────────────────────────────────────────────────────────────
|
||||
SCRIPTS="$HOME/.config/hypr/.scripts"
|
||||
|
||||
# ─< Check if the given command exists silently >─────────────────────────────────────────
|
||||
command_exists() {
|
||||
command -v "$@" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
_kill_() {
|
||||
# ─< Kill already running processes >─────────────────────────────────────────────────────
|
||||
hyprpanel="gjs" # since hyprpanel has so many different wordings, making it clear that this is currently the hyprpanel service name
|
||||
_ps=(gBar wofi swaync waybar $hyprpanel)
|
||||
for _prs in "${_ps[@]}"; do
|
||||
if pidof "${_prs}" >/dev/null; then
|
||||
pkill "${_prs}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
_redshift() {
|
||||
. $SCRIPTS/redshift.sh && notify-send -u low "" "Redshift active"
|
||||
}
|
||||
|
||||
# ─< 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"
|
||||
_kill_
|
||||
|
||||
# relaunch swaync
|
||||
sleep 0.3
|
||||
|
||||
hyprctl reload
|
||||
|
||||
sleep 0.2
|
||||
# swaync >/dev/null 2>&1 &
|
||||
# notify-send "low" "bar" "launching.."
|
||||
bash "$SCRIPTS/bar"
|
||||
|
||||
notify-send "low" "wallpaper" "loading.."
|
||||
bash "$SCRIPTS/wallpaper"
|
||||
|
||||
if command_exists redshift; then
|
||||
notify-send "low" "redshift" "protecting your eyes from the blue light.."
|
||||
_redshift
|
||||
fi
|
||||
|
||||
exit 0
|
||||
}
|
||||
|
||||
main
|
14
scripts/screenshot
Executable file
14
scripts/screenshot
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/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
|
||||
fi
|
3
scripts/screenshot_area
Executable file
3
scripts/screenshot_area
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/bash
|
||||
grimshot copy area || exit
|
||||
notify-send "Screenshot copied to clipboard"
|
3
scripts/screenshot_full
Executable file
3
scripts/screenshot_full
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/bash
|
||||
grimshot copy output || exit
|
||||
notify-send "Screenshot copied to clipboard"
|
168
scripts/wallpaper
Executable file
168
scripts/wallpaper
Executable file
|
@ -0,0 +1,168 @@
|
|||
#!/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 │
|
||||
# ╰───────────────────────────────────────────────────────────────────────────╯
|
||||
|
||||
init() {
|
||||
# ─< 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
|
||||
}
|
||||
|
||||
randomSwww() {
|
||||
: "${SWWW_EXCLUDED_DIRS:=Anime,Colorful,Gaming,Gifs,Logos,Nordic,Windoof}"
|
||||
|
||||
# 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
|
||||
}
|
||||
|
||||
# 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 >────────────────────────────────────────────────
|
||||
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
|
||||
else
|
||||
log_notify "critical" "Error" "File not found: $1"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
35
scripts/wlogout.sh
Executable file
35
scripts/wlogout.sh
Executable file
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/env bash
|
||||
# ─< Check if the given command exists silently >─────────────────────────────────────────
|
||||
command_exists() {
|
||||
command -v "$@" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
if ! command_exists wlogout; then
|
||||
notify-send "logout" "Cannot logout, wlogout not present!"
|
||||
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 -o DP-1 - | ffmpeg -i - -vf "scale=iw/10:ih/10:flags=neighbor,scale=iw*10:ih*10:flags=neighbor" -y "$blurred_path"
|
||||
grim -o DP-1 - | ffmpeg -i - -vf "boxblur=24" -y "$blurred_path"
|
||||
}
|
||||
|
||||
# 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
|
41
scripts/ytfzf.sh
Executable file
41
scripts/ytfzf.sh
Executable file
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# ─< ANSI color codes >───────────────────────────────────────────────────────────────────
|
||||
RED='\033[0;31m'
|
||||
CYAN='\033[0;36m'
|
||||
YELLOW='\033[0;33m'
|
||||
LIGHT_GREEN='\033[0;92m'
|
||||
BOLD='\033[1m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
echo_error() {
|
||||
printf "${BOLD}${RED}ERROR: ${NC}${RED}%s${NC}\n" "$1" >&2
|
||||
}
|
||||
|
||||
echo_info() {
|
||||
printf "${BOLD}${CYAN}INFO: ${NC}${CYAN}%s${NC}\n" "$1"
|
||||
}
|
||||
|
||||
echo_warning() {
|
||||
printf "${BOLD}${YELLOW}WARNING: ${NC}${YELLOW}%s${NC}\n" "$1"
|
||||
}
|
||||
|
||||
echo_note() {
|
||||
printf "${BOLD}${LIGHT_GREEN}NOTE: ${NC}${LIGHT_GREEN}%s${NC}\n" "$1"
|
||||
}
|
||||
|
||||
# ─< Check if the given command exists silently >─────────────────────────────────────────
|
||||
command_exists() {
|
||||
command -v "$@" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
if ! command_exists ytfzf; then
|
||||
echo_error "You dont have ytfzf installed.."
|
||||
fi
|
||||
|
||||
echo_note "What do you want to watch?"
|
||||
read -r watch
|
||||
|
||||
if [[ -z "$watch" ]]; then
|
||||
ytfzf -t "$watch"
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue