<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Dear list,</p>
<p>in our last meetup I had asked the question if anybody has some
clever ideas how to keep the currently running clock visible. My
issue is that when opening more than 1 frame that information in
the mode line gets covered by another frame and is not visible any
more. Compacting the mode line will not help if I open many more
frames. I then came to the realisation, that I could perhaps show
this information in the status bar of my window manager (I use
sway with swaybar). The bar is never overlapped by any windows and
has enough "screen real-estate" left to show this information.</p>
<p>The key ingredient is the emacs function
''org-clock-get-clock-string" which provides exactly the string
that will be shown in the mode line. Assuming one starts an emacs
server and adding some fail-safe code for when org is not loaded
or we are not clocked in, one arrives at the following shell
invocation:</p>
<p>emacsclient -e "(if (and (fboundp 'org-clocking-p)
(org-clocking-p)) (substring-no-properties
(org-clock-get-clock-string)) \"💤\")" | tr -d '"'</p>
<p>Aside: getting the original string out of a propertized string
took me the longest time! Somehow the manual focuses on extracting
the properties but never the string itself. I found
"substring-no-properties" by chance, if there is a better function
to use, please let me know.</p>
<p>How to get this string to show up in your bar is left as an
exercise to the reader. You can find my approach described here:
<a class="moz-txt-link-freetext" href="https://sam-d.com/blog/show-current-org-clock-and-task-in-sway-bar/">https://sam-d.com/blog/show-current-org-clock-and-task-in-sway-bar/</a></p>
<p>Hope this is useful you</p>
<p>Best</p>
<p>Sebastian</p>
<div id="grammalecte_menu_main_button_shadow_host"
style="width: 0px; height: 0px;"></div>
</body>
</html>