diff --git a/README.md b/README.md index 87696311..43ca87ec 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,8 @@ - [Features](#features) - [Usage](#usage) + - [Usage on Windows](#usage-on-windows) + - [Usage on Hyprland / Sway / wlroots](#usage-on-hyprland--sway--wlroots) - [CLI configuration](#cli-configuration) - [Config file](#config-file) - [Keyboard Shortcuts](#keyboard-shortcuts) @@ -161,6 +163,10 @@ running `flameshot.exe -h`. If you require console output, run `flameshot-cli.exe` instead. `flameshot-cli.exe` is a minimal wrapper around `flameshot.exe` that ensures all stdout is captured and output to the console. +### Usage on Hyprland / Sway / wlroots + +Please [refer to this document](docs/UsageHyprlandSwayWlroots.md) for detailed instructions on how to set up Flameshot on Hyprland, Sway, and wlroots-based Wayland compositors. + ### CLI configuration You can use the graphical menu to configure Flameshot, but alternatively you can use your terminal or scripts to do so. diff --git a/docs/Sway and wlroots support.md b/docs/UsageHyprlandSwayWlroots.md similarity index 77% rename from docs/Sway and wlroots support.md rename to docs/UsageHyprlandSwayWlroots.md index 8138d328..81e3a0c8 100644 --- a/docs/Sway and wlroots support.md +++ b/docs/UsageHyprlandSwayWlroots.md @@ -1,3 +1,42 @@ +# Hyprland support + +Flameshot works out of the box with very little configuration on Hyprland, as long as [`xdg-desktop-portal-hyprland`](https://wiki.hypr.land/Hypr-Ecosystem/xdg-desktop-portal-hyprland/) is installed and running. + +Below is a simple setup that you can use as a starting point: + +> [!NOTE] +> This example uses the new Lua config format introduced in Hyprland v0.55 + +```lua +-- KEY BINDINGS +-- PrintScreen key pressed -> the currently focused monitor (the one containing the cursor) is captured, and the Flameshot GUI is brought up for annotating, cropping, etc. +hl.bind("Print", function() + local mon = hl.get_active_monitor() + local n = mon and mon.id or 0 + hl.dispatch(hl.dsp.exec_cmd("flameshot screen --number " .. n .. " --edit")) +end) + +-- WINDOW RULES +hl.window_rule({ + match = { class = "flameshot" }, + no_anim = true, + pin = true, + float = true, + decorate = false, + no_blur = true, + no_shadow = true, +}) +hl.window_rule({ + match = { class = "flameshot", title = "flameshot" }, + move = { 0, 0 }, +}) +hl.window_rule({ + match = { class = "flameshot", title = "flameshot-pin" }, + move = { "cursor_x-(window_w*0.5)", "cursor_y-(window_h*0.5)" }, +}) +``` + + # Sway and wlroots support 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.