Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ depends=('qt6-base' 'qt6-svg' 'hicolor-icon-theme' 'kguiaddons')
makedepends=('qt6-tools' 'cmake' 'ninja')
optdepends=(
'gnome-shell-extension-appindicator: for system tray icon if you are using Gnome'
'grim: for wlroots wayland support'
'xdg-desktop-portal: for wayland support, you will need the implementation for your wayland desktop environment'
'qt6-imageformats: for additional export image formats (e.g. tiff, webp, and more)'
)
Expand Down
2 changes: 1 addition & 1 deletion docs/Sway and wlroots support.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Flameshot currently supports Sway and other wlroots based Wayland compositors through [xdg-desktop-portal-wlr](https://github.com/emersion/xdg-desktop-portal-wlr). However, due to the way dbus works, there may be some extra steps required for the integration to work properly.

## Basic steps
The following packages need to be installed: `xdg-desktop-portal xdg-desktop-portal-wlr grim`. Please ensure your distro packages these, or install them manually.
The following packages need to be installed: `xdg-desktop-portal xdg-desktop-portal-wlr`. Please ensure your distro packages these, or install them manually.

Ensure that environment variables are set properly. If your distro does not set them automatically, use a launch script to export `XDG_CURRENT_DESKTOP=sway` or `XDG_CURRENT_DESKTOP=river` **before** Sway or River is launched.
```sh
Expand Down
6 changes: 0 additions & 6 deletions flameshot.example.ini
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@
;; Whether the tray icon is disabled (bool)
;disabledTrayIcon=false
;
;; Use grim-based wayland universal screenshot adapter (bool)
;useGrimAdapter=false
;
;; Disable Grim Warning notification (bool)
;disabledGrimWarning=true
;
;; Automatically close daemon when it's not needed (bool)
;; (This option is not available on Windows)
;autoCloseIdleDaemon=false
Expand Down
28 changes: 0 additions & 28 deletions src/config/generalconf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ GeneralConf::GeneralConf(QWidget* parent)
initAutoCloseIdleDaemon();
#endif
initShowTrayIcon();
initUseGrimAdapter();
initShowDesktopNotification();
initShowAbortNotification();
#if !defined(DISABLE_UPDATE_CHECKER)
Expand Down Expand Up @@ -124,10 +123,6 @@ void GeneralConf::_updateComponents(bool allowEmptySavePath)
#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
m_showTray->setChecked(!config.disabledTrayIcon());
#endif

#if defined(Q_OS_LINUX)
m_useGrimAdapter->setChecked(config.useGrimAdapter());
#endif
}

void GeneralConf::updateComponents()
Expand Down Expand Up @@ -160,11 +155,6 @@ void GeneralConf::showAbortNotificationChanged(bool checked)
ConfigHandler().setShowAbortNotification(checked);
}

void GeneralConf::useGrimAdapter(bool checked)
{
ConfigHandler().useGrimAdapter(checked);
}

#if !defined(DISABLE_UPDATE_CHECKER)
void GeneralConf::checkForUpdatesChanged(bool checked)
{
Expand Down Expand Up @@ -343,24 +333,6 @@ void GeneralConf::initShowTrayIcon()
#endif
}

void GeneralConf::initUseGrimAdapter()
{
#if defined(Q_OS_LINUX)
m_useGrimAdapter =
new QCheckBox(tr("Use grim to capture screenshots"), this);
m_useGrimAdapter->setToolTip(
tr("Grim is a wayland only utility to capture screens based on the "
"screencopy protocol. Generally only enable on minimal wayland window "
"managers like sway, hyprland, etc."));
m_scrollAreaLayout->addWidget(m_useGrimAdapter);

connect(m_useGrimAdapter,
&QCheckBox::clicked,
this,
&GeneralConf::useGrimAdapter);
#endif
}

void GeneralConf::initHistoryConfirmationToDelete()
{
m_historyConfirmationToDelete = new QCheckBox(
Expand Down
3 changes: 0 additions & 3 deletions src/config/generalconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ private slots:
void showSidePanelButtonChanged(bool checked);
void showDesktopNotificationChanged(bool checked);
void showAbortNotificationChanged(bool checked);
void useGrimAdapter(bool checked);
#if !defined(DISABLE_UPDATE_CHECKER)
void checkForUpdatesChanged(bool checked);
#endif
Expand Down Expand Up @@ -89,7 +88,6 @@ private slots:
void initShowSidePanelButton();
void initShowStartupLaunchMessage();
void initShowTrayIcon();
void initUseGrimAdapter();
void initSquareMagnifier();
void initUndoLimit();
void initUploadWithoutConfirmation();
Expand All @@ -111,7 +109,6 @@ private slots:
QCheckBox* m_sysNotifications;
QCheckBox* m_abortNotifications;
QCheckBox* m_showTray;
QCheckBox* m_useGrimAdapter;
QCheckBox* m_helpMessage;
QCheckBox* m_sidePanelButton;
#if !defined(DISABLE_UPDATE_CHECKER)
Expand Down
18 changes: 18 additions & 0 deletions src/core/capturerequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ CaptureRequest::CaptureRequest(CaptureRequest::CaptureMode mode,
, m_delay(delay)
, m_tasks(tasks)
, m_data(std::move(data))
, m_selectedMonitor(-1)
, m_hasSelectedMonitor(false)
{

ConfigHandler config;
Expand Down Expand Up @@ -86,3 +88,19 @@ void CaptureRequest::setInitialSelection(const QRect& selection)
{
m_initialSelection = selection;
}

void CaptureRequest::setSelectedMonitor(int monitorIndex)
{
m_selectedMonitor = monitorIndex;
m_hasSelectedMonitor = true;
}

int CaptureRequest::selectedMonitor() const
{
return m_selectedMonitor;
}

bool CaptureRequest::hasSelectedMonitor() const
{
return m_hasSelectedMonitor;
}
5 changes: 5 additions & 0 deletions src/core/capturerequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ class CaptureRequest
void addSaveTask(const QString& path = QString());
void addPinTask(const QRect& pinWindowGeometry);
void setInitialSelection(const QRect& selection);
void setSelectedMonitor(int monitorIndex);
int selectedMonitor() const;
bool hasSelectedMonitor() const;

private:
CaptureMode m_mode;
Expand All @@ -57,6 +60,8 @@ class CaptureRequest
ExportTask m_tasks;
QVariant m_data;
QRect m_pinWindowGeometry, m_initialSelection;
int m_selectedMonitor;
bool m_hasSelectedMonitor;

CaptureRequest() {}
};
Expand Down
1 change: 1 addition & 0 deletions src/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ target_sources(
PRIVATE abstractlogger.cpp
filenamehandler.cpp
screengrabber.cpp
monitorpreview.cpp
confighandler.cpp
systemnotification.cpp
valuehandler.cpp
Expand Down
2 changes: 0 additions & 2 deletions src/utils/confighandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ static QMap<class QString, QSharedPointer<ValueHandler>>
OPTION("showDesktopNotification" ,Bool ( true )),
OPTION("showAbortNotification" ,Bool ( true )),
OPTION("disabledTrayIcon" ,Bool ( false )),
OPTION("useGrimAdapter" ,Bool ( false )),
OPTION("disabledGrimWarning" ,Bool ( false )),
OPTION("historyConfirmationToDelete" ,Bool ( true )),
#if !defined(DISABLE_UPDATE_CHECKER)
OPTION("checkForUpdates" ,Bool ( true )),
Expand Down
2 changes: 0 additions & 2 deletions src/utils/confighandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ class ConfigHandler : public QObject
CONFIG_GETTER_SETTER(showAbortNotification, setShowAbortNotification, bool)
CONFIG_GETTER_SETTER(filenamePattern, setFilenamePattern, QString)
CONFIG_GETTER_SETTER(disabledTrayIcon, setDisabledTrayIcon, bool)
CONFIG_GETTER_SETTER(useGrimAdapter, useGrimAdapter, bool)
CONFIG_GETTER_SETTER(disabledGrimWarning, disabledGrimWarning, bool)
CONFIG_GETTER_SETTER(drawThickness, setDrawThickness, int)
CONFIG_GETTER_SETTER(drawFontSize, setDrawFontSize, int)
CONFIG_GETTER_SETTER(drawCircleCounterSize, setDrawCircleCounterSize, int)
Expand Down
81 changes: 81 additions & 0 deletions src/utils/monitorpreview.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: 2026 Jeremy Borgman & Contributors

#include "monitorpreview.h"
#include "src/utils/colorutils.h"
#include "src/utils/confighandler.h"
#include <QLabel>
#include <QMouseEvent>
#include <QScreen>
#include <QVBoxLayout>

MonitorPreview::MonitorPreview(int monitorIndex,
QScreen* screen,
const QPixmap& thumbnail,
QWidget* parent)
: QWidget(parent)
, m_monitorIndex(monitorIndex)
{
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setContentsMargins(10, 10, 10, 10);
layout->setSpacing(10);

QLabel* imageLabel = new QLabel(this);
imageLabel->setAlignment(Qt::AlignCenter);
imageLabel->setPixmap(thumbnail);
imageLabel->setStyleSheet(
"QLabel { background-color: black; border-radius: 8px; }");
imageLabel->setScaledContents(false);

m_textLabel = new QLabel(tr("Monitor %1: %2\nClick to select")
.arg(m_monitorIndex + 1)
.arg(screen->name()),
this);
m_textLabel->setAlignment(Qt::AlignCenter);

layout->addWidget(imageLabel);
layout->addWidget(m_textLabel);

m_uiColor = ConfigHandler().uiColor();
m_contrastColor = ColorUtils::contrastColor(m_uiColor);

// Apply initial themed background to text label only
QString normalStyle =
QString("QLabel { color: white; background-color: rgba(%1, %2, %3, 200); "
"padding: 5px; font-size: 12pt; border-radius: 3px; }")
.arg(m_uiColor.red())
.arg(m_uiColor.green())
.arg(m_uiColor.blue());
m_textLabel->setStyleSheet(normalStyle);
}

void MonitorPreview::mousePressEvent(QMouseEvent* event)
{
Q_UNUSED(event)
emit monitorSelected(m_monitorIndex);
}

void MonitorPreview::enterEvent(QEnterEvent* event)
{
Q_UNUSED(event)
QColor hoverBg = m_contrastColor;
QString hoverStyle =
QString("QLabel { color: white; background-color: rgba(%1, %2, %3, 220); "
"padding: 5px; font-size: 12pt; border-radius: 3px; }")
.arg(hoverBg.red())
.arg(hoverBg.green())
.arg(hoverBg.blue());
m_textLabel->setStyleSheet(hoverStyle);
}

void MonitorPreview::leaveEvent(QEvent* event)
{
Q_UNUSED(event)
QString normalStyle =
QString("QLabel { color: white; background-color: rgba(%1, %2, %3, 200); "
"padding: 5px; font-size: 12pt; border-radius: 3px; }")
.arg(m_uiColor.red())
.arg(m_uiColor.green())
.arg(m_uiColor.blue());
m_textLabel->setStyleSheet(normalStyle);
}
37 changes: 37 additions & 0 deletions src/utils/monitorpreview.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: 2026 Jeremy Borgman & Contributors

#pragma once

#include <QWidget>

class QScreen;
class QPixmap;
class QLabel;
class QEnterEvent;

class MonitorPreview : public QWidget
{
Q_OBJECT
public:
MonitorPreview(int monitorIndex,
QScreen* screen,
const QPixmap& thumbnail,
QWidget* parent = nullptr);

int monitorIndex() const { return m_monitorIndex; }

signals:
void monitorSelected(int index);

protected:
void mousePressEvent(QMouseEvent* event) override;
void enterEvent(QEnterEvent* event) override;
void leaveEvent(QEvent* event) override;

private:
int m_monitorIndex;
QColor m_uiColor;
QColor m_contrastColor;
QLabel* m_textLabel;
};
Loading
Loading