arch hyprland

This commit is contained in:
[yuri]
2025-11-19 20:41:01 +01:00
parent 6ecde1d092
commit b415a3d71f
112 changed files with 2884 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
#!/usr/bin/env bash
# ____ _
# / ___| | ___ __ _ _ __ _ _ _ __
# | | | |/ _ \/ _` | '_ \| | | | '_ \
# | |___| | __/ (_| | | | | |_| | |_) |
# \____|_|\___|\__,_|_| |_|\__,_| .__/
# |_|
#
# Remove gamemode flag
if [ -f ~/.cache/gamemode ]; then
rm ~/.cache/gamemode
echo ":: ~/.cache/gamemode removed"
fi

View File

@@ -0,0 +1,46 @@
#!/usr/bin/env bash
# __
# ___ ____ ___ _ ___ __ _ ___ ___/ /__
# / _ `/ _ `/ ' \/ -_) ' \/ _ \/ _ / -_)
# \_, /\_,_/_/_/_/\__/_/_/_/\___/\_,_/\__/
# /___/
#
ml4w_cache_folder="$HOME/.cache/ml4w/hyprland-dotfiles"
gamemode_monitor="$HOME/.config/hypr/conf/monitors/gamemode.conf"
if [ -f $HOME/.config/ml4w/settings/gamemode-enabled ]; then
if [ -f $ml4w_cache_folder/last_monitor.conf ]; then
cat $ml4w_cache_folder/last_monitor.conf > $HOME/.config/hypr/conf/monitor.conf
rm $ml4w_cache_folder/last_monitor.conf
fi
if [ -f $ml4w_cache_folder/restart-wpauto ]; then
rm $ml4w_cache_folder/restart-wpauto
$HOME/.config/hypr/scripts/wallpaper-automation.sh &
fi
hyprctl reload
rm $HOME/.config/ml4w/settings/gamemode-enabled
notify-send "Gamemode deactivated" "Animations and blur enabled"
else
if [ -f $gamemode_monitor ]; then
cat $HOME/.config/hypr/conf/monitor.conf > $ml4w_cache_folder/last_monitor.conf
echo "source = $gamemode_monitor" > $HOME/.config/hypr/conf/monitor.conf
fi
if [ -f $ml4w_cache_folder/wallpaper-automation ]; then
touch $ml4w_cache_folder/restart-wpauto
$HOME/.config/hypr/scripts/wallpaper-automation.sh
fi
hyprctl --batch "\
keyword animations:enabled 0;\
keyword decoration:shadow:enabled 0;\
keyword decoration:blur:enabled 0;\
keyword general:gaps_in 0;\
keyword general:gaps_out 0;\
keyword general:border_size 1;\
keyword decoration:active_opacity 1;\
keyword decoration:inactive_opacity 1;\
keyword decoration:fullscreen_opacity 1;\
keyword decoration:rounding 0"
touch $HOME/.config/ml4w/settings/gamemode-enabled
notify-send "Gamemode activated" "Animations and blur disabled"
fi

View File

@@ -0,0 +1,53 @@
#!/usr/bin/env bash
# _____________ __
# / ___/_ __/ //_/
# / (_ / / / / ,<
# \___/ /_/ /_/|_|
#
# Source: https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland
# Check that settings file exists
config="$HOME/.config/gtk-3.0/settings.ini"
if [ ! -f "$config" ]; then exit 1; fi
# Read settings file
gnome_schema="org.gnome.desktop.interface"
gtk_theme="$(grep 'gtk-theme-name' "$config" | sed 's/.*\s*=\s*//')"
icon_theme="$(grep 'gtk-icon-theme-name' "$config" | sed 's/.*\s*=\s*//')"
cursor_theme="$(grep 'gtk-cursor-theme-name' "$config" | sed 's/.*\s*=\s*//')"
cursor_size="$(grep 'gtk-cursor-theme-size' "$config" | sed 's/.*\s*=\s*//')"
font_name="$(grep 'gtk-font-name' "$config" | sed 's/.*\s*=\s*//')"
prefer_dark_theme="$(grep 'gtk-application-prefer-dark-theme' "$config" | sed 's/.*\s*=\s*//')"
terminal=$(cat $HOME/.config/ml4w/settings/terminal.sh)
# Echo value for debugging
echo "GTK-Theme:" $gtk_theme
echo "Icon Theme:" $icon_theme
echo "Cursor Theme:" $cursor_theme
echo "Cursor Size:" $cursor_size
if [[ $prefer_dark_theme == "0" || $prefer_dark_theme == "false" ]]; then
prefer_dark_theme_value="prefer-light"
else
prefer_dark_theme_value="prefer-dark"
fi
echo "Color Theme:" $prefer_dark_theme_value
echo "Font Name:" $font_name
echo "Terminal:" $terminal
# Update gsettings
gsettings set "$gnome_schema" gtk-theme "$gtk_theme"
gsettings set "$gnome_schema" icon-theme "$icon_theme"
gsettings set "$gnome_schema" cursor-theme "$cursor_theme"
gsettings set "$gnome_schema" font-name "$font_name"
gsettings set "$gnome_schema" color-scheme "$prefer_dark_theme_value"
# Update cursor for Hyprland
if [ -f ~/.config/hypr/conf/cursor.conf ]; then
echo "exec-once = hyprctl setcursor $cursor_theme $cursor_size" >~/.config/hypr/conf/cursor.conf
hyprctl setcursor $cursor_theme $cursor_size
fi
# Update gsettings for open any terminal
gsettings set com.github.stunkymonkey.nautilus-open-any-terminal terminal "$terminal"
gsettings set com.github.stunkymonkey.nautilus-open-any-terminal use-generic-terminal-name "true"
gsettings set com.github.stunkymonkey.nautilus-open-any-terminal keybindings "<Ctrl><Alt>t"

