diff --git a/files/.config/sway/config b/files/.config/sway/config index b421780..439a245 100644 --- a/files/.config/sway/config +++ b/files/.config/sway/config @@ -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" { diff --git a/files/.local/bin/get-focused-window-geometry b/files/.local/bin/get-focused-window-geometry new file mode 100755 index 0000000..9345feb --- /dev/null +++ b/files/.local/bin/get-focused-window-geometry @@ -0,0 +1,3 @@ +#!/bin/bash + +get-focused-window-properties | jq --raw-output '.rect|((.x|tostring)+","+(.y|tostring)+" "+(.width|tostring)+"x"+(.height|tostring))' diff --git a/files/.local/bin/get-focused-window-properties b/files/.local/bin/get-focused-window-properties new file mode 100755 index 0000000..4828e1d --- /dev/null +++ b/files/.local/bin/get-focused-window-properties @@ -0,0 +1,3 @@ +#!/bin/bash + +swaymsg -t get_tree | jq --raw-output '..|if .focused? == true then . else empty end' diff --git a/files/.local/bin/sshot b/files/.local/bin/sshot index 26357a6..d814746 100755 --- a/files/.local/bin/sshot +++ b/files/.local/bin/sshot @@ -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 diff --git a/files/.zshrc b/files/.zshrc index 5e4344f..ef87d6c 100644 --- a/files/.zshrc +++ b/files/.zshrc @@ -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