Moved all GUI related scripts to wm_scripts.

This commit is contained in:
sheldonmlee 2021-05-23 14:30:50 +08:00
parent 287232d736
commit 2ee44a5f15
3 changed files with 91 additions and 52 deletions

8
.config/wm_scripts/manpages.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
#
# Views manpages as pdf.
#
name=$(man -k . | rofi -dmenu | awk '{print($1)}')
[[ ! -z $name ]] && man -Tpdf $name | zathura -

View File

@ -1,34 +1,89 @@
#!/bin/bash
#dmenu script for screenshots
CUSTOM_SCRIPTS_FILE=~/.custom_bash_scripts
if test -f $CUSTOM_SCRIPTS_FILE; then
source $CUSTOM_SCRIPTS_FILE
else
echo ".custom_bash_scripts.sh does not exist."
fi
options="
#
# Script to take screenshots or gifs
#
scrot_dir=$HOME/screenshots
gif_dir=$scrot_dir/gifs
date_format='%Y-%m-%d_%H-%M-%S'
[ -d $scrot_dir ] || mkdir $scrot_dir
[ -d $gif_dir ] || mkdir $gif_dir
main() {
prompt_main
}
# prompt with rofi
prompt_main() {
options="
1) Fullscreen\n\
2) Selection\n\
3) Record screen\n\
"
#echo -e $options
3) Record screen
"
#echo -e $options
# -i case insensitive
# -l vertical lines
option=$(echo -e $options | dmenu -i)
# -i case insensitive
# -l vertical lines
option=$(echo -e $options | rofi -dmenu)
#echo "\"$option\""
case $option in
1*)
sleep 0.5
f_scrot
;;
2*)
s_scrot
;;
2*)
ffmpeg_record
;;
esac
#echo "\"$option\""
case $option in
1*)
sleep 0.5
f_scrot
;;
2*)
s_scrot
;;
3*)
prompt_gif
;;
esac
}
prompt_gif() {
options="
10s\n\
30s\n\
60s
"
option=$(echo -e $options | rofi -dmenu)
case $option in
10s)
byzanz_gif 10
;;
30s)
byzanz_gif 30
;;
60s)
byzanz_gif 60
;;
esac
}
# screenshots using scrot
s_scrot() {
name=$(date +${date_format}_sel.png)
path="${scrot_dir}/${name}"
scrot -s $path &
xclip -sel clip $path -t image/png
}
f_scrot() {
name=$(date +${date_format}_full.png)
path="${scrot_dir}/${name}"
scrot $path &&
xclip -sel clip $path -t image/png
}
# screen recorder
byzanz_gif() {
name=$(date +${date_format}.gif)
path="${gif_dir}/${name}"
byzanz-record -c -d $1 --delay=0 $path
}
main "$@"

View File

@ -1,30 +1,5 @@
#!/bin/bash
# screenshots using scrot
scrot_dir=$HOME/screenshots/
date_format='%Y-%m-%d_%H-%M-%S'
s_scrot() {
name=$(date +${date_format}_sel.png)
path="${scrot_dir}${name}"
scrot -s $path
xclip -sel clip $path -t image/png
}
f_scrot() {
name=$(date +${date_format}_full.png)
path="${scrot_dir}${name}"
scrot $path
xclip -sel clip $path -t image/png
}
# screen recorder
byzanz_10() {
name=$(date +${date_format}.gif)
byzanz-record -c -d 10 --delay=0 "${scrot_dir}${name}"
}
# cd into config dir
cfdir()
{
@ -67,3 +42,4 @@ function unrealbuild {
${UNR_PATH}/Engine/Build/BatchFiles/Linux/RunMono.sh ${UNR_PATH}/Engine/Binaries/DotNET/UnrealBuildTool.exe $PROJ_NAME -ModuleWithSuffix $PROJ_NAME Linux Development -editorrecompile -canskiplink "${CURR_DIR}/${PROJ_NAME}.uproject" -progress
}