forked from Shinonome/dots-hyprland
replace jq with gojq
This commit is contained in:
@@ -17,7 +17,7 @@
|
|||||||
## This tool is based on grimshot, with swaymsg commands replaced by their
|
## This tool is based on grimshot, with swaymsg commands replaced by their
|
||||||
## hyprctl equivalents.
|
## hyprctl equivalents.
|
||||||
## https://github.com/swaywm/sway/blob/master/contrib/grimshot
|
## https://github.com/swaywm/sway/blob/master/contrib/grimshot
|
||||||
|
jq=gojq
|
||||||
getTargetDirectory() {
|
getTargetDirectory() {
|
||||||
test -f "${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs" &&
|
test -f "${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs" &&
|
||||||
. "${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs"
|
. "${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs"
|
||||||
@@ -191,14 +191,14 @@ if [ "$ACTION" = "check" ]; then
|
|||||||
check hyprctl
|
check hyprctl
|
||||||
check hyprpicker
|
check hyprpicker
|
||||||
check wl-copy
|
check wl-copy
|
||||||
check jq
|
check $jq
|
||||||
check notify-send
|
check notify-send
|
||||||
exit
|
exit
|
||||||
elif [ "$SUBJECT" = "active" ]; then
|
elif [ "$SUBJECT" = "active" ]; then
|
||||||
wait
|
wait
|
||||||
FOCUSED=$(hyprctl activewindow -j)
|
FOCUSED=$(hyprctl activewindow -j)
|
||||||
GEOM=$(echo "$FOCUSED" | jq -r '"\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"')
|
GEOM=$(echo "$FOCUSED" | $jq -r '"\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"')
|
||||||
APP_ID=$(echo "$FOCUSED" | jq -r '.class')
|
APP_ID=$(echo "$FOCUSED" | $jq -r '.class')
|
||||||
WHAT="$APP_ID window"
|
WHAT="$APP_ID window"
|
||||||
elif [ "$SUBJECT" = "screen" ]; then
|
elif [ "$SUBJECT" = "screen" ]; then
|
||||||
wait
|
wait
|
||||||
@@ -207,7 +207,7 @@ elif [ "$SUBJECT" = "screen" ]; then
|
|||||||
elif [ "$SUBJECT" = "output" ]; then
|
elif [ "$SUBJECT" = "output" ]; then
|
||||||
wait
|
wait
|
||||||
GEOM=""
|
GEOM=""
|
||||||
OUTPUT=$(hyprctl monitors -j | jq -r '.[] | select(.focused == true)' | jq -r '.name')
|
OUTPUT=$(hyprctl monitors -j | $jq -r '.[] | select(.focused == true)' | $jq -r '.name')
|
||||||
WHAT="$OUTPUT"
|
WHAT="$OUTPUT"
|
||||||
elif [ "$SUBJECT" = "area" ]; then
|
elif [ "$SUBJECT" = "area" ]; then
|
||||||
if [ "$FREEZE" = "yes" ] && [ "$(command -v "hyprpicker")" ] >/dev/null 2>&1; then
|
if [ "$FREEZE" = "yes" ] && [ "$(command -v "hyprpicker")" ] >/dev/null 2>&1; then
|
||||||
@@ -218,15 +218,15 @@ elif [ "$SUBJECT" = "area" ]; then
|
|||||||
|
|
||||||
# get fade & fadeOut animation and unset it
|
# get fade & fadeOut animation and unset it
|
||||||
# this removes the black border seen around screenshots
|
# this removes the black border seen around screenshots
|
||||||
FADE="$(hyprctl -j animations | jq -jr '.[0][] | select(.name == "fade") | .name, ",", (if .enabled == true then "1" else "0" end), ",", (.speed|floor), ",", .bezier')"
|
FADE="$(hyprctl -j animations | $jq -jr '.[0][] | select(.name == "fade") | .name, ",", (if .enabled == true then "1" else "0" end), ",", (.speed|floor), ",", .bezier')"
|
||||||
FADEOUT="$(hyprctl -j animations | jq -jr '.[0][] | select(.name == "fadeOut") | .name, ",", (if .enabled == true then "1" else "0" end), ",", (.speed|floor), ",", .bezier')"
|
FADEOUT="$(hyprctl -j animations | $jq -jr '.[0][] | select(.name == "fadeOut") | .name, ",", (if .enabled == true then "1" else "0" end), ",", (.speed|floor), ",", .bezier')"
|
||||||
hyprctl keyword animation 'fade,0,1,default' >/dev/null
|
hyprctl keyword animation 'fade,0,1,default' >/dev/null
|
||||||
hyprctl keyword animation 'fadeOut,0,1,default' >/dev/null
|
hyprctl keyword animation 'fadeOut,0,1,default' >/dev/null
|
||||||
|
|
||||||
WORKSPACES="$(hyprctl monitors -j | jq -r 'map(.activeWorkspace.id)')"
|
WORKSPACES="$(hyprctl monitors -j | $jq -r 'map(.activeWorkspace.id)')"
|
||||||
WINDOWS="$(hyprctl clients -j | jq -r --argjson workspaces "$WORKSPACES" 'map(select([.workspace.id] | inside($workspaces)))')"
|
WINDOWS="$(hyprctl clients -j | $jq -r --argjson workspaces "$WORKSPACES" 'map(select([.workspace.id] | inside($workspaces)))')"
|
||||||
# shellcheck disable=2086 # if we don't split, spaces mess up slurp
|
# shellcheck disable=2086 # if we don't split, spaces mess up slurp
|
||||||
GEOM=$(echo "$WINDOWS" | jq -r '.[] | "\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"' | slurp $SLURP_ARGS)
|
GEOM=$(echo "$WINDOWS" | $jq -r '.[] | "\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"' | slurp $SLURP_ARGS)
|
||||||
|
|
||||||
# Check if user exited slurp without selecting the area
|
# Check if user exited slurp without selecting the area
|
||||||
if [ -z "$GEOM" ]; then
|
if [ -z "$GEOM" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user