✨ feat(hypr): add new hyprshot options
code extracted from https://github.com/Gustash/Hyprshot/pull/68
This commit is contained in:
parent
78ff7b3010
commit
0b328fb64d
1 changed files with 22 additions and 3 deletions
|
@ -26,6 +26,9 @@ Options:
|
||||||
-s, --silent don't send notification when screenshot is saved
|
-s, --silent don't send notification when screenshot is saved
|
||||||
-r, --raw output raw image data to stdout
|
-r, --raw output raw image data to stdout
|
||||||
-t, --notif-timeout notification timeout in milliseconds (default 5000)
|
-t, --notif-timeout notification timeout in milliseconds (default 5000)
|
||||||
|
--border-width width of the selection border in pixels (default 0)
|
||||||
|
--border-color color of the selection border (default #181926)
|
||||||
|
--background-color color around the selection (default #8087a25a)
|
||||||
--clipboard-only copy screenshot to clipboard and don't save image in disk
|
--clipboard-only copy screenshot to clipboard and don't save image in disk
|
||||||
-- [command] open screenshot with a command of your choosing. e.g. hyprshot -m window -- mirage
|
-- [command] open screenshot with a command of your choosing. e.g. hyprshot -m window -- mirage
|
||||||
|
|
||||||
|
@ -150,6 +153,7 @@ function checkRunning() {
|
||||||
|
|
||||||
function begin_grab() {
|
function begin_grab() {
|
||||||
if [ $FREEZE -eq 1 ] && [ "$(command -v "hyprpicker")" ] >/dev/null 2>&1; then
|
if [ $FREEZE -eq 1 ] && [ "$(command -v "hyprpicker")" ] >/dev/null 2>&1; then
|
||||||
|
sleep 0.2
|
||||||
hyprpicker -r -z &
|
hyprpicker -r -z &
|
||||||
sleep 0.2
|
sleep 0.2
|
||||||
HYPRPICKER_PID=$!
|
HYPRPICKER_PID=$!
|
||||||
|
@ -204,7 +208,7 @@ function grab_selected_output() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function grab_region() {
|
function grab_region() {
|
||||||
slurp -d
|
slurp -d -b $BACKGROUND_COLOR -c $BORDER_COLOR -w $BORDER_WIDTH
|
||||||
}
|
}
|
||||||
|
|
||||||
function grab_window() {
|
function grab_window() {
|
||||||
|
@ -216,7 +220,7 @@ function grab_window() {
|
||||||
# through stdin
|
# through stdin
|
||||||
local boxes="$(echo $clients | jq -r '.[] | "\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1]) \(.title)"' | cut -f1,2 -d' ')"
|
local boxes="$(echo $clients | jq -r '.[] | "\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1]) \(.title)"' | cut -f1,2 -d' ')"
|
||||||
Print "Boxes:\n%s\n" "$boxes"
|
Print "Boxes:\n%s\n" "$boxes"
|
||||||
slurp -r <<<"$boxes"
|
slurp -r -b $BACKGROUND_COLOR -c $BORDER_COLOR -w $BORDER_WIDTH <<<"$boxes"
|
||||||
}
|
}
|
||||||
|
|
||||||
function grab_active_window() {
|
function grab_active_window() {
|
||||||
|
@ -244,7 +248,7 @@ function parse_mode() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function args() {
|
function args() {
|
||||||
local options=$(getopt -o hf:o:m:D:dszr:t: --long help,filename:,output-folder:,mode:,delay:,clipboard-only,debug,silent,freeze,raw,notif-timeout: -- "$@")
|
local options=$(getopt -o hf:o:m:D:dszr:t: --long help,filename:,output-folder:,mode:,delay:,clipboard-only,debug,silent,freeze,raw,notif-timeout:,border-color:,background-color:,border-width: -- "$@")
|
||||||
eval set -- "$options"
|
eval set -- "$options"
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
|
@ -288,6 +292,18 @@ function args() {
|
||||||
shift
|
shift
|
||||||
NOTIF_TIMEOUT=$1
|
NOTIF_TIMEOUT=$1
|
||||||
;;
|
;;
|
||||||
|
--border-color)
|
||||||
|
shift
|
||||||
|
BORDER_COLOR=$1
|
||||||
|
;;
|
||||||
|
--background-color)
|
||||||
|
shift
|
||||||
|
BACKGROUND_COLOR=$1
|
||||||
|
;;
|
||||||
|
--border-width)
|
||||||
|
shift
|
||||||
|
BORDER_WIDTH=$1
|
||||||
|
;;
|
||||||
--)
|
--)
|
||||||
shift # Skip -- argument
|
shift # Skip -- argument
|
||||||
COMMAND=${@:2}
|
COMMAND=${@:2}
|
||||||
|
@ -315,6 +331,9 @@ RAW=0
|
||||||
NOTIF_TIMEOUT=5000
|
NOTIF_TIMEOUT=5000
|
||||||
CURRENT=0
|
CURRENT=0
|
||||||
FREEZE=0
|
FREEZE=0
|
||||||
|
BORDER_COLOR=\#181926
|
||||||
|
BACKGROUND_COLOR=\#8087a25a
|
||||||
|
BORDER_WIDTH=0
|
||||||
[ -z "$XDG_PICTURES_DIR" ] && type xdg-user-dir &>/dev/null && XDG_PICTURES_DIR=$(xdg-user-dir PICTURES)
|
[ -z "$XDG_PICTURES_DIR" ] && type xdg-user-dir &>/dev/null && XDG_PICTURES_DIR=$(xdg-user-dir PICTURES)
|
||||||
FILENAME="$(date +'%Y-%m-%d-%H%M%S_hyprshot.png')"
|
FILENAME="$(date +'%Y-%m-%d-%H%M%S_hyprshot.png')"
|
||||||
[ -z "$HYPRSHOT_DIR" ] && SAVEDIR=${XDG_PICTURES_DIR:=~} || SAVEDIR=${HYPRSHOT_DIR}
|
[ -z "$HYPRSHOT_DIR" ] && SAVEDIR=${XDG_PICTURES_DIR:=~} || SAVEDIR=${HYPRSHOT_DIR}
|
||||||
|
|
Loading…
Add table
Reference in a new issue