dshoreman / nextshot

A simple tool for taking screenshots on Linux and sharing via Nextcloud

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Window mode on Wayland should fall back to selection

dshoreman opened this issue · comments

There's no handling for --window in the shoot_wayland function, so it's currently defaulting to full screen.

There's no support for window selection in Slurp, but that could soon change if emersion/slurp#28 gets merged. Even then, it doesn't seem there'll be a way of specifically requiring "click" vs "drag" (like Slop's --tolerance 999999) in order to support dedicated window/selection modes in NextShot.

Falling back to --selection mode (as it did for X before --window was supported) isn't the best idea, as Slurp will exit if a user simply clicks in a window. Until Slurp gets window support, it may be worth seeing if we can parse a list of windows from swaymsg instead.

Adding something like slop's --tolerance to slurp is certainly a possibility.

@yorickvP I thought about suggesting an option when I first saw the PR, but I didn't want to delay the merge. Getting window positions/sizes via swaymsg didn't even cross my mind until I saw your jq snippets, so having the pipe feature will be great in itself 😉

While an actual tolerance option could eventually be useful for the default mode, setting -t 999999 feels hacky. A simple boolean flag that switches between click or selection would be far cleaner IMHO.

Not really sure what it'd be called though. With -c and -w used for border colour and weight respectively, it rules out [-c]lick or [-w]indow. I'd suggest -a for "area selection", but that could be confused with the common --all in many other programs.

This would probably be better off as its own feature request once region selection is merged to avoid clutter there, especially as it might depend on how the new functionality is enabled. In the end an extra toggle flag might not even be necessary.