1
0
Fork 0

Initial configuration

This commit is contained in:
Avery 2024-03-18 23:39:38 +01:00
commit 294fd9dcf3
Signed by: Avery
GPG key ID: B684FD451B692E04
35 changed files with 5369 additions and 0 deletions

View file

@ -0,0 +1,74 @@
#!/bin/sh
shopt -s nullglob
WALLPAPER_PATH=~/.local/share/wallpapers
WALLPAPERS=($WALLPAPER_PATH/*)
if [ ! -f "$WALLPAPER_PATH/.current_path" ]; then
# Current wallpaper file does not exist, create it
echo ${WALLPAPERS[0]} > "$WALLPAPER_PATH/.current_path"
fi
CURRENT_WALLPAPER=$(cat "$WALLPAPER_PATH/.current_path")
# Get the current wallpaper's index
for index in ${!WALLPAPERS[@]}; do
if [ "${WALLPAPERS[$index]}" = "$CURRENT_WALLPAPER" ]; then
CURRENT_WP_INDEX=$index
fi
done
if [ -z $CURRENT_WP_INDEX ]; then
CURRENT_WP_INDEX=0
fi
if [ $1 = "previous" ]; then
WALLPAPER=${WALLPAPERS[$CURRENT_WP_INDEX - 1]}
TRANSITION_ANGLE=300
elif [ $1 = "next" ]; then
NEXT_INDEX=$((CURRENT_WP_INDEX + 1))
if [ $NEXT_INDEX = ${#WALLPAPERS[@]} ]; then
NEXT_INDEX=0
fi
WALLPAPER=${WALLPAPERS[$NEXT_INDEX]}
TRANSITION_ANGLE=120
elif [ $1 = "open-menu" ]; then
INPUT=$''
for index in ${!WALLPAPERS[@]}; do
if [ $index = $CURRENT_WP_INDEX ]; then
continue
fi
_WALLPAPER="${WALLPAPERS[$index]}"
_WALLPAPER_NAME=$(basename "$_WALLPAPER")
INPUT+="$_WALLPAPER_NAME\0icon\x1f$_WALLPAPER"
if [ ! $(($index + 1)) = ${#WALLPAPERS[@]} ]; then
INPUT+=$'\n'
fi
done
WALLPAPER=$(echo -en "$INPUT" | rofi -dmenu -mesg "Cambiar fondo de pantalla" -p "" -i -theme ~/.config/rofi/wallpaper_selector.rasi)
if [ ! $? = 0 ]; then
exit 1
fi
WALLPAPER="${WALLPAPER_PATH}/${WALLPAPER}"
TRANSITION_ANGLE=270
else
echo "Unknown first argument: $1"
exit 1
fi
if [ -z $WALLPAPER ]; then
exit 1
fi
WALLPAPER_NAME=$(basename "$WALLPAPER")
echo "Setting wallpaper to $WALLPAPER, args: $@"
echo "$WALLPAPER" > "$WALLPAPER_PATH/.current_path"
ln -sf "$WALLPAPER" "$WALLPAPER_PATH/.current_image"
dunstify -i "$WALLPAPER" -t 2800 "Cambiando fondo de pantalla" "Cambiando a $WALLPAPER_NAME"
swww img\
--transition-type wipe\
--transition-angle $TRANSITION_ANGLE\
--transition-step 90\
--transition-duration 1\
--transition-fps 165\
"$WALLPAPER"

View file

@ -0,0 +1,18 @@
#!/bin/bash
RPC_HOST=http://localhost:6680/mopidy/rpc
TRACK=$(curl -s -X POST -H Content-Type:application/json -d '{ "method": "core.playback.get_current_track", "jsonrpc": "2.0", "params": {}, "id": 1 }' $RPC_HOST)
TRACK_URI=$(echo $TRACK | jq -r '.result.uri')
IMAGES=$(curl -s -X POST -H Content-Type:application/json -d '{ "method": "core.library.get_images", "jsonrpc": "2.0", "params": { "uris": ["'"$TRACK_URI"'"] }, "id": 1}' $RPC_HOST)
IMAGE_URI=$(echo $IMAGES | jq -r 'first(.result[] | sort_by(.width) | reverse | .[].uri)')
if [[ -n "$IMAGE_URI" ]]; then
if [[ "$IMAGE_URI" == *"local/"* ]]; then
# Image is local
IMAGE="$HOME/.local/share/mopidy/local/images${IMAGE_URI/local\//}"
else
curl -o /tmp/cover.png $IMAGE_URI &> /dev/null
IMAGE="/tmp/cover.png"
fi
fi
dunstify -r 99902 -I $IMAGE "Reproduciendo" "$(mpc --format '<b>%artist% - %album%</b>\n%title%' current 2> /dev/null)"

View file

@ -0,0 +1,5 @@
#!/usr/bin/env sh
while true; do
waybar
done

View file

@ -0,0 +1,3 @@
#!/bin/sh
mpv --no-video --audio-device=pipewire/Soundboard --audio-client-name="Soundboard" $@

View file

@ -0,0 +1,24 @@
#!/bin/sh
missing_params() {
echo "Missing parameters, usage: screenshot.sh <type>"
exit 1
}
test -n 1 || missing_params
FILE_NAME=$(date +'Screenshot_%Y%m%d_%H%M%S')
TEMPORARY_PATH="/tmp/$FILE_NAME.png"
SCREENSHOT_PATH=$(xdg-user-dir PICTURES)/$FILE_NAME.jxl
if [ $1 == "full" ]; then
grim $TEMPORARY_PATH
elif [ $1 == "section" ]; then
grim -g "$(slurp -b '#000000aa' -w 0)" $TEMPORARY_PATH
fi
if [ $? == 0 ]; then
wl-copy < $TEMPORARY_PATH
cjxl $TEMPORARY_PATH $SCREENSHOT_PATH
dunstify --raw_icon=$TEMPORARY_PATH "Captura de pantalla realizada" "Guardada como $FILE_NAME.jxl"
rm $TEMPORARY_PATH
fi

View file

@ -0,0 +1,7 @@
#!/bin/sh
pw-cli create-node adapter '{ factory.name=support.null-audio-sink node.name="Soundboard" node.description="Soundboard" media.class=Audio/Sink object.linger=true audio.position=[FL FR] }'
pw-link Soundboard:monitor_FL easyeffects_source:input_FL
pw-link Soundboard:monitor_FR easyeffects_source:input_FR
pw-link Soundboard:monitor_FL easyeffects_sink:playback_FL
pw-link Soundboard:monitor_FR easyeffects_sink:playback_FR

View file

@ -0,0 +1,72 @@
#!/bin/sh
VOLUME_REGEX="^(-*|\+*)[0-9]+$"
if [ "$1" == "output" ]; then
if [[ $2 =~ $VOLUME_REGEX ]]; then
if [ $(pamixer --get-mute) == "true" ]; then
pamixer --unmute > /dev/null
fi
if [ "${2:0:1}" == "-" ]; then
pamixer --allow-boost -d "${2:1}" > /dev/null
elif [ "${2:0:1}" == "+" ]; then
pamixer --allow-boost -i "${2:1}" > /dev/null
fi
volume="$(pamixer --get-volume-human)"
message="$volume"
elif [ $2 == "toggle-mute" ]; then
if [ $(pamixer --get-mute) == "true" ]; then
pamixer --unmute > /dev/null
volume="$(pamixer --get-volume-human)"
message="$volume"
else
pamixer --mute > /dev/null
message="󰖁 Silenciado"
fi
else
message="volumectl error: Unknown second argument"
fi
elif [ "$1" == "input" ]; then
if [[ $2 =~ $VOLUME_REGEX ]]; then
if [ $(pamixer --default-source --get-mute) == "true" ]; then
pamixer --default-source --unmute > /dev/null
fi
if [ "${2:0:1}" == "-" ];then
pamixer --default-source --allow-boost -d "${2:1}" > /dev/null
elif [ "${2:0:1}" == "+" ]; then
pamixer --default-source --allow-boost -i "${2:1}" > /dev/null
fi
volume="$(pamixer --default-source --get-volume-human)"
message="$volume"
elif [ $2 == "toggle-mute" ]; then
if [ $(pamixer --default-source --get-mute) == "true" ]; then
pamixer --default-source --unmute > /dev/null
volume="$(pamixer --default-source --get-volume-human)"
message="$volume"
else
pamixer --default-source --mute > /dev/null
message=" Silenciado"
fi
else
message="volumectl error: Unknown second argument"
fi
elif [ "$1" == "mpd" ]; then
if [[ $2 =~ $VOLUME_REGEX ]]; then
mpc volume $2 > /dev/null
icon="󰝚"
volume="$(perl -e "print ('$(mpc 2>/dev/null)' =~ /volume:[ ]*([0-9]*%)/);")"
if [ "$volume" == "0%" ]; then
icon="󰝛"
volume="Silenciado"
fi
message="$icon $volume"
else
message="volumectl error: Unknown second argument"
fi
else
message="volumectl error: Unknown first argument"
fi
volume=$(echo $volume | tr -d "%")
dunstify --appname "volumectl" --replace 9001 --urgency low --timeout 1250 --hints int:value:$volume "$message"