Compare commits
4 commits
253599cfcb
...
54e7c05282
Author | SHA1 | Date | |
---|---|---|---|
|
54e7c05282 | ||
|
2134c34480 | ||
|
69d52c7ffc | ||
|
9d3897b579 |
6 changed files with 71 additions and 37 deletions
74
bin/glurp
74
bin/glurp
|
@ -1,52 +1,84 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
error_usage() {
|
||||
>&2 cat << EOF
|
||||
Usage :
|
||||
declare -A temp_files
|
||||
temp_files[command_to_source]=$(mktemp)
|
||||
|
||||
clean() {
|
||||
rm -- "${temp_files[@]}"
|
||||
}
|
||||
|
||||
usage() {
|
||||
cat << EOF
|
||||
Usage:
|
||||
glurp full|area clip|file
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
|
||||
error() {
|
||||
>&2 printf '\033[0m\033[1;31mERROR:\033[0m \033[1m%s\033[0m\n' "$*"
|
||||
}
|
||||
|
||||
error_usage() {
|
||||
error "Invalid usage"
|
||||
>&2 usage
|
||||
}
|
||||
|
||||
error_usage_clean() {
|
||||
error_usage
|
||||
clean
|
||||
}
|
||||
|
||||
screenshot_path() {
|
||||
printf %s "/tmp/screenshot-${USER}-$(date +%N).png"
|
||||
local path
|
||||
if [ -n "$1" ]; then
|
||||
path="$1"
|
||||
else
|
||||
path=.
|
||||
fi
|
||||
mkdir -p "$path"
|
||||
printf '%sscreenshot-%s.png' "${path}/" "$(date +%Y_%m_%d_%H_%M_%S_%N)"
|
||||
}
|
||||
|
||||
grim=grim
|
||||
wl_copy_args="-t image/png"
|
||||
trap error_usage_clean EXIT
|
||||
set -e
|
||||
|
||||
slurp=()
|
||||
grim_args=()
|
||||
wl_copy=()
|
||||
|
||||
# Arguments
|
||||
case "$1" in
|
||||
full)
|
||||
:
|
||||
;;
|
||||
area)
|
||||
slurp=slurp
|
||||
pipe1='|'
|
||||
grim_args="-g -"
|
||||
slurp+=(slurp \|)
|
||||
grim_args+=(-g -)
|
||||
;;
|
||||
*)
|
||||
error_usage
|
||||
false
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
|
||||
case "$1" in
|
||||
clip)
|
||||
pipe2='|'
|
||||
wl_copy=wl-copy
|
||||
wl_copy+=(\| wl-copy -t image/png)
|
||||
grim_args+=(-)
|
||||
;;
|
||||
file)
|
||||
grim_args="${grim_args} $(screenshot_path)"
|
||||
grim_args+=("$(screenshot_path "/tmp/${USER}")")
|
||||
;;
|
||||
*)
|
||||
error_usage
|
||||
false
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
|
||||
[ -n "$wl_copy" ] && wl_copy="${wl_copy} ${wl_copy_args}"
|
||||
cat > "${temp_files[command_to_source]}" << EOF
|
||||
${slurp[@]} grim ${grim_args[@]} ${@} ${wl_copy[@]}
|
||||
EOF
|
||||
|
||||
# Execution
|
||||
set -xe
|
||||
"$slurp" "$pipe1" "$grim" "$grim_args" "$pipe2" "$wl_copy"
|
||||
trap clean EXIT
|
||||
|
||||
sh -s < "${temp_files[command_to_source]}"
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/sh
|
||||
exec printf "$@" "screenshot-%s.${1:-png}" "$(date +"%Y_%m_%d-%N")"
|
||||
|
|
@ -55,7 +55,7 @@ decoration {
|
|||
}
|
||||
|
||||
# Animations
|
||||
$animSpeed = 4
|
||||
$animSpeed = 3
|
||||
animations {
|
||||
enabled = yes
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ DLAGENTS=('file::/usr/bin/curl -qgC - -o %o %u'
|
|||
|
||||
#-- The package required by makepkg to download VCS sources
|
||||
# Format: 'protocol::package'
|
||||
VCSCLIENTS=('bzr::bzr'
|
||||
VCSCLIENTS=('bzr::breezy'
|
||||
'fossil::fossil'
|
||||
'git::git'
|
||||
'hg::mercurial'
|
||||
|
@ -38,7 +38,7 @@ CHOST="x86_64-pc-linux-gnu"
|
|||
|
||||
#-- Compiler and Linker Flags
|
||||
#CPPFLAGS=""
|
||||
CFLAGS="-march=native -mtune=generic -O2 -pipe -fno-plt -fexceptions \
|
||||
CFLAGS="-march=native -O2 -pipe -fno-plt -fexceptions \
|
||||
-Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \
|
||||
-fstack-clash-protection -fcf-protection"
|
||||
CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"
|
||||
|
@ -134,15 +134,15 @@ DBGSRCDIR="/usr/src/debug"
|
|||
# COMPRESSION DEFAULTS
|
||||
#########################################################################
|
||||
#
|
||||
COMPRESSGZ=(pigz -c -f -n)
|
||||
COMPRESSBZ2=(pbzip2 -c -f)
|
||||
COMPRESSGZ=(gzip -c -f -n)
|
||||
COMPRESSBZ2=(bzip2 -c -f)
|
||||
COMPRESSXZ=(xz -c -z --threads=0 -)
|
||||
COMPRESSZST=(zstd -c -z -q --threads=0 -)
|
||||
COMPRESSLRZ=(lrzip -q)
|
||||
COMPRESSLZO=(lzop -q)
|
||||
COMPRESSZ=(compress -c -f)
|
||||
COMPRESSLZ4=(lz4 -q)
|
||||
COMPRESSLZ=(plzip -c -f)
|
||||
COMPRESSLZ=(lzip -c -f)
|
||||
|
||||
#########################################################################
|
||||
# EXTENSION DEFAULTS
|
||||
|
|
|
@ -7,3 +7,14 @@
|
|||
defaultbranch = main
|
||||
[pull]
|
||||
rebase = true
|
||||
[alias]
|
||||
s = status
|
||||
l = log
|
||||
c = commit
|
||||
d = diff
|
||||
p = pull
|
||||
ch = checkout
|
||||
a = add
|
||||
sh = show
|
||||
m = merge
|
||||
r = rebase
|
||||
|
|
|
@ -9,11 +9,5 @@ else
|
|||
fi
|
||||
|
||||
# git
|
||||
alias ga='git add'
|
||||
alias gs='git status'
|
||||
alias gc='git commit'
|
||||
alias gm='git merge'
|
||||
alias gch='git checkout'
|
||||
alias gp='git pull'
|
||||
alias gpus='git push'
|
||||
alias g=git
|
||||
|
||||
|
|
Loading…
Reference in a new issue