1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-29 22:36:38 +02:00

core: add key ctrl+z to suspend WeeChat process (closes #985)

This commit is contained in:
Sébastien Helleu
2023-08-28 17:39:33 +02:00
parent 5ecb1adc34
commit cc2b44a8ec
12 changed files with 100 additions and 7 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ For a list of important changes that require manual actions, please look at rele
New features::
* core: add command `/sys` to show resource limits and usage
* core: add command `/sys` to show resource limits/usage and suspend WeeChat process (issue #985)
* core: ignore key bindings with empty command
* core: add support of quotes in commands `/key bind` and `/key bindctxt`
* core: evaluate command given to `/repeat` with contextual variables (issue #2007)
+10
View File
@@ -1558,6 +1558,16 @@ Sie können mit dem Befehl <<command_weechat_key,/key>> geändert und neue hinzu
| kbd:[Ctrl+↓] | ruft nächsten Befehl/Nachricht aus dem globalen Verlaufsspeicher auf (für alle Buffer). | `+/input history_global_next+`
|===
// TRANSLATION MISSING
[[key_bindings_cmdline_system]]
==== System
[width="100%",cols="^.^3,.^8,.^5",options="header"]
|===
| Taste | Beschreibung | Befehl
| kbd:[Ctrl+z] | Suspend WeeChat process. | `+/sys suspend+`
|===
[[key_bindings_buffers]]
=== Buffer
+9
View File
@@ -1545,6 +1545,15 @@ They can be changed and new ones can be added with the <<command_weechat_key,/ke
| kbd:[Ctrl+↓] | Call next command/message in global history (common for all buffers). | `+/input history_global_next+`
|===
[[key_bindings_cmdline_system]]
==== System
[width="100%",cols="^.^3,.^8,.^5",options="header"]
|===
| Key | Description | Command
| kbd:[Ctrl+z] | Suspend WeeChat process. | `+/sys suspend+`
|===
[[key_bindings_buffers]]
=== Buffers
+9
View File
@@ -1581,6 +1581,15 @@ Ils peuvent être modifiés et de nouveaux peuvent être ajoutés avec la comman
| kbd:[Ctrl+↓] | Rappeler la commande suivante dans l'historique global (commun à tous les tampons). | `+/input history_global_next+`
|===
[[key_bindings_cmdline_system]]
==== Système
[width="100%",cols="^.^3,.^8,.^5",options="header"]
|===
| Touche | Description | Commande
| kbd:[Ctrl+z] | Suspendre le processus WeeChat. | `+/sys suspend+`
|===
[[key_bindings_buffers]]
=== Tampons
+10
View File
@@ -1691,6 +1691,16 @@ They can be changed and new ones can be added with the <<command_weechat_key,/ke
| kbd:[Ctrl+↓] | Chiama il comando/messaggio successivo nella cronologia globale (identico per tutti i buffer). | `+/input history_global_next+`
|===
// TRANSLATION MISSING
[[key_bindings_cmdline_system]]
==== System
[width="100%",cols="^.^3,.^8,.^5",options="header"]
|===
| Tasti | Descrizione | Comando
| kbd:[Ctrl+z] | Suspend WeeChat process. | `+/sys suspend+`
|===
// TRANSLATION MISSING
[[key_bindings_buffers]]
=== Buffers
+10
View File
@@ -1647,6 +1647,16 @@ They can be changed and new ones can be added with the <<command_weechat_key,/ke
| kbd:[Ctrl+↓] | グローバル履歴から次のコマンド/メッセージを呼び出す (すべてのバッファに対して共通の履歴) | `+/input history_global_next+`
|===
// TRANSLATION MISSING
[[key_bindings_cmdline_system]]
==== System
[width="100%",cols="^.^3,.^8,.^5",options="header"]
|===
| キー | 説明 | コマンド
| kbd:[Ctrl+z] | Suspend WeeChat process. | `+/sys suspend+`
|===
// TRANSLATION MISSING
[[key_bindings_buffers]]
=== Buffers
+10
View File
@@ -1555,6 +1555,16 @@ Można je zmienić oraz dodać nowe za pomocą komendy <<command_weechat_key,/ke
| kbd:[Ctrl+↓] | Pokaż następną komendę/wiadomość w historii globalnej (wspólnej dla wszystkich buforów). | `+/input history_global_next+`
|===
// TRANSLATION MISSING
[[key_bindings_cmdline_system]]
==== System
[width="100%",cols="^.^3,.^8,.^5",options="header"]
|===
| Skrót | Opis | Komenda
| kbd:[Ctrl+z] | Suspend WeeChat process. | `+/sys suspend+`
|===
[[key_bindings_buffers]]
=== Bufory
+10
View File
@@ -1459,6 +1459,16 @@ WeeChat нуди доста подразумеваних тастерских п
| kbd:[Ctrl+↓] | Позив наредне команде/поруке у глобалној историји (заједничкој за све бафере). | `+/input history_global_next+`
|===
// TRANSLATION MISSING
[[key_bindings_cmdline_system]]
==== System
[width="100%",cols="^.^3,.^8,.^5",options="header"]
|===
| Тастер | Опис | Команда
| kbd:[Ctrl+z] | Suspend WeeChat process. | `+/sys suspend+`
|===
[[key_bindings_buffers]]
=== Бафери
+17 -6
View File
@@ -59,12 +59,13 @@
#include "wee-secure.h"
#include "wee-secure-buffer.h"
#include "wee-secure-config.h"
#include "wee-signal.h"
#include "wee-string.h"
#include "wee-sys.h"
#include "wee-upgrade.h"
#include "wee-utf8.h"
#include "wee-util.h"
#include "wee-version.h"
#include "wee-sys.h"
#include "../gui/gui-bar.h"
#include "../gui/gui-bar-item.h"
#include "../gui/gui-bar-item-custom.h"
@@ -7801,6 +7802,12 @@ COMMAND_CALLBACK(sys)
return WEECHAT_RC_OK;
}
if (string_strcmp (argv[1], "suspend") == 0)
{
signal_suspend ();
return WEECHAT_RC_OK;
}
COMMAND_ERROR;
}
@@ -9489,12 +9496,16 @@ command_init ()
hook_command (
NULL, "sys",
N_("system actions"),
N_("get rlimit|rusage"),
N_(" get: display system info\n"
"rlimit: display resource limits "
N_("get rlimit|rusage"
" || suspend"),
N_(" get: display system info\n"
" rlimit: display resource limits "
"(see /help weechat.startup.sys_rlimit and man getrlimit)\n"
"rusage: display resource usage (see man getrusage)"),
"get rlimit|rusage",
" rusage: display resource usage (see man getrusage)\n"
"suspend: suspend WeeChat and go back to the shell, by sending "
"signal SIGTSTP to the WeeChat process"),
"get rlimit|rusage"
" || suspend",
&command_sys, NULL, NULL);
}
+12
View File
@@ -37,6 +37,7 @@
#include "wee-log.h"
#include "wee-string.h"
#include "../gui/gui-buffer.h"
#include "../gui/gui-window.h"
#include "../plugins/plugin.h"
@@ -293,6 +294,17 @@ signal_handle ()
signal_sigterm_count = 0;
}
/*
* Suspends WeeChat process.
*/
void
signal_suspend ()
{
kill (getpid (), SIGTSTP);
gui_window_ask_refresh (2);
}
/*
* Initializes signal.
*/
+1
View File
@@ -32,6 +32,7 @@ extern int signal_search_number (int signal_number);
extern int signal_search_name (const char *name);
extern void signal_catch (int signum, void (*handler)(int));
extern void signal_handle ();
extern void signal_suspend ();
extern void signal_init ();
#endif /* WEECHAT_SIGNAL_H */
+1
View File
@@ -102,6 +102,7 @@ gui_key_default_bindings (int context, int create_option)
BIND("ctrl-u", "/input delete_beginning_of_line");
BIND("meta-ctrl-u", "/input delete_beginning_of_input");
BIND("ctrl-y", "/input clipboard_paste");
BIND("ctrl-z", "/sys suspend");
BIND("home", "/input move_beginning_of_line");
BIND("ctrl-a", "/input move_beginning_of_line");
BIND("shift-home", "/input move_beginning_of_input");