Rebase: Created version v2, removed useless commits.
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
for pid in $(pidof -x battery); do
|
||||
if [ $pid != $$ ]; then
|
||||
kill -9 $pid
|
||||
fi
|
||||
done
|
||||
|
||||
DIR="/usr/local/bin/icons"
|
||||
|
||||
# Notify when below this percentage
|
||||
warning_level=15
|
||||
|
||||
# How often to check battery status, in minutes
|
||||
check_interval=1
|
||||
|
||||
while true; do
|
||||
battery_level=$(acpi -b \
|
||||
| cut -d, -f2 | cut --characters=2,3,4 \
|
||||
| sed 's/%//g')
|
||||
charging=$(acpi -b | grep -c "Charging")
|
||||
|
||||
# When battery is low, and not already charging
|
||||
if [ $battery_level -lt $warning_level ] &&
|
||||
[ $charging -eq 0 ]
|
||||
then
|
||||
dunstify -a "Battery" \
|
||||
"Low battery: ${battery_level}%" \
|
||||
"Battery is running low" \
|
||||
-r 100 \
|
||||
-i $DIR/battery.svg
|
||||
fi
|
||||
|
||||
sleep ${check_interval}m
|
||||
done
|
||||
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
DIR_ICONS="/usr/local/bin/icons"
|
||||
|
||||
MAX_BRI=$(cat /sys/class/backlight/*/max_brightness)
|
||||
CUR_BRI=$(cat /sys/class/backlight/*/brightness)
|
||||
|
||||
# calculating current percentage
|
||||
((CUR_PER = CUR_BRI * 100 / MAX_BRI))
|
||||
|
||||
if [ $CUR_PER -ge 50 ]; then
|
||||
dunstify -a "Brightness" \
|
||||
"Brightness" \
|
||||
"Current brightness is $CUR_PER%" \
|
||||
-r 100 \
|
||||
-i $DIR_ICONS/sun.svg
|
||||
else
|
||||
dunstify -a "Brightness" \
|
||||
"Brightness" \
|
||||
"Current brightness is $CUR_PER%" \
|
||||
-r 100 \
|
||||
-i $DIR_ICONS/moon.svg
|
||||
fi
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" viewBox="0 0 24 24" fill="none" stroke="#f07178" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="feather feather-battery"><rect x="1" y="6" width="18" height="12" rx="2" ry="2"></rect><line x1="23" y1="13" x2="23" y2="11"></line></svg>
|
||||
|
After Width: | Height: | Size: 321 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" viewBox="0 0 24 24" fill="none" stroke="#f07178" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="feather feather-mic-off"><line x1="1" y1="1" x2="23" y2="23"></line><path d="M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V4a3 3 0 0 0-5.94-.6"></path><path d="M17 16.95A7 7 0 0 1 5 12v-2m14 0v2a7 7 0 0 1-.11 1.23"></path><line x1="12" y1="19" x2="12" y2="23"></line><line x1="8" y1="23" x2="16" y2="23"></line></svg>
|
||||
|
After Width: | Height: | Size: 489 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" viewBox="0 0 24 24" fill="none" stroke="#c3e88d" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="feather feather-mic"><path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"></path><path d="M19 10v2a7 7 0 0 1-14 0v-2"></path><line x1="12" y1="19" x2="12" y2="23"></line><line x1="8" y1="23" x2="16" y2="23"></line></svg>
|
||||
|
After Width: | Height: | Size: 413 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" viewBox="0 0 24 24" fill="none" stroke="#ffcb6b" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="feather feather-moon"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path></svg>
|
||||
|
After Width: | Height: | Size: 276 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" viewBox="0 0 24 24" fill="none" stroke="#ffcb6b" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="feather feather-sun"><circle cx="12" cy="12" r="5"></circle><line x1="12" y1="1" x2="12" y2="3"></line><line x1="12" y1="21" x2="12" y2="23"></line><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line><line x1="1" y1="12" x2="3" y2="12"></line><line x1="21" y1="12" x2="23" y2="12"></line><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line></svg>
|
||||
|
After Width: | Height: | Size: 645 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" viewBox="0 0 24 24" fill="none" stroke="#82aaff" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="feather feather-volume-1"><polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"></polygon><path d="M15.54 8.46a5 5 0 0 1 0 7.07"></path></svg>
|
||||
|
After Width: | Height: | Size: 323 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" viewBox="0 0 24 24" fill="none" stroke="#82aaff" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="feather feather-volume-2"><polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"></polygon><path d="M19.07 4.93a10 10 0 0 1 0 14.14M15.54 8.46a5 5 0 0 1 0 7.07"></path></svg>
|
||||
|
After Width: | Height: | Size: 354 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" viewBox="0 0 24 24" fill="none" stroke="#f07178" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="feather feather-volume-x"><polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"></polygon><line x1="23" y1="9" x2="17" y2="15"></line><line x1="17" y1="9" x2="23" y2="15"></line></svg>
|
||||
|
After Width: | Height: | Size: 365 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" viewBox="0 0 24 24" fill="none" stroke="#82aaff" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="feather feather-volume"><polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"></polygon></svg>
|
||||
|
After Width: | Height: | Size: 275 B |
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
|
||||
DIR="/usr/local/bin/icons"
|
||||
|
||||
CUR_VOL=$(pactl list sinks | grep '^[[:space:]]Volume:' | \
|
||||
head -n $(( $SINK + 1 )) | tail -n 1 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,')
|
||||
MUTE=$(pactl list sinks | grep Mute | sed 's/.*Mute: //g')
|
||||
affirmative="yes"
|
||||
negative="no"
|
||||
|
||||
VOL_QUIET=33
|
||||
VOL_LOUD=66
|
||||
|
||||
if [[ $MUTE = $affirmative ]]; then
|
||||
dunstify -a "Mute" \
|
||||
"Mute" \
|
||||
"Muted" \
|
||||
-r 100 \
|
||||
-i $DIR/volume-x.svg
|
||||
elif [[ $MUTE = $negative ]]; then
|
||||
if [ $CUR_VOL -le $VOL_QUIET ]; then
|
||||
dunstify -a "Mute" \
|
||||
"Mute" \
|
||||
"Unmuted" \
|
||||
-r 100 \
|
||||
-i $DIR/volume.svg
|
||||
fi
|
||||
if [ $CUR_VOL -gt $VOL_QUIET ] && [ $CUR_VOL -le $VOL_LOUD ]; then
|
||||
dunstify -a "Mute" \
|
||||
"Mute" \
|
||||
"Unmuted" \
|
||||
-r 100 \
|
||||
-i $DIR/volume-1.svg
|
||||
fi
|
||||
if [ $CUR_VOL -gt $VOL_LOUD ]; then
|
||||
dunstify -a "Mute" \
|
||||
"Mute" \
|
||||
"Unmuted" \
|
||||
-r 100 \
|
||||
-i $DIR/volume-2.svg
|
||||
fi
|
||||
|
||||
fi
|
||||
echo $MUTE
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# take all the cache and remove useless packages
|
||||
sudo pacman -Sc
|
||||
sudo pacman -Scc
|
||||
paccache -r
|
||||
sudo pacman -Rns $(pacman -Qtdq)
|
||||
|
||||
# list cache
|
||||
sudo du -sh ~/.cache/
|
||||
rm -rf ~/.cache/*
|
||||
@@ -0,0 +1,75 @@
|
||||
#!/bin/bash
|
||||
mkdir -p ~/.cache/rofi-bookmarks
|
||||
CACHEDIR="~/.cache/rofi-bookmarks"
|
||||
|
||||
places_sqlite="$(find ~/.mozilla/firefox/*.default*/ -name "places.sqlite" -print -quit)"
|
||||
|
||||
places_rofi_sqlite="$(dirname "${places_sqlite}")/places.rofi.sqlite"
|
||||
|
||||
favicons_sqlite="$(find ~/.mozilla/firefox/*.default*/ -name "favicons.sqlite" -print -quit)"
|
||||
|
||||
favicons_rofi_sqlite="$(dirname "${favicons_sqlite}")/favicons.rofi.sqlite"
|
||||
|
||||
# path to the sqlite3 binary
|
||||
sqlite_path="$(which sqlite3)"
|
||||
|
||||
# sqlite3 parameters (define separator character)
|
||||
sqlite_params="-separator ^"
|
||||
|
||||
# browser path
|
||||
browser_path="$(which firefox)"
|
||||
|
||||
# functions
|
||||
|
||||
# create a backup file
|
||||
create_backup() {
|
||||
if [ "$#" -eq 2 ] && [ -n "$1" ] && [ -n "$2" ]; then
|
||||
if [ ! -f "$2" ] || [ "$1" -nt "$2" ]; then
|
||||
cp "$1" "$2"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# process bookmarks
|
||||
process_bookmarks() {
|
||||
query="select b.title, p.url, b.id, SUBSTR(SUBSTR(p.url, INSTR(url, '//') + 2), 0, INSTR(SUBSTR(p.url, INSTR(p.url, '//') + 2), '/')) as domain from moz_bookmarks as b left outer join moz_places as p on b.fk=p.id where b.type = 1 and p.hidden=0 and b.title not null" # and parent=$1
|
||||
$sqlite_path $sqlite_params "$places_rofi_sqlite" "$query" | while IFS=^ read title url id domain; do
|
||||
if [ -z "$title" ]; then
|
||||
title="$url"
|
||||
fi
|
||||
page_id=$($sqlite_path $favicons_rofi_sqlite 'SELECT Id FROM 'moz_pages_w_icons' WHERE page_url="'$url'"')
|
||||
icon_id=$($sqlite_path $favicons_rofi_sqlite 'SELECT max(icon_id) FROM 'moz_icons_to_pages' WHERE page_id='$page_id'')
|
||||
icon_link=$($sqlite_path $favicons_rofi_sqlite 'SELECT icon_url FROM 'moz_icons' WHERE id='$icon_id'')
|
||||
wget -nc -O ~/.cache/rofi-bookmarks/$icon_id.png $icon_link &
|
||||
if [ $icon_id -eq $icon_id ]; then
|
||||
echo -en " $title \0icon\x1f$CACHEDIR/$icon_id.png\n"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# process bookmark
|
||||
process_bookmark() {
|
||||
if [ "$#" = 1 ] && [ -n "$1" ]; then
|
||||
title="$(echo $1 | sed "s|.*{id:\(.*\)}$|\1|")"
|
||||
id=$($sqlite_path $places_rofi_sqlite 'SELECT id FROM 'moz_bookmarks' WHERE title="'"$title"'"')
|
||||
query="select p.url from moz_bookmarks as b left outer join moz_places as p on b.fk=p.id where b.type = 1 and p.hidden=0 and b.title not null and b.id=$id"
|
||||
url="$($sqlite_path $sqlite_params "$places_rofi_sqlite" "$query")"
|
||||
nohup $browser_path "$url" >/dev/null 2>&1 &
|
||||
fi
|
||||
}
|
||||
|
||||
# application
|
||||
|
||||
parameter="$1"
|
||||
|
||||
# create a backup, as we cannot operate on a places.sqlite file directly due to exclusive lock
|
||||
create_backup "$places_sqlite" "$places_rofi_sqlite"
|
||||
create_backup "$favicons_sqlite" "$favicons_rofi_sqlite"
|
||||
# open a bookmark when there is a param sety
|
||||
if [ -n "$parameter" ]; then
|
||||
process_bookmark "$parameter"
|
||||
exit
|
||||
fi
|
||||
|
||||
# process bookmarks
|
||||
process_bookmarks
|
||||
@@ -0,0 +1,81 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# rofi theme
|
||||
THEME="$HOME/.config/rofi/compact_without_icons.rasi"
|
||||
|
||||
get_options() {
|
||||
# echo " Capture Region Clip"
|
||||
# echo " Capture Region File"
|
||||
# echo " Capture Screen Clip"
|
||||
# echo " Capture Screen File"
|
||||
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"
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
# run the selected command
|
||||
case $choice in
|
||||
' Capture Region Clip')
|
||||
screenshot -crtc
|
||||
;;
|
||||
' Capture Region File')
|
||||
screenshot -crtf
|
||||
;;
|
||||
' Capture Screen Clip')
|
||||
screenshot -cstc
|
||||
;;
|
||||
' Capture Screen File')
|
||||
screenshot -cstf
|
||||
;;
|
||||
' Record Region (GIF)')
|
||||
screenshot -rrg
|
||||
;;
|
||||
' Record Screen (GIF)')
|
||||
screenshot -rsg
|
||||
;;
|
||||
' Record Region (MP4)')
|
||||
screenshot -rrv
|
||||
;;
|
||||
' Record Screen (MP4)')
|
||||
screenshot -rsv
|
||||
;;
|
||||
' 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')
|
||||
screenshot -s
|
||||
;;
|
||||
esac
|
||||
|
||||
# done
|
||||
set -e
|
||||
}
|
||||
|
||||
main &
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,251 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Screenshot directory
|
||||
screenshot_directory="$HOME/Pictures/screenshots/rofi"
|
||||
videos_directory="$HOME/Videos/rofi"
|
||||
audio_directory="$HOME/Music/rofi"
|
||||
|
||||
# set ffmpeg defaults
|
||||
ffmpeg() {
|
||||
command ffmpeg -hide_banner -loglevel error -nostdin "$@"
|
||||
}
|
||||
|
||||
video_to_gif() {
|
||||
ffmpeg -i "$1" -vf palettegen -f image2 -c:v png - |
|
||||
ffmpeg -i "$1" -i - -filter_complex paletteuse "$2"
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
# 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"
|
||||
}
|
||||
|
||||
# capture region to file
|
||||
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"
|
||||
notify-send "Screenshot" "Region saved to $screenshot_directory"
|
||||
}
|
||||
|
||||
# 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"
|
||||
}
|
||||
|
||||
# capture screenshot to file
|
||||
cstf() {
|
||||
dt=$(date '+%d-%m-%Y %H:%M:%S')
|
||||
ffcast -q png "$screenshot_directory/$dt.png"
|
||||
notify-send "Screenshot" "Screenshot saved to $screenshot_directory"
|
||||
}
|
||||
|
||||
# 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"
|
||||
}
|
||||
|
||||
# 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"
|
||||
}
|
||||
|
||||
# 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"
|
||||
}
|
||||
|
||||
# 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"
|
||||
}
|
||||
|
||||
# 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"
|
||||
}
|
||||
|
||||
# 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 screen to file"
|
||||
echo -cstc
|
||||
echo " Capture screen to clipboard."
|
||||
echo -cstf
|
||||
echo " Capture screen to file"
|
||||
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."
|
||||
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
|
||||
}
|
||||
|
||||
# running the program
|
||||
main $1 &
|
||||
exit 0
|
||||
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# rofi theme
|
||||
DIR_THEME="$HOME/.config/rofi/compact_without_icons.rasi"
|
||||
|
||||
DIR="/usr/local/bin/themes"
|
||||
|
||||
get_options_theme() {
|
||||
echo "blue"
|
||||
echo "dark"
|
||||
}
|
||||
|
||||
get_options_theme_polybar() {
|
||||
echo "polybar-square"
|
||||
echo "polybar-rounded"
|
||||
}
|
||||
|
||||
main() {
|
||||
|
||||
# Get THEME from rofi
|
||||
THEME=$( (get_options_theme) | rofi -dmenu -i -fuzzy -p "" -theme "$DIR_THEME")
|
||||
|
||||
# If user has not picked anything, exit
|
||||
if [[ -z "${THEME// /}" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cp -f $DIR/$THEME/kitty/kitty.conf ~/.config/kitty/
|
||||
cp -f $DIR/$THEME/rofi/* ~/.config/rofi/
|
||||
cp -f $DIR/$THEME/vsc/* ~/.config/Code\ -\ OSS/User
|
||||
cp -f $DIR/$THEME/vsc/* ~/.config/Code/User
|
||||
cp -f $DIR/$THEME/polybar/* ~/.config/polybar
|
||||
cp -f $DIR/$THEME/i3/* ~/.config/i3
|
||||
cp -f $DIR/$THEME/dunst/* ~/.config/dunst
|
||||
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
|
||||
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
DIR="/usr/local/bin/icons"
|
||||
|
||||
CUR_VOL=$(pactl list sinks | grep '^[[:space:]]Volume:' | \
|
||||
head -n $(( $SINK + 1 )) | tail -n 1 | sed -e 's,.* \([0-9][0-9]*\)%.*,\1,')
|
||||
|
||||
VOL_QUIET=33
|
||||
VOL_LOUD=66
|
||||
|
||||
if [ $CUR_VOL -le $VOL_QUIET ]; then
|
||||
dunstify -a "Volume" \
|
||||
"Volume" \
|
||||
"Current volume is $CUR_VOL%" \
|
||||
-r 100 \
|
||||
-i $DIR/volume.svg
|
||||
fi
|
||||
if [ $CUR_VOL -gt $VOL_QUIET ] && [ $CUR_VOL -le $VOL_LOUD ]; then
|
||||
dunstify -a "Volume" \
|
||||
"Volume" \
|
||||
"Current volume is $CUR_VOL%" \
|
||||
-r 100 \
|
||||
-i $DIR/volume-1.svg
|
||||
fi
|
||||
if [ $CUR_VOL -gt $VOL_LOUD ]; then
|
||||
dunstify -a "Volume" \
|
||||
"Volume" \
|
||||
"Current volume is $CUR_VOL%" \
|
||||
-r 100 \
|
||||
-i $DIR/volume-2.svg
|
||||
fi
|
||||