Skip to content

Fix not closing when taking rectangle screenshots in background/DBus mode, improve command line option handling

Noah Davis requested to merge work/ndavis/rectangle-close into master

bd002309: Only UI CaptureModes, no ExportManager CaptureMode, better CLI handling

This is all one commit since the changes require each other to keep Spectacle functioning as well as it did before the patch.

ExportManager only stored the capture mode for determining whether to format window titles in file names. This change makes it so we don't have to syncronize as many states with ExportManager.

PlatformXcb now clears ExportManager's window title when a non-window grabbing GrabMode is used via the windowTitleChanged signal.

CaptureModeModel now only has capture modes represented in the UI. For getting the TransientWithParent grab mode, we are supposed to use the transientOnly setting. Using that is awkward, but that's how it was supposed to be and would take a lot more effort to change in a way that has a high chance of being genuinely better.

Command line options are now more organized in the code and more consistently handled in actual use. When running spectacle via CLI with an existing instance and without specifying --new-instance, any command line options you specify will now be respected in the existing instance instead of just being ignored or only partially used.

5c5d9f2d: GrabMode::InvalidChoice -> GrabMode::NoGrabModes

It's a name more consistent with how we name flags elsewhere. Also reformat the values for GrabMode to make them easier to understand.

176538b7: Make window related grab modes fall back to the most similar grab mode

e4f3c646: ExportManager: use more consistent member variable names

In line with our code policies.

54ccca89: make activate() workingDirectory arg unused instead of unnamed

Makes it easier to understand what it was supposed to mean in LSP/IDE popups.

581e7bc1: main.cpp: add comment explaining how requestActivated works

27ee7b30: SpectacleCore: set notification parent, use consistent variable name

388d3e11: Set quit on last window closed when creating a GUI

BUG: 463344

Tests to try:

spectacle # keep this running for all the GUI mode commands
# in a separate terminal shell instance:
spectacle --pointer --no-decoration --delay 6000 --copy-path --activewindow
spectacle --pointer --delay 6000 --copy-image --windowundercursor # use this on a QMenu
spectacle --pointer --delay 6000 --copy-image --windowundercursor --transientonly # use this on a QMenu
spectacle --pointer --delay 3000 --copy-image --region
spectacle --delay 5000 --fullscreen
spectacle --onclick --current # needs multiple screens
spectacle --launchonly # should show the take a new screenshot dialog
spectacle --background --nonotify # removes all windows, saves all screens, no notification, closes spectacle
spectacle --background --region # starts a rectangle capture, shows notification on save, closes spectacle when notification expires
Edited by Noah Davis

Merge request reports