diff options
| author | Mateja <mail@matejamaric.com> | 2021-04-08 15:50:34 +0200 | 
|---|---|---|
| committer | Mateja <mail@matejamaric.com> | 2021-04-08 15:50:34 +0200 | 
| commit | dc273f41c5d548026b4bea766c919f1e4e8a04ac (patch) | |
| tree | 2d4f157915a660d0f7cf6e181496e466b2a8211b | |
| parent | 081aa95b38c53b5a9ea47907496e0ff043fdffe3 (diff) | |
| download | st-dc273f41c5d548026b4bea766c919f1e4e8a04ac.tar.gz st-dc273f41c5d548026b4bea766c919f1e4e8a04ac.zip  | |
Applied `newterm` patch.v1.2.0
| -rw-r--r-- | README.md | 7 | ||||
| -rw-r--r-- | config.def.h | 1 | ||||
| -rw-r--r-- | st.c | 21 | ||||
| -rw-r--r-- | st.h | 1 | 
4 files changed, 27 insertions, 3 deletions
@@ -6,18 +6,19 @@ This is my fork of [st][stterm] terminal with following patches applied:  - nordtheme (with black background)  - alpha  - boxdraw +- newterm  ## Dependencies:  - Fira Code font -### Build requirements: +### Build dependencies:  - Xlib header files  - fontconfig  - freetype2 -### Installation +## Installation  Edit `config.mk` to match your local setup (st is installed into  the `/usr/local` namespace by default). @@ -27,7 +28,7 @@ necessary as root):      make clean install -### Running st +## Running st  If you did not install st with make clean install, you must compile  the st terminfo entry with the following command: diff --git a/config.def.h b/config.def.h index 42e4347..7ec089f 100644 --- a/config.def.h +++ b/config.def.h @@ -214,6 +214,7 @@ static Shortcut shortcuts[] = {  	{ TERMMOD,              XK_Y,           selpaste,       {.i =  0} },  	{ ShiftMask,            XK_Insert,      selpaste,       {.i =  0} },  	{ TERMMOD,              XK_Num_Lock,    numlock,        {.i =  0} }, +	{ TERMMOD,              XK_Return,      newterm,        {.i =  0} },  };  /* @@ -153,6 +153,7 @@ typedef struct {  } STREscape;  static void execsh(char *, char **); +static char *getcwd_by_pid(pid_t pid);  static void stty(char **);  static void sigchld(int);  static void ttywriteraw(const char *, size_t); @@ -1059,6 +1060,26 @@ tswapscreen(void)  }  void +newterm(const Arg* a) +{ +	switch (fork()) { +	case -1: +		die("fork failed: %s\n", strerror(errno)); +		break; +	case 0: +		chdir(getcwd_by_pid(pid)); +		execlp("st", "./st", NULL); +		break; +	} +} + +static char *getcwd_by_pid(pid_t pid) { +	char buf[32]; +	snprintf(buf, sizeof buf, "/proc/%d/cwd", pid); +	return realpath(buf, NULL); +} + +void  tscrolldown(int orig, int n)  {  	int i; @@ -82,6 +82,7 @@ void die(const char *, ...);  void redraw(void);  void draw(void); +void newterm(const Arg *);  void printscreen(const Arg *);  void printsel(const Arg *);  void sendbreak(const Arg *);  | 
