Discussion:
[STUMP] How to include Slack Notification into mode line
York Zhao
2018-03-25 19:26:15 UTC
Permalink
Hi list,

I'm using Linux Mint 17.3 at home, and 18.3 at work. I'm trying to use
StumpWM. However, since we use Slack at work, I have to be able to get
notified whenever new slack messages arrive. Without this ability, StumpWM
would be useless for me. I've tried to run `gnome-panel' but all I got was
a black band at the top of the screen showing nothing. Is it possible to
have this notification in mode line?

Thanks in advance,
Javier Olaechea
2018-03-26 02:18:42 UTC
Permalink
The notify contrib should display slack notifications

https://github.com/stumpwm/stumpwm-contrib/tree/master/util/notify
Post by York Zhao
Hi list,
I'm using Linux Mint 17.3 at home, and 18.3 at work. I'm trying to use
StumpWM. However, since we use Slack at work, I have to be able to get
notified whenever new slack messages arrive. Without this ability, StumpWM
would be useless for me. I've tried to run `gnome-panel' but all I got was
a black band at the top of the screen showing nothing. Is it possible to
have this notification in mode line?
Thanks in advance,
_______________________________________________
Stumpwm-devel mailing list
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
--
"I object to doing things that computers can do." — Olin Shivers
York Zhao
2018-03-27 12:47:38 UTC
Permalink
Thank you very much Javier. Because I'm new to Common Lisp, it would be a
lot easier for me if I could have some usage information with examples for
this "notify" package. Could you point me to some of these information as I
didn't find them on the GitHub link.

Have a great day,

York
Post by Javier Olaechea
The notify contrib should display slack notifications
https://github.com/stumpwm/stumpwm-contrib/tree/master/util/notify
Post by York Zhao
Hi list,
I'm using Linux Mint 17.3 at home, and 18.3 at work. I'm trying to use
StumpWM. However, since we use Slack at work, I have to be able to get
notified whenever new slack messages arrive. Without this ability, StumpWM
would be useless for me. I've tried to run `gnome-panel' but all I got was
a black band at the top of the screen showing nothing. Is it possible to
have this notification in mode line?
Thanks in advance,
_______________________________________________
Stumpwm-devel mailing list
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
--
"I object to doing things that computers can do." — Olin Shivers
_______________________________________________
Stumpwm-devel mailing list
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
York Zhao
2018-03-30 19:27:28 UTC
Permalink
I still have no idea how to get "notify" working. Would it be possible for
someone to provide me a bit more instruction as to how to get Slack
notifications in StumpWM? The following is my ./stumpwm.d/init.lisp:

;; -*-lisp-*-

(in-package :stumpwm)

;; Bind "c" to gnome-terminal instead of xterm
(define-key *root-map* (kbd "c") "exec gnome-terminal")

(setf *mode-line-position* :bottom)
(mode-line)

(add-to-load-path "/path/to/stumpwm-contrib/util/notify")
;; (load-module "notify")

(emacs)
Post by York Zhao
Thank you very much Javier. Because I'm new to Common Lisp, it would be a
lot easier for me if I could have some usage information with examples for
this "notify" package. Could you point me to some of these information as I
didn't find them on the GitHub link.
Have a great day,
York
Post by Javier Olaechea
The notify contrib should display slack notifications
https://github.com/stumpwm/stumpwm-contrib/tree/master/util/notify
Post by York Zhao
Hi list,
I'm using Linux Mint 17.3 at home, and 18.3 at work. I'm trying to use
StumpWM. However, since we use Slack at work, I have to be able to get
notified whenever new slack messages arrive. Without this ability, StumpWM
would be useless for me. I've tried to run `gnome-panel' but all I got was
a black band at the top of the screen showing nothing. Is it possible to
have this notification in mode line?
Thanks in advance,
_______________________________________________
Stumpwm-devel mailing list
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
--
"I object to doing things that computers can do." — Olin Shivers
_______________________________________________
Stumpwm-devel mailing list
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
York Zhao
2018-03-31 15:40:54 UTC
Permalink
Finally, "stumptray" works for this purpose which means that only from this
moment on am I able to really start using the awesome StumpWM.

