patch: open-selected
This commit is contained in:
@@ -176,6 +176,7 @@ static uint forcemousemod = ShiftMask;
|
|||||||
*/
|
*/
|
||||||
static MouseShortcut mshortcuts[] = {
|
static MouseShortcut mshortcuts[] = {
|
||||||
/* mask button function argument release */
|
/* mask button function argument release */
|
||||||
|
{ ControlMask, Button2, selopen, {.i = 0}, 1 },
|
||||||
{ XK_ANY_MOD, Button4, kscrollup, {.i = 1}, 0, /* !alt */ -1 },
|
{ XK_ANY_MOD, Button4, kscrollup, {.i = 1}, 0, /* !alt */ -1 },
|
||||||
{ XK_ANY_MOD, Button5, kscrolldown, {.i = 1}, 0, /* !alt */ -1 },
|
{ XK_ANY_MOD, Button5, kscrolldown, {.i = 1}, 0, /* !alt */ -1 },
|
||||||
{ XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
|
{ XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
|
||||||
|
|||||||
10
st.c
10
st.c
@@ -1887,6 +1887,16 @@ csihandle(void)
|
|||||||
term.c.y+1, term.c.x+1);
|
term.c.y+1, term.c.x+1);
|
||||||
ttywrite(buf, len, 0);
|
ttywrite(buf, len, 0);
|
||||||
break;
|
break;
|
||||||
|
case 7:
|
||||||
|
if (strstr(strescseq.args[1], "file://") != strescseq.args[1]) {
|
||||||
|
fprintf(stderr, "erresc: dir %s must have prefix 'file://'\n",
|
||||||
|
strescseq.args[1]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (chdir(strescseq.args[1] + 7) != 0) /* +7 to remove prefix */
|
||||||
|
fprintf(stderr, "erresc: invalid directory %s\n",
|
||||||
|
strescseq.args[1]);
|
||||||
|
return;
|
||||||
default:
|
default:
|
||||||
goto unknown;
|
goto unknown;
|
||||||
}
|
}
|
||||||
|
|||||||
16
x.c
16
x.c
@@ -5,6 +5,7 @@
|
|||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <libgen.h>
|
#include <libgen.h>
|
||||||
@@ -56,6 +57,7 @@ static void clipcopy(const Arg *);
|
|||||||
static void clippaste(const Arg *);
|
static void clippaste(const Arg *);
|
||||||
static void numlock(const Arg *);
|
static void numlock(const Arg *);
|
||||||
static void selpaste(const Arg *);
|
static void selpaste(const Arg *);
|
||||||
|
static void selopen(const Arg *);
|
||||||
static void zoom(const Arg *);
|
static void zoom(const Arg *);
|
||||||
static void zoomabs(const Arg *);
|
static void zoomabs(const Arg *);
|
||||||
static void zoomreset(const Arg *);
|
static void zoomreset(const Arg *);
|
||||||
@@ -289,6 +291,20 @@ selpaste(const Arg *dummy)
|
|||||||
xw.win, CurrentTime);
|
xw.win, CurrentTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
selopen(const Arg *dummy)
|
||||||
|
{
|
||||||
|
pid_t chpid;
|
||||||
|
|
||||||
|
if ((chpid = fork()) == 0) {
|
||||||
|
if (fork() == 0)
|
||||||
|
execlp("xdg-open", "xdg-open", getsel(), NULL);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (chpid > 0)
|
||||||
|
waitpid(chpid, NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
numlock(const Arg *dummy)
|
numlock(const Arg *dummy)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user