Add clipboard and irc widgets

This commit is contained in:
Tom Willemse 2016-11-24 21:46:47 +01:00
parent d3d6e313ec
commit 3077d8d5d1

View file

@ -1,9 +1,10 @@
# -*- geiser-default-implementation: chicken; -*-
#+TITLE: Mowedline init
Load the =matchable= module so I can use =match-lambda=.
#+BEGIN_SRC scheme
(use matchable)
(use matchable dbus)
#+END_SRC
Set the default font and color to something nicer.
@ -117,7 +118,7 @@ Define a convenience function to add a Font Awesome icon to a widget.
(define email-widget
(widget:text
#:name "email"
#:format (compose text-maybe-pad-both (add-fa-icon ""))))
#:format (compose text-maybe-pad-left (add-fa-icon ""))))
#+END_SRC
* The window
@ -125,6 +126,20 @@ Define a convenience function to add a Font Awesome icon to a widget.
Create a mowedline window, put it at the bottom.
#+BEGIN_SRC scheme
(define clipboard-widget
(widget:text #:format text-maybe-pad-left))
(let ((ctx (make-context #:service 'org.gnome.GPaste
#:interface 'org.gnome.GPaste1
#:path "/org/gnome/GPaste")))
(register-signal-handler ctx
"Update"
(lambda (type replace id)
(update clipboard-widget "Text copied!")
(thread-start! (make-thread (lambda ()
(thread-sleep! 3)
(update clipboard-widget "")))))))
(window #:position 'bottom
#:width 1843
#:margin-bottom 15
@ -133,7 +148,11 @@ Define a convenience function to add a Font Awesome icon to a widget.
#:background 'transparent
taglist-widget
(widget:spacer #:flex 1)
clipboard-widget
(widget:text #:name "irc" #:format (lambda (text) (text-maybe-pad-left (with-input-from-string text read))))
email-widget
(widget:clock))
(widget:clock #:format text-maybe-pad-left))
#+END_SRC