webp,jpg,png for screenshot tool

master
Daniel Napora 2022-12-12 01:02:50 +01:00
parent 89796239cf
commit 510e36fe0f
2 changed files with 42 additions and 9 deletions

View File

@ -849,7 +849,10 @@ case $LANG in
SCRNREC="Nagrywanie pulpitu"
FULLREC="Pełny ekran"
AREA="Obszar lub okno"
VIDEOSETTINGS="Ust. nagrywania"
SETTINGS="Ustawienia"
SCROTSETTINGS="Zrzuty ekranu"
EXTENSION="Typ obrazka (rozszerzenie)"
VIDEOSETTINGS="Ustawienia nagrywania"
AUDIO="Dźwięk"
FORMAT="Kontener (rozszerzenie)"
FRAMERATE="Klatki na sekundę (fps)"
@ -873,6 +876,9 @@ case $LANG in
SCRNREC="Grabador Captura Pantalla"
FULLREC="Pantalla Completa "
AREA="Área seleccionada o Ventana"
SETTINGS="Ajustes"
SCROTSETTINGS="Screenshot settings"
EXTENSION="File type (extension)"
VIDEOSETTINGS="Ajustes de Grabación"
AUDIO="Audio"
FORMAT="Formato de archivo (extension)"
@ -897,6 +903,9 @@ case $LANG in
SCRNREC="Screen recording"
FULLREC="Full screen "
AREA="Selected Area or Window"
SETTINGS="Settings"
SCROTSETTINGS="Screenshot settings"
EXTENSION="File type (extension)"
VIDEOSETTINGS="Recording settings"
AUDIO="Audio"
FORMAT="Container (file extension)"
@ -922,10 +931,7 @@ item_height_factor=300
[ -d $(xdg-user-dir PICTURES)/screenshots ] || mkdir -p $(xdg-user-dir PICTURES)/screenshots
IMG="$(xdg-user-dir PICTURES)/screenshots/Mabox_$(date +'%Y%m%d-%H-%M-%S').png"
VIEW="'viewnior $IMG'"
THUMB="$(DISPLAY=:0 scrot -t 340x213 -o $HOME/.config/mabox/jgscrot.png -e 'echo $m')"
# Video recordings
CNF_FILE="$HOME"/.config/mabox/mb-screenrec.conf
@ -938,10 +944,20 @@ container=webm
record_audio=no
#Framerate (frames per second)
framerate=30
# Screenshot file type/extension
image_extension=webp
EOF
fi
. "$CNF_FILE"
EXT=${image_extension:-png}
IMG="$(xdg-user-dir PICTURES)/screenshots/Mabox_$(date +'%Y%m%d-%H-%M-%S').${EXT}"
VIEW="'viewnior $IMG'"
THUMB="$(DISPLAY=:0 scrot -t 340x213 -o $HOME/.config/mabox/jgscrot.png -e 'echo $m')"
if [ "$record_audio" == "yes" ];then
case "$LANG" in
pl*) AUD="dźwięk";;
@ -957,7 +973,7 @@ mkconfigfile
cat <<EOF > ${MENU_ITEMS}
@icon,,$((jgtools_padding + 4)),$((jgtools_padding + 4)),340,100,4,left,top,,,$THUMB
^sep($SCRNSHOTS)
^sep($SCRNSHOTS <small>($EXT)</small>)
 $FULLSCR,^root(full)
 $ACTIVE_WIN,^root(window)
 $ACTIVE_WIN_NO_DECOR,^root(borderless)
@ -966,13 +982,14 @@ cat <<EOF > ${MENU_ITEMS}
#  Multimonitor, scrot -m $IMG -e $VIEW
^sep()
 $OPEN_SCR_DIR,xdg-open $(xdg-user-dir PICTURES)/screenshots
^sep($SCRNREC)
^sep($SCRNREC <small>($container ${AUD} $framerate fps)</small>)
 $FULLREC,mb-screenrec -f
 $AREA,mb-screenrec -a
^sep()
 $VIDEOSETTINGS [ <small><b>$container</b> / <b>${AUD}</b> / <b>$framerate fps</b></small> ],^checkout(videosettings)
 $OPEN_REC_DIR,xdg-open $(xdg-user-dir VIDEOS)/Recordings
^sep()
 $SETTINGS,^checkout(settings)
^sep()
 $CANCEL <small>esc</small>,exit 1
^tag(full)
@ -996,13 +1013,20 @@ cat <<EOF > ${MENU_ITEMS}
 $SEC10,scrot -d 10 -u $IMG -e $VIEW
^sep()
⮜ $BACK,^back()
^tag(videosettings)
^tag(settings)
^sep($SCROTSETTINGS)
$EXTENSION [ <b>${EXT}</b> ],^checkout(imgext)
^sep($VIDEOSETTINGS)
$AUDIO [ <b>${AUD}</b> ],^checkout(audio)
$FORMAT [ <b>${container}</b> ],^checkout(format)
$FRAMERATE [ <b>${framerate}</b> ],^checkout(framerate)
^sep()
 $EDIT_CONF_FILE,xdg-open $CNF_FILE
^tag(imgext)
^sep($EXTENSION)
WebP (.webp),mb-setvar image_extension=webp ${CNF_FILE};mb-jgtools screenshot ipc
PNG (.png),mb-setvar image_extension=png ${CNF_FILE};mb-jgtools screenshot ipc
JPG (.jpg),mb-setvar image_extension=jpg ${CNF_FILE};mb-jgtools screenshot ipc
^tag(audio)
^sep($AUDIO)
$REC_AUDIO,mb-setvar record_audio=yes ${CNF_FILE};mb-jgtools screenshot ipc
@ -1020,6 +1044,7 @@ mp4,mb-setvar container=mp4 ${CNF_FILE};mb-jgtools screenshot ipc
15,mb-setvar framerate=15 ${CNF_FILE};mb-jgtools screenshot ipc
10,mb-setvar framerate=10 ${CNF_FILE};mb-jgtools screenshot ipc
EOF
cat "${MENU_ITEMS}"
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
}

View File

@ -1,5 +1,5 @@
#!/bin/bash
# Daniel Napora 2021 <napcok@gmail.com>
# Daniel Napora 2021-22 <napcok@gmail.com>
#: mb-reset - reset/update user config files to current defaults.
#: It only affects files shipped with Mabox.
#: Be aware that you may loose your own customizations (if any).
@ -118,6 +118,14 @@ rsync -a /usr/share/mabox/common/66-symbols.conf $HOME/.config/fontconfig/conf.d
fc-cache
rsync -a /usr/share/mabox/common/volumettf $HOME/.config/tint2/scripts/
rsync -a /usr/share/mabox/lang/$LNGDIR/.config/tint2/*.tint2rc $HOME/.config/tint2/
TYPE=$(cat /sys/class/dmi/id/chassis_type)
case "$TYPE" in
8|9|10|14):;;
*)
# fix tint2 battery indicator bug spawning notifications even if there is no battery
sd "battery_low_cmd =.*$" "battery_low_cmd =" "$HOME"/.config/tint2/*.tint2rc
;;
esac
killall -SIGUSR1 tint2
}