commit 405f433207f6e6917caae6cde906496bcd8f8ae6
parent 6019a9b97a720eac9003c18b34aa5cee896eb223
Author: Samuel Dionne-Riel <samuel@dionne-riel.com>
Date: Sat, 22 Jan 2022 01:00:36 -0500
saturn: RGBA and white on dark
Diffstat:
1 file changed, 38 insertions(+), 0 deletions(-)
diff --git a/saturn/main.fnl b/saturn/main.fnl
@@ -3,6 +3,25 @@
(local dbus (require :dbus_proxy))
(local inspect (require :inspect))
+(local CSS "
+ * {
+ color: rgb(255, 255, 255);
+ text-shadow:
+ 0px 1px rgba(0, 0, 0, 255)
+ , 1px 0px rgba(0, 0, 0, 255)
+ , 0px -1px rgba(0, 0, 0, 255)
+ , -1px 0px rgba(0, 0, 0, 255)
+ , 1px 1px rgba(0, 0, 0, 255)
+ , 1px -1px rgba(0, 0, 0, 255)
+ , -1px 1px rgba(0, 0, 0, 255)
+ , -1px -1px rgba(0, 0, 0, 255)
+ ;
+ }
+ #toplevel {
+ background-color: rgba(0, 0, 0, 0.6);
+ }
+ ")
+
(local dbus-service-attrs
{
:bus dbus.Bus.SESSION
@@ -73,16 +92,35 @@
(local posix (require :posix))
(local Gtk lgi.Gtk)
+(local Gdk lgi.Gdk)
(local Pango lgi.Pango)
(local icon-theme (Gtk.IconTheme.get_default))
+;; Use the declared CSS for this app
+(let [style_provider (Gtk.CssProvider)]
+ (style_provider:load_from_data CSS)
+ (Gtk.StyleContext.add_provider_for_screen
+ (Gdk.Screen.get_default)
+ style_provider
+ Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
+ ))
+
+
(local window (Gtk.Window {
:title "Saturn V"
+ :name "toplevel"
:default_width 720
:default_height 800
:on_destroy Gtk.main_quit
}))
+
+;; Using RGBA visual for semi-transparent backgrounds
+;; Requires compositing (e.g. a compositor on X11)
+(let [screen (window:get_screen)
+ visual (screen:get_rgba_visual)]
+ (window:set_visual visual))
+
(fn find-icon [name]
(var found false)
(if (= (name.sub 1 1) "/")