fix sshot script
This commit is contained in:
parent
a160b9bf9d
commit
ad20551289
|
@ -46,12 +46,16 @@ gaps outer -8
|
|||
smart_gaps on
|
||||
|
||||
# Floating mod
|
||||
for_window [class="^Pavucontrol$"] floating enable
|
||||
for_window [class="^Pulseeffects$"] floating enable
|
||||
for_window [app_id="pavucontrol"] floating enable
|
||||
for_window [class="Remmina" title="Remmina Remote Desktop Client"] floating enable
|
||||
for_window [class="feh" title="pinned screenshot"] floating enable sticky enable
|
||||
for_window [class="feh"] floating enable
|
||||
for_window [class="TeamViewer"] floating enable
|
||||
|
||||
for_window [window_type="dialog"] floating enable
|
||||
for_window [window_type="utility"] floating enable
|
||||
for_window [window_type="toolbar"] floating enable
|
||||
for_window [window_type="splash"] floating enable
|
||||
|
||||
# https://github.com/ValveSoftware/steam-for-linux/issues/1040
|
||||
for_window [class="^Steam$" title="^Friends$"] floating enable
|
||||
for_window [class="^Steam$" title="Steam - News"] floating enable
|
||||
|
@ -223,10 +227,10 @@ bindsym XF86MonBrightnessDown exec brightness-control down
|
|||
bindsym XF86AudioMute exec volume-control mute
|
||||
bindsym XF86AudioRaiseVolume exec volume-control up
|
||||
bindsym XF86AudioLowerVolume exec volume-control down
|
||||
bindsym Shift+Print exec sshot --pin
|
||||
bindsym Control+Print exec sshot --partial
|
||||
bindsym Alt+Print exec sshot --window
|
||||
bindsym Print exec sshot
|
||||
bindsym Shift+print exec sshot --pin
|
||||
bindsym Control+print exec sshot --partial
|
||||
bindsym Alt+print exec sshot --window
|
||||
bindsym print exec sshot
|
||||
|
||||
# resize window (you can also use the mouse for that)
|
||||
mode "resize" {
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
get-focused-window-properties | jq --raw-output '.rect|((.x|tostring)+","+(.y|tostring)+" "+(.width|tostring)+"x"+(.height|tostring))'
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
swaymsg -t get_tree | jq --raw-output '..|if .focused? == true then . else empty end'
|
|
@ -16,37 +16,24 @@ mkdir -p "$(dirname $file)" 2>/dev/null
|
|||
|
||||
if [[ -n "$ARG_PARTIAL" ]]; then
|
||||
# prompt the user for the area to take a screenshot from
|
||||
read -r geometry < <(slop --highlight --color="0.6,0.4,0.3,0.4" --tolerance=0 --format "%wx%h+%x+%y")
|
||||
|
||||
geometry="$(slurp)"
|
||||
if [ -z "$geometry" ]; then
|
||||
exit 1
|
||||
fi
|
||||
elif [[ -n $ARG_WINDOW ]]; then
|
||||
# get the active window geometry
|
||||
while read -r line; do
|
||||
if echo "$line" | grep -q "Position"; then
|
||||
p="$(echo "$line" | grep -Eo '[0-9]+,[0-9]+' | sed 's/,/+/')"
|
||||
elif echo "$line" | grep -q "Geometry"; then
|
||||
g="$(echo "$line" | grep -Eo '[0-9]+x[0-9]+')"
|
||||
fi
|
||||
done <<< "$(xdotool getactivewindow getwindowgeometry)"
|
||||
geometry="$g"+"$p"
|
||||
geometry="$(get-focused-window-geometry)"
|
||||
fi
|
||||
|
||||
# take a screenshot
|
||||
scrot "$file"
|
||||
|
||||
if [[ -n "$geometry" ]]; then
|
||||
# crop the screenshot to geometry
|
||||
convert "$file" -crop "$geometry" "$file"
|
||||
fi
|
||||
grim -g "$geometry" -- "$file"
|
||||
|
||||
# place to image in the clipboard
|
||||
xclip -selection clipboard -target image/png "$file"
|
||||
wl-copy < "$file"
|
||||
|
||||
if [[ -n "$ARG_PIN" ]]; then
|
||||
# pin the screenshot
|
||||
feh --title "pinned screenshot" --geometry "$geometry" "$file" &
|
||||
feh --geometry "$(echo -n "$geometry" | sed -E 's/([0-9]+),([0-9]+) ([0-9]+)x([0-9]+)/\3x\4+\1+\2/')" "$file" &
|
||||
fi
|
||||
|
||||
# print the file name
|
||||
|
|
|
@ -14,7 +14,7 @@ if [ -z "$WAYLAND_DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then
|
|||
#export WLR_DRM_NO_ATOMIC=1
|
||||
#export WLR_DRM_NO_ATOMIC_GAMMA=1
|
||||
|
||||
exec sway
|
||||
exec sway -d -V &>~/sway.log
|
||||
fi
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue