wl-mitm/config.toml

120 lines
4.2 KiB
TOML

[socket]
# Which socket to listen on? If relative,
# defaults to being relative to $XDG_RUNTIME_DIR
listen = "wayland-10"
# Which Wayland socket to use as upstream?
# If missing, defaults to $WAYLAND_DISPLAY
# upstream = "wayland-1"
[exec]
# A command to invoke when asking the user to permit or deny a
# Wayland request (configured via [[filter.requests]] below).
#
# A status code 0 indicates the request is allowed. Else, it is
# blocked.
#
# If missing, `action = "ask"` will act like `action = "block"`.
#
# The first and second arguments to this program will be the interface
# and request name, respectively. The third argument will be a human-readable
# description for the request, as configured by the `desc` field.
#
# A JSON representation of the request will be passed through via the
# WL_MITM_MSG_JSON env variable.
ask_cmd = "contrib/ask-bemenu.sh"
# A command to invoke when a request filter has `action = "notify"`.
#
# Everything is the same as `ask_cmd`, except that we don't wait for this
# process to finish and we ignore its output and status code. The request
# will not be filtered whatever this command does.
notify_cmd = "contrib/notify-libnotify.sh"
[logging]
# If true, log all known requests (client -> server) at the DEBUG level
# log_all_requests = false
# If true, log all known events (server -> client) at the DEBUG level
# log_all_events = false
# Set the maximum log level output to stdout
# Overrides the RUST_LOG environmet variable if set
# log_level = "info"
[filter]
# A list of Wayland global singleton objects that's allowed
# Each of them generally correspond to an implemented protocol
# Note that we can only allow globals we have a corresponding XML
# file under proto/ for.
allowed_globals = [
# Base wl protocols
"wl_compositor",
"wl_shm",
"wl_data_device_manager",
"wl_output", # each output is also a global
"wl_seat",
# Window management
"xdg_wm_base",
"zxdg_decoration_manager_v1",
# Presentation time (used by video playback)
"wp_presentation",
# Surface scaling
"wp_viewporter",
# Linux DMA-BUF
"zwp_linux_dmabuf_v1",
# Linux DRM (for clients requiring GPU accel)
"wl_drm",
"wp_drm_lease_device_v1",
"wp_linux_drm_syncobj_manager_v1",
# Clipboard manager from wlroots, used for the filter example below.
"zwlr_data_control_manager_v1"
]
# When set to true, do not actually filter anything -- only emit a
# warning when a filter would have been triggered.
# Defaults to false
# dry_run = false
# A list of requests we'd like to filter
[[filter.requests]]
# The interface name in question
interface = "zwlr_data_control_offer_v1"
# List of requests to apply this action to
# In this case, the "receive" request is the one where the client
# asks the server to sent over clipboard data
requests = [ "receive" ]
# What to do? "block" to block it outright; "ask" to invoke
# `ask_cmd` first.
action = "ask"
# A short, human-readable description of the action; passed to the
# `ask_cmd`
desc = "pasting from clipboard (from background)"
# What to do when we need to block the request, either from ask_cmd's return
# value or from `action = "block"`? "ignore" means we'll simply not pass this
# request to the server. "reject" means we'll send an error back (see `error_code`),
# but that also means most client implementations will exit entirely.
# Defaults to "ignore"
block_type = "ignore"
# An error code to send back when this is blocked; defaults to 0
# See the interface's XML definition (or at Wayland explorer) for
# a list of error codes.
# This is only used when `block_type = "reject"`.
#error_code = 0
[[filter.requests]]
interface = "zwlr_data_control_device_v1"
# These are the requests used by clients to set the clipboard content
requests = [ "set_selection", "set_primary_selection" ]
action = "ask"
desc = "overriding clipboard selection"
# This is the paste request used when we press Ctrl-V in a foreground application.
#
# Filtering this would make most apps misbehave whether we use "ignore" or "reject",
# so best course of action is to simply notify the user that the foreground app has
# pasted.
[[filter.requests]]
interface = "wl_data_offer"
requests = [ "receive" ]
action = "notify"
desc = "pasted from clipboard or accepted drag and drop"