flameshot-org / flameshot

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

[Feature] Cancel flameshot capture from command line #1310

Open solonovamax opened 3 years ago

solonovamax commented 3 years ago

I have a simple issue: I want to make a kde connect command that captures a screenshot, but if I accidentally press it, I want to cancel the screenshot after like 30 seconds to a minute.

So something simple like flameshot gui -c 30 (which exits after 30 seconds) or flameshot gui && sleep 30; flameshot -k (which open the gui, sleeps for 30 seconds, and then kills any active capture (which doesn't kill the daemon) with flameshot -k) would work.

Not gonna make a massive post for this, since nobody would be bothered to read a 4000 word essay on a stupidly simple feature.

mmahmoudian commented 3 years ago

To be upfront, I'm bot rejecting the idea here as I'm trying to understand it better. Isn't this a very niche use case? These are reasons I think it is unnecessary based on what I understood from your feature request:

  1. If you accidentally triggered flameshot gui, you can cancel the screen capture by pressing Esc or clicking on the X button. Basically if you don't have access to mouse and keyboard, flameshot gui is useless for you.
  2. Instead of having the kill argument implemented, you can use pkill flameshot to kill it and then start the daemon with flameshot &.

Can you explain why either of these two methods are not sufficient enough and adding a new cli argument would be better?

solonovamax commented 3 years ago

Eh, it just doesn't seem like as clean of a solution to have to kill the daemon and restart it, rather than just simply having some method to stop it.

Is it a kind of niche usecase? Yeah, probably. But to be fair, 99% of the flags on most programs are for niche use cases. Like seriously, nobody uses all of the flags of yay, ever. But they're there to give the users more options. In the end it's up to you in which direction you want to go in. /shrug

mmahmoudian commented 3 years ago

I'm definitely not the decision maker as this software (similar to most of the good FOSS out there) is community-driven. I'm definitely not against adding more flags, but here is my rational:

  1. always when a person uses flameshot gui, they have access to mouse/keyboard and they can be used as I explained before to close the gui and keep the daemon open
  2. What I don't like to see is becoming something as hideous as rsync:
    ❯  man rsync | wc -l  # how many lines are in rsync manual
    3719
    ❯  man rsync | wc -w  # how many words are in rsync manual
    31464

    but at the same time I would love to see Flameshot be used by many people in their workflow in different ways which means it should be very integratable and configurable. So I'm not against adding flags to CLI.

I'll just tag few of the devs here for their opinion and further discussion. @borgmanJeremy @ZetaoYang @Martin-Eckleben @hosiet

borgmanJeremy commented 3 years ago

@mmahmoudian I am good to add this. I could see it being really useful for automated testing as well. We already have an asynchronous interface with d-bus so it should be pretty straightforward.

holazt commented 3 years ago

@solonovamax First of all, flameshot gui is a custom selection for taking screenshots, when the capture widget is displayed, it is waiting for the user to select the area by himself before proceeding to the next step.

If you want to take a screenshot directly and don't want to show the capture widget, you can use flameshot screen or flameshot full to take a screenshot. The -d option is for a time-delayed screenshot operation. e. g., flameshot full -p /mnt/d -d 5000 or flameshot screen -p /mnt/d -d 5000 (The time unit is milliseconds).

@mmahmoudian @borgmanJeremy Plus, I think it would be possible to just add a maximum wait time option to the flameshot gui custom selection, and close (cancel) the capture widget if this maximum wait time is exceeded. When using it, if the user does not add this maximum wait time, the capture widget will not be closed (cancelled) by default.

solonovamax commented 3 years ago

@ZetaoYang yeah, I know that flameshot gui shows the gui specifically. That's why I'd like to have some kind of a timeout for it.

Because my exact use case is this: I have some commands I can trigger from my phone (using KDE connect) and one of them is to take a screenshot with the gui and share it with my phone (another is a full screen capture without the widget, but that works fine.) and I'm worried that I might accidentally trigger it. So, it'd be nice if there was some kind of timeout for the gui call.