forked from micaelbergeron/xcmenu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.def.h
134 lines (122 loc) · 4.61 KB
/
config.def.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/* path to lock file */
#define LOCK_FILE "/tmp/xcmenu.pid"
/* dmenu mode character limit */
#define DMENU_LIMIT 230
/* zlib compression level */
#define ZLIB_LEVEL Z_BEST_SPEED
/* maximum request size until we INCR send it */
#define MAX_INCR UINT_MAX /* bytes */
/* zlib compression? */
static char USE_ZLIB = 1;
/* clipboard post-process flags explained */
enum {
CLIPBOARD_NONE = 0x00,
CLIPBOARD_TRIM_WHITESPACE = 0x01, /* trim trailing and leading whitespace */
CLIPBOARD_TRIM_WHITESPACE_NO_MULTILINE = 0x02, /* trim whitespace, if not multiline */
CLIPBOARD_TRIM_TRAILING_NEWLINE = 0x04, /* trim trailing newline */
CLIPBOARD_OWN_IMMEDIATLY = 0x08, /* own clipboard immediatly after new data */
CLIPBOARD_CLEAR_SELECTIONS = 0x1 /* clear all special selections on copy.
this is how X applications expect the clipboard to behave */
};
/* registered clipboards and their settings
* xcmenu will only handle the registered clipboards
*
* arguments are following:
* REGISTER_CLIPBOARD(
* clipboard name,
* name of clipboard you want to synchorize to,
* maximum allowed length for clipboard history,
* post-processing flags for new clipboard data
* )
*
* Owning clipboard immediatly will give you the
* post processed snippet immediatly, however
* owning clipboard immediatly will cause the previous
* owner to lose control of it (eg. PRIMARY selection disappears).
*
* So using that flag is not recommended for PRIMARY at least.
*
* Note that synced clipboards are owned when syncing happens,
* you can notice this visually if you sync to PRIMARY for example,
* so that the selection from application disappears.
*
*/
clipdata clipboards[] = {
REGISTER_CLIPBOARD("PRIMARY", NULL, 0, CLIPBOARD_NONE),
REGISTER_CLIPBOARD("SECONDARY", NULL, 0,
CLIPBOARD_OWN_IMMEDIATLY),
REGISTER_CLIPBOARD("CLIPBOARD", "PRIMARY", 150,
CLIPBOARD_CLEAR_SELECTIONS),
};
/* registered special selections and their settings
* xcmenu will only handle the registered special selections
*
* arguments are following:
* REGISTER_SELECTION(
* special selection name,
* data index,
* reset after new copy?
* )
*
* I've included python script on the git repo that you can use
* to get targets from different X applications, which xcmenu treats
* as "special selections".
*
* If ctrl-c isn't working in some application as expected when xcmenu
* is running, it's most like that the target isn't registered here.
*
* The data you get usually depends on application.
* But most of the time the data is prioritized by the below list,
* from top to bottom.
*
* The data index specifies on which slot the data will be stored,
* selections with same data slot replaces the old data.
*
* For example, if you copied image/tiff data,
* and later image/jpeg, the image/tiff data would be replaced by,
* the image/jpeg data.
*
* If the same application offers data in multiple formats that are
* marked as shared in xcmenu, then the data higher in the list
* is prioritized for shared clipboard.
*
* If reset is set to 1, the data is reset after new copy regardless if the
* copy had data for the special selection.
*
* NOTE: Reset bit is useless when CLEAR_SELECTIONS bit flag is enabled
* for clipboard. It's effectietly same as settin reset bit for every special selection.
*
*/
static specialclip sclip[] = {
REGISTER_SELECTION("text/uri-list", 0, 0),
REGISTER_SELECTION("x-special/gnome-copied-files", 0, 0),
REGISTER_SELECTION("application/x-kde-cutselection", 0, 0),
REGISTER_SELECTION("image/svg+xml", 1, 0),
REGISTER_SELECTION("image/png", 1, 0),
REGISTER_SELECTION("image/tiff", 1, 0),
REGISTER_SELECTION("image/jpeg", 1, 0),
REGISTER_SELECTION("image/x-bmp", 1, 0),
REGISTER_SELECTION("image/x-icon", 1, 0),
REGISTER_SELECTION("image/x-ico", 1, 0),
REGISTER_SELECTION("image/bmp", 1, 0),
REGISTER_SELECTION("image/x-win-bitmap", 1, 0),
REGISTER_SELECTION("image/x-MS-bmp", 1, 0),
REGISTER_SELECTION("text/plain", 2, 1),
REGISTER_SELECTION("text/richtext", 2, 1),
REGISTER_SELECTION("text/html", 2, 1),
};
/* command sequence starter */
#define XCMENU_CMD_SEQ "#LC:"
/* bit flags for command sequence actions */
typedef enum clipflag {
CLIP_NONE = 0x0,
CLIP_SKIP_HISTORY = 0x1, /* skips clipboard history */
} clipflag;
/* commands and their assigned bits */
static cmdseq cmdseqs[] = {
{ "skip_history:", CLIP_SKIP_HISTORY }
};
/* example of command sequence:
* #LC:skip_history:<clipboard text here>
*/
/* vim: set ts=8 sw=3 tw=0 :*/