View File

@@ -0,0 +1,39 @@
#!/bin/bash
# __ __ _ ____
# / // /_ _____ ____(_)__/ / /__
# / _ / // / _ \/ __/ / _ / / -_)
# /_//_/\_, / .__/_/ /_/\_,_/_/\__/
# /___/_/
#
SERVICE="hypridle"
print_status() {
if pgrep -x "$SERVICE" >/dev/null ; then
echo '{"text": "RUNNING", "class": "active", "tooltip": "Screen locking active\nLeft: Deactivate\nRight: Lock Screen"}'
else
echo '{"text": "NOT RUNNING", "class": "notactive", "tooltip": "Screen locking deactivated\nLeft: Activate\nRight: Lock Screen"}'
fi
}
case "$1" in
status)
# Add a tiny delay to avoid race condition on startup
sleep 0.2
print_status
;;
toggle)
if pgrep -x "$SERVICE" >/dev/null ; then
killall "$SERVICE"
else
"$SERVICE" &
fi
# Give it a moment to start/stop before checking again
sleep 0.2
print_status
;;
*)
echo "Usage: $0 {status|toggle}"
exit 1
;;
esac

View File

@@ -0,0 +1,61 @@
#!/bin/bash
# _ _ _ _
# | | | |_ _ _ __ _ __ ___| |__ __ _ __| | ___
# | |_| | | | | '_ \| '__/ __| '_ \ / _` |/ _` |/ _ \
# | _ | |_| | |_) | | \__ \ | | | (_| | (_| | __/
# |_| |_|\__, | .__/|_| |___/_| |_|\__,_|\__,_|\___|
# |___/|_|
#
# Remove legacy shaders folder
if [ -d $HOME/.config/hypr/shaders ]; then
rm -rf $HOME/.config/hypr/shaders
fi
if [[ "$1" == "rofi" ]]; then
# Open rofi to select the Hyprshade filter for toggle
options="$(hyprshade ls | sed 's/^[ *]*//')\noff"
# Open rofi
choice=$(echo -e "$options" | rofi -dmenu -replace -config ~/.config/rofi/config-hyprshade.rasi -i -no-show-icons -l 4 -width 30 -p "Hyprshade")
if [ ! -z $choice ]; then
echo "hyprshade_filter=\"$choice\"" >~/.config/ml4w/settings/hyprshade.sh
if [ "$choice" == "off" ]; then
hyprshade off
notify-send "Hyprshade deactivated"
echo ":: hyprshade turned off"
else
notify-send "Changing Hyprshade to $choice" "Toggle shader with SUPER+SHIFT+H"
fi
fi
else
# Toggle Hyprshade based on the selected filter
hyprshade_filter="blue-light-filter-50"
# Check if hyprshade.sh settings file exists and load
if [ -f ~/.config/ml4w/settings/hyprshade.sh ]; then
source ~/.config/ml4w/settings/hyprshade.sh
fi
# Toggle Hyprshade
if [ "$hyprshade_filter" != "off" ]; then
if [ -z $(hyprshade current) ]; then
echo ":: hyprshade is not running"
hyprshade on $hyprshade_filter
notify-send "Hyprshade activated" "with $(hyprshade current)"
echo ":: hyprshade started with $(hyprshade current)"
else
notify-send "Hyprshade deactivated"
echo ":: Current hyprshade $(hyprshade current)"
echo ":: Switching hyprshade off"
hyprshade off
fi
else
hyprshade off
echo ":: hyprshade turned off"
fi
fi

View File