However, the new problem is that the slack icon is very small, and stays at
the very far right of the mode line. Is it possible to make this icon
larger, or move it to the left of the mode line?
Post by York Zhao
I still have no idea how to get "notify" working. Would it be possible for
someone to provide me a bit more instruction as to how to get Slack
;; -*-lisp-*-
(in-package :stumpwm)
;; Bind "c" to gnome-terminal instead of xterm
(define-key *root-map* (kbd "c") "exec gnome-terminal")
(setf *mode-line-position* :bottom)
(mode-line)
(add-to-load-path "/path/to/stumpwm-contrib/util/notify")
;; (load-module "notify")
(emacs)
Post by York Zhao
Thank you very much Javier. Because I'm new to Common Lisp, it would be a
lot easier for me if I could have some usage information with examples for
this "notify" package. Could you point me to some of these information as I
didn't find them on the GitHub link.
Have a great day,
York
Post by Javier Olaechea
The notify contrib should display slack notifications
https://github.com/stumpwm/stumpwm-contrib/tree/master/util/notify
Post by York Zhao
Hi list,
I'm using Linux Mint 17.3 at home, and 18.3 at work. I'm trying to use
StumpWM. However, since we use Slack at work, I have to be able to get
notified whenever new slack messages arrive. Without this ability, StumpWM
would be useless for me. I've tried to run `gnome-panel' but all I got was
a black band at the top of the screen showing nothing. Is it possible to
have this notification in mode line?
Thanks in advance,
_______________________________________________
Stumpwm-devel mailing list
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
--
"I object to doing things that computers can do." — Olin Shivers
_______________________________________________
Stumpwm-devel mailing list
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
Javier Olaechea
2018-04-02 14:17:15 UTC
Permalink
Upon reading the README.md I've realized the instructions could be written
in a
more straightforward manner. All you have to do for the contrib to work is
put
the following lines in your rc file.

(load-module "notify")
(notify-server-on) ; or (notify-server-toggle)

With that in your rc file show-notification would run every time a slack
notification, or any other notification, is sent. In the case of
show-notification that means using the message box that StumpWM for its
messages.

If you would like that the notification be displayed in a different manner
you
would have to change the function stored in *notification-received-hook*
(which
incidentally is not a hook, hooks are lists of functions). For example
Ubuntu
comes with libnotify which you can use from the CLI through notify-send. One
could use libnotify by placing the following code it its rc-file after
loading
the notify module.

