added scripts

This commit is contained in:
2005 2024-05-24 00:20:58 +02:00
parent 241370064e
commit d30746aeb5
10 changed files with 124 additions and 0 deletions

31
scripts/cava.sh Executable file
View file

@ -0,0 +1,31 @@
#! /bin/sh
bar="▁▂▃▄▅▆▇█"
dict="s/;//g;"
# creating "dictionary" to replace char with bar
i=0
while [ $i -lt ${#bar} ]
do
dict="${dict}s/$i/${bar:$i:1}/g;"
i=$((i=i+1))
done
# write cava config
config_file="/tmp/polybar_cava_config"
echo "
[general]
bars = 30
[output]
method = raw
raw_target = /dev/stdout
data_format = ascii
ascii_max_range = 7
" > $config_file
# read stdout from cava
cava -p $config_file | while read -r line; do
echo $line | sed $dict
done

42
scripts/music.sh Executable file
View file

@ -0,0 +1,42 @@
#!/bin/sh
if info=$(cmus-remote -Q 2> /dev/null); then
status=$(echo "$info" | grep -v "set " | grep -v "tag " | grep "status " | cut -d ' ' -f 2)
if [ "$status" = "playing" ] || [ "$status" = "paused" ] || [ "$status" = "stopped" ]; then
title=$(echo "$info" | grep -v 'set ' | grep " title " | cut -d ' ' -f 3-)
artist=$(echo "$info" | grep -v 'set ' | grep " artist " | cut -d ' ' -f 3-)
position=$(echo "$info" | grep -v "set " | grep -v "tag " | grep "position " | cut -d ' ' -f 2)
duration=$(echo "$info" | grep -v "set " | grep -v "tag " | grep "duration " | cut -d ' ' -f 2)
if [ "$artist" ] || [ "$title" ]; then
if [ "$duration" -ge 0 ]; then
pos_minutes=$(printf "%02d" $((position / 60)))
pos_seconds=$(printf "%02d" $((position % 60)))
dur_minutes=$(printf "%02d" $((duration / 60)))
dur_seconds=$(printf "%02d" $((duration % 60)))
info_string="| $pos_minutes:$pos_seconds / $dur_minutes:$dur_seconds"
fi
info_string="$artist - $title $info_string"
if [ "$status" = "playing" ]; then
echo "#1 $info_string"
elif [ "$status" = "paused" ]; then
echo "#2 $info_string"
elif [ "$status" = "stopped" ]; then
echo "#3 $info_string"
else
echo "Music offline"
fi
else
echo "Music offline"
fi
else
echo "Music offline"
fi
else
echo "Music offline"
fi

View file

@ -0,0 +1,9 @@
#!/bin/sh
window=$(i3-msg -t get_tree | jq -r ".. | select(.focused? == true) | .window")
window_name=$(xdotool getwindowclassname "$window" || xdotool getwindowname "$window" || echo "?")
echo $window_name > /tmp/replay.tmp
gpu-screen-recorder -w "$window" -f 60 -a "$(pactl get-default-sink).monitor|$(pactl get-default-source)" -c mp4 -k h264 -r 150 -o "$HOME/Videos/Replays/$window_name"
#gpu-screen-recorder -w "$window" -f 60 -c mkv -a "$(pactl get-default-sink).monitor" -r 60 -o "$HOME/Videos/Replays/$window_name"

3
scripts/save_replay.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh -e
killall -SIGUSR1 gpu-screen-recorder

2
scripts/screenshot.sh Normal file
View file

@ -0,0 +1,2 @@
#!/bin/sh
NUM=$(echo $RANDOM) maim -s $HOME/Pictures/screenshots/$(date +%Y%m%d_%H%M)$NUM.png ; cat $HOME/Pictures/screenshots/$(date +%Y%m%d_%H%M)$NUM.png | xclip -selection clipboard -t image/png

4
scripts/start_replay.sh Executable file
View file

@ -0,0 +1,4 @@
#!/bin/sh
mkdir -p "$video_path"
echo "Screen" > /tmp/replay.tmp
gpu-screen-recorder -w screen -k h264 -f 60 -a "$(pactl get-default-sink).monitor|$(pactl get-default-source)" -c mp4 -r 150 -o "$HOME/Videos/Replays/screen"

6
scripts/status.sh Executable file
View file

@ -0,0 +1,6 @@
if [[ $(pgrep gpu-screen-reco) ]]; then
echo "on: $(cat /tmp/replay.tmp)"
else
echo "off"
fi

3
scripts/stop_replay.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
killall -SIGINT gpu-screen-recorder

6
scripts/toggle.sh Executable file
View file

@ -0,0 +1,6 @@
if [[ $(pgrep gpu-screen-reco) ]]; then
~/.config/scripts/stop_replay.sh
else
~/.config/scripts/start_replay.sh
fi

18
scripts/type.sh Executable file
View file

@ -0,0 +1,18 @@
# 1k 15 25 35
# 5k 15 25 35 50
# 10k 15 25 35 50
dttyper -w 15 -l english1000
dttyper -w 25 -l english1000
dttyper -w 35 -l english1000
dttyper -w 15 -l english5000
dttyper -w 25 -l english5000
dttyper -w 35 -l english5000
dttyper -w 50 -l english5000
dttyper -w 15 -l english10000
dttyper -w 25 -l english10000
dttyper -w 35 -l english10000
dttyper -w 50 -l english10000