@@ -0,0 +1,49 @@
#!/usr/bin/env bash
# __ __ _ ___
# / /_____ __ __/ / (_)__ ___/ (_)__ ___ ____
# / '_/ -_) // / _ \/ / _ \/ _ / / _ \/ _ `(_-<
# /_/\_\\__/\_, /_.__/_/_//_/\_,_/_/_//_/\_, /___/
# /___/ /___/
#
# -----------------------------------------------------
# Get keybindings location based on variation
# -----------------------------------------------------
config_file=$(<~/.config/hypr/conf/keybinding.conf)
config_file=${config_file//source = ~//home/$USER}
# -----------------------------------------------------
# Load Launcher
# -----------------------------------------------------
launcher=$(cat $HOME/.config/ml4w/settings/launcher)
# -----------------------------------------------------
# Path to keybindings config file
# -----------------------------------------------------
echo "Reading from: $config_file"
keybinds=$(awk -F'[=#]' '
$1 ~ /^bind/ {
# Replace the string "$mainMod" with "SUPER" (for the super key)
gsub(/\$mainMod/, "SUPER", $0)
# Remove "bind" and extra spaces, if any, at the beginning of the line
gsub(/^bind[[:space:]]*=+[[:space:]]*/, "", $0)
# Split the keybinding part (e.g., "Mod1,Return") using a comma
split($1, kbarr, ",")
# Format the keybinding and associated command and prepare for output:
# Concatenate the two keybinding keys (e.g., "Mod1" + "Return") and append the command
print kbarr[1] " + " kbarr[2] "\r" $2
}
' "$config_file")
sleep 0.2
if [ "$launcher" == "walker" ]; then
keybinds=$(echo -n "$keybinds" | tr '\r' ':')
$HOME/.config/walker/launch.sh -d -N -H -p "Search Keybinds" <<<"$keybinds"
else
rofi -dmenu -i -markup -eh 2 -replace -p "Keybinds" -config ~/.config/rofi/config-compact.rasi <<<"$keybinds"
fi

View File

@@ -0,0 +1,22 @@
#!/usr/bin/env bash
# -----------------------------------------------------
# Load Launcher
# -----------------------------------------------------
launcher=$(cat $HOME/.config/ml4w/settings/launcher)
# Use Walker
_launch_walker() {
$HOME/.config/walker/launch.sh --height 500
}
# Use Rofi
_launch_rofi() {
pkill rofi || rofi -show drun -replace -i
}
if [ "$launcher" == "walker" ]; then
_launch_walker
else
_launch_rofi
fi

View File

@@ -0,0 +1,23 @@
#!/usr/bin/env bash
# __
# ___ ____ ___ _ ___ __ _ ___ ___/ /__
# / _ `/ _ `/ ' \/ -_) ' \/ _ \/ _ / -_)
# \_, /\_,_/_/_/_/\__/_/_/_/\___/\_,_/\__/
# /___/
#
_loadGameMode() {
hyprctl --batch "\
keyword animations:enabled 0;\
keyword decoration:shadow:enabled 0;\
keyword decoration:blur:enabled 0;\
keyword general:gaps_in 0;\
keyword general:gaps_out 0;\
keyword general:border_size 1;\
keyword decoration:rounding 0"
}
if [ -f $HOME/.config/ml4w/settings/gamemode-enabled ]; then
_loadGameMode
notify-send "Gamemode activated" "Animations and blur disabled"
fi

View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
hyprctl reload

View File

@@ -0,0 +1,47 @@
#!/usr/bin/env bash
# __
# __ _ ___ _ _____ / /____
# / ' \/ _ \ |/ / -_) / __/ _ \
# /_/_/_/\___/___/\__/ \__/\___/
#
# Function to log messages (useful for debugging)
log_message() {
# echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" >> ~/moveto_log.txt
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1"
}
# Get the target workspace from the argument
target_workspace=$1
# Check if a target workspace was provided
if [ -z "$target_workspace" ]; then
log_message "Error: No target workspace provided"
exit 1
fi
# Get the current active workspace
current_workspace=$(hyprctl activewindow -j | jq '.workspace.id')
if [ -z "$current_workspace" ]; then
log_message "Error: Couldn't determine current workspace"
exit 1
fi
log_message "Moving from workspace $current_workspace to $target_workspace"
# Get all window addresses in the current workspace
window_addresses=$(hyprctl clients -j | jq -r ".[] | select(.workspace.id == $current_workspace) | .address")
# Move each window to the target workspace
for address in $window_addresses; do
log_message "Moving window $address to workspace $target_workspace"
hyprctl dispatch movetoworkspacesilent "$target_workspace,address:$address"
done
log_message "Finished moving windows"
# Switch to the target workspace
hyprctl dispatch workspace "$target_workspace"
log_message "Switched to workspace $target_workspace"

View File

@@ -0,0 +1,78 @@
#!/usr/bin/env bash
# ___
# / _ \___ _ _____ ____
# / ___/ _ \ |/|/ / -_) __/
# /_/ \___/__,__/\__/_/
#
terminate_clients() {
TIMEOUT=5
# Get a list of all client PIDs in the current Hyprland session
client_pids=$(hyprctl clients -j | jq -r '.[] | .pid')
# Send SIGTERM (kill -15) to each client PID and wait for termination
for pid in $client_pids; do
echo ":: Sending SIGTERM to PID $pid"
kill -15 $pid
done
start_time=$(date +%s)
for pid in $client_pids; do
# Wait for the process to terminate
while kill -0 $pid 2>/dev/null; do
current_time=$(date +%s)
elapsed_time=$((current_time - start_time))
if [ $elapsed_time -ge $TIMEOUT ]; then
echo ":: Timeout reached."
return 0
fi
echo ":: Waiting for PID $pid to terminate..."
sleep 1
done
echo ":: PID $pid has terminated."
done
bash $home/.config/ml4w/listeners.sh --stopall
}
if [[ "$1" == "exit" ]]; then
echo ":: Exit"
terminate_clients
sleep 0.5
hyprctl dispatch exit
sleep 2
fi
if [[ "$1" == "lock" ]]; then
echo ":: Lock"
sleep 0.5
hyprlock
fi
if [[ "$1" == "reboot" ]]; then
echo ":: Reboot"
terminate_clients
sleep 0.5
systemctl reboot
fi
if [[ "$1" == "shutdown" ]]; then
echo ":: Shutdown"
terminate_clients
sleep 0.5
systemctl poweroff
fi
if [[ "$1" == "suspend" ]]; then
echo ":: Suspend"
sleep 0.5
systemctl suspend
fi
if [[ "$1" == "hibernate" ]]; then
echo ":: Hibernate"
sleep 1
systemctl hibernate
fi

View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
killall hypridle
sleep 1
hypridle &
notify-send "hypridle has been restarted."

View File

@@ -0,0 +1,263 @@
#!/usr/bin/env bash
# __ __
# ___ ___________ ___ ___ ___ / / ___ / /_
# (_-</ __/ __/ -_) -_) _ \(_-</ _ \/ _ \/ __/
# /___/\__/_/ \__/\__/_//_/___/_//_/\___/\__/
#
# Based on https://github.com/hyprwm/contrib/blob/main/grimblast/screenshot.sh
# -----------------------------------------------------
# Screenshots will be stored in $HOME by default.
# The screenshot will be moved into the screenshot directory
# Add this to ~/.config/user-dirs.dirs to save screenshots in a custom folder:
# XDG_SCREENSHOTS_DIR="$HOME/Screenshots"
prompt='Screenshot'
mesg="DIR: ~/Screenshots"
# Screenshot Filename
source ~/.config/ml4w/settings/screenshot-filename.sh
# Screenshot Folder
source ~/.config/ml4w/settings/screenshot-folder.sh
# Screenshot Editor
export GRIMBLAST_EDITOR="$(cat ~/.config/ml4w/settings/screenshot-editor.sh)"
# Example for keybindings
# bind = SUPER, p, exec, grimblast save active
# bind = SUPER SHIFT, p, exec, grimblast save area
# bind = SUPER ALT, p, exec, grimblast save output
# bind = SUPER CTRL, p, exec, grimblast save screen
# Quick instant mode: full screen
take_instant_full() {
grim "$NAME" && notify-send -t 1000 "Screenshot saved to $screenshot_folder/$NAME"
[[ -f "$HOME/$NAME" && -d "$screenshot_folder" && -w "$screenshot_folder" ]] && mv "$HOME/$NAME" "$screenshot_folder/"
}
# Quick instant mode: area selection
take_instant_area() {
local pid_picker region
# freeze screen for region selection
hyprpicker -r -z &
pid_picker=$!
trap 'kill "$pid_picker" 2>/dev/null' EXIT
sleep 0.1
# user selects region; kill picker on cancel
region=$(slurp -b "#00000080" -c "#888888ff" -w 1) || exit 0
[[ -z "$region" ]] && exit 0
# unfreeze screen
kill "$pid_picker" 2>/dev/null
trap - EXIT
# capture and notify
grim -g "$region" "$NAME" && notify-send -t 1000 "Screenshot saved to $screenshot_folder/$NAME"
[[ -f "$HOME/$NAME" && -d "$screenshot_folder" && -w "$screenshot_folder" ]] && mv "$HOME/$NAME" "$screenshot_folder/"
}
# Handle instant flags
if [[ "$1" == "--instant" ]]; then
take_instant_full
exit 0
elif [[ "$1" == "--instant-area" ]]; then
take_instant_area
exit 0
fi
# Options
option_1="Immediate"
option_2="Delayed"
option_capture_1="Capture Everything"
option_capture_2="Capture Active Display"
option_capture_3="Capture Selection"
option_time_1="5s"
option_time_2="10s"
option_time_3="20s"
option_time_4="30s"
option_time_5="60s"
#option_time_4="Custom (in seconds)" # Roadmap or someone contribute :)
list_col='1'
list_row='2'
copy='Copy'
save='Save'
copy_save='Copy & Save'
edit='Edit'
# Rofi CMD
rofi_cmd() {
rofi -dmenu -replace -config ~/.config/rofi/config-screenshot.rasi -i -no-show-icons -l 2 -width 30 -p "Take screenshot"
}
# Pass variables to rofi dmenu
run_rofi() {
echo -e "$option_1\n$option_2" | rofi_cmd
}
####
# Choose Timer
# CMD
timer_cmd() {
rofi -dmenu -replace -config ~/.config/rofi/config-screenshot.rasi -i -no-show-icons -l 5 -width 30 -p "Choose timer"
}
# Ask for confirmation
timer_exit() {
echo -e "$option_time_1\n$option_time_2\n$option_time_3\n$option_time_4\n$option_time_5" | timer_cmd
}
# Confirm and execute
timer_run() {
selected_timer="$(timer_exit)"
if [[ "$selected_timer" == "$option_time_1" ]]; then
countdown=5
${1}
elif [[ "$selected_timer" == "$option_time_2" ]]; then
countdown=10
${1}
elif [[ "$selected_timer" == "$option_time_3" ]]; then
countdown=20
${1}
elif [[ "$selected_timer" == "$option_time_4" ]]; then
countdown=30
${1}
elif [[ "$selected_timer" == "$option_time_5" ]]; then
countdown=60
${1}
else
exit
fi
}
###
####
# Chose Screenshot Type
# CMD
type_screenshot_cmd() {
rofi -dmenu -replace -config ~/.config/rofi/config-screenshot.rasi -i -no-show-icons -l 3 -width 30 -p "Type of screenshot"
}
# Ask for confirmation
type_screenshot_exit() {
echo -e "$option_capture_1\n$option_capture_2\n$option_capture_3" | type_screenshot_cmd
}
# Confirm and execute
type_screenshot_run() {
selected_type_screenshot="$(type_screenshot_exit)"
if [[ "$selected_type_screenshot" == "$option_capture_1" ]]; then
option_type_screenshot=screen
${1}
elif [[ "$selected_type_screenshot" == "$option_capture_2" ]]; then
option_type_screenshot=output
${1}
elif [[ "$selected_type_screenshot" == "$option_capture_3" ]]; then
option_type_screenshot=area
${1}
else
exit
fi
}
###
####
# Choose to save or copy photo
# CMD
copy_save_editor_cmd() {
rofi -dmenu -replace -config ~/.config/rofi/config-screenshot.rasi -i -no-show-icons -l 4 -width 30 -p "How to save"
}
# Ask for confirmation
copy_save_editor_exit() {
echo -e "$copy\n$save\n$copy_save\n$edit" | copy_save_editor_cmd
}
# Confirm and execute
copy_save_editor_run() {
selected_chosen="$(copy_save_editor_exit)"
if [[ "$selected_chosen" == "$copy" ]]; then
option_chosen=copy
${1}
elif [[ "$selected_chosen" == "$save" ]]; then
option_chosen=save
${1}
elif [[ "$selected_chosen" == "$copy_save" ]]; then
option_chosen=copysave
${1}
elif [[ "$selected_chosen" == "$edit" ]]; then
option_chosen=edit
${1}
else
exit
fi
}
###
timer() {
if [[ $countdown -gt 10 ]]; then
notify-send -t 1000 "Taking screenshot in ${countdown} seconds"
countdown_less_10=$((countdown - 10))
sleep $countdown_less_10
countdown=10
fi
while [[ $countdown -ne 0 ]]; do
notify-send -t 1000 "Taking screenshot in ${countdown} seconds"
countdown=$((countdown - 1))
sleep 1
done
}
# take shots
takescreenshot() {
sleep 1
grimblast --notify "$option_chosen" "$option_type_screenshot" $NAME
if [ -f $HOME/$NAME ]; then
if [ -d $screenshot_folder ]; then
mv $HOME/$NAME $screenshot_folder/
fi
fi
}
takescreenshot_timer() {
sleep 1
timer
sleep 1
grimblast --notify "$option_chosen" "$option_type_screenshot" $NAME
if [ -f $HOME/$NAME ]; then
if [ -d $screenshot_folder ]; then
mv $HOME/$NAME $screenshot_folder/
fi
fi
}
# Execute Command
run_cmd() {
if [[ "$1" == '--opt1' ]]; then
type_screenshot_run
copy_save_editor_run "takescreenshot"
elif [[ "$1" == '--opt2' ]]; then
timer_run
type_screenshot_run
copy_save_editor_run "takescreenshot_timer"
fi
}
# Actions
chosen="$(run_rofi)"
case ${chosen} in
$option_1)
run_cmd --opt1
;;
$option_2)
run_cmd --opt2
;;
esac

