Bug 468874 - Using background mode with `-b` to hide the GUI and just save to a file with `-o` no longer works with `-region`.
Summary: Using background mode with `-b` to hide the GUI and just save to a file with ...
Status: RESOLVED INTENTIONAL
Alias: None
Product: Spectacle
Classification: Applications
Component: General (show other bugs)
Version: 23.04.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Noah Davis
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-23 18:39 UTC by incoming
Modified: 2023-04-24 01:50 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description incoming 2023-04-23 18:39:21 UTC
SUMMARY

Using `-b` to hide the GUI and just save to a file with `-o` no longer works with `-region`. This instead causes spectacle to open it's GUI after selecting the region to capture, and does not save to the selected file.

The previous behavior when using `-region -b -o="$HOME/somefile.png"` would immediately let you select a region, and save it to a file once selected without showing the GUI.

This issue does not happen with the active window and other selection options, only with selecting a region.

STEPS TO REPRODUCE
1. `spectacle -region -b -o="$HOME/somefile.png"`
2. Left click (for some reason, immediately dragging to capture no longer works)
3. Region toolbar appears, drag region
4. Spectacle GUI opens without saving the file.

OBSERVED RESULT

Left click drag does not immediately select a region, and GUI opens after selecting a region.

EXPECTED RESULT

Left click drag should select a region immediately, and the GUI should not open and instead save the region to a file.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.27.4
KDE Frameworks Version: 5.105.0
Qt Version: 5.15.9
Kernel Version: 6.2.9-arch1-1 (64-bit)
Graphics Platform: X11
Processors: 4 × Intel® Core™ i7-8665U CPU @ 1.90GHz
Memory: 15.3 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics 620
Manufacturer: LENOVO
Product Name: 20QD000LUS
System Version: ThinkPad X1 Carbon 7th

ADDITIONAL INFORMATION
Comment 1 Noah Davis 2023-04-23 18:45:16 UTC
Note, you're supposed to use `--region` or `-r`, not `-region`. If you use `--region`, does it work for you?
Comment 2 incoming 2023-04-23 19:36:10 UTC
Ah, my screenshot tool had `-region` hardcoded as an option, I'm assuming it was being parsed as `-r` previously and worked just fine, using `-r` or `--region` works just fine now! Thank you for letting me know :)
Comment 3 Noah Davis 2023-04-24 00:21:13 UTC
(In reply to incoming from comment #2)
> Ah, my screenshot tool had `-region` hardcoded as an option, I'm assuming it
> was being parsed as `-r` previously and worked just fine, using `-r` or
> `--region` works just fine now! Thank you for letting me know :)

Just so you know, here's what's going on when you use `-region`. All of the letters together just happen to be valid single letter flags and single letter flags can be combined without spaces when putting a single dash at the front of all of them:

  -r, --region: Capture a rectangular region of the screen
  -e, --no-decoration: In background mode, exclude decorations in the screenshot
  -g, --gui: Start in GUI mode (default)
  -i, --new-instance: Starts a new GUI instance of spectacle without registering to DBus
  -o, --output <fileName>: In background mode, save image to specified file
  -n, --nonotify: In background mode, do not pop up a notification when the screenshot is taken

`-g` currently gets precidence over `-b` because `-g` would otherwise be a completely useless flag, which is what was causing the change in behavior. If I knew of a way to make the last specified flag override the previous incompatible option, I could make using `-region` work again.
Comment 4 incoming 2023-04-24 01:50:32 UTC
Ah, thank you! That's helpful :)