initial commit

This commit is contained in:
sudacode 2025-03-10 23:39:25 -07:00
commit 2b6b25783d
Signed by: sudacode
SSH Key Fingerprint: SHA256:lT5C2bB398DcX6daCF/gYFNSTK3y+Du3oTGUnYzfTEw
4 changed files with 119 additions and 0 deletions

14
change-wallpaper.sh Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
WALLPAPER_DIR="$HOME/Pictures/variety/"
CURRENT_WALL=$(hyprctl hyprpaper listloaded)
# Get a random wallpaper that is not the current one
WALLPAPER=$(find "$WALLPAPER_DIR" -type f ! -name "$(basename "$CURRENT_WALL")" ! -name "*.json" | shuf -n 1)
echo "Changing wallpaper to $WALLPAPER"
echo "$WALLPAPER" > "$HOME/.wallpaper"
# Apply the selected wallpaper
hyprctl hyprpaper reload ,"$WALLPAPER"
notify-send -i hyprpaper -u normal "change-wallpaper.sh" "Wallpaper changed to ${WALLPAPER##*/variety/}"

29
mpv-add.sh Executable file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
set -Eeuo pipefail
URL="${1:-$(wl-paste -p)}"
MPV_SOCKET=/tmp/mpvsocket
ICON_PATH="$HOME/.local/share/icons/Magna-Glassy-Dark-Icons/apps/48/mpv.svg"
TITLE="mpv-add.sh"
if [[ -z "$URL" ]]; then
notify-send -i "$ICON_PATH" "$TITLE" "No URL provided"
exit 1
fi
if ! [[ -f "$URL" ]] && ! yt-dlp --simulate "$URL"; then
notify-send -i "$ICON_PATH" "$TITLE" "Invalid URL"
exit 1
fi
if ! pgrep -x mpv &> /dev/null; then
mpv "$URL" &> /dev/null &
notify-send -i "$ICON_PATH" "$TITLE" "Playing $URL"
else
if echo "{ \"command\": [\"script-message\", \"add_to_queue\", \"$URL\" ] }" | socat - "$MPV_SOCKET" &> /dev/null; then
notify-send -i "$ICON_PATH" "$TITLE" "Added $URL to queue"
else
notify-send -i "$ICON_PATH" "$TITLE" "Failed to add $URL to queue"
fi
fi

14
ocr.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
set -Eeuo pipefail
RES="$(slurp | grim -g - - | gazou | sed -n '2p')"
# Truncate RES for display if it's longer than 100 characters
DISPLAY_RES="${RES:0:100}"
if [ ${#RES} -gt 100 ]; then
DISPLAY_RES="${DISPLAY_RES}..."
fi
notify-send "ocr.sh" "Text: $DISPLAY_RES"
echo "$RES" | wl-copy

62
screenshot.sh Executable file
View File

@ -0,0 +1,62 @@
#!/bin/bash
#
# GUI Screenshot Tool for Wayland Using Zenity, Grim, Slurp, and Rofi
# Last Modification: Wed Mar 5 2025
#
TMP_DIR=/tmp
DEFAULT_FILENAME=screenshot.png
CHOICES=(
"1. a part of the screen"
"2. a part of the screen and put the output into the clipboard"
"3. whole screen"
"4. edit"
)
CHOICE="$(rofi -dmenu -i -p "Enter option or select from the list" \
-mesg "Select a Screenshot Option" \
-a 0 -no-custom -location 0 \
-yoffset 30 -xoffset 30 \
-theme-str 'listview {columns: 1; lines: 4;} window {width: 45%;}' \
-window-title "screenshot.sh" \
<<< "$(printf "%s\n" "${CHOICES[@]}")")"
# echo $CHOICE
case $CHOICE in
"1. a part of the screen")
slurp | grim -g - "$TMP_DIR/$DEFAULT_FILENAME"
;;
"2. a part of the screen and put the output into the clipboard")
slurp | grim -g - - | wl-copy
exit
;;
"3. whole screen")
grim "$TMP_DIR/$DEFAULT_FILENAME"
;;
"4. edit")
grim -g "$(slurp)" - | swappy -f -
exit
;;
"")
exit
;;
esac
FILE=$(zenity --file-selection --title="Select a File" --filename=$DEFAULT_FILENAME --save 2> /dev/null)
# echo $FILE
case $? in
0)
mv "$TMP_DIR/$DEFAULT_FILENAME" $FILE
;;
1)
rm "$TMP_DIR/$DEFAULT_FILENAME"
;;
-1)
echo "An unexpected error has occurred."
;;
esac
exit