View File

@@ -0,0 +1,8 @@
#!/usr/bin/env bash
clear
figlet -f smslant "Systeminfo"
echo
setsid hyprctl systeminfo
echo
echo "Press return to exit"
read

View File

@@ -0,0 +1,13 @@
#!/usr/bin/env bash
cache_file="$HOME/.cache/toggle_animation"
if [[ $(cat $HOME/.config/hypr/conf/animation.conf) == *"disabled"* ]]; then
echo ":: Toggle blocked by disabled.conf variation."
else
if [ -f $cache_file ]; then
hyprctl keyword animations:enabled true
rm $cache_file
else
hyprctl keyword animations:enabled false
touch $cache_file
fi
fi

View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bash
# _ _ _ __ _ _
# / \ | | |/ _| | ___ __ _| |_
# / _ \ | | | |_| |/ _ \ / _` | __|
# / ___ \| | | _| | (_) | (_| | |_
# /_/ \_\_|_|_| |_|\___/ \__,_|\__|
#
hyprctl dispatch workspaceopt allfloat
notify-send "Windows on this workspace toggled to floating/tiling"

View File

@@ -0,0 +1,30 @@
#!/usr/bin/env bash
# _ _ __ ______
# / \ _ _| |_ ___ \ \ / / _ \
# / _ \| | | | __/ _ \ \ \ /\ / /| |_) |
# / ___ \ |_| | || (_) | \ V V / | __/
# /_/ \_\__,_|\__\___/ \_/\_/ |_|
#
ml4w_cache_folder="$HOME/.cache/ml4w/hyprland-dotfiles"
sec=$(cat ~/.config/ml4w/settings/wallpaper-automation.sh)
_setWallpaperRandomly() {
waypaper --random
echo ":: Next wallpaper in 60 seconds..."
sleep $sec
_setWallpaperRandomly
}
if [ ! -f $ml4w_cache_folder/wallpaper-automation ]; then
touch $ml4w_cache_folder/wallpaper-automation
echo ":: Start wallpaper automation script"
notify-send "Wallpaper automation process started" "Wallpaper will be changed every $sec seconds."
_setWallpaperRandomly
else
rm $ml4w_cache_folder/wallpaper-automation
notify-send "Wallpaper automation process stopped."
echo ":: Wallpaper automation script process $wp stopped"
wp=$(pgrep -f wallpaper-automation.sh)
kill -KILL $wp
fi

