In Wayland environments, particularly with window managers like Hyprland, traditional screenshot tools like Flameshot may not work seamlessly. Fortunately, you can achieve the same functionality using lightweight tools such as grim
, slurp
, and swappy
. These tools allow you to capture screenshots, select regions, and annotate them, all while being optimized for Wayland. In this guide, we’ll walk through setting up these tools as a replacement for Flameshot and binding them to a key in Hyprland on an Arch Linux system.
Step 1: Install the required tools
Ensure you have installed the following tools:
sudo pacman -S grim slurp swappy
Step 2: Create a screenshot command
The command grim -g "$(slurp)" - | swappy -f -
works as follows:
- grim: Captures the screen or a selected region.
- slurp: Allows you to select a region of the screen using your mouse.
- swappy: Opens the captured screenshot in an editor for annotations.
Step 3: Test the command
Open a terminal and run the following command to capture a region and open it in Swappy for editing:
grim -g "$(slurp)" - | swappy -f -
You should be able to select a region with slurp
, take a screenshot with grim
, and annotate it with swappy
.
Step 4: Add a key binding in Hyprland
To bind this to a key in Hyprland, add the following to your Hyprland configuration file (usually located at ~/.config/hypr/hyprland.conf
):
bind=MOD,KEY,exec,grim -g "$(slurp)" - | swappy -f -
- Replace
MOD
with your preferred modifier (e.g.,SUPER
orCTRL
). - Replace
KEY
with the key you want to use for the screenshot (e.g.,S
).
For example, to bind the command to Super + S
:
bind=SUPER,S,exec,grim -g "$(slurp)" - | swappy -f -
Step 5: Reload Hyprland config
After updating the configuration, reload Hyprland for the changes to take effect:
hyprctl reload
Now, pressing Super + S
(or your chosen keybinding) will allow you to capture and edit screenshots as an alternative to Flameshot.
Original idea: https://discourse.nixos.org/t/screenshots-on-hyprland-on-nixos/29055/4