flameshot-org / flameshot

Powerful yet simple to use screenshot software :desktop_computer: :camera_flash:
https://flameshot.org
GNU General Public License v3.0
25.01k stars 1.6k forks source link

Selecting a window in GUI mode #5

Open TilBlechschmidt opened 7 years ago

TilBlechschmidt commented 7 years ago

When running in GUI selection mode it would be nice if the initial selection could be set to the window outlines by just left clicking a window without dragging.

lupoDharkael commented 7 years ago

A windows selection mode is great, but there is a problem with it: I want to add support for Wayland, and the protocol doesn't support knowing where the windows are and its properties. Which makes adding such feature a very problematic thing to manage in such migration.

Naatan commented 7 years ago

Why not add it for X11 and then add it for Wayland once it becomes available? I don't see why applications should suffer because Wayland can't keep up. If anything stuff like this will urge Wayland to add support for it.

lupoDharkael commented 6 years ago

I'm thinking about implementing window detection using shape detection in the image itself. That way it wont depend on the desktop environment and could be easier to port Flameshot to other systems someday. I'll try to find a self-contained solution for rectangle detection because I don't what to add a heavy dependency like OpenCV.

JaneSmith commented 6 years ago

I'd like a window screenshot feature that can work like this: https://askubuntu.com/questions/50604/application-for-taking-pretty-screenshots-like-os-x-does

elypter commented 6 years ago

just copy the way shutter does it.

MurzNN commented 6 years ago

Also you can lookup Hotshots code as example of window selector: https://github.com/obiwankennedy/HotShots

ndac-todoroki commented 6 years ago

I'll try to find a self-contained solution for rectangle detection

This is certainly cool, but there are problems... if a window have transparent surroundings, and if you want to include that too, I'm afraid you can not detect the correct area to capture.

lupoDharkael commented 6 years ago

I agree, and now I think it's better to support native mechanics for window selection as a separated mode.

