From c331732ca6bb1d48e39d3a4c1f3d0583a4607ad4 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Sun, 20 Mar 2022 15:50:51 +0000 Subject: [PATCH] saturn: word-wrap app names to get more icons in a row --- saturn/main.fnl | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/saturn/main.fnl b/saturn/main.fnl index a0bf624..c0cfe2e 100644 --- a/saturn/main.fnl +++ b/saturn/main.fnl @@ -157,8 +157,8 @@ (fn read-desktop-file [f] (let [parsed (inifile.parse f) vals (. parsed "Desktop Entry")] - (when vals.Icon - (tset vals "IconImage" (find-icon vals.Icon))) + (tset vals "IconImage" + (find-icon (or vals.Icon "application-x-executable"))) (tset vals "ID" (f:sub 0 -9)) vals)) @@ -230,11 +230,24 @@ (fn button-for [app] (doto (Gtk.Button { - :label app.Name :image-position Gtk.PositionType.TOP :relief Gtk.ReliefStyle.NONE - :on_clicked #(launch app) }) - (: :set_image app.IconImage))) + :on_clicked #(launch app) + }) + (: :add + (doto (Gtk.Box {:orientation Gtk.Orientation.VERTICAL}) + (: :add app.IconImage) + (: :add (doto + (Gtk.Label { + :label app.Name + :halign Gtk.Align.CENTER + :justify Gtk.Justification.CENTER + :wrap true + }) + (: :set_line_wrap true) + (: :set_max_width_chars 10) + (tset :expand false))) + )))) (fn handle-dbus-method-call [conn sender path interface method params invocation]