mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-26 21:00:21 +00:00
command: add clipboard/text-primary property
This property contains the text in the primary selection.
This commit is contained in:
@@ -4171,6 +4171,12 @@ static int mp_property_clipboard(void *ctx, struct m_property *prop,
|
||||
node_map_add_string(&node, "text", data);
|
||||
talloc_free(data);
|
||||
}
|
||||
params.target = CLIPBOARD_TARGET_PRIMARY_SELECTION;
|
||||
data = NULL;
|
||||
if (get_clipboard(mpctx, &data, ¶ms) == M_PROPERTY_OK) {
|
||||
node_map_add_string(&node, "text-primary", data);
|
||||
talloc_free(data);
|
||||
}
|
||||
*(struct mpv_node *)arg = node;
|
||||
return M_PROPERTY_OK;
|
||||
}
|
||||
@@ -4178,7 +4184,9 @@ static int mp_property_clipboard(void *ctx, struct m_property *prop,
|
||||
struct m_property_action_arg *act = arg;
|
||||
const char *key = act->key;
|
||||
|
||||
if (strcmp(key, "text"))
|
||||
if (!strcmp(key, "text-primary"))
|
||||
params.target = CLIPBOARD_TARGET_PRIMARY_SELECTION;
|
||||
else if (strcmp(key, "text"))
|
||||
return M_PROPERTY_UNKNOWN;
|
||||
|
||||
switch (act->action) {
|
||||
|
||||
Reference in New Issue
Block a user