Introduction
Introduction Statistics Contact Development Disclaimer Help
st-iso14755-0.8.3.diff - sites - public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log
Files
Refs
---
st-iso14755-0.8.3.diff (2276B)
---
1 diff --git a/config.def.h b/config.def.h
2 index 0895a1f..578a90e 100644
3 --- a/config.def.h
4 +++ b/config.def.h
5 @@ -159,6 +159,11 @@ static unsigned int defaultattr = 11;
6 */
7 static uint forcemousemod = ShiftMask;
8
9 +/*
10 + * Command used to query unicode glyphs.
11 + */
12 +char *iso14755_cmd = "dmenu -w \"$WINDOWID\" -p codepoint: </dev/null";
13 +
14 /*
15 * Internal mouse shortcuts.
16 * Beware that overloading Button1 will disable the selection.
17 @@ -188,6 +193,7 @@ static Shortcut shortcuts[] = {
18 { TERMMOD, XK_Y, selpaste, {.i = …
19 { ShiftMask, XK_Insert, selpaste, {.i = …
20 { TERMMOD, XK_Num_Lock, numlock, {.i = …
21 + { TERMMOD, XK_I, iso14755, {.i = …
22 };
23
24 /*
25 diff --git a/st.1 b/st.1
26 index 39120b4..4a98626 100644
27 --- a/st.1
28 +++ b/st.1
29 @@ -159,6 +159,10 @@ Copy the selected text to the clipboard selection.
30 .TP
31 .B Ctrl-Shift-v
32 Paste from the clipboard selection.
33 +.TP
34 +.B Ctrl-Shift-i
35 +Launch dmenu to enter a unicode codepoint and send the corresponding gl…
36 +to st.
37 .SH CUSTOMIZATION
38 .B st
39 can be customized by creating a custom config.h and (re)compiling the s…
40 diff --git a/st.c b/st.c
41 index 0ce6ac2..532dc8c 100644
42 --- a/st.c
43 +++ b/st.c
44 @@ -1985,6 +1985,28 @@ tprinter(char *s, size_t len)
45 }
46 }
47
48 +void
49 +iso14755(const Arg *arg)
50 +{
51 + FILE *p;
52 + char *us, *e, codepoint[9], uc[UTF_SIZ];
53 + unsigned long utf32;
54 +
55 + if (!(p = popen(iso14755_cmd, "r")))
56 + return;
57 +
58 + us = fgets(codepoint, sizeof(codepoint), p);
59 + pclose(p);
60 +
61 + if (!us || *us == '\0' || *us == '-' || strlen(us) > 7)
62 + return;
63 + if ((utf32 = strtoul(us, &e, 16)) == ULONG_MAX ||
64 + (*e != '\n' && *e != '\0'))
65 + return;
66 +
67 + ttywrite(uc, utf8encode(utf32, uc), 1);
68 +}
69 +
70 void
71 toggleprinter(const Arg *arg)
72 {
73 diff --git a/st.h b/st.h
74 index d978458..7b00dd6 100644
75 --- a/st.h
76 +++ b/st.h
77 @@ -81,6 +81,7 @@ void die(const char *, ...);
78 void redraw(void);
79 void draw(void);
80
81 +void iso14755(const Arg *);
82 void printscreen(const Arg *);
83 void printsel(const Arg *);
84 void sendbreak(const Arg *);
85 @@ -122,3 +123,4 @@ extern char *termname;
86 extern unsigned int tabspaces;
87 extern unsigned int defaultfg;
88 extern unsigned int defaultbg;
89 +extern char *iso14755_cmd;
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.