Open TilBlechschmidt opened 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.
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.
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.
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
just copy the way shutter does it.
Also you can lookup Hotshots code as example of window selector: https://github.com/obiwankennedy/HotShots
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.
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)
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.
great tool, the only thing I lack is the ability to screenshot a window. please make it available at least for x11!
Also need this feature. Waiting in hope!
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.
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.
Would also be very interested in this feature.
I would love this feature!
i love this suggest! :+1:
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.
This feature is so necessary :D
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.
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
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?
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.
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.
is this a thing yet or am i blind?
@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.
So, what about this feature? It's really easy way to get app screen instead of whole desktop.
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.
@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
Vote
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)
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.
@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.
@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. :)
@aryadovoy then checkout #1814 Pull request would be highly appreciated if you have the time to work on it
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.
@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.
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?
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.
So this feature is still opening just because we MUST wait for Wayland?
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
Sadly, that we lack of this feature for 6 years.
@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:
@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:
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.
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.
@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:
@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 :)
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.