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() {
|
declare -A temp_files
|
||||||
>&2 cat << EOF
|
temp_files[command_to_source]=$(mktemp)
|
||||||
Usage :
|
|
||||||
|
clean() {
|
||||||
|
rm -- "${temp_files[@]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
cat << EOF
|
||||||
|
Usage:
|
||||||
glurp full|area clip|file
|
glurp full|area clip|file
|
||||||
EOF
|
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() {
|
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
|
trap error_usage_clean EXIT
|
||||||
wl_copy_args="-t image/png"
|
set -e
|
||||||
|
|
||||||
|
slurp=()
|
||||||
|
grim_args=()
|
||||||
|
wl_copy=()
|
||||||
|
|
||||||
# Arguments
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
full)
|
full)
|
||||||
|
:
|
||||||
;;
|
;;
|
||||||
area)
|
area)
|
||||||
slurp=slurp
|
slurp+=(slurp \|)
|
||||||
pipe1='|'
|
grim_args+=(-g -)
|
||||||
grim_args="-g -"
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
error_usage
|
false
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
clip)
|
clip)
|
||||||
pipe2='|'
|
wl_copy+=(\| wl-copy -t image/png)
|
||||||
wl_copy=wl-copy
|
grim_args+=(-)
|
||||||
;;
|
;;
|
||||||
file)
|
file)
|
||||||
grim_args="${grim_args} $(screenshot_path)"
|
grim_args+=("$(screenshot_path "/tmp/${USER}")")
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
error_usage
|
false
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
shift
|
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
|
trap clean EXIT
|
||||||
set -xe
|
|
||||||
"$slurp" "$pipe1" "$grim" "$grim_args" "$pipe2" "$wl_copy"
|
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
|
# Animations
|
||||||
$animSpeed = 4
|
$animSpeed = 3
|
||||||
animations {
|
animations {
|
||||||
enabled = yes
|
enabled = yes
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ DLAGENTS=('file::/usr/bin/curl -qgC - -o %o %u'
|
||||||
|
|
||||||
#-- The package required by makepkg to download VCS sources
|
#-- The package required by makepkg to download VCS sources
|
||||||
# Format: 'protocol::package'
|
# Format: 'protocol::package'
|
||||||
VCSCLIENTS=('bzr::bzr'
|
VCSCLIENTS=('bzr::breezy'
|
||||||
'fossil::fossil'
|
'fossil::fossil'
|
||||||
'git::git'
|
'git::git'
|
||||||
'hg::mercurial'
|
'hg::mercurial'
|
||||||
|
@ -38,7 +38,7 @@ CHOST="x86_64-pc-linux-gnu"
|
||||||
|
|
||||||
#-- Compiler and Linker Flags
|
#-- Compiler and Linker Flags
|
||||||
#CPPFLAGS=""
|
#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 \
|
-Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \
|
||||||
-fstack-clash-protection -fcf-protection"
|
-fstack-clash-protection -fcf-protection"
|
||||||
CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"
|
CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"
|
||||||
|
@ -134,15 +134,15 @@ DBGSRCDIR="/usr/src/debug"
|
||||||
# COMPRESSION DEFAULTS
|
# COMPRESSION DEFAULTS
|
||||||
#########################################################################
|
#########################################################################
|
||||||
#
|
#
|
||||||
COMPRESSGZ=(pigz -c -f -n)
|
COMPRESSGZ=(gzip -c -f -n)
|
||||||
COMPRESSBZ2=(pbzip2 -c -f)
|
COMPRESSBZ2=(bzip2 -c -f)
|
||||||
COMPRESSXZ=(xz -c -z --threads=0 -)
|
COMPRESSXZ=(xz -c -z --threads=0 -)
|
||||||
COMPRESSZST=(zstd -c -z -q --threads=0 -)
|
COMPRESSZST=(zstd -c -z -q --threads=0 -)
|
||||||
COMPRESSLRZ=(lrzip -q)
|
COMPRESSLRZ=(lrzip -q)
|
||||||
COMPRESSLZO=(lzop -q)
|
COMPRESSLZO=(lzop -q)
|
||||||
COMPRESSZ=(compress -c -f)
|
COMPRESSZ=(compress -c -f)
|
||||||
COMPRESSLZ4=(lz4 -q)
|
COMPRESSLZ4=(lz4 -q)
|
||||||
COMPRESSLZ=(plzip -c -f)
|
COMPRESSLZ=(lzip -c -f)
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# EXTENSION DEFAULTS
|
# EXTENSION DEFAULTS
|
||||||
|
|
|
@ -7,3 +7,14 @@
|
||||||
defaultbranch = main
|
defaultbranch = main
|
||||||
[pull]
|
[pull]
|
||||||
rebase = true
|
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
|
fi
|
||||||
|
|
||||||
# git
|
# git
|
||||||
alias ga='git add'
|
alias g=git
|
||||||
alias gs='git status'
|
|
||||||
alias gc='git commit'
|
|
||||||
alias gm='git merge'
|
|
||||||
alias gch='git checkout'
|
|
||||||
alias gp='git pull'
|
|
||||||
alias gpus='git push'
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue