Update scripts

This commit is contained in:
Pedro Rey Anca 2024-12-30 16:05:37 +01:00
parent 1c008d576a
commit d337902211
Signed by: peprolinbot
GPG key ID: 053EA6E00116533A
15 changed files with 86 additions and 115 deletions

View file

@ -1,10 +0,0 @@
#!/usr/bin/env bash
if (( $# == 1 )) then
# echo -ne "Archive name: "
# read name
# tar -cvzf "$name.tar.gz" $1
tar -cvzf "$1.tar.gz" $1
else
echo "Wrong number of arguments..."
fi

View file

@ -1,5 +1,3 @@
#!/usr/bin/env bash
if [ "$1" == "on" ]; then
state_opt=1
elif [ "$1" == "off" ]; then
@ -13,4 +11,4 @@ fi
monitor_count=$(bash -c "ddcutil detect | grep Display | wc -l")
seq $monitor_count | xargs -n 1 ddcutil setvcp d6 $state_opt -d
seq "$monitor_count" | xargs -n 1 ddcutil setvcp d6 $state_opt -d

View file

@ -1,6 +0,0 @@
#!/usr/bin/env bash
for i in "$@" ; do
tar -xvzf $i
break
done

View file

@ -1,12 +1,10 @@
#!/usr/bin/env bash
[ $# -eq 0 ] && { # $# is number of args
echo "$(basename $0): missing command" >&2
echo "$(basename "$0"): missing command" >&2
exit 1
}
prog="$(which "$1")" # see below
[ -z "$prog" ] && {
echo "$(basename $0): unknown command: $1" >&2
echo "$(basename "$0"): unknown command: $1" >&2
exit 1
}
shift # remove $1, now $prog, from args

View file

@ -1,5 +1,3 @@
#!/usr/bin/env bash
#### Options
option_1="󰹑 Capture"
@ -37,19 +35,14 @@ timer_menu() {
selected_timer="$(timer_cmd)"
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}
fi
}
@ -66,13 +59,10 @@ type_screenshot_menu() {
selected_type_screenshot="$(type_screenshot_cmd)"
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}
fi
}

View file

@ -1,5 +1,3 @@
#!/usr/bin/env bash
## Based on https://github.com/sgsax/apod-desktop/blob/master/apod
@ -13,22 +11,19 @@ IMG_FILE=/tmp/apotd.jpg
echo Getting APOD page...
page_data=`curl -s $PAGE_URL`
if [ $? -ne 0 ]; then
if ! page_data=$(curl -s $PAGE_URL); then
echo "Unable to retrieve page";
exit 1;
fi
# extract the image url from the astropix page
echo Getting image url...
imgurl=`echo "$page_data" | grep -i "img src" | sed -e 's/.*<img src="\(.*\)".*/\1/i'`
echo Image url is $imgurl
imgurl=$(echo "$page_data" | grep -i "img src" | sed -e 's/.*<img src="\(.*\)".*/\1/i')
echo "Image url is $imgurl"
# get that image file
echo Getting image at ${BASE_URL}${imgurl}
curl ${BASE_URL}${imgurl} -o $IMG_FILE
if [ $? -ne 0 ]; then
echo "Getting image at ${BASE_URL}${imgurl}"
if ! curl "${BASE_URL}${imgurl}" -o $IMG_FILE; then
echo "Unable to retrieve image"
exit 2
fi

View file

@ -1,5 +1,3 @@
#!/usr/bin/env bash
# base URL for Bing
BASE_URL=https://bing.com
@ -10,22 +8,19 @@ IMG_FILE=/tmp/bpotd.jpg
echo Querying the API...
api_data=`curl $ENDPOINT`
if [ $? -ne 0 ]; then
if ! api_data=$(curl "$ENDPOINT"); then
echo "Unable to contact the API";
exit 1;
fi
# extract the image url from the astropix page
echo Getting image url...
imgurl=`echo $api_data | jq -r .images[0].url`
echo Image url is $imgurl
imgurl=$(echo "$api_data" | jq -r .images[0].url)
echo "Image url is $imgurl"
# get that image file
echo Getting image at ${BASE_URL}${imgurl}
curl ${BASE_URL}${imgurl} -o $IMG_FILE
if [ $? -ne 0 ]; then
echo "Getting image at ${BASE_URL}${imgurl}"
if ! curl "${BASE_URL}${imgurl}" -o $IMG_FILE; then
echo "Unable to retrieve image"
exit 2
fi

View file

@ -1,5 +1,3 @@
#!/usr/bin/env bash
config_file=~/.config/hypr/hyprland.conf
keybinds=$(grep -oP '(?<=bind=).*' $config_file)
keybinds=$(echo "$keybinds" | sed 's/,\([^,]*\)$/ = \1/' | sed 's/, exec//g' | sed 's/^,//g')

View file

@ -1,15 +1,13 @@
#!/usr/bin/env zsh
respond="$(echo -e "󰐥 Shutdown\n󰜉 Restart\n󰜺 Cancel" | fuzzel --dmenu --lines=3 --width=15 --prompt='Choose action: ')"
respond="$(echo " Shutdown\n Restart\n Cancel" | fuzzel --dmenu --lines=3 --width=10 --prompt='')"
if [ $respond = ' Shutdown' ]
if [ "$respond" = '󰐥 Shutdown' ]
then
echo "shutdown"
shutdown now
elif [ $respond = ' Restart' ]
elif [ "$respond" = '󰜉 Restart' ]
then
echo "restart"
reboot
else
notify-send "cancel shutdown"
notify-send "Shutdown cancelled"
fi

View file

@ -1,5 +1,3 @@
#!/usr/bin/env bash
if hyprctl getoption decoration:blur:enabled | grep "int: 1" >/dev/null ; then
hyprctl keyword decoration:blur:enabled false >/dev/null
else

View file

@ -1,5 +1,3 @@
#!/usr/bin/env bash
if hyprctl getoption decoration:active_opacity | grep "float: 1" >/dev/null ; then
hyprctl keyword decoration:active_opacity 0.90 >/dev/null
hyprctl keyword decoration:inactive_opacity 0.90 >/dev/null

View file

@ -1,11 +1,9 @@
#!/usr/bin/env bash
PIDS=$(pgrep -f "swaybg")
swaybg -m fill -i $1 &
swaybg -m fill -i "$1" &
if [ -n "$PIDS" ]; then
echo "$PIDS" | xargs kill
fi
magick $1 ~/.config/hypr/wallpaper.png
magick "$1" ~/.config/hypr/wallpaper.png

View file

@ -1,16 +1,14 @@
#!/usr/bin/env bash
bpotd_entry="⚙️ Bing's Picture Of The Day"
apotd_entry="⚙️ NASA's Astronomy Picture Of The Day"
wallpapers_folder=$HOME/Pictures/Wallpapers/
wallpaper_name=`echo -e "$bpotd_entry\n$apotd_entry" | { cat; find $wallpapers_folder -type f | sed "s|$wallpapers_folder||"; } | fuzzel --dmenu`
wallpaper_name=$(echo -e "$bpotd_entry\n$apotd_entry" | { cat; find "$wallpapers_folder" -type f | sed "s|$wallpapers_folder||"; } | fuzzel --dmenu)
if [ "$wallpaper_name" == "$bpotd_entry" ]; then
setbg-bpotd
elif [ "$wallpaper_name" == "$apotd_entry" ]; then
setbg-apotd
elif [[ -f $wallpapers_folder/$wallpaper_name ]]; then
wall-change $wallpapers_folder/$wallpaper_name
wall-change "$wallpapers_folder/$wallpaper_name"
else
exit 1
fi