mirror of
https://github.com/Keyitdev/dotfiles.git
synced 2026-09-24 01:52:09 +00:00
New version: created v3
This commit is contained in:
+6
-6
@@ -9,15 +9,15 @@ cur_bri=$(cat /sys/class/backlight/*/brightness)
|
||||
cur_per=$((cur_bri * 100 / max_bri))
|
||||
|
||||
if [ "$cur_per" -ge 50 ]; then
|
||||
dunstify -a "Brightness" \
|
||||
"Brightness" \
|
||||
"Current brightness is $cur_per%" \
|
||||
dunstify -a "Screen" \
|
||||
"Screen" \
|
||||
"Brightness: $cur_per%" \
|
||||
-r 100 \
|
||||
-i "$dir_icons"/sun.svg
|
||||
else
|
||||
dunstify -a "Brightness" \
|
||||
"Brightness" \
|
||||
"Current brightness is $cur_per%" \
|
||||
dunstify -a "Screen" \
|
||||
"Screen" \
|
||||
"Brightness: $cur_per%" \
|
||||
-r 100 \
|
||||
-i "$dir_icons"/moon.svg
|
||||
fi
|
||||
+28
-32
@@ -1,38 +1,34 @@
|
||||
#!/bin/bash
|
||||
#!/bin/zsh
|
||||
|
||||
screen="HDMI-1"
|
||||
dir_icons="/usr/local/bin/icons"
|
||||
MON="HDMI-1" # Discover monitor name with: xrandr | grep " connected"
|
||||
STEP=10 # Step Up/Down brightnes by: 5 = ".05", 10 = ".10", etc.
|
||||
|
||||
CurrBright=$( xrandr --verbose --current | grep ^"$MON" -A5 | tail -n1 )
|
||||
CurrBright="${CurrBright##* }" # Get brightness level with decimal place
|
||||
current_bright_float=$(xrandr --verbose | grep "$screen" -A10000 | grep 'Brightness:' | sed 's/[^0-9,.]//g')
|
||||
current_bright_int=$(echo $((current_bright_float*100 + 0.5)) | sed "s/\..*//" ) # cast to int
|
||||
|
||||
Left=${CurrBright%%"."*} # Extract left of decimal point
|
||||
Right=${CurrBright#*"."} # Extract right of decimal point
|
||||
|
||||
MathBright="0"
|
||||
[[ "$Left" != 0 && "$STEP" -lt 10 ]] && STEP=10 # > 1.0, only .1 works
|
||||
[[ "$Left" != 0 ]] && MathBright="$Left"00 # 1.0 becomes "100"
|
||||
[[ "${#Right}" -eq 1 ]] && Right="$Right"0 # 0.5 becomes "50"
|
||||
MathBright=$(( MathBright + Right ))
|
||||
|
||||
dunstify -a "Brightness" \
|
||||
"Brightness" \
|
||||
"Current brightness is $MathBright%" \
|
||||
-r 100 \
|
||||
-i "$dir_icons"/sun.svg
|
||||
|
||||
[[ "$1" == "up" || "$1" == "+" ]] && MathBright=$(( MathBright + STEP ))
|
||||
[[ "$1" == "down" || "$1" == "-" ]] && MathBright=$(( MathBright - STEP ))
|
||||
[[ "${MathBright:0:1}" == "-" ]] && MathBright=0 # Negative not allowed
|
||||
[[ "$MathBright" -gt 150 ]] && MathBright=150 # Can't go over 1.50
|
||||
|
||||
if [[ "${#MathBright}" -eq 3 ]] ; then
|
||||
MathBright="$MathBright"000 # Pad with lots of zeros
|
||||
CurrBright="${MathBright:0:1}.${MathBright:1:2}"
|
||||
else
|
||||
MathBright="$MathBright"000 # Pad with lots of zeros
|
||||
CurrBright=".${MathBright:0:2}"
|
||||
if [[ "$1" == "up" || "$1" == "+" ]]; then
|
||||
new_bright_int=$(($current_bright_int + 1))
|
||||
fi
|
||||
if [[ "$1" == "down" || "$1" == "-" ]]; then
|
||||
new_bright_int=$(($current_bright_int - 1))
|
||||
fi
|
||||
|
||||
xrandr --output "$MON" --brightness "$CurrBright" # Set new brightness
|
||||
if [[ "${#new_bright_int}" -eq 2 ]]; then # cast to float, two-digit number
|
||||
new_bright_float=$((0.$new_bright_int))
|
||||
fi
|
||||
if [[ "${#new_bright_int}" -eq 1 ]]; then # cast to float, one-digit number
|
||||
new_bright_float=$((0.0$new_bright_int))
|
||||
fi
|
||||
|
||||
if [[ "$new_bright_float" -lt "0" ]]; then # brightness must be positive
|
||||
exit
|
||||
fi
|
||||
|
||||
xrandr --output $screen --brightness $new_bright_float
|
||||
|
||||
# send notification
|
||||
dunstify -a "Screen" \
|
||||
"Screen ($screen)" \
|
||||
"Brightness: $new_bright_int%" \
|
||||
-r 100 \
|
||||
-i "$dir_icons"/sun.svg
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
for range in $(fc-match --format='%{charset}\n' "$1"); do
|
||||
for n in $(seq "0x${range%-*}" "0x${range#*-}"); do
|
||||
n_hex=$(printf "%04x" "$n")
|
||||
# using \U for 5-hex-digits
|
||||
printf "%-5s\U$n_hex\t" "$n_hex"
|
||||
count=$((count + 1))
|
||||
if [ $((count % 10)) = 0 ]; then
|
||||
printf "\n"
|
||||
fi
|
||||
done
|
||||
done
|
||||
printf "\n"
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
font="dedede"
|
||||
green="9ece6a"
|
||||
red="db4b4b"
|
||||
|
||||
i3lock -n --force-clock -F -i ~/Pictures/wallpapers/lockscreen2.png -e \
|
||||
--refresh-rate=1 --line-uses-inside --pointer=default --pass-media-keys --pass-volume-keys --pass-screen-keys \
|
||||
--inside-color="$green" --ring-color="$green" --insidever-color="$green" --ringver-color="$green" --insidewrong-color="$red" --ringwrong-color="$red" \
|
||||
--keyhl-color="$green" --separator-color="$green" --bshl-color="$green" --color=000000 \
|
||||
--time-str="%H:%M" --time-size=140 --time-pos="960:300" --time-font="Roboto mono:style=Bold" --time-color="$font" \
|
||||
--date-str="%A %d %B" --date-size=45 --date-pos="960:380" --date-font="Roboto mono" --date-color="$font" \
|
||||
--verif-text="Verifying" --greeter-text="" --wrong-text="Wrong Password!" --noinput-text="No input" \
|
||||
--verif-font="Roboto mono" --greeter-font="Roboto mono" --wrong-font="Roboto mono" \
|
||||
--verif-size=35 --greeter-size=35 --wrong-size=35 \
|
||||
--verif-pos="960:540" --greeter-pos="960:600" --wrong-pos="960:540" \
|
||||
--verif-color="$green" --greeter-color="$font" --wrong-color="$red" \
|
||||
--bar-indicator --bar-direction=0 --bar-step=10 --bar-max-height=10 --bar-base-width=10 --bar-total-width=1920 --bar-color=00000000 --bar-pos="0:1070"
|
||||
+12
-12
@@ -11,30 +11,30 @@ vol_quiet=33
|
||||
vol_loud=66
|
||||
|
||||
if [ "$MUTE" = "$affirmative" ]; then
|
||||
dunstify -a "Mute" \
|
||||
"Mute" \
|
||||
"Sink is now muted" \
|
||||
dunstify -a "Speakers" \
|
||||
"Speakers" \
|
||||
"Speakers are muted" \
|
||||
-r 100 \
|
||||
-i "$dir"/volume-x.svg
|
||||
elif [ "$MUTE" = "$negative" ]; then
|
||||
if [ "$cur_vol" -le "$vol_quiet" ]; then
|
||||
dunstify -a "Mute" \
|
||||
"Mute" \
|
||||
"Sink is now unmuted" \
|
||||
dunstify -a "Speakers" \
|
||||
"Speakers" \
|
||||
"Speakers are unmuted" \
|
||||
-r 100 \
|
||||
-i "$dir"/volume.svg
|
||||
fi
|
||||
if [ "$cur_vol" -gt "$vol_quiet" ] && [ "$cur_vol" -le "$vol_loud" ]; then
|
||||
dunstify -a "Mute" \
|
||||
"Mute" \
|
||||
"Sink is now unmuted" \
|
||||
dunstify -a "Speakers" \
|
||||
"Speakers" \
|
||||
"Speakers are unmuted" \
|
||||
-r 100 \
|
||||
-i "$dir"/volume-1.svg
|
||||
fi
|
||||
if [ "$cur_vol" -gt "$vol_loud" ]; then
|
||||
dunstify -a "Mute" \
|
||||
"Mute" \
|
||||
"Sink is now unmuted" \
|
||||
dunstify -a "Speakers" \
|
||||
"Speakers" \
|
||||
"Speakers are unmuted" \
|
||||
-r 100 \
|
||||
-i "$dir"/volume-2.svg
|
||||
fi
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
mkdir -p ~/.cache/rofi-bookmarks
|
||||
CACHEDIR="~/.cache/rofi-bookmarks"
|
||||
|
||||
|
||||
+30
-51
@@ -1,73 +1,52 @@
|
||||
#!/usr/bin/env bash
|
||||
#!/bin/sh
|
||||
|
||||
# rofi theme
|
||||
theme="$HOME/.config/rofi/compact_without_icons.rasi"
|
||||
theme="$HOME/.config/rofi/main_without_icons.rasi"
|
||||
|
||||
get_options() {
|
||||
echo " Capture Region"
|
||||
echo " Capture Region (without saving)"
|
||||
echo " Capture Screen"
|
||||
echo " Capture Screen (without saving)"
|
||||
echo " Record Region (GIF)"
|
||||
echo " Record Screen (GIF)"
|
||||
echo " Record Region (MP4)"
|
||||
echo " Record Screen (MP4)"
|
||||
#echo " Record Region (MP4+audio_virt)"
|
||||
#echo " Record Region (MP4+audio_mic)"
|
||||
#echo " Record Audio virt"
|
||||
#echo " Record Audio mic"
|
||||
echo " Stop Recording"
|
||||
echo " Selected area screenshot"
|
||||
echo " Full screen screenshot"
|
||||
echo " Selected area video"
|
||||
echo " Full screen video"
|
||||
echo " Record audio (microphone)"
|
||||
echo " Record audio (desktop)"
|
||||
echo " Selected area video with audio (microphone)"
|
||||
echo " Full screen video with audio (microphone)"
|
||||
echo " Stop Recording"
|
||||
}
|
||||
|
||||
main() {
|
||||
|
||||
# get choice from rofi
|
||||
choice=$( (get_options) | rofi -dmenu -i -fuzzy -p "" -theme "$theme")
|
||||
|
||||
# if user has not picked anything, exit
|
||||
if [[ -z "${choice// /}" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
choice=$( (get_options) | rofi -dmenu -i -fuzzy -p "" -theme "$theme")
|
||||
|
||||
# run the selected command
|
||||
case $choice in
|
||||
' Capture Region (without saving)')
|
||||
screenshot -crtc
|
||||
' Selected area screenshot')
|
||||
screenshot -sa
|
||||
;;
|
||||
' Capture Region')
|
||||
screenshot -crtf
|
||||
' Full screen screenshot')
|
||||
screenshot -sf
|
||||
;;
|
||||
' Capture Screen (without saving)')
|
||||
screenshot -cstc
|
||||
' Selected area video')
|
||||
screenshot -va
|
||||
;;
|
||||
' Capture Screen')
|
||||
screenshot -cstf
|
||||
' Full screen video')
|
||||
screenshot -vf
|
||||
;;
|
||||
' Record Region (GIF)')
|
||||
screenshot -rrg
|
||||
' Record audio (microphone)')
|
||||
screenshot -am
|
||||
;;
|
||||
' Record Screen (GIF)')
|
||||
screenshot -rsg
|
||||
' Record audio (desktop)')
|
||||
screenshot -ad
|
||||
;;
|
||||
' Record Region (MP4)')
|
||||
screenshot -rrv
|
||||
' Selected area video with audio (microphone)')
|
||||
screenshot -vaam
|
||||
;;
|
||||
' Record Screen (MP4)')
|
||||
screenshot -rsv
|
||||
' Full screen video with audio (microphone)')
|
||||
screenshot -vfam
|
||||
;;
|
||||
' Record Region (MP4+audio_virt)')
|
||||
screenshot -rrav
|
||||
;;
|
||||
' Record Region (MP4+audio_mic)')
|
||||
screenshot -rrmv
|
||||
;;
|
||||
' Record Audio virt')
|
||||
screenshot -rav
|
||||
;;
|
||||
' Record Audio mic')
|
||||
screenshot -ram
|
||||
;;
|
||||
' Stop Recording')
|
||||
' Stop Recording')
|
||||
screenshot -s
|
||||
;;
|
||||
esac
|
||||
@@ -78,4 +57,4 @@ main() {
|
||||
|
||||
main &
|
||||
|
||||
exit 0
|
||||
exit 0
|
||||
+128
-229
@@ -5,249 +5,148 @@ screenshot_directory="$HOME/Pictures/screenshots"
|
||||
videos_directory="$HOME/Videos"
|
||||
audio_directory="$HOME/Music"
|
||||
|
||||
# set ffmpeg defaults
|
||||
ffmpeg() {
|
||||
command ffmpeg -hide_banner -loglevel error -nostdin "$@"
|
||||
}
|
||||
mkdir -p "$screenshot_directory"
|
||||
mkdir -p "$videos_directory"
|
||||
mkdir -p "$audio_directory"
|
||||
|
||||
video_to_gif() {
|
||||
ffmpeg -i "$1" -vf palettegen -f image2 -c:v png - |
|
||||
ffmpeg -i "$1" -i - -filter_complex paletteuse "$2"
|
||||
}
|
||||
date=$(date '+%d-%m-%Y-%H-%M-%S')
|
||||
screen_resolution="$(xdpyinfo | grep dimensions | sed -r 's/^[^0-9]*([0-9]+x[0-9]+).*$/\1/')"
|
||||
microphone="$(pacmd list-sources | grep -E '^\s+name: .*alsa_input' | cut -c 8- | sed 's/[<,>]//g')"
|
||||
desktop="$(pacmd list-sources | grep -E '^\s+name: .*alsa_output' | cut -c 8- | sed 's/[<,>]//g')"
|
||||
|
||||
countdown() {
|
||||
notify-send "Screenshot" "Recording in 3 seconds" -t 1000 -i record
|
||||
sleep 1
|
||||
notify-send "Screenshot" "Recording in 2 seconds" -t 1000 -i record
|
||||
sleep 1
|
||||
notify-send "Screenshot" "Recording in 1 seconds" -t 1000 -i record
|
||||
sleep 1
|
||||
get_area(){
|
||||
slop="$(slop -n -f '%w,%h,%x,%y')"
|
||||
w=$(echo "$slop" | cut -d ',' -f1)
|
||||
h=$(echo "$slop" | cut -d ',' -f2)
|
||||
x=$(echo "$slop" | cut -d ',' -f3)
|
||||
y=$(echo "$slop" | cut -d ',' -f4)
|
||||
[ $((w%2)) -eq 1 ] && w=$(( w + 1 ))
|
||||
[ $((h%2)) -eq 1 ] && h=$(( h + 1 ))
|
||||
[ $((x%2)) -eq 1 ] && x=$(( x + 1 ))
|
||||
[ $((y%2)) -eq 1 ] && y=$(( y + 1 ))
|
||||
wh="${w}x${h}"
|
||||
}
|
||||
|
||||
# capture region to clipboard
|
||||
crtc() {
|
||||
notify-send "Screenshot" "Select a region to capture"
|
||||
ffcast -q "$(slop -n -f '-g %g ')" png /tmp/screenshot_clip.png
|
||||
xclip -selection clipboard -t image/png /tmp/screenshot_clip.png
|
||||
rm /tmp/screenshot_clip.png
|
||||
notify-send "Screenshot" "Region copied to Clipboard"
|
||||
screenshot_selected_area(){
|
||||
ffcast -q -g "$(slop)" png "$screenshot_directory/$date.png"
|
||||
xclip -selection clipboard -t image/png "$screenshot_directory/$date.png"
|
||||
notify-send -i "$screenshot_directory/$date.png" "Screenshot" "Area screenshot taken"
|
||||
}
|
||||
|
||||
# capture region to file and clipboard
|
||||
crtf() {
|
||||
notify-send "Screenshot" "Select a region to capture"
|
||||
dt=$(date '+%d-%m-%Y %H:%M:%S')
|
||||
ffcast -q "$(slop -n -f '-g %g ')" png "$screenshot_directory/$dt.png"
|
||||
xclip -selection clipboard -t image/png "$screenshot_directory/$dt.png"
|
||||
notify-send "Screenshot" "Region saved to $screenshot_directory"
|
||||
screenshot_full_screen(){
|
||||
ffcast -q png "$screenshot_directory/$date.png"
|
||||
xclip -selection clipboard -t image/png "$screenshot_directory/$date.png"
|
||||
notify-send -i "$screenshot_directory/$date.png" "Screenshot" "Full screen screenshot taken"
|
||||
}
|
||||
|
||||
# capture screenshot to clipboard
|
||||
cstc() {
|
||||
ffcast -q png /tmp/screenshot_clip.png
|
||||
xclip -selection clipboard -t image/png /tmp/screenshot_clip.png
|
||||
rm /tmp/screenshot_clip.png
|
||||
notify-send "Screenshot" "Screenshot copied to Clipboard"
|
||||
video_selected_area(){
|
||||
get_area
|
||||
ffmpeg -hide_banner -loglevel error -show_region 1 \
|
||||
-f x11grab -video_size "$wh" -framerate 30 -i :0.0+"$x","$y" -pix_fmt yuv420p "$videos_directory/$date.mp4"
|
||||
ffmpeg -i "$videos_directory/$date.mp4" -ss 00:00:01.000 -vframes 1 "/tmp/$date.png"
|
||||
notify-send -i "/tmp/$date.png" "Video" "Area video taken"
|
||||
}
|
||||
|
||||
# capture screenshot to file and clipboard
|
||||
cstf() {
|
||||
dt=$(date '+%d-%m-%Y %H:%M:%S')
|
||||
ffcast -q png "$screenshot_directory/$dt.png"
|
||||
xclip -selection clipboard -t image/png "$screenshot_directory/$dt.png"
|
||||
notify-send "Screenshot" "Screenshot saved to $screenshot_directory"
|
||||
video_full_screen(){
|
||||
ffmpeg -hide_banner -loglevel error -show_region 1 \
|
||||
-f x11grab -video_size "$screen_resolution" -framerate 30 -i :0.0 -pix_fmt yuv420p "$videos_directory/$date.mp4"
|
||||
ffmpeg -i "$videos_directory/$date.mp4" -ss 00:00:01.000 -vframes 1 "/tmp/$date.png"
|
||||
notify-send -i "/tmp/$date.png" "Video" "Full screen video taken"
|
||||
}
|
||||
|
||||
# record region (GIF)
|
||||
rrg() {
|
||||
notify-send "Screenshot" "Select a region to record"
|
||||
dt=$(date '+%d-%m-%Y %H:%M:%S')
|
||||
ffcast -q "$(slop -n -f '-g %g ' && countdown)" rec /tmp/screenshot_gif.mp4
|
||||
notify-send "Screenshot" "Converting to gif... (this can take a while)"
|
||||
video_to_gif /tmp/screenshot_gif.mp4 "$screenshot_directory/$dt.gif"
|
||||
rm /tmp/screenshot_gif.mp4
|
||||
notify-send "Screenshot" "Recording saved to $screenshot_directory"
|
||||
video_full_screen_rgba(){
|
||||
ffmpeg -hide_banner -loglevel error -show_region 1 \
|
||||
-f x11grab -video_size "$screen_resolution" -framerate 30 -i :0.0 -pix_fmt rgba "$videos_directory/$date.mp4"
|
||||
ffmpeg -i "$videos_directory/$date.mp4" -ss 00:00:01.000 -vframes 1 "/tmp/$date.png"
|
||||
notify-send -i "/tmp/$date.png" "Video" "Full screen video taken (rgba)"
|
||||
}
|
||||
|
||||
# record screen (GIF)
|
||||
rsg() {
|
||||
countdown
|
||||
dt=$(date '+%d-%m-%Y %H:%M:%S')
|
||||
ffcast -q rec /tmp/screenshot_gif.mp4
|
||||
notify-send "Screenshot" "Converting to gif... (this can take a while)"
|
||||
video_to_gif /tmp/screenshot_gif.mp4 "$screenshot_directory/$dt.gif"
|
||||
rm /tmp/screenshot_gif.mp4
|
||||
notify-send "Screenshot" "Recording saved to $screenshot_directory"
|
||||
audio_microphone(){
|
||||
ffmpeg -f pulse -i "$microphone" -metadata title="$date" "$audio_directory/$date.mp3"
|
||||
notify-send "Audio" "Microphone audio recorded"
|
||||
}
|
||||
|
||||
# record region (mp4)
|
||||
rrv() {
|
||||
notify-send "Screenshot" "Select a region to record"
|
||||
dt=$(date '+%d-%m-%Y %H:%M:%S')
|
||||
ffcast -q "$(slop -n -f '-g %g ' && countdown)" rec "$videos_directory/$dt.mp4"
|
||||
notify-send "Screenshot" "Recording saved to $videos_directory"
|
||||
audio_desktop(){
|
||||
ffmpeg -f pulse -i "$desktop" -metadata title="$date" "$audio_directory/$date.mp3"
|
||||
notify-send "Audio" "Desktop audio recorded"
|
||||
}
|
||||
|
||||
# record screen (mp4)
|
||||
rsv() {
|
||||
countdown
|
||||
dt=$(date '+%d-%m-%Y %H:%M:%S')
|
||||
ffcast -q rec "$videos_directory/$dt.mp4"
|
||||
notify-send "Screenshot" "Recording saved to $videos_directory"
|
||||
video_selected_area_audio_microphone(){
|
||||
get_area
|
||||
ffmpeg -hide_banner -loglevel error -show_region 1 \
|
||||
-f x11grab -video_size "$wh" -framerate 30 -i :0.0+"$x","$y" \
|
||||
-f alsa -i default -pix_fmt yuv420p "$videos_directory/$date.mp4"
|
||||
ffmpeg -i "$videos_directory/$date.mp4" -ss 00:00:01.000 -vframes 1 "/tmp/$date.png"
|
||||
notify-send -i "/tmp/$date.png" "Video" "Area video with audio taken"
|
||||
}
|
||||
|
||||
# record screen (mp4) with audio virt
|
||||
rrav() {
|
||||
notify-send "Screenshot" "Select a region to record"
|
||||
dt=$(date '+%d-%m-%Y %H:%M:%S')
|
||||
ffcast -q "$(slop -n -f '-g %g ' && countdown)" ffmpeg \
|
||||
-hide_banner \
|
||||
-loglevel error \
|
||||
-f x11grab -show_region 1 -framerate 30 -video_size %wx%h -i :0.0+%x,%y \
|
||||
-f pulse -i alsa_output.pci-0000_00_1f.3.analog-stereo.monitor -ac 1 "$videos_directory/$dt.mp4"
|
||||
notify-send "Screenshot" "Recording saved to $videos_directory"
|
||||
video_full_screen_audio_microphone(){
|
||||
ffmpeg -hide_banner -loglevel error -show_region 1 \
|
||||
-f x11grab -video_size "$screen_resolution" -framerate 30 -i :0.0 \
|
||||
-f alsa -i default -pix_fmt yuv420p "$videos_directory/$date.mp4"
|
||||
ffmpeg -i "$videos_directory/$date.mp4" -ss 00:00:01.000 -vframes 1 "/tmp/$date.png"
|
||||
notify-send -i "/tmp/$date.png" "Video" "Full screen video with audio taken"
|
||||
}
|
||||
|
||||
# record screen (mp4) with mic audio
|
||||
rrmv() {
|
||||
notify-send "Screenshot" "Select a region to record"
|
||||
dt=$(date '+%d-%m-%Y %H:%M:%S')
|
||||
ffcast -q "$(slop -n -f '-g %g ' && countdown)" ffmpeg \
|
||||
-hide_banner \
|
||||
-loglevel error \
|
||||
-f x11grab -show_region 1 -framerate 30 -video_size %wx%h -i :0.0+%x,%y \
|
||||
-f pulse -i alsa_input.pci-0000_00_1f.3.analog-stereo -ac 1 "$videos_directory/$dt.mp4"
|
||||
notify-send "Screenshot" "Recording saved to $videos_directory"
|
||||
}
|
||||
|
||||
# record audio virt
|
||||
rav() {
|
||||
notify-send "Screenshot" "Starting audio recording." -i sound-recorder
|
||||
dt=$(date '+%d-%m-%Y %H:%M:%S')
|
||||
'ffmpeg' \
|
||||
-loglevel error \
|
||||
-f pulse -i alsa_output.pci-0000_00_1f.3.analog-stereo.monitor -ac 1 "$audio_directory/$dt.mp3"
|
||||
notify-send "Screenshot" "Audio saved to $audio_directory" -i sound-recorder
|
||||
}
|
||||
|
||||
# record audio mic
|
||||
ram() {
|
||||
notify-send "Screenshot" "Starting audio recording." -i sound-recorder
|
||||
dt=$(date '+%d-%m-%Y %H:%M:%S')
|
||||
'ffmpeg' \
|
||||
-loglevel error \
|
||||
-f pulse -i alsa_input.pci-0000_00_1f.3.analog-stereo -ac 1 "$audio_directory/$dt.mp3"
|
||||
notify-send "Screenshot" "Audio saved to $audio_directory" -i sound-recorder
|
||||
}
|
||||
|
||||
check_deps() {
|
||||
if ! hash "$1" 2>/dev/null; then
|
||||
echo "Error: This script requires $1"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
usage() {
|
||||
echo USAGE: screenshot [OPTION]
|
||||
echo -s, --stop
|
||||
echo " stop recording"
|
||||
echo -h, --help
|
||||
echo " show help"
|
||||
echo -crtc
|
||||
echo " Capture region to clipboard."
|
||||
echo -crtf
|
||||
echo " Capture region to file and clipboard"
|
||||
echo -cstc
|
||||
echo " Capture screen to clipboard."
|
||||
echo -cstf
|
||||
echo " Capture screen to file and clipboard"
|
||||
echo -rrg
|
||||
echo " Record (GIF) region."
|
||||
echo -rsg
|
||||
echo " Record (GIF) screen."
|
||||
echo -rrv
|
||||
echo " Record (mp4/video) region."
|
||||
echo -rsv
|
||||
echo " Record (mp4/video) screen."
|
||||
echo -rrav
|
||||
echo " Record (mp4/video+audio(virt)) region."
|
||||
echo -rrmv
|
||||
echo " Record (mp4/video+audio(mic)) region."
|
||||
echo -rav
|
||||
echo " Record audio virt."
|
||||
echo -ram
|
||||
echo " Record audio mic."
|
||||
stop(){
|
||||
pkill -fxn '(/\S+)*ffmpeg\s.*\sx11grab\s.*'
|
||||
pkill -fxn '(/\S+)*ffmpeg\s.*\spulse\s.*'
|
||||
exit 1
|
||||
}
|
||||
|
||||
main() {
|
||||
# check dependencies
|
||||
check_deps slop
|
||||
check_deps ffcast
|
||||
check_deps ffmpeg
|
||||
check_deps xclip
|
||||
check_deps rofi
|
||||
|
||||
while [ "$1" != "" ]; do
|
||||
PARAM="$1"
|
||||
case $PARAM in
|
||||
-h | --help)
|
||||
usage
|
||||
exit
|
||||
;;
|
||||
-s | --stop)
|
||||
pkill -fxn '(/\S+)*ffmpeg\s.*\sx11grab\s.*'
|
||||
pkill -fxn '(/\S+)*ffmpeg\s.*\spulse\s.*'
|
||||
exit 1
|
||||
;;
|
||||
-crtc)
|
||||
crtc
|
||||
;;
|
||||
-crtf)
|
||||
crtf
|
||||
;;
|
||||
-cstc)
|
||||
cstc
|
||||
;;
|
||||
-cstf)
|
||||
cstf
|
||||
;;
|
||||
-rrg)
|
||||
rrg
|
||||
;;
|
||||
-rsg)
|
||||
rsg
|
||||
;;
|
||||
-rrv)
|
||||
rrv
|
||||
;;
|
||||
-rsv)
|
||||
rsv
|
||||
;;
|
||||
-rrav)
|
||||
rrav
|
||||
;;
|
||||
-rrmv)
|
||||
rrmv
|
||||
;;
|
||||
-rav)
|
||||
rav
|
||||
;;
|
||||
-ram)
|
||||
ram
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: unknown parameter \"$PARAM\""
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
# done
|
||||
set -e
|
||||
help(){
|
||||
cat << EOF
|
||||
-h | -help | --help
|
||||
-s | -stop
|
||||
-sa | -screenshot_selected_area
|
||||
-sf | -screenshot_full_screen
|
||||
-va | -video_selected_area
|
||||
-vf | -video_full_screen
|
||||
-am | -audio_microphone
|
||||
-ad | -audio_desktop
|
||||
-vaam | -video_selected_area_audio_microphone
|
||||
-vfam | -video_full_screen_audio_microphone
|
||||
EOF
|
||||
}
|
||||
main(){
|
||||
while [ "$1" != "" ]; do
|
||||
PARAM="$1"
|
||||
case $PARAM in
|
||||
-h | -help | --help)
|
||||
help
|
||||
exit 1
|
||||
;;
|
||||
-s | -stop)
|
||||
stop
|
||||
exit 1
|
||||
;;
|
||||
-sa | -screenshot_selected_area)
|
||||
screenshot_selected_area
|
||||
;;
|
||||
-sf | -screenshot_full_screen)
|
||||
screenshot_full_screen
|
||||
;;
|
||||
-va | -video_selected_area)
|
||||
video_selected_area
|
||||
;;
|
||||
-vf | -video_full_screen)
|
||||
video_full_screen
|
||||
;;
|
||||
-vf_rgba | -video_full_screen_rgba)
|
||||
video_full_screen_rgba
|
||||
;;
|
||||
-am | -audio_microphone)
|
||||
audio_microphone
|
||||
;;
|
||||
-ad | -audio_desktop)
|
||||
audio_desktop
|
||||
;;
|
||||
-vaam | -video_selected_area_audio_microphone)
|
||||
video_selected_area_audio_microphone
|
||||
;;
|
||||
-vfam | -video_full_screen_audio_microphone)
|
||||
video_full_screen_audio_microphone
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: unknown parameter \"$PARAM\""
|
||||
help
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
# done
|
||||
set -e
|
||||
}
|
||||
|
||||
# running the program
|
||||
main "$1" &
|
||||
exit 0
|
||||
exit 0
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# rofi theme
|
||||
dir_theme="$HOME/.config/rofi/compact_without_icons.rasi"
|
||||
|
||||
DIR="/usr/local/bin/themes"
|
||||
|
||||
get_options_theme_polybar() {
|
||||
echo "polybar-square"
|
||||
echo "polybar-rounded"
|
||||
}
|
||||
|
||||
main() {
|
||||
|
||||
# Get theme_polybar from rofi
|
||||
theme_polybar=$( (get_options_theme_polybar) | rofi -dmenu -i -fuzzy -p "" -theme "$dir_theme")
|
||||
|
||||
# If user has not picked anything, exit
|
||||
if [[ -z "${theme_polybar// /}" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
cp -f $DIR/$theme_polybar/launch.sh ~/.config/polybar
|
||||
|
||||
# done
|
||||
set -e
|
||||
|
||||
i3-msg restart
|
||||
}
|
||||
|
||||
main &
|
||||
|
||||
exit 0
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Terminate already running bar instances
|
||||
killall -q polybar
|
||||
|
||||
# Wait until the processes have been shut down
|
||||
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
|
||||
|
||||
# Launch Polybar, using default config location ~/.config/polybar/config
|
||||
polybar main --config=~/.config/polybar/polybar-rounded/config.ini &
|
||||
polybar second --config=~/.config/polybar/polybar-rounded/config.ini &
|
||||
|
||||
echo "Polybar launched..."
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Terminate already running bar instances
|
||||
killall -q polybar
|
||||
|
||||
# Wait until the processes have been shut down
|
||||
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
|
||||
|
||||
# Launch Polybar, using default config location ~/.config/polybar/config
|
||||
polybar main --config=~/.config/polybar/polybar-square/config.ini &
|
||||
polybar second --config=~/.config/polybar/polybar-square/config.ini &
|
||||
|
||||
echo "Polybar launched..."
|
||||
+9
-9
@@ -8,23 +8,23 @@ vol_quiet=33
|
||||
vol_loud=66
|
||||
|
||||
if [ "$cur_vol" -le "$vol_quiet" ]; then
|
||||
dunstify -a "Volume" \
|
||||
"Volume" \
|
||||
"Current volume is $cur_vol%" \
|
||||
dunstify -a "Speakers" \
|
||||
"Speakers" \
|
||||
"Volume: $cur_vol%" \
|
||||
-r 100 \
|
||||
-i $dir_icons/volume.svg
|
||||
fi
|
||||
if [ "$cur_vol" -gt "$vol_quiet" ] && [ "$cur_vol" -le "$vol_loud" ]; then
|
||||
dunstify -a "Volume" \
|
||||
"Volume" \
|
||||
"Current volume is $cur_vol%" \
|
||||
dunstify -a "Speakers" \
|
||||
"Speakers" \
|
||||
"Volume: $cur_vol%" \
|
||||
-r 100 \
|
||||
-i $dir_icons/volume-1.svg
|
||||
fi
|
||||
if [ "$cur_vol" -gt "$vol_loud" ]; then
|
||||
dunstify -a "Volume" \
|
||||
"Volume" \
|
||||
"Current volume is $cur_vol%" \
|
||||
dunstify -a "Speakers" \
|
||||
"Speakers" \
|
||||
"Volume: $cur_vol%" \
|
||||
-r 100 \
|
||||
-i $dir_icons/volume-2.svg
|
||||
fi
|
||||
Reference in New Issue
Block a user