mirror of
https://github.com/weechat/weechat.git
synced 2026-07-04 00:33:13 +02:00
buflist: add keys F1/F2, alt+F1/alt+F2 to scroll the buflist bar
This commit is contained in:
@@ -321,37 +321,11 @@ buflist_hsignal_cb (const void *pointer, void *data, const char *signal,
|
||||
int
|
||||
buflist_mouse_init ()
|
||||
{
|
||||
struct t_hashtable *keys;
|
||||
|
||||
keys = weechat_hashtable_new (4,
|
||||
WEECHAT_HASHTABLE_STRING,
|
||||
WEECHAT_HASHTABLE_STRING,
|
||||
NULL, NULL);
|
||||
if (!keys)
|
||||
return 0;
|
||||
|
||||
weechat_hook_focus (BUFLIST_BAR_ITEM_NAME, &buflist_focus_cb, NULL, NULL);
|
||||
|
||||
weechat_hook_hsignal(BUFLIST_MOUSE_HSIGNAL,
|
||||
&buflist_hsignal_cb, NULL, NULL);
|
||||
|
||||
weechat_hashtable_set (keys,
|
||||
"@item(" BUFLIST_BAR_ITEM_NAME "):button1*",
|
||||
"hsignal:" BUFLIST_MOUSE_HSIGNAL);
|
||||
weechat_hashtable_set (keys,
|
||||
"@item(" BUFLIST_BAR_ITEM_NAME "):button2*",
|
||||
"hsignal:" BUFLIST_MOUSE_HSIGNAL);
|
||||
weechat_hashtable_set (keys,
|
||||
"@bar(" BUFLIST_BAR_NAME "):ctrl-wheelup",
|
||||
"hsignal:" BUFLIST_MOUSE_HSIGNAL);
|
||||
weechat_hashtable_set (keys,
|
||||
"@bar(" BUFLIST_BAR_NAME "):ctrl-wheeldown",
|
||||
"hsignal:" BUFLIST_MOUSE_HSIGNAL);
|
||||
weechat_hashtable_set (keys, "__quiet", "1");
|
||||
weechat_key_bind ("mouse", keys);
|
||||
|
||||
weechat_hashtable_free (keys);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -437,6 +437,8 @@ buflist_sort_buffers ()
|
||||
int
|
||||
weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
{
|
||||
struct t_hashtable *keys;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
@@ -463,6 +465,44 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
|
||||
buflist_mouse_init ();
|
||||
|
||||
/* default keys and mouse actions */
|
||||
keys = weechat_hashtable_new (32,
|
||||
WEECHAT_HASHTABLE_STRING,
|
||||
WEECHAT_HASHTABLE_STRING,
|
||||
NULL, NULL);
|
||||
if (keys)
|
||||
{
|
||||
/* default keys */
|
||||
weechat_hashtable_set (keys,
|
||||
"meta-OP", "/bar scroll buflist * -100%");
|
||||
weechat_hashtable_set (keys,
|
||||
"meta-OQ", "/bar scroll buflist * +100%");
|
||||
weechat_hashtable_set (keys,
|
||||
"meta-meta-OP", "/bar scroll buflist * b");
|
||||
weechat_hashtable_set (keys,
|
||||
"meta-meta-OQ", "/bar scroll buflist * e");
|
||||
weechat_key_bind ("default", keys);
|
||||
|
||||
/* default mouse actions */
|
||||
weechat_hashtable_remove_all (keys);
|
||||
weechat_hashtable_set (keys,
|
||||
"@item(" BUFLIST_BAR_ITEM_NAME "):button1*",
|
||||
"hsignal:" BUFLIST_MOUSE_HSIGNAL);
|
||||
weechat_hashtable_set (keys,
|
||||
"@item(" BUFLIST_BAR_ITEM_NAME "):button2*",
|
||||
"hsignal:" BUFLIST_MOUSE_HSIGNAL);
|
||||
weechat_hashtable_set (keys,
|
||||
"@bar(" BUFLIST_BAR_NAME "):ctrl-wheelup",
|
||||
"hsignal:" BUFLIST_MOUSE_HSIGNAL);
|
||||
weechat_hashtable_set (keys,
|
||||
"@bar(" BUFLIST_BAR_NAME "):ctrl-wheeldown",
|
||||
"hsignal:" BUFLIST_MOUSE_HSIGNAL);
|
||||
weechat_hashtable_set (keys, "__quiet", "1");
|
||||
weechat_key_bind ("mouse", keys);
|
||||
}
|
||||
|
||||
weechat_hashtable_free (keys);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user