(defun libnotify-show-notification (app icon summary body)
(stumpwm:run-shell-command
(format nil "notify-send --app-name=~A --icon=~A \"~A\" \"~A\""
app
icon
summary
body)) )
(setf notify:*notification-received-hook* #'libnotify-show-notification)

Cheers
Post by York Zhao
I still have no idea how to get "notify" working. Would it be possible for
someone to provide me a bit more instruction as to how to get Slack
;; -*-lisp-*-
(in-package :stumpwm)
;; Bind "c" to gnome-terminal instead of xterm
(define-key *root-map* (kbd "c") "exec gnome-terminal")
(setf *mode-line-position* :bottom)
(mode-line)
(add-to-load-path "/path/to/stumpwm-contrib/util/notify")
;; (load-module "notify")
(emacs)
Post by York Zhao
Thank you very much Javier. Because I'm new to Common Lisp, it would be a
lot easier for me if I could have some usage information with examples for
this "notify" package. Could you point me to some of these information as I
didn't find them on the GitHub link.
Have a great day,
York
Post by Javier Olaechea
The notify contrib should display slack notifications
https://github.com/stumpwm/stumpwm-contrib/tree/master/util/notify
Post by York Zhao
Hi list,
I'm using Linux Mint 17.3 at home, and 18.3 at work. I'm trying to use
StumpWM. However, since we use Slack at work, I have to be able to get
notified whenever new slack messages arrive. Without this ability, StumpWM
would be useless for me. I've tried to run `gnome-panel' but all I got was
a black band at the top of the screen showing nothing. Is it possible to
have this notification in mode line?
Thanks in advance,
_______________________________________________
Stumpwm-devel mailing list
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
--
"I object to doing things that computers can do." — Olin Shivers
_______________________________________________
Stumpwm-devel mailing list
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
--
"I object to doing things that computers can do." — Olin Shivers
York Zhao
2018-04-03 03:31:04 UTC
Permalink
Thank you very much for your detailed instruction Javier!

I'm very confused by the package name "#:notify". What does the "#" prefix
mean? I can only call the functions inside this package by:

(in-package #:notify)
(notify-server-on)

But I don't want to introduce a namespace only to call one or two
functions. I want to be able to call the function with namespace prefix
like:

(notify:notify-server-on)

But this doesn't work. What did I do wrong?

Thanks,
Post by Javier Olaechea
Upon reading the README.md I've realized the instructions could be written
in a
more straightforward manner. All you have to do for the contrib to work is
put
the following lines in your rc file.
(load-module "notify")
(notify-server-on) ; or (notify-server-toggle)
With that in your rc file show-notification would run every time a slack
notification, or any other notification, is sent. In the case of
show-notification that means using the message box that StumpWM for its
messages.
If you would like that the notification be displayed in a different manner
you
would have to change the function stored in *notification-received-hook*
(which
incidentally is not a hook, hooks are lists of functions). For example
Ubuntu
comes with libnotify which you can use from the CLI through notify-send. One
could use libnotify by placing the following code it its rc-file after
loading
the notify module.
(defun libnotify-show-notification (app icon summary body)
(stumpwm:run-shell-command
(format nil "notify-send --app-name=~A --icon=~A \"~A\" \"~A\""
app
icon
summary
body)) )
(setf notify:*notification-received-hook* #'libnotify-show-notification)
Cheers
Post by York Zhao
I still have no idea how to get "notify" working. Would it be possible
for someone to provide me a bit more instruction as to how to get Slack
;; -*-lisp-*-
(in-package :stumpwm)
;; Bind "c" to gnome-terminal instead of xterm
(define-key *root-map* (kbd "c") "exec gnome-terminal")
(setf *mode-line-position* :bottom)
(mode-line)
(add-to-load-path "/path/to/stumpwm-contrib/util/notify")
;; (load-module "notify")
(emacs)
Post by York Zhao
Thank you very much Javier. Because I'm new to Common Lisp, it would be
a lot easier for me if I could have some usage information with examples
for this "notify" package. Could you point me to some of these information
as I didn't find them on the GitHub link.
Have a great day,
York
Post by Javier Olaechea
The notify contrib should display slack notifications
https://github.com/stumpwm/stumpwm-contrib/tree/master/util/notify
Post by York Zhao
Hi list,
I'm using Linux Mint 17.3 at home, and 18.3 at work. I'm trying to use
StumpWM. However, since we use Slack at work, I have to be able to get
notified whenever new slack messages arrive. Without this ability, StumpWM
would be useless for me. I've tried to run `gnome-panel' but all I got was
a black band at the top of the screen showing nothing. Is it possible to
have this notification in mode line?
Thanks in advance,
_______________________________________________
Stumpwm-devel mailing list
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
--
"I object to doing things that computers can do." — Olin Shivers
_______________________________________________
Stumpwm-devel mailing list
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
--
"I object to doing things that computers can do." — Olin Shivers
_______________________________________________
Stumpwm-devel mailing list
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
Javier Olaechea
2018-04-03 04:50:09 UTC
Permalink
Short-version:

You can use :: to access internal symbols of a package. So the code in my
previous email should be amended to

(load-module "notify")
(notify:notify-server-on)

or

(load-module "notify")
(notify::notify-server-toggle)


Long version:
# is a non-terminating dispatching macro character
<http://www.lispworks.com/documentation/HyperSpec/Body/02_dh.htm>, which
means that the meaning is determined by the character following the
sharp-sign (#). #: creates an is an uninterned
<http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_u.htm#uninterned>
symbol, that is a symbol that doesn't belong to a package. They are
normally used for package designators among other things. In the case
of (in-package
#:notify), #:notify stands in (denotes) the package notify. #' is short
hand notation for accessing the function namespace. Because funcall
takes a function
designator
<http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_f.htm#function_designator>
we
can get away with passing it a symbol and it will be coerced it to the
function bound to that symbol in the function namespace.

Hope that clears things up
Post by York Zhao
Thank you very much for your detailed instruction Javier!
I'm very confused by the package name "#:notify". What does the "#" prefix
(in-package #:notify)
(notify-server-on)
But I don't want to introduce a namespace only to call one or two
functions. I want to be able to call the function with namespace prefix
(notify:notify-server-on)
But this doesn't work. What did I do wrong?
Thanks,
Post by Javier Olaechea
Upon reading the README.md I've realized the instructions could be
written in a
more straightforward manner. All you have to do for the contrib to work
is put
the following lines in your rc file.
(load-module "notify")
(notify-server-on) ; or (notify-server-toggle)
With that in your rc file show-notification would run every time a slack
notification, or any other notification, is sent. In the case of
show-notification that means using the message box that StumpWM for its
messages.
If you would like that the notification be displayed in a different
manner you
would have to change the function stored in *notification-received-hook*
(which
incidentally is not a hook, hooks are lists of functions). For example
Ubuntu
comes with libnotify which you can use from the CLI through notify-send. One
could use libnotify by placing the following code it its rc-file after
loading
the notify module.
(defun libnotify-show-notification (app icon summary body)
(stumpwm:run-shell-command
(format nil "notify-send --app-name=~A --icon=~A \"~A\" \"~A\""
app
icon
summary
body)) )
(setf notify:*notification-received-hook* #'libnotify-show-notification)
Cheers
Post by York Zhao
I still have no idea how to get "notify" working. Would it be possible
for someone to provide me a bit more instruction as to how to get Slack
;; -*-lisp-*-
(in-package :stumpwm)
;; Bind "c" to gnome-terminal instead of xterm
(define-key *root-map* (kbd "c") "exec gnome-terminal")
(setf *mode-line-position* :bottom)
(mode-line)
(add-to-load-path "/path/to/stumpwm-contrib/util/notify")
;; (load-module "notify")
(emacs)
Post by York Zhao
Thank you very much Javier. Because I'm new to Common Lisp, it would be
a lot easier for me if I could have some usage information with examples
for this "notify" package. Could you point me to some of these information
as I didn't find them on the GitHub link.
Have a great day,
York
Post by Javier Olaechea
The notify contrib should display slack notifications
https://github.com/stumpwm/stumpwm-contrib/tree/master/util/notify
Post by York Zhao
Hi list,
I'm using Linux Mint 17.3 at home, and 18.3 at work. I'm trying to
use StumpWM. However, since we use Slack at work, I have to be able to get
notified whenever new slack messages arrive. Without this ability, StumpWM
would be useless for me. I've tried to run `gnome-panel' but all I got was
a black band at the top of the screen showing nothing. Is it possible to
have this notification in mode line?
Thanks in advance,
_______________________________________________
Stumpwm-devel mailing list
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
--
"I object to doing things that computers can do." — Olin Shivers
_______________________________________________
Stumpwm-devel mailing list
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
--
"I object to doing things that computers can do." — Olin Shivers
_______________________________________________
Stumpwm-devel mailing list
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
--
"I object to doing things that computers can do." — Olin Shivers
York Zhao
2018-04-04 04:08:05 UTC
Permalink
Thank you so much Javier for the detailed explanation, it works beautifully
now!

The only problem is that if I miss a message, I may have to press "C-t m"
repeatedly to "search" for previous messages. Is there a way to show all
the messages, similar to Emacs's *Messages* buffer?
Post by Javier Olaechea
You can use :: to access internal symbols of a package. So the code in my
previous email should be amended to
(load-module "notify")
(notify:notify-server-on)
or
(load-module "notify")
(notify::notify-server-toggle)
# is a non-terminating dispatching macro character
<http://www.lispworks.com/documentation/HyperSpec/Body/02_dh.htm>, which
means that the meaning is determined by the character following the
sharp-sign (#). #: creates an is an uninterned
<http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_u.htm#uninterned>
symbol, that is a symbol that doesn't belong to a package. They are
normally used for package designators among other things. In the case of (in-package
#:notify), #:notify stands in (denotes) the package notify. #' is short
hand notation for accessing the function namespace. Because funcall takes a function
designator
<http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_f.htm#function_designator> we
can get away with passing it a symbol and it will be coerced it to the
function bound to that symbol in the function namespace.
Hope that clears things up
Post by York Zhao
Thank you very much for your detailed instruction Javier!
I'm very confused by the package name "#:notify". What does the "#"
(in-package #:notify)
(notify-server-on)
But I don't want to introduce a namespace only to call one or two
functions. I want to be able to call the function with namespace prefix
(notify:notify-server-on)
But this doesn't work. What did I do wrong?
Thanks,
Post by Javier Olaechea
Upon reading the README.md I've realized the instructions could be
written in a
more straightforward manner. All you have to do for the contrib to work
is put
the following lines in your rc file.
(load-module "notify")
(notify-server-on) ; or (notify-server-toggle)
With that in your rc file show-notification would run every time a slack
notification, or any other notification, is sent. In the case of
show-notification that means using the message box that StumpWM for its
messages.
If you would like that the notification be displayed in a different
manner you
would have to change the function stored in *notification-received-hook*
(which
incidentally is not a hook, hooks are lists of functions). For example
Ubuntu
comes with libnotify which you can use from the CLI through notify-send. One
could use libnotify by placing the following code it its rc-file after
loading
the notify module.
(defun libnotify-show-notification (app icon summary body)
(stumpwm:run-shell-command
(format nil "notify-send --app-name=~A --icon=~A \"~A\" \"~A\""
app
icon
summary
body)) )
(setf notify:*notification-received-hook* #'libnotify-show-notification)
Cheers
Post by York Zhao
I still have no idea how to get "notify" working. Would it be possible
for someone to provide me a bit more instruction as to how to get Slack
;; -*-lisp-*-
(in-package :stumpwm)
;; Bind "c" to gnome-terminal instead of xterm
(define-key *root-map* (kbd "c") "exec gnome-terminal")
(setf *mode-line-position* :bottom)
(mode-line)
(add-to-load-path "/path/to/stumpwm-contrib/util/notify")
;; (load-module "notify")
(emacs)
Post by York Zhao
Thank you very much Javier. Because I'm new to Common Lisp, it would
be a lot easier for me if I could have some usage information with examples
for this "notify" package. Could you point me to some of these information
as I didn't find them on the GitHub link.
Have a great day,
York
Post by Javier Olaechea
The notify contrib should display slack notifications
https://github.com/stumpwm/stumpwm-contrib/tree/master/util/notify
Post by York Zhao
Hi list,
I'm using Linux Mint 17.3 at home, and 18.3 at work. I'm trying to
use StumpWM. However, since we use Slack at work, I have to be able to get
notified whenever new slack messages arrive. Without this ability, StumpWM
would be useless for me. I've tried to run `gnome-panel' but all I got was
a black band at the top of the screen showing nothing. Is it possible to
have this notification in mode line?
Thanks in advance,
_______________________________________________
Stumpwm-devel mailing list
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
--
"I object to doing things that computers can do." — Olin Shivers
_______________________________________________
Stumpwm-devel mailing list
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
--
"I object to doing things that computers can do." — Olin Shivers
_______________________________________________
Stumpwm-devel mailing list
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel
--
"I object to doing things that computers can do." — Olin Shivers
Loading...