Commit Graph

1072 Commits

Author SHA1 Message Date
Jeremy Borgman c9633f3581 Remove deprecated msg and added error message 2026-06-25 16:40:36 -05:00
rs-pro0 09a954616c Fix capture when logical min/max coordinates are not zero (#4735) 2026-06-19 15:30:51 -05:00
borgmanJeremy e408812d77 Moving to Qt cmd parser (#4722) 2026-06-10 18:00:40 -05:00
borgmanJeremy 936716b8d8 Adjusting how open with handles temporary files (#4716) 2026-06-08 18:53:53 -05:00
El Thoro 8b039730b5 Replace ifdef LINUX with UNIX to include BSD systems (#4700)
* Replace ifdef LINUX with UNIX to include BSD systems

* Replace  missed ifdef LINUX
2026-05-28 16:50:03 -05:00
borgmanJeremy 090033fe99 respect system proxy settings (#4674) 2026-05-27 18:05:00 -05:00
El Thoro 95032bd2b7 Fix for #3177 (#4680) 2026-05-12 16:47:05 -05:00
Алексей 410cfae9e2 screengrabber: pass non-empty parent_window to xdg-desktop-portal (#4664)
* screengrabber: pass non-empty parent_window to xdg-desktop-portal

xdg-desktop-portal-gnome on GNOME 46 rejects requests where the
parent_window argument is an empty string with the error
"Failed to associate portal window with parent window ''",
which made daemon-mode (tray icon, DBus captureScreen) capture
fail for all GNOME Wayland users.

Allocate an offscreen QWidget (Qt::WA_DontShowOnScreen) so a
winId is generated, and pass "x11:<hex>" on X11 sessions or
"wayland:" on Wayland. Both are accepted by xdg-desktop-portal
as valid no-real-parent handles, while remaining non-empty as
the portal spec requires.

Tested on: Ubuntu 24.04, GNOME 46 Wayland, NVIDIA proprietary
590.48.01, Qt 6.4.2, xdg-desktop-portal-gnome 46.2.

Fixes daemon-mode capture on GNOME 46 Wayland.

* clang format

---------

Co-authored-by: Jeremy Borgman <borgman.jeremy@pm.me>
2026-05-07 07:45:20 -05:00
borgmanJeremy c549f7bd6c fix issue with screen selection in non interactive mode (#4667) 2026-05-03 06:33:59 -05:00
Vladimir Mitnitsky e497f478dc fix(macos): make fullscreen capture overlay configurable (#4622)
macOS showFullScreen() triggers a native fullscreen space transition
animation when capturing. Replace with show() using FramelessWindowHint,
WindowStaysOnTopHint, and Qt::Tool flags to avoid the animation.

Add a 'useNativeFullscreen' config option (default: off) so users who
prefer the native fullscreen behavior can re-enable it from
Settings > General.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-23 20:33:54 -05:00
El Thoro 55c04e8b03 Option to disable tray icon on Windows (#4634) 2026-04-13 07:39:25 -05:00
Vladimir Mitnitsky f5008851c8 feature(macos): show dock icon when any app window is open (#4628)
On macOS with LSUIElement=true, Flameshot runs as an agent app (no dock
icon). This adds a dock icon that appears while any user-facing window
(Settings, About, Launcher, Upload History) is visible and disappears
when the last one is closed or hidden.

Uses QWindow::visibilityChanged signal with a per-window dynamic property
to track visibility state and a reference counter for the activation
policy toggle.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: borgmanJeremy <46930769+borgmanJeremy@users.noreply.github.com>
2026-04-13 07:36:48 -05:00
Vladimir Mitnitsky 016b9197e8 fix(macos): fix clipboard copy failing from tray and GUI (#4629)
The clipboard copy from tray menu and capture GUI was broken on macOS:

1. FlameshotDaemon::copyToClipboard() created a KDSingleApplication
   instance and called isPrimaryInstance(), which always returned false
   (the daemon already holds the socket). This caused a 3-second IPC
   timeout before falling back. Fix: use instance() to check if the
   daemon singleton exists in-process, matching non-macOS behavior.

2. saveToClipboardMime() used setData("image/...") which puts a lazy
   reference on the macOS pasteboard. If the app exits before paste,
   data is lost ("Cannot keep promise"). Fix: use setImageData() for
   native pasteboard persistence, plus setData() for exact format.

3. saveJpegToClipboardMacOS() used osascript with a temp file and
   incorrectly labeled JPEG data as PNG UTI. Removed entirely — the
   fixed saveToClipboardMime() now handles both JPEG and PNG.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-12 08:07:44 -05:00
Vladimir Mitnitsky ef678de7a1 fix(macos): use proper macos api to get privacy screen recorder access (#4617) 2026-04-12 08:04:37 -05:00
Vladimir Mitnitsky d888a3f16c fix(macos): prevent config tab content from rendering behind tab bar (#4627)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-08 20:03:49 -05:00
El Thoro 9dfdab8c48 Fix pin position on Windows for scaled screen (#4614) 2026-04-06 16:14:25 -05:00
borgmanJeremy 8cf641d0da Added dbus capture (#4605) 2026-03-31 09:52:16 -05:00
borgmanJeremy 8fab4556f6 Fixed issue with comsic not being full screen (#4596) 2026-03-30 06:29:26 -05:00
borgmanJeremy 9803b386c2 Added feature on x11 and windows to capture active monitor (#4594) 2026-03-28 06:05:36 -05:00
borgmanJeremy 0ad3357a76 Added x11 fallback (#4588) 2026-03-26 19:14:42 -05:00
El Thoro 6e74dbe189 Code quality: Consistent includes, remove unused includes (#4587)
* Add pragma once

* Consistent includes

* Remove unused includes

* Fix Windows build

* Fix Windows build
2026-03-26 17:39:10 -05:00
Benigno Batista Júnior b26cf40e51 fix: remove duplicate layout parent in SidePanelWidget (#4578)
The widget's layout is set in the member initializer list (line 25)
via m_layout(new QVBoxLayout(this)). Passing 'this' to the QHBoxLayout
constructor at line 84 tries to set a second layout on the same widget,
which Qt rejects with a warning on every capture:

  QLayout: Attempting to add QLayout "" to SidePanelWidget "",
  which already has a layout

The parent argument is unnecessary since the layout is added to
m_layout via addLayout() at line 94.

Co-authored-by: Benigno Batista Júnior <benigno@opus-software.com.br>
2026-03-21 06:35:49 -05:00
borgmanJeremy eebcc1c0f5 Fix X11 crash (#4570) 2026-03-21 06:33:44 -05:00
Eric Blanquer 3eb366e038 Hide monitor selection in launcher when only one screen is connected and make launcher UI more compact (#4569) 2026-03-14 14:34:36 -05:00
El Thoro 199ff2586a Windows: Global "take screenshot" shortcut (#4556)
* Enable QHotkey on Windows to define global shortcut for taking screenshot

* Check if Windows forces PrntScr for its snipping tool; provide the option to change corresponding registry key by Flameshot

* Option to register Flameshot as MS-SCREENCLIP application

* clang-format

* Default shortcut

* Minor: Move MsScreenclip initialization to separate function

* Minor: Move MsScreenclip initialization to separate function
2026-03-14 09:59:28 -05:00
borgmanJeremy d4956a87cd Fixed screen subcommand to fit per screen paradigm (#4544)
* Fixed screen subcommand to fit per screen paradigm

* Full subcommand fix
2026-03-04 18:06:13 -06:00
borgmanJeremy 4a32a7e86a Fix race condition caused by improper dbus hack (#4547) 2026-03-02 18:42:25 -06:00
borgmanJeremy b5224b5de3 When in CLI mode qApp needs to be deleted before exiting or Qt's destructor complains (because of the memory leak that would occur) (#4546) 2026-03-02 18:42:20 -06:00
El Thoro 76d883362f Add option for portable binary (using flameshot.ini in app folder) (#4531)
* Option to build a portable binary, which is using flameshot.ini in application folder.

* Align Qt version

* Fix appveyor

* Fix appveyor

* Fix appveyor
2026-02-24 06:46:32 -06:00
borgmanJeremy 42c462bb97 Fix last region on scaled displays (#4530) 2026-02-23 15:49:57 -06:00
Benigno Batista Júnior c2cae0301b fix: use runtime detection for Wayland clipboard (#4497)
When compiled with USE_WAYLAND_CLIPBOARD, the clipboard now works
correctly on both Wayland and X11 sessions.

Previously, builds with USE_WAYLAND_CLIPBOARD=ON would always use
KSystemClipboard, which doesn't work properly when running under X11
(e.g., via XWayland or QT_QPA_PLATFORM=xcb).

This change adds a runtime check for the platform name:
- 'wayland' -> uses KSystemClipboard (KF6 GuiAddons)
- otherwise -> uses QApplication::clipboard() (standard Qt)

This allows distros to ship a single binary that works on both
display servers without requiring separate builds.

Co-authored-by: Benigno Batista Júnior <benigno@opus-software.com.br>
2026-02-21 07:29:17 -06:00
borgmanJeremy 3ef8f093d3 fix build issue in debug mode and cleanup wording (#4525)
* fix build issue in debug mode and cleanup wording

* clang format
2026-02-19 06:03:53 -06:00
borgmanJeremy 53d4da8fcd Multimonitor fix (#4498)
* Rework capture system to only enter fullscreen widget on one monitor

* Sort monitor previews by screen position instead of Qt index (#4522)

The monitor selection dialog displayed monitors in Qt's default
screen order (by connector name, e.g. DP-1 before DP-2), which
can differ from the physical arrangement configured in the display
settings. This sorts the preview widgets by their X geometry
position so they match the user's actual left-to-right layout.

---------

Co-authored-by: Brian J. Cohen <brianjcohen@gmail.com>
2026-02-18 16:01:37 -06:00
Benigno Batista Júnior c4000368c8 fix: check QPainter::isActive() before drawing in Wayland (#4496)
On Wayland, the backing store may not be ready when paintEvent is called,
causing QPainter to fail with 'Paint device returned engine == 0'.

This adds isActive() checks to prevent crashes when the painter
cannot be initialized.

Fixes crashes on KDE Plasma Wayland with Qt 6.
2026-02-03 15:41:30 -06:00
Hanchin Hsieh 72a5afc31c fix: copy to clipboard not work on macOS terminal (#4473) 2026-01-20 17:15:04 -06:00
BackSlasher 85ef3fe4c2 grim: set device pixel ratio on captured screenshots (#4479) 2026-01-19 13:32:00 -06:00
borgmanJeremy fcb35b4793 rework the update checker, menu item, and notifier (#4481) 2026-01-19 11:03:46 -06:00
borgmanJeremy 5a075c17b8 fix cosmic to use freedesktopportal (#4477) 2026-01-19 08:53:13 -06:00
Jacob Zhong 042fa5bd1d change source for mac icon (#4423) 2026-01-13 19:48:39 -06:00
borgmanJeremy 0a9983b057 Revert "Add support for logging to a log file in the $XDG_STATE_DIR/flameshot…" (#4425)
This reverts commit 0f37bf0997.
2025-12-03 20:16:06 -06:00
borgmanJeremy 7ed3cfc83e cleanup compiler warnings due to Qt function labeling return value no… (#4415)
* cleanup compiler warnings due to Qt function labeling return value nodiscard

* clang format
2025-11-29 07:17:22 -06:00
borgmanJeremy 279adc7317 fix segfault from double right click (#4414)
* fix segfault from double right click

* clang format
2025-11-29 07:16:34 -06:00
no7076 535032b173 Fix copy failure on GNOME via GUI (#4363)
* Fix copy failure on GNOME
My suspicion is that GNOME and specifically Mutter requires specific trusted context for the QtClipboard (from 'kf.guiaddons: Could not init WaylandClipboard, falling back to QtClipboard.') clipboard operation. This means that a visible window must provide the clipboard data. Since the daemon has no visible window, this is a workaround that makes the 'flameshot gui' window handle the copying with a slight delay using QTimer to ensure that GNOME has requested the clipboard data and saved it.

This seems like a better solution #4355 as no helper windows are needed, since we already have the 'flameshot gui' window and can use it. I've limited it to GNOME only as I cannot easily test in other environments.

Fixes #4116, #4298

* Keep capture window alive until GNOME fetches clipboard data

* Move the GNOME clipboard workaround in screenshotsaver.cpp

* Log GNOME clipboard timeout and restore success notification

* Apply linter fixes
2025-11-28 10:43:41 -06:00
El Thoro d54096e76c Force PNG clipboard on Windows (#4413) 2025-11-28 10:35:24 -06:00
Sam Coulter 0f37bf0997 Add support for logging to a log file in the $XDG_STATE_DIR/flameshot (#4371)
(or equivelent directories on windows/mac-os)

By default logging to file is enabled for all log messages.

Filtering log messages written to disk by level severity and choosing a
different path to save the log files is configurable via the config menu.

There is also a shortcut on the about menu popup to open the configured
logging directory. This shortcut is disabled if logging to file is
disabled

The log file implements a simple roller that saves only the two most
recent sets of logs generated by flameshot. This should stop log
messages from eating users' disk.

We use cmake to check the version of QT6. If greater than or equal to
6.7, we set the default log directory to the standard App State
directory. If not, we use the app local data directory
2025-11-18 19:33:18 -06:00
Sam Coulter 805f9d78f1 Fix hang caused by no Notifications service registered in DBus (#4357)
Issue #4353

Add a check when looking up the `org.freedesktop.Notifications` service
to see if the it actually exists before trying to fetch it

Add a check on QDBus service lookup in screengrabber freedesktop
2025-11-10 16:53:11 -06:00
borgmanJeremy bba3d1d57b link to qtdbus on macos (#4325) 2025-10-28 15:42:33 -05:00
Avineet Singh 3602d0a793 Fix multiple memory leaks in Region::process() function (#4284)
* Fix multiple memory leaks in Region::process() function

- Add proper cleanup for allocated QApplication object
- Add proper cleanup for allocated char** argv array
- Add proper cleanup for allocated int* argc pointer
- Ensure all return paths properly clean up allocated memory
- Prevents memory leaks when Region::process() is called

Fixes multiple memory leaks identified in codebase analysis.

* Apply clang-format to fix code style compliance

- Remove trailing whitespace
- Normalize line endings
- Ensure compliance with project's clang-format rules

Fixes CI test-clang-format workflow failure.

* Refactor cleanup logic in Region::process

Introduced a cleanup lambda to handle memory deallocation in Region::process, replacing repeated code with a single reusable function for better maintainability and readability.

* Format cleanup lambda for readability

Reformatted the cleanup lambda in Region::process for improved readability by expanding it to multiple lines.

* Refactor Region::process to use smart pointers

Replaces manual memory management with std::unique_ptr for temporary QApplication and argument variables. Removes redundant cleanup logic for improved safety and readability.
2025-10-26 20:13:40 -05:00
Avineet Singh f8ab6a6751 Fix memory leak in guiMutexLock() function (#4277)
- Add proper cleanup when QSharedMemory::create() fails
- Prevents memory leak when mutex creation fails on GUI capture attempts
- Ensures allocated QSharedMemory object is deleted before returning nullptr

Fixes potential memory leak identified in codebase analysis.
2025-10-06 19:29:38 -05:00
Aman Chaturvedi d5acafff05 chore: fix typo in comment in GlobalShortcutFilter (#4274)
* chore: fix typo in comment in GlobalShortcutFilter

* chore: fix typos in comments and function names

- Fix 'temporal workwrround' to 'temporary workaround' in GlobalShortcutFilter
- Fix 'habdler' to 'handler' in ButtonHandler comment
- Fix 'the the' to 'to the' in ButtonHandler comment
- Fix 'minimun' to 'minimum' in ButtonHandler function name

---------

Co-authored-by: Aman Chaturvedi <aman.chaturvedi@kpit.com>
2025-10-03 19:22:30 -05:00