Adding open selected text patch
This commit is contained in:
parent
137bb152b3
commit
c7503f5737
7 changed files with 34 additions and 1 deletions
|
|
@ -15,7 +15,7 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the
|
|||
|
||||
### Changelog:
|
||||
|
||||
2025-02-20 - Added the drag-n-drop patch
|
||||
2025-02-20 - Added the drag-n-drop and open-selected-text patches
|
||||
|
||||
2024-05-31 - Added the anygeometry patch
|
||||
|
||||
|
|
@ -235,6 +235,9 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the
|
|||
- [open-copied-url](https://st.suckless.org/patches/open_copied_url/)
|
||||
- open contents of the clipboard in a user-defined browser
|
||||
|
||||
- [open-selected-text](https://st.suckless.org/patches/open_selected_text)
|
||||
- open the selected text using `xdg-open`
|
||||
|
||||
- [openurlonclick](https://www.reddit.com/r/suckless/comments/cc83om/st_open_url/)
|
||||
- allows for URLs to be opened directly when you click on them
|
||||
|
||||
|
|
|
|||
|
|
@ -401,6 +401,9 @@ static uint forcemousemod = ShiftMask;
|
|||
*/
|
||||
static MouseShortcut mshortcuts[] = {
|
||||
/* mask button function argument release screen */
|
||||
#if OPEN_SELECTED_TEXT_PATCH
|
||||
{ ControlMask, Button2, selopen, {.i = 0}, 1 },
|
||||
#endif // OPEN_SELECTED_TEXT_PATCH
|
||||
#if CLIPBOARD_PATCH
|
||||
{ XK_ANY_MOD, Button2, clippaste, {.i = 0}, 1 },
|
||||
#else
|
||||
|
|
|
|||
13
patch/openselectedtext.c
Normal file
13
patch/openselectedtext.c
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
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);
|
||||
}
|
||||
3
patch/openselectedtext.h
Normal file
3
patch/openselectedtext.h
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#include <sys/wait.h>
|
||||
|
||||
static void selopen(const Arg *);
|
||||
|
|
@ -38,6 +38,9 @@
|
|||
#elif NETWMICON_LEGACY_PATCH
|
||||
#include "netwmicon_legacy.c"
|
||||
#endif
|
||||
#if OPEN_SELECTED_TEXT_PATCH
|
||||
#include "openselectedtext.c"
|
||||
#endif
|
||||
#if OPENURLONCLICK_PATCH
|
||||
#include "openurlonclick.c"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -35,6 +35,9 @@
|
|||
#if NETWMICON_PATCH || NETWMICON_FF_PATCH || NETWMICON_LEGACY_PATCH
|
||||
#include "netwmicon.h"
|
||||
#endif
|
||||
#if OPEN_SELECTED_TEXT_PATCH
|
||||
#include "openselectedtext.h"
|
||||
#endif
|
||||
#if RIGHTCLICKTOPLUMB_PATCH
|
||||
#include "rightclicktoplumb_x.h"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -306,6 +306,11 @@
|
|||
*/
|
||||
#define OPENCOPIED_PATCH 0
|
||||
|
||||
/* Open the selected text using xdg-open.
|
||||
* https://st.suckless.org/patches/open_selected_text/
|
||||
*/
|
||||
#define OPEN_SELECTED_TEXT_PATCH 0
|
||||
|
||||
/* This patch allows for URLs to be opened directly when you click on them. This may not work with
|
||||
* all terminal applications.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue