sway icon indicating copy to clipboard operation
sway copied to clipboard

Add `anything` option to grimshot

Open RagnarGrootKoerkamp opened this issue 4 years ago • 13 comments

This enables selecting a window, output, or area within one invocation, removing the need for multiple keybindings.

  • Drag for an area (note that this already works in the window case)
  • Click on a window to select it
  • Click outside of all windows (e.g. in gaps or on the statusbar) to select the output

Ideally this needs some testing with multiple monitors, which I don't have.

~The name selection may need to change.~ It's anything now.

RagnarGrootKoerkamp avatar May 20 '21 11:05 RagnarGrootKoerkamp

This sounds great, can't wait to get this!

Ashe avatar Jun 20 '21 13:06 Ashe

@Ashe Note that you could already just take the updated grimshot file and put it somewhere in your path (at least that's what I did).

RagnarGrootKoerkamp avatar Jun 20 '21 14:06 RagnarGrootKoerkamp

Ideally this needs some testing with multiple monitors, which I don't have.

Though I'm not using grimshot myself, I stole the snippet (swaymsg ... | slurp -o) and have been using it for many months with multiple monitors and it works without issue.

fluix-dev avatar Jun 20 '21 16:06 fluix-dev

@fluix-dev Oh, I didn't know of slurp -o before. That simplifies things since now we can use the same jq command as the existing window option, and just do slurp -o to add the rectangles for all outputs instead of only slurp.

RagnarGrootKoerkamp avatar Jun 25 '21 11:06 RagnarGrootKoerkamp

selection could maybe change to e.g. anything

RagnarGrootKoerkamp avatar Jun 25 '21 11:06 RagnarGrootKoerkamp

Oh, I didn't know of slurp -o before

Oh haha, looks like I got a similar snippet from somewhere else.

selection could maybe change to e.g. anything

Hm, yeah anything is probably better.

fluix-dev avatar Jun 25 '21 14:06 fluix-dev

Clicking on the status bar (waybar) results on the current window getting screenshotted.

Would it be possible to maybe use right-click to trigger saving the current output?

I like the idea, but it's doesn't seem to be possible to screenshot the whole output without using gaps.

WhyNotHugo avatar Aug 27 '21 13:08 WhyNotHugo

@WhyNotHugo Hmm, do you mean that the last window you hovered before moving the cursor over the waybar is what gets screenshotted? That sounds weird to me. For me, both hovering the gaps and hovering the waybar (anything outside all windows) have the desired effect of screenshotting the entire output.

RagnarGrootKoerkamp avatar Aug 27 '21 13:08 RagnarGrootKoerkamp

Is there anything blocking this PR from being merged, or does this just need a reviewer? This is one of the few things I really missed switching from x11 to sway.

edward-shen avatar Oct 15 '22 07:10 edward-shen

I think it's ready and has just fallen of the radar. I've been using it for over a year without problems and having a single screenshot button that does everything is super convenient indeed.

RagnarGrootKoerkamp avatar Oct 15 '22 07:10 RagnarGrootKoerkamp

Clicking on the status bar did not work for me. Without gaps I don’t see how you can screenshot the whole output.

WhyNotHugo avatar Oct 15 '22 12:10 WhyNotHugo

Hmm, interesting. That would probably be an issue with slurp. I'm running version 1.3.2, and with it the following works:

echo 0,0 500x500 | slurp -o
  • click in the top left corner of the output to select it
  • click outside the top left corner of the output to select the entire output
  • click and drag anywhere to select an area.

RagnarGrootKoerkamp avatar Oct 15 '22 12:10 RagnarGrootKoerkamp

Mind you, I'm just pointing out an issue I've found; I'm not saying that this should be a blocker to merging.

WhyNotHugo avatar Oct 15 '22 13:10 WhyNotHugo

The contrib/ directory has been moved from Sway to a separate repository: https://github.com/OctopusET/sway-contrib

See https://github.com/swaywm/sway/pull/7541 for details.

Please re-open your pull request against the new repository.

emersion avatar Aug 02 '23 15:08 emersion

See https://github.com/OctopusET/sway-contrib/pull/11

RagnarGrootKoerkamp avatar Aug 23 '23 12:08 RagnarGrootKoerkamp