mirror of
https://github.com/rkd77/elinks.git
synced 2025-02-02 15:09:23 -05:00
[clipboard] Added "ui.clipboard_file" to add text to the system clipboard.
ui.clipboard_file is filename of the clipboard file. This file can be a named pipe. See contrib/clipboard/clip.sh how to set up copying to clipboard using socat and xclip. Just run clip.sh (it will be running in a loop) before starting elinks and set ui.clipboard_file = "~/.elinks/clipboard.fifo".
This commit is contained in:
parent
073bad0776
commit
911155a862
8
contrib/clipboard/clip.sh
Executable file
8
contrib/clipboard/clip.sh
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
trap exit SIGTERM SIGINT
|
||||||
|
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
socat -u PIPE:$HOME/.elinks/clipboard.fifo EXEC:"xclip -sel clip"
|
||||||
|
done
|
@ -1459,6 +1459,10 @@ static union option_info config_options_info[] = {
|
|||||||
N_("Keep the session active even if the last terminal "
|
N_("Keep the session active even if the last terminal "
|
||||||
"exits.")),
|
"exits.")),
|
||||||
|
|
||||||
|
INIT_OPT_STRING("ui", N_("Clipboard file"),
|
||||||
|
"clipboard_file", 0, "",
|
||||||
|
N_("Filename of the clipboard file.")),
|
||||||
|
|
||||||
#ifdef HAVE_STRFTIME
|
#ifdef HAVE_STRFTIME
|
||||||
INIT_OPT_STRING("ui", N_("Date format"),
|
INIT_OPT_STRING("ui", N_("Date format"),
|
||||||
"date_format", 0, "%b %e %H:%M",
|
"date_format", 0, "%b %e %H:%M",
|
||||||
|
@ -67,11 +67,13 @@
|
|||||||
|
|
||||||
#include "elinks.h"
|
#include "elinks.h"
|
||||||
|
|
||||||
|
#include "config/options.h"
|
||||||
#include "main/select.h"
|
#include "main/select.h"
|
||||||
#include "osdep/osdep.h"
|
#include "osdep/osdep.h"
|
||||||
#include "osdep/signals.h"
|
#include "osdep/signals.h"
|
||||||
#include "terminal/terminal.h"
|
#include "terminal/terminal.h"
|
||||||
#include "util/conv.h"
|
#include "util/conv.h"
|
||||||
|
#include "util/file.h"
|
||||||
#include "util/memory.h"
|
#include "util/memory.h"
|
||||||
#include "util/string.h"
|
#include "util/string.h"
|
||||||
|
|
||||||
@ -403,6 +405,26 @@ get_clipboard_text(void)
|
|||||||
void
|
void
|
||||||
set_clipboard_text(unsigned char *data)
|
set_clipboard_text(unsigned char *data)
|
||||||
{
|
{
|
||||||
|
unsigned char *f = get_opt_str("ui.clipboard_file", NULL);
|
||||||
|
|
||||||
|
if (f && *f) {
|
||||||
|
unsigned char *filename = expand_tilde(f);
|
||||||
|
|
||||||
|
if (filename) {
|
||||||
|
#ifdef HAVE_ACCESS
|
||||||
|
if (access(filename, W_OK) >= 0) {
|
||||||
|
FILE *out = fopen(filename, "a");
|
||||||
|
|
||||||
|
if (out) {
|
||||||
|
fputs(data, out);
|
||||||
|
fclose(out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
mem_free(filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* GNU Screen's clipboard */
|
/* GNU Screen's clipboard */
|
||||||
if (is_gnuscreen()) {
|
if (is_gnuscreen()) {
|
||||||
struct string str;
|
struct string str;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user