diff --git a/scripts/cava.sh b/scripts/cava.sh new file mode 100755 index 0000000..0300282 --- /dev/null +++ b/scripts/cava.sh @@ -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 + diff --git a/scripts/music.sh b/scripts/music.sh new file mode 100755 index 0000000..08783ee --- /dev/null +++ b/scripts/music.sh @@ -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 \ No newline at end of file diff --git a/scripts/replay_application_name.sh b/scripts/replay_application_name.sh new file mode 100755 index 0000000..a17b29d --- /dev/null +++ b/scripts/replay_application_name.sh @@ -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" diff --git a/scripts/save_replay.sh b/scripts/save_replay.sh new file mode 100755 index 0000000..aebefda --- /dev/null +++ b/scripts/save_replay.sh @@ -0,0 +1,3 @@ +#!/bin/sh -e + +killall -SIGUSR1 gpu-screen-recorder diff --git a/scripts/screenshot.sh b/scripts/screenshot.sh new file mode 100644 index 0000000..895906d --- /dev/null +++ b/scripts/screenshot.sh @@ -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 diff --git a/scripts/start_replay.sh b/scripts/start_replay.sh new file mode 100755 index 0000000..3eac1e0 --- /dev/null +++ b/scripts/start_replay.sh @@ -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" diff --git a/scripts/status.sh b/scripts/status.sh new file mode 100755 index 0000000..8f9bd7c --- /dev/null +++ b/scripts/status.sh @@ -0,0 +1,6 @@ +if [[ $(pgrep gpu-screen-reco) ]]; then + echo "on: $(cat /tmp/replay.tmp)" +else + echo "off" +fi + diff --git a/scripts/stop_replay.sh b/scripts/stop_replay.sh new file mode 100755 index 0000000..d38da9c --- /dev/null +++ b/scripts/stop_replay.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +killall -SIGINT gpu-screen-recorder diff --git a/scripts/toggle.sh b/scripts/toggle.sh new file mode 100755 index 0000000..2ad4fc4 --- /dev/null +++ b/scripts/toggle.sh @@ -0,0 +1,6 @@ +if [[ $(pgrep gpu-screen-reco) ]]; then + ~/.config/scripts/stop_replay.sh +else + ~/.config/scripts/start_replay.sh +fi + diff --git a/scripts/type.sh b/scripts/type.sh new file mode 100755 index 0000000..05306c0 --- /dev/null +++ b/scripts/type.sh @@ -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 +