Home
  
  

2020-08-23

August 22, 2020

NOTE: This is a raw, untended note, representing a quick capture for the topic at hand. Hopefully it will soon develop into a draft of something useful!

Thank linus for that readme pointing me to the SPC-m-m-d-t keybinding. Would never have found this page otherwise.

Am writing an electron status bar right now, directly in yodo. This thing is now consuming my window manager. I'm enjoying being able to edit components like this, right on my desktop, with code like:

(defn pomodoro
""
[]
(let [minutes-since-last @(rf/subscribe [::pomos.subs/minutes-since-last])
minutes-current @(rf/subscribe [::pomos.subs/minutes-passed])
latest-pomo @(rf/subscribe [::pomos.subs/latest-pomo])]
[:div
{:class ["flex" "flex-row" "items-center"
"text-white"
"py-2 px-4"
"rounded-lg" "bg-opacity-50" "bg-city-blue-dark-500"]}
[actions.comp/actions-pool
(concat
[
{:value "Start"
:block-icon nil
:event [::pomos.events/start-pomo latest-pomo]}
{:value "Finish"
:block-icon nil
:event [::pomos.events/finish-pomo latest-pomo]
}])]
(if minutes-current
(str "(" minutes-current " min)")
(when minutes-since-last
(str "(" minutes-since-last " min break)")))]))

TailwindCSS with a type-ahead is a must. If you need it for clojure, I'm currently using a custom company mode that processes classes from a 'built' css file, which makes it work somewhat in clojure strings.

Repo here: company-css-classes

-- 2020-08-23 16:26

somewhat related

(defn position-status-bar
"Selects the status-bar client via `status-bar-client`.
Applies a modified screen-geometry to give it full width and some height.
Also sets it ontop and floating.
May need to be called often/at startup/after awm restart, or otherwise
avoided/fixed via awful rules.
TODO handle as cli/rofi command, add call when bar is launched?
TODO consider adding bar as seperate desktop app?
"
[]
(let [screen-geo (-> (screen) :geometry)
bar-geo (-> screen-geo
;; put it below the current status-bar
(assoc :y 50)
;; give it some height
(assoc :height 70))
bar-window-id (-> (status-bar-client) :window)]
(awm/awm-cli
{:parse? false
:pp? true}
(str
"for c in awful.client.iterate(function (c) return c.window == "
(awm/->lua-arg bar-window-id)
" end) do\n"
"c.floating = true; "
"c.ontop = true; "
"c:geometry( "
(awm/->lua-arg bar-geo)
" ) "
"end"))))
(comment
(->> (all-clients)
(filter #(= "electron" (:instance %)))
))

I got to the above last night, and it felt like less effort to just do it with clojure's tooling rather than trying to refactor my approach to awesome's rules. Just much better to have feedback on the code you write.

Related: The awm dev loop is not great.

Russell Matney

Russell Matney

Writing, Stories, Software, Indie Games

 

© 2020