View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
ml4w_cache_folder="$HOME/.cache/ml4w/hyprland-dotfiles"
generated_versions="$ml4w_cache_folder/wallpaper-generated"
rm $generated_versions/*
echo ":: Wallpaper cache cleared"
notify-send "Wallpaper cache cleared"

View File

@@ -0,0 +1,28 @@
#!/usr/bin/env bash
# __ ______ _____ __ __ _
# \ \ / / _ \ | ____|/ _|/ _| ___ ___| |_ ___
# \ \ /\ / /| |_) | | _| | |_| |_ / _ \/ __| __/ __|
# \ V V / | __/ | |___| _| _| __/ (__| |_\__ \
# \_/\_/ |_| |_____|_| |_| \___|\___|\__|___/
#
ml4w_cache_folder="$HOME/.cache/ml4w/hyprland-dotfiles"
# Get current wallpaper
cache_file="$ml4w_cache_folder/current_wallpaper"
if [ $1 == "reload" ]; then
# Releod wallpaper with current effect
waypaper --wallpaper $(cat $cache_file)
else
# Open rofi to select the Hyprshade filter for toggle
options="$(ls ~/.config/hypr/effects/wallpaper/)\noff"
# Open rofi
choice=$(echo -e "$options" | rofi -dmenu -replace -config ~/.config/rofi/config-themes.rasi -i -no-show-icons -l 5 -width 30 -p "Hyprshade")
if [ ! -z $choice ]; then
echo "$choice" >~/.config/ml4w/settings/wallpaper-effect.sh
notify-send "Changing Wallpaper Effect to " "$choice"
waypaper --wallpaper $(cat $cache_file)
fi
fi

View File

@@ -0,0 +1,49 @@
#!/usr/bin/env bash
# _ _
# __ ____ _| | |_ __ __ _ _ __ ___ _ __
# \ \ /\ / / _` | | | '_ \ / _` | '_ \ / _ \ '__|
# \ V V / (_| | | | |_) | (_| | |_) | __/ |
# \_/\_/ \__,_|_|_| .__/ \__,_| .__/ \___|_|
# |_| |_|
#
# -----------------------------------------------------
# Restore last wallpaper
# -----------------------------------------------------
# -----------------------------------------------------
# Set defaults
# -----------------------------------------------------
ml4w_cache_folder="$HOME/.cache/ml4w/hyprland-dotfiles"
defaultwallpaper="$HOME/.config/ml4w/wallpapers/default.jpg"
cachefile="$ml4w_cache_folder/current_wallpaper"
# -----------------------------------------------------
# Get current wallpaper
# -----------------------------------------------------
if [ -f "$cachefile" ]; then
sed -i "s|~|$HOME|g" "$cachefile"
wallpaper=$(cat $cachefile)
if [ -f $wallpaper ]; then
echo ":: Wallpaper $wallpaper exists"
else
echo ":: Wallpaper $wallpaper does not exist. Using default."
wallpaper=$defaultwallpaper
fi
else
echo ":: $cachefile does not exist. Using default wallpaper."
wallpaper=$defaultwallpaper
fi
# -----------------------------------------------------
# Set wallpaper
# -----------------------------------------------------
echo ":: Setting wallpaper with source image $wallpaper"
if [ -f ~/.local/bin/waypaper ]; then
export PATH=$PATH:~/.local/bin/
fi
waypaper --wallpaper "$wallpaper"

View File

@@ -0,0 +1,201 @@
#!/usr/bin/env bash
# _ __ ____
# | | /| / /__ _/ / /__ ___ ____ ___ ____
# | |/ |/ / _ `/ / / _ \/ _ `/ _ \/ -_) __/
# |__/|__/\_,_/_/_/ .__/\_,_/ .__/\__/_/
# /_/ /_/
# Source library.sh
source $HOME/.config/ml4w/library.sh
# -----------------------------------------------------
# Check to use wallpaper cache
# -----------------------------------------------------
if [ -f ~/.config/ml4w/settings/wallpaper_cache ]; then
use_cache=1
_writeLog "Using Wallpaper Cache"
else
use_cache=0
_writeLog "Wallpaper Cache disabled"
fi
# -----------------------------------------------------
# Create cache folder
# -----------------------------------------------------
ml4w_cache_folder="$HOME/.cache/ml4w/hyprland-dotfiles"
if [ ! -d $ml4w_cache_folder ]; then
mkdir -p $ml4w_cache_folder
fi
# -----------------------------------------------------
# Set defaults
# -----------------------------------------------------
force_generate=0
# Cache for generated wallpapers with effects
generatedversions="$ml4w_cache_folder/wallpaper-generated"
if [ ! -d $generatedversions ]; then
mkdir -p $generatedversions
fi
# Will be set when waypaper is running
waypaperrunning=$ml4w_cache_folder/waypaper-running
if [ -f $waypaperrunning ]; then
rm $waypaperrunning
exit
fi
cachefile="$ml4w_cache_folder/current_wallpaper"
blurredwallpaper="$ml4w_cache_folder/blurred_wallpaper.png"
squarewallpaper="$ml4w_cache_folder/square_wallpaper.png"
rasifile="$ml4w_cache_folder/current_wallpaper.rasi"
blurfile="$HOME/.config/ml4w/settings/blur.sh"
defaultwallpaper="$HOME/.config/ml4w/wallpapers/default.jpg"
wallpapereffect="$HOME/.config/ml4w/settings/wallpaper-effect.sh"
blur="50x30"
blur=$(cat $blurfile)
# -----------------------------------------------------
# Get selected wallpaper
# -----------------------------------------------------
if [ -z $1 ]; then
if [ -f $cachefile ]; then
wallpaper=$(cat $cachefile)
else
wallpaper=$defaultwallpaper
fi
else
wallpaper=$1
fi
used_wallpaper=$wallpaper
_writeLog "Setting wallpaper with source image $wallpaper"
tmpwallpaper=$wallpaper
# -----------------------------------------------------
# Copy path of current wallpaper to cache file
# -----------------------------------------------------
if [ ! -f $cachefile ]; then
touch $cachefile
fi
echo "$wallpaper" > $cachefile
_writeLog "Path of current wallpaper copied to $cachefile"
# -----------------------------------------------------
# Get wallpaper filename
# -----------------------------------------------------
wallpaperfilename=$(basename $wallpaper)
_writeLog "Wallpaper Filename: $wallpaperfilename"
# -----------------------------------------------------
# Wallpaper Effects
# -----------------------------------------------------
if [ -f $wallpapereffect ]; then
effect=$(cat $wallpapereffect)
if [ ! "$effect" == "off" ]; then
used_wallpaper=$generatedversions/$effect-$wallpaperfilename
if [ -f $generatedversions/$effect-$wallpaperfilename ] && [ "$force_generate" == "0" ] && [ "$use_cache" == "1" ]; then
_writeLog "Use cached wallpaper $effect-$wallpaperfilename"
else
_writeLog "Generate new cached wallpaper $effect-$wallpaperfilename with effect $effect"
notify-send --replace-id=1 "Using wallpaper effect $effect..." "with image $wallpaperfilename" -h int:value:33
source $HOME/.config/hypr/effects/wallpaper/$effect
fi
_writeLog "Loading wallpaper $generatedversions/$effect-$wallpaperfilename with effect $effect"
_writeLog "Setting wallpaper with $used_wallpaper"
touch $waypaperrunning
waypaper --wallpaper $used_wallpaper
else
_writeLog "Wallpaper effect is set to off"
fi
else
effect="off"
fi
# -----------------------------------------------------
# Detect Theme
# -----------------------------------------------------
SETTINGS_FILE="$HOME/.config/gtk-3.0/settings.ini"
THEME_PREF=$(grep -E '^gtk-application-prefer-dark-theme=' "$SETTINGS_FILE" | awk -F'=' '{print $2}')
# -----------------------------------------------------
# Execute matugen
# -----------------------------------------------------
_writeLog "Execute matugen with $used_wallpaper"
if [ "$THEME_PREF" -eq 1 ]; then
$HOME/.local/bin/matugen image $used_wallpaper -m "dark"
else
$HOME/.local/bin/matugen image $used_wallpaper -m "light"
fi
# -----------------------------------------------------
# Reload Waybar
# -----------------------------------------------------
sleep 1
$HOME/.config/waybar/launch.sh
# -----------------------------------------------------
# Reload nwg-dock-hyprland
# -----------------------------------------------------
$HOME/.config/nwg-dock-hyprland/launch.sh &
# -----------------------------------------------------
# Update Pywalfox
# -----------------------------------------------------
if type pywalfox >/dev/null 2>&1; then
pywalfox update
fi
# -----------------------------------------------------
# Update SwayNC
# -----------------------------------------------------
sleep 0.1
swaync-client -rs
# -----------------------------------------------------
# Created blurred wallpaper
# -----------------------------------------------------
if [ -f $generatedversions/blur-$blur-$effect-$wallpaperfilename.png ] && [ "$force_generate" == "0" ] && [ "$use_cache" == "1" ]; then
_writeLog "Use cached wallpaper blur-$blur-$effect-$wallpaperfilename"
else
_writeLog "Generate new cached wallpaper blur-$blur-$effect-$wallpaperfilename with blur $blur"
# notify-send --replace-id=1 "Generate new blurred version" "with blur $blur" -h int:value:66
magick $used_wallpaper -resize 75% $blurredwallpaper
_writeLog "Resized to 75%"
if [ ! "$blur" == "0x0" ]; then
magick $blurredwallpaper -blur $blur $blurredwallpaper
cp $blurredwallpaper $generatedversions/blur-$blur-$effect-$wallpaperfilename.png
_writeLog "Blurred"
fi
fi
cp $generatedversions/blur-$blur-$effect-$wallpaperfilename.png $blurredwallpaper
# -----------------------------------------------------
# Create rasi file
# -----------------------------------------------------
if [ ! -f $rasifile ]; then
touch $rasifile
fi
echo "* { current-image: url(\"$blurredwallpaper\", height); }" >"$rasifile"
# -----------------------------------------------------
# Created square wallpaper
# -----------------------------------------------------
_writeLog "Generate new cached wallpaper square-$wallpaperfilename"
magick $tmpwallpaper -gravity Center -extent 1:1 $squarewallpaper
cp $squarewallpaper $generatedversions/square-$wallpaperfilename.png

View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bash
if [ -f /usr/bin/waypaper ]; then
echo ":: Launching waybar in /usr/bin"
waypaper $1 &
elif [ -f $HOME/.local/bin/waypaper ]; then
echo ":: Launching waybar in $HOME/.local/bin"
$HOME/.local/bin/waypaper $1 &
else
echo ":: waypaper not found"
fi

View File

@@ -0,0 +1,61 @@
#!/usr/bin/env bash
# __ ______ ____
# \ \/ / _ \ / ___|
# \ /| | | | | _
# / \| |_| | |_| |
# /_/\_\____/ \____|
#
# Setup Timers
_sleep1="0.1"
_sleep2="0.5"
_sleep3="2"
_sleep4="1"
sleep $_sleep4
# Kill all possible running xdg-desktop-portals
killall -e xdg-desktop-portal-hyprland
killall -e xdg-desktop-portal-gnome
killall -e xdg-desktop-portal-kde
killall -e xdg-desktop-portal-lxqt
killall -e xdg-desktop-portal-wlr
killall -e xdg-desktop-portal-gtk
killall -e xdg-desktop-portal
# Set required environment variables
dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=hyprland
# Stop all services
systemctl --user stop pipewire
systemctl --user stop wireplumber
systemctl --user stop xdg-desktop-portal
systemctl --user stop xdg-desktop-portal-gnome
systemctl --user stop xdg-desktop-portal-kde
systemctl --user stop xdg-desktop-portal-wlr
systemctl --user stop xdg-desktop-portal-hyprland
sleep $_sleep1
# Start xdg-desktop-portal-hyprland
/usr/lib/xdg-desktop-portal-hyprland &
sleep $_sleep3
# Start xdg-desktop-portal-gtk
if [ -f /usr/lib/xdg-desktop-portal-gtk ]; then
/usr/lib/xdg-desktop-portal-gtk &
sleep $_sleep1
fi
# Start xdg-desktop-portal
/usr/lib/xdg-desktop-portal &
sleep $_sleep2
# Start required services
systemctl --user start pipewire
systemctl --user start wireplumber
systemctl --user start xdg-desktop-portal
systemctl --user start xdg-desktop-portal-hyprland
# Run waybar
sleep $_sleep3
# ~/.config/waybar/launch.sh