chore: restructure the project, make it not use the astal application stuff

now it's more organized and I have more control over the shell behaviour
This commit is contained in:
retrozinndev
2025-08-06 15:25:21 -03:00
parent 5a6d5b47c6
commit d549ad9596
191 changed files with 529 additions and 1000 deletions
@@ -0,0 +1,75 @@
#!usr/bin/env bash
# Prompts the user with dmenu(or dmenu-like app, see hypr/scripts/get-dmenu.sh)
# to choose an image file inside defined $WALLPAPERS_DIR. If the user selects
# an entry, it automatically writes changes to the hyprpaper.conf file and
# hot-reloads if hyprpaper is running.
# --------------
# Licensed under the MIT License
# Made by retrozinndev (João Dias)
# From https://github.com/retrozinndev/colorshell
style="lighten" # lighten / darken
dmenu=$(sh "$XDG_CONFIG_HOME/hypr/scripts/get-dmenu.sh")
if [[ -z "$WALLPAPERS_DIR" ]]; then
WALLPAPERS_DIR="$HOME/wallpapers"
fi
function Write_changes() {
echo "[LOG] Writing to hyprpaper config file"
echo \
'$wallpaper'" = $wall
splash = true
preload = "'$wallpaper'"
wallpaper = , "'$wallpaper'"" | sed -e "s/^(\\[n])//g" > $XDG_CONFIG_HOME/hypr/hyprpaper.conf
}
function Reload_wallpaper() {
echo "[LOG] Hot-reloading wallpaper"
hyprctl hyprpaper unload all
hyprctl hyprpaper preload $wall
hyprctl hyprpaper wallpaper ", $wall"
}
function Reload_pywal() {
echo "[LOG] Reloading pywal colorscheme"
wal -t --cols16 $style -i "$wall"
}
if [[ -z "$dmenu" ]]; then
notify-send -u normal -a "Wallpaper" "Dmenu not found" "Couldn't find anyrun or wofi for dmenu! Try installing one of these two before selecting wallpaper!"
exit 1
fi
if [[ -z $(ls -A $WALLPAPERS_DIR) ]]; then
notify-send -u normal -a "Wallpaper" "Wallpapers not found" "Couldn't find any wallpaper inside \`~/wallpapers\`, try putting an image you like in there to choose it!"
exit 1
fi
if [[ -z $1 ]]; then
# Prompt wallpaper list
wall="$WALLPAPERS_DIR/$(ls $WALLPAPERS_DIR | $dmenu)"
# Check if input wallpaper is empty
if [[ $wall == "$WALLPAPERS_DIR/" ]]; then
echo "No wallpaper has been selected by user!"
if [[ $RANDOM_WALLPAPER_WHEN_EMPTY == true ]]; then
wall="$WALLPAPERS_DIR/$(ls $WALLPAPERS_DIR | shuf -n 1)"
echo "Selected random from $WALLPAPERS_DIR: $wall"
else
echo "Skipping hyprpaper changes and exiting."
exit 0
fi
fi
else
wall=$1
fi
Reload_pywal
Reload_wallpaper
Write_changes
exit 0
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
selection=$(cliphist list | anyrun --plugins libstdin.so | cliphist decode)
if [[ ! -z "$selection" ]]; then
printf "%s" "$selection" | sed -e 's/\\[n]$//g' | wl-copy
fi
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
function send_notification() {
notify-send -u normal -a "color-picker" "$1" "$2"
}
# Check if hyprpicker is installed
if ! command -v hyprpicker > /dev/null; then
send_notification "An error occurred" "Looks like you don't have hyprpicker installed! Try installing it before using the Color Picker tool."
exit 1
fi
raw_output=`hyprpicker -al 2> /dev/null`
selected_color=`echo $raw_output | xargs | sed -e 's/ //g'`
if ! [[ -z $selected_color ]]; then
send_notification "Selected Color" "The selected color is <span foreground='$selected_color'>$selected_color</span>, it was also copied to your clipboard!"
fi
+16
View File
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
# This script executes the provided program with UWSM
# if in usage or launches it normally with hyprctl.
# ---------------
# Licensed under the MIT License
# Made by retrozinndev (João Dias)
# From: https://github.com/retrozinndev/colorshell
if uwsm check is-active; then
exec uwsm app -- "$@"
exit 0
fi
exec "$@"
+21
View File
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
# This script loads/generate color schemes from current
# wallpaper using pywal16.
# ----------
# Licensed under the MIT License
# Made by retrozinndev (João Dias)
# From https://github.com/retrozinndev/colorshell
if ! [[ -f "$HOME/.config/hypr/hyprpaper.conf" ]]; then
notify-send -a "Wallpaper" "Couldn't load" "Wallpaper file not found! Please check for the wallpaper: $wallpaper."
exit 1
fi
wallpaper="$(cat $HOME'/.config/hypr/hyprpaper.conf' | grep '$wallpaper =' | sed -e 's/^$wallpaper = //')"
if [[ -d "$HOME/.cache/wal" ]]; then
wal -R
else
wal -q -t --cols16 darken -i "$wallpaper"
fi
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
# Checks environment for dmenu or dmenu-like apps
# and prints out a command to pipe of.
# -----------
# Licensed under the MIT License
# Made by retrozinndev (João Dias)
# From: https://github.com/retrozinndev/colorshell
DMENUS=(
"anyrun:--plugins:libstdin.so"
"rofi:-dmenu"
"wofi:--show:dmenu"
"dmenu"
)
for dmenu in ${DMENUS[@]}; do
name=$(printf "$dmenu" | awk -F: '{ print $1 }')
cmd=$(env "$name" -h > /dev/null)
code=$?
if [[ ! $code == 127 ]]; then
echo "$dmenu" | sed 's/:/ /g'
break;
fi
done
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
# This script loads hyprsunset settings previously
# saved by the save-hyprsunset.sh script on shutdown.
# --------------
# Licensed under the MIT License
# Made by retrozinndev (João Dias)
# From https://github.com/retrozinndev/colorshell
[[ -z $XDG_CONFIG_HOME ]] && XDG_CONFIG_HOME="$HOME/.config"
file_="$XDG_CONFIG_HOME/hypr/hyprsunset.conf"
if ! [[ -f "$file_" ]]; then
echo "[warn] Couldn't load hyprsunset config: file not found"
exit 0
fi
if ! [[ "$XDG_CURRENT_DESKTOP" =~ "Hyprland" ]]; then
echo "[error] Seems like you're not running Hyprland! Exiting"
exit 1
fi
if [[ -z $(command -v hyprsunset) ]]; then
echo "[error] Couldn't load hyprsunset settings: it's either not installed or not in PATH"
exit 1
fi
temperature=$(cat "$file_" | grep -E "^temperature = (.*)" | awk -F= '{ print $2 }')> /dev/null
gamma=$(cat "$file_" | grep -E "^gamma = (.*)" | awk -F= '{ print $2 }')> /dev/null
hyprctl hyprsunset temperature $temperature
sleep .05
hyprctl hyprsunset gamma $gamma
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
# This script saves hyprsunset values into a file using
# hyprlang, in `$XDG_CONFIG_HOME/hypr/hyprsunset.conf`.
# It is used to save last user configuration on computer
# shutdown.
# --------------
# Licensed under the MIT License
# Made by retrozinndev (João Dias)
# From https://github.com/retrozinndev/colorshell
[[ -z $XDG_CONFIG_HOME ]] && XDG_CONFIG_HOME="$HOME/.config"
if ! [[ "$XDG_CURRENT_DESKTOP" =~ "Hyprland" ]]; then
echo "[error] Seems like you're not running Hyprland! Exiting"
exit 1
fi
if [[ -z $(command -v hyprsunset) ]]; then
echo "[error] Couldn't save hyprsunset settings: it's either not installed or not in PATH"
exit 1
fi
output="$XDG_CONFIG_HOME/hypr/hyprsunset.conf"
temperature=$(hyprctl hyprsunset temperature || 6000)
gamma=$(hyprctl hyprsunset gamma || 100)
printf "temperature = %d\ngamma = %d" "$temperature" "$gamma" > $output
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
# This script handles taking a screenshot using the
# hyprshot tool.
# --------------
# Licensed under the MIT License
# Made by retrozinndev (João Dias)
# From https://github.com/retrozinndev/colorshell
# exit slurp and quit if slurp(region selection) is running
killall slurp && exit 0
if [[ -z $(command -v hyprshot) ]]; then
echo "[err] you don't have hyprshot installed, please install it first"
exit 1
fi
if [[ "$1" == "full" ]]; then
hyprshot -m active -m output -o "$(xdg-user-dir PICTURES)/Screenshots"
exit 0
fi
hyprshot -m region -o "$(xdg-user-dir PICTURES)/Screenshots"