Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terminal Bell event on new message #30

Closed
cippaciong opened this issue Dec 20, 2013 · 7 comments
Closed

Terminal Bell event on new message #30

cippaciong opened this issue Dec 20, 2013 · 7 comments

Comments

@cippaciong
Copy link

Hi, I would like to ask if is possible to add this feature to warn users when a new message arrives.
I would find it very useful because I usually leave the client open on an empty workspace instead of the one where I am working (I'm using a tiling WM) and I have to manually check the presence of new messages periodically.

@vysheng
Copy link
Owner

vysheng commented Jan 15, 2014

Client now supports lua callbacks. You can ring terminal bell in callback function.

@vysheng vysheng closed this as completed Jan 15, 2014
@dannluciano
Copy link
Contributor

@vysheng exists any sample of how do this?

@vysheng
Copy link
Owner

vysheng commented Jan 16, 2014

You can use test.lua as a sample. To use it you should compile source with lua support (it is compiled with it by default) and start with '-s test.lua' param.

@cippaciong
Copy link
Author

This is not working for me. I can't see any change in my WM when I receive a message.
Maybe I misinterpreted how this is supposed to work.

@vysheng
Copy link
Owner

vysheng commented Jan 16, 2014

You can write something like that:
bell.lua:
1 started = 0
2 our_id = 0
3
4
5 function on_msg_receive (msg)
6 if started == 0 then
7 return
8 end
9 if msg.out then
10 return
11 end
12 print ("\a")
13 end
14
15 function on_our_id (id)
16 our_id = id
17 end
18
19 function on_secret_chat_created (peer)
20 end
21
22 function on_user_update (user)
23 end
24
25 function on_chat_update (user)
26 end
27
28 function on_get_difference_end ()
29 started = 1
30 end
31
32 function on_binlog_replay_end ()
33 end

Then start app with param '-s bell.lua'
This code should print message '\a' (bell symbol) on every incomming message.

@cippaciong
Copy link
Author

Yay, that's working!
Thank you so much =)

@dannluciano
Copy link
Contributor

Very Nice, guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants