diff options
-rw-r--r-- | doc/config.md | 22 | ||||
-rw-r--r-- | res/config.toml | 1 | ||||
-rw-r--r-- | src/display/client.nim | 5 |
3 files changed, 26 insertions, 2 deletions
diff --git a/doc/config.md b/doc/config.md index ccaa64ab..15b5a071 100644 --- a/doc/config.md +++ b/doc/config.md @@ -498,7 +498,7 @@ escape to the keybinding respectively (essentially making `M-` the same as An action is a JavaScript function called by Chawan every time the keybinding is typed in. A list of built-in pager functions can be found below. -### Pager actions +### Browser actions <table> @@ -508,11 +508,29 @@ is typed in. A list of built-in pager functions can be found below. </tr> <tr> -<td>`pager.quit()`</td> +<td>`quit()`</td> <td>Exit the browser.</td> </tr> <tr> +<td>`suspend()`</td> +<td>Temporarily suspend the browser (by delivering the client process a +SIGSTOP signal.)<br> +Note: this does not suspend buffer processes. +</tr> + +</table> + +### Pager actions + +<table> + +<tr> +<th>**Name**</th> +<th>**Function**</th> +</tr> + +<tr> <td>`pager.cursorUp()`</td> <td>Move the cursor to the previous line.</td> </tr> diff --git a/res/config.toml b/res/config.toml index ae1d5984..4e319652 100644 --- a/res/config.toml +++ b/res/config.toml @@ -37,6 +37,7 @@ substitute-url = '(x) => "https://lite.duckduckgo.com/lite/?kp=-1&kd=-1&q=" + en [page] q = 'quit()' +C-z = 'suspend()' h = 'pager.cursorLeft()' j = 'pager.cursorDown()' k = 'pager.cursorUp()' diff --git a/src/display/client.nim b/src/display/client.nim index a292bf0a..5b961841 100644 --- a/src/display/client.nim +++ b/src/display/client.nim @@ -154,6 +154,11 @@ proc command(client: Client, src: string) = client.console.container.requestLines().then(proc() = client.console.container.cursorLastLine()) +proc suspend(client: Client) {.jsfunc.} = + client.pager.term.quit() + discard kill(getpid(), cint(SIGSTOP)) + client.pager.term.restart() + proc quit(client: Client, code = 0) {.jsfunc.} = if client.alive: client.alive = false |