I plan to release a new version soon™ when I end the exams. This could be implemented for Flameshot 0.7 (I'd like to push more features but my time is limited)

demizer commented 6 years ago

This is a great tool, but it needs window selection. Also, it should be possible to add a dropshadow to make it similar to the way macOS takes screenshots.

Metadorius commented 5 years ago

great tool, the only thing I lack is the ability to screenshot a window. please make it available at least for x11!

KiriKira commented 5 years ago

Also need this feature. Waiting in hope!

azzamsa commented 5 years ago

Or just copy on how maim did it. maim -i $(xdotool getactivewindow) filename.png

This is the only feature I miss when leaving maim for flameshot.

slondr commented 5 years ago

Any update on this feature? Lacking window selection support is probably the only thing that makes me keep Shutter installed instead of just using Flameshot for everything.

imtbl commented 4 years ago

Would also be very interested in this feature.

jameswilliamknight commented 4 years ago

I would love this feature!

decryp2kanon commented 4 years ago

i love this suggest! :+1:

Massimo-B commented 4 years ago

I agree my #799 could be solved by this like Left-Click to snapshot the window instead of a command line parameter. Just an option for including window decoration or not would be helpful.

tiotrom commented 3 years ago

This feature is so necessary :D

Flimm commented 3 years ago

For those looking for a workaround, in GNOME, you can press Alt-PrintScreen, and it will save a screenshot of the currently active window in your Pictures directory.

tiotrom commented 3 years ago

For those looking for a workaround, in GNOME, you can press Alt-PrintScreen, and it will save a screenshot of the currently active window in your Pictures directory.

Oh awesome. This is so useful honestly! Thanks a lot. Had no idea

MithicSpirit commented 3 years ago

I want to add support for Wayland, and the protocol doesn't support knowing where the windows are and its properties.

Has there been any change on this? Or are we still waiting on that being added to the protocol?

ghost commented 3 years ago

Would highly appreciate GUI mode for Flameshot especially as windows user. That's a feature that I've been missing with Flameshot that has been available with Snip & Sketch / snipping bar.

Edit: Not "GUI mode" that's nonsense I wrote. I wanna be able to do a selection of a window inside of the Flameshot GUI. Like OP wants. Just on Windows (OS) too. That is visible inside the GUI I probably meant by GUI mode like it is available and visible as icon or option to chose with the snipping bar in Windows.

The third icon representing the window selection option. Otherwise we might have to wait for: [ ] computer vision for rectangles selection (as in firefox screenshot) Which in similar manner is already present with ShareX and would probably fullfill the very same issue.

grafik

MithicSpirit commented 3 years ago

I don't use Windows but the Linux version does have a GUI version (it can be started by either executing flameshot gui or through the system tray icon). That isn't exactly what this issue is discussing though so I think that if you can't start it maybe create a new issue.

apprehensions commented 2 years ago

is this a thing yet or am i blind?

mmahmoudian commented 2 years ago

@wael444 no it is not a thing yet. You can follow some if the discussions in #1814

If you want this now and you are on Linux and using X11, you can use this wrapper tool I wrote to do it:

https://codeberg.org/mehrad/dmenu_shot

Basically when you use the "Select_Window" it will allow you to click on one of your open windows and then it automatically handles the dimension of the selection.

aryadovoy commented 2 years ago

So, what about this feature? It's really easy way to get app screen instead of whole desktop.

borgmanJeremy commented 2 years ago

It's not going to happen unless qt adds a way to do this. It will be a nightmare to manage it across desktop environments and operating systems.

mmahmoudian commented 2 years ago

@aryadovoy if you want a quick way to do it with Flameshot in Linux on X11, you can use the Select_Window in this dmenu tool: https://codeberg.org/mehrad/dmenu_shot

CholoTook commented 2 years ago

Vote

WebDust21 commented 2 years ago

Just installed Flameshot...and found this issue less than 10 minutes later while looking for a way to do just this...

It's not impossible to do in Linux, as both GIMP and Spectacle can "capture active window" without an issue.

Yes, transparent edges are a minor issue--GIMP simply captures the entire transparent edge (including what's visible behind it). We don't necessarily need a "perfect" solution, just a way to have Flameshot automatically select the active window (command line shortcut activated with Ctrl + PrntScrn, for example)

borgmanJeremy commented 2 years ago

It's not impossible on any platform but I am not going to merge something that is unmaintainable. We need a clear strategy for how to do this in a cross platform / cross desktop way.

mmahmoudian commented 2 years ago

@WebDust21 I 100% agree with @borgmanJeremy. Whatever the solution is, it should be cross-platform unless and until we have no choice.

If you are on X11 and want to do it, there are many easy ways to do so. Take a look at this project of mine in which you can select the window and it will tell Flameshot to focus on that area. You ca either use the software or grab that relevant piece of code.

aryadovoy commented 2 years ago

@mmahmoudian, I see solution for all platforms — parsing image and cropping active window (mouse should be on this window to get position and determine which window should be parsed and cropped). Maybe it's too much, but it should work everywhere. :)

mmahmoudian commented 2 years ago

@aryadovoy then checkout #1814 Pull request would be highly appreciated if you have the time to work on it

friday commented 2 years ago

It could indeed be possible to use some kind of edge detection, but it would have to make some assumptions. You wouldn't be able to detect a black terminal window with a borderless theme on a black background for example.

mmahmoudian commented 2 years ago

@friday there is no image processing method in existence that can handle this case unless there are some other visual cues. The worst case scenario is having a borderless black terminal with opaque background which all its area is inside another slightly larger terminal. No machine learning method can dig that out unless it can get some extra information based on text or window decoration.

I think if we end up using any image processing method, we should not consider edge cases and we should just go with typical and normal cases. The ideal case would be that we can read window dimension and position info from Qt as it has no overhead on our side.

XieJiSS commented 1 year ago

This feature is quite needed anyway, despite the thread being inactive for nearly a year - should we pick this up again and consider how to implement it?

mmahmoudian commented 1 year ago

should we pick this up again and consider how to implement it?

Sure, if you are up for it. PRs are always welcome. But I have to hide your comment as it does not add anything constructive to the thread and discussion.

sakurawald commented 1 year ago

So this feature is still opening just because we MUST wait for Wayland?

mmahmoudian commented 1 year ago

So this feature is still opening just because we MUST wait for Wayland?

No, it is open because we need someone to consider helping implementing it. If you are up for it, PRs are definitely welcome

KES777 commented 1 year ago

Sadly, that we lack of this feature for 6 years.

mmahmoudian commented 1 year ago

@KES777 Please avoid cross posting. It does mot help anyone and will only clutter the issues and make me to work more that what it needs to keep the issues tidy.

This in already very easy to do in X11 (have been possible for over a year). It is not possible on wayland though.

For X11 I have implemented this in a personal project under "selec window", and you can salvage the code:

https://codeberg.org/mehrad/dmenu_shot

harold commented 1 year ago

@mmahmoudian - thank you for this! I was able to adapt your code to a short script that works well for me under x11/i3:

#!/bin/bash
TMP_WINDOW_ID=$(xdotool selectwindow)
unset WINDOW X Y WIDTH HEIGHT SCREEN
eval $(xdotool getwindowgeometry --shell "${TMP_WINDOW_ID}")
xdotool windowfocus --sync "${TMP_WINDOW_ID}"
sleep 0.05
flameshot gui --region "${WIDTH}x${HEIGHT}+${X}+${Y}"

Ignore the haters, you're doing great! Thank you for all the efforts. :bow:

RokeJulianLockhart commented 10 months ago

We could ask the current window managers to separate their window detection code into a library or libraries, I suppose.

Heck, we could just take theirs, do it for them, and then say

"Hey, we consolidated all your code, want to use this and pool our development resources?"

It seems more feasible than image detection, at least.

Korb commented 4 months ago

In the PicPick app, this feature is called "Capture Window Control", and it allows you to select not only the outer contours of any window, but also its internal areas. I propose to consider this function in this more universal way.

grymmjack commented 2 months ago

@wael444 no it is not a thing yet. You can follow some if the discussions in #1814

If you want this now and you are on Linux and using X11, you can use this wrapper tool I wrote to do it:

https://codeberg.org/mehrad/dmenu_shot

Basically when you use the "Select_Window" it will allow you to click on one of your open windows and then it automatically handles the dimension of the selection.

I use display scaling on my KDE setup of 150%

To accommodate this you need to add the scaling environment variables to get the correct geometry:

221c221
<         flameshot gui --region "${WIDTH}x${HEIGHT}+${X}+${Y}"
---
>         QT_AUTO_SCREEN_SCALE_FACTOR=1.5 QT_SCREEN_SCALE_FACTORS="" flameshot gui --region "${WIDTH}x${HEIGHT}+${X}+${Y}"

1.5 = 150% scaling, for example:

image

@mmahmoudian thank you for dmenu_shot! Also thank you for exposing dmenu! it's great.

I wonder, is there a way to get the screen scaling factor and automatically compensate that in your tool?

BTW, I found this information here in flameshot troubleshooting: https://flameshot.org/docs/guide/troubleshooting/

Also, I found slop does the same thing as xdotool, and can be done in 1 line like so: env QT_AUTO_SCREEN_SCALE_FACTOR=1.5 QT_SCREEN_SCALE_FACTORS="" flameshot gui --region "$(slop)"

Works great, but less fancy than your dmenu_shot @mmahmoudian :)

https://packages.debian.org/sid/slop