This script installs Flameshot and configures a custom GNOME keyboard shortcut to launch it with the Print key. It's properly set up to work under Wayland, the default session in Ubuntu 24.04 and later.
Ubuntu 24.04 and newer versions use Wayland instead of X11 by default. Many users encounter “Unable to capture screen” errors when using Flameshot with default GNOME shortcuts in a Wayland environment.
This script directly addresses this issue by:
- Ensuring the APT version of Flameshot is installed, removing any conflicting Snap version if detected.
- Setting the necessary
QT_QPA_PLATFORM=waylandenvironment variable for proper Wayland compatibility. - Automating the creation of a custom GNOME shortcut for the Print key, which is configured to work correctly with Flameshot under Wayland.
References:
To install Flameshot and configure the shortcut, simply paste this command into your terminal. It will first ensure curl is installed and then run the installer.
sudo apt-get install -y curl && \
curl -fsSL https://raw.githubusercontent.com/haydar/flameshot-ubuntu-wayland-fix/main/flameshot-install.sh | bash