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

Show desktop notifications only when scli is not active #109

Open
exquo opened this issue Mar 7, 2021 · 0 comments
Open

Show desktop notifications only when scli is not active #109

exquo opened this issue Mar 7, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@exquo
Copy link
Collaborator

exquo commented Mar 7, 2021

When a new message arrives while the user is looking at (or interacting with) scli, it is not necessary to show a desktop (popup) notification, in addition to a notification in scli itself. Unfortunately, it is not easy to figure out where the user is looking :).

We could use some "proxy" metrics, like the time of the last keypress in scli, or check with the window manager weather scli's terminal window is currently active. These are not 100% reliable however.

  • The "keypress timeout" method is what signal-desktop seems to use. The problem with it is: if a new message arrives shortly enough (before the timeout has been reached) after the program's window became 'inactive' / not visible, the user has no notification of the new message.

  • The "current window" method requires querying a windows manager / server (through e.g. Xlib), which is not platform-independent. And if a terminal multiplexer such as tmux is used, then "scli's window is active" does not equate to "scli is in view" due to multiple "panes" / "tabs" / .. within the same window.

    An example of using this method: undistract-me tool, that sends a notification when a long-running process finishes. It uses xprop, so works only with X, and does not know of tmux.

I don't know of a foolproof way of doing this. For now, scli simply shows a desktop notification for every incoming message.

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

No branches or pull requests

1 participant