aboutsummaryrefslogtreecommitdiff
path: root/st
diff options
context:
space:
mode:
authorKumar Damani <damani.kumar@gmail.com>2020-05-16 14:20:19 +0000
committerKumar Damani <damani.kumar@gmail.com>2020-05-16 14:20:19 +0000
commit438240ed9e5e475c57c70014c8184feabd1e1690 (patch)
tree26498e25e9cfcd6dd3e7951ba7f1bc34cf559110 /st
parent00997d20e5bf2a7f58775f1f3ab419bb6345f7cf (diff)
added nvim
Diffstat (limited to 'st')
-rw-r--r--st/st/config.h15
-rwxr-xr-xst/st/stbin115704 -> 115704 bytes
-rw-r--r--st/st/st.c11
-rw-r--r--st/st/st.h1
-rw-r--r--st/st/x.c4
5 files changed, 23 insertions, 8 deletions
diff --git a/st/st/config.h b/st/st/config.h
index 6ee8ea9..0c2115b 100644
--- a/st/st/config.h
+++ b/st/st/config.h
@@ -53,6 +53,13 @@ static unsigned int actionfps = 30;
static unsigned int blinktimeout = 800;
/*
+ * interval (in milliseconds) between each successive call to ximspot. This
+ * improves terminal performance while not reducing functionality to those
+ * whom need XIM support.
+ */
+int ximspot_update_interval = 1000;
+
+/*
* thickness of underline and bar cursors
*/
static unsigned int cursorthickness = 2;
@@ -187,6 +194,7 @@ ResourcePref resources[] = {
{ "cwscale", FLOAT, &cwscale },
{ "chscale", FLOAT, &chscale },
{ "alpha", FLOAT, &alpha },
+ { "ximspot_update_interval", INTEGER, &ximspot_update_interval },
};
/*
@@ -214,11 +222,11 @@ MouseKey mkeys[] = {
};
static char *openurlcmd[] = { "/bin/sh", "-c",
- "sed 's/.*│//g' | tr -d '\n' | grep -aEo '(((http|https)://|www\\.)[a-zA-Z0-9.]*[:]?[a-zA-Z0-9./&%?$#=_-]*)|((magnet:\\?xt=urn:btih:)[a-zA-Z0-9]*)'| uniq | sed 's/^www./http:\\/\\/www\\./g' | dmenu -i -p 'Follow which url?' -l 10 | xargs -r xdg-open",
+ "sed 's/.*│//g' | tr -d '\n' | grep -aEo '(((http|https)://|www\\.)[a-zA-Z0-9.]*[:]?[a-zA-Z0-9./@&%?$#=_-]*)|((magnet:\\?xt=urn:btih:)[a-zA-Z0-9]*)'| uniq | sed 's/^www./http:\\/\\/www\\./g' | dmenu -w $(xdotool getactivewindow) -i -p 'Follow which url?' -l 10 | xargs -r xdg-open",
"externalpipe", NULL };
static char *copyurlcmd[] = { "/bin/sh", "-c",
- "sed 's/.*│//g' | tr -d '\n' | grep -aEo '(((http|https)://|www\\.)[a-zA-Z0-9.]*[:]?[a-zA-Z0-9./&%?$#=_-]*)|((magnet:\\?xt=urn:btih:)[a-zA-Z0-9]*)' | uniq | sed 's/^www./http:\\/\\/www\\./g' | dmenu -i -p 'Copy which url?' -l 10 | tr -d '\n' | xclip -selection clipboard",
+ "sed 's/.*│//g' | tr -d '\n' | grep -aEo '(((http|https)://|www\\.)[a-zA-Z0-9.]*[:]?[a-zA-Z0-9./@&%?$#=_-]*)|((magnet:\\?xt=urn:btih:)[a-zA-Z0-9]*)' | uniq | sed 's/^www./http:\\/\\/www\\./g' | dmenu -w $(xdotool getactivewindow) -i -p 'Copy which url?' -l 10 | tr -d '\n' | xclip -selection clipboard",
"externalpipe", NULL };
static char *copyoutput[] = { "/bin/sh", "-c", "st-copyout", "externalpipe", NULL };
@@ -232,10 +240,9 @@ static Shortcut shortcuts[] = {
{ TERMMOD, XK_Prior, zoom, {.f = +1} },
{ TERMMOD, XK_Next, zoom, {.f = -1} },
{ MODKEY, XK_Home, zoomreset, {.f = 0} },
- { ShiftMask, XK_Insert, clippaste, {.i = 0} },
{ MODKEY, XK_c, clipcopy, {.i = 0} },
+ { ShiftMask, XK_Insert, clippaste, {.i = 0} },
{ MODKEY, XK_v, clippaste, {.i = 0} },
- { MODKEY, XK_p, selpaste, {.i = 0} },
{ XK_ANY_MOD, Button2, selpaste, {.i = 0} },
{ MODKEY, XK_Num_Lock, numlock, {.i = 0} },
{ MODKEY, XK_Control_L, iso14755, {.i = 0} },
diff --git a/st/st/st b/st/st/st
index 9f03e4e..1ebe1cd 100755
--- a/st/st/st
+++ b/st/st/st
Binary files differ
diff --git a/st/st/st.c b/st/st/st.c
index 21c6739..e4df60c 100644
--- a/st/st/st.c
+++ b/st/st/st.c
@@ -14,6 +14,7 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <termios.h>
+#include <time.h>
#include <unistd.h>
#include <wchar.h>
@@ -142,6 +143,7 @@ typedef struct {
int charset; /* current charset */
int icharset; /* selected charset for sequence */
int *tabs;
+ struct timespec last_ximspot_update;
} Term;
/* CSI Escape sequence structs */
@@ -1056,6 +1058,7 @@ void
tnew(int col, int row)
{
term = (Term){ .c = { .attr = { .fg = defaultfg, .bg = defaultbg } } };
+ clock_gettime(CLOCK_MONOTONIC, &term.last_ximspot_update);
tresize(col, row);
treset();
}
@@ -2744,7 +2747,13 @@ draw(void)
term.ocx, term.ocy, term.line[term.ocy][term.ocx]);
term.ocx = cx, term.ocy = term.c.y;
xfinishdraw();
- xximspot(term.ocx, term.ocy);
+
+ struct timespec now;
+ clock_gettime(CLOCK_MONOTONIC, &now);
+ if (ximspot_update_interval && TIMEDIFF(now, term.last_ximspot_update) > ximspot_update_interval) {
+ xximspot(term.ocx, term.ocy);
+ term.last_ximspot_update = now;
+ }
}
void
diff --git a/st/st/st.h b/st/st/st.h
index 94ce5c3..4504a30 100644
--- a/st/st/st.h
+++ b/st/st/st.h
@@ -133,3 +133,4 @@ extern unsigned int defaultfg;
extern unsigned int defaultbg;
extern float alpha;
extern MouseKey mkeys[];
+extern int ximspot_update_interval;
diff --git a/st/st/x.c b/st/st/x.c
index cc7a8a4..58f9864 100644
--- a/st/st/x.c
+++ b/st/st/x.c
@@ -661,8 +661,6 @@ setsel(char *str, Time t)
XSetSelectionOwner(xw.dpy, XA_PRIMARY, xw.win, t);
if (XGetSelectionOwner(xw.dpy, XA_PRIMARY) != xw.win)
selclear();
-
- clipcopy(NULL);
}
void
@@ -680,7 +678,7 @@ brelease(XEvent *e)
}
if (e->xbutton.button == Button2)
- clippaste(NULL);
+ selpaste(NULL);
else if (e->xbutton.button == Button1)
mousesel(e, 1);
}