Permissions
Choose which programs may capture the screen, inject input, or read the clipboard
By default, any program can capture the screen, read the clipboard, and send fake input. Permissions limit that to programs you allow.
sweets.permissions({ enforce = true })
sweets.permission({
program = "/usr/lib/xdg-desktop-portal-wlr",
protocol = "screencopy",
mode = "allow",
})
sweets.permission({ program = "/usr/bin/grim", protocol = "screencopy", mode = "allow" })
sweets.permission({ program = "/usr/bin/wl-paste", protocol = "data_control", mode = "allow" })Allow your screen-sharing portal before you turn on enforce, or screen
sharing stops working everywhere.
Restart Sweets after changing permissions. A reload doesn't change them.
On FreeBSD, executable-based rules cannot grant access yet. See the FreeBSD limits.
sweets.permissions
| Field | Default | Effect |
|---|---|---|
enforce | false | true blocks everything no rule allows |
sweets.permission
Each call adds one rule.
| Field | Effect |
|---|---|
program | Full path to the program, or a pattern |
protocol | One protocol from the table below, or a list |
mode | "allow" or "deny" |
| Protocol | Covers | Used by |
|---|---|---|
screencopy | Screenshots and screen sharing | grim, sweetshot, xdg-desktop-portal-wlr, wf-recorder |
virtual_input | Fake keyboard and mouse input | wtype, wlrctl |
data_control | Clipboard access | wl-copy, wl-paste, sweetshot, clipboard managers |
gamma_control | Screen color temperature | gammastep |
output_management | Monitor settings | wlr-randr, kanshi |
If several rules match, the last one wins:
-- Everything in /usr/bin may send input, except wtype.
sweets.permission({ program = { prefix = "/usr/bin/" }, protocol = "virtual_input", mode = "allow" })
sweets.permission({ program = "/usr/bin/wtype", protocol = "virtual_input", mode = "deny" })A program that needs several protocols takes a list. A suffix pattern
matches it wherever it is installed:
-- sweetshot captures the screen and copies the shot to the clipboard.
sweets.permission({
program = { suffix = "/bin/sweetshot" },
protocol = { "screencopy", "data_control" },
mode = "allow",
})See sweetshot.
A blocked program usually reports that the compositor doesn't support the feature.
Finding a program's path
Blocked programs are logged:
grep "permission policy" ~/.local/state/sweets/sweets.logCopy the program= path into your rule. Scripts show up as their interpreter,
like /usr/bin/python3.
Limits
- Flatpak and other sandboxed apps are always blocked from these protocols.
- If your config fails to load at startup, permissions aren't enforced.
- This prevents accidents. It isn't a security guarantee.