From 091710ce80ea1c4252aff4c0eea6f943bde3e131 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Pankowski?= Date: Sat, 29 Mar 2025 13:38:56 +0100 Subject: [PATCH] alacritty: detect theme on (re)start --- awesome/.config/awesome/rc.lua | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/awesome/.config/awesome/rc.lua b/awesome/.config/awesome/rc.lua index f22546c..c43c4e8 100644 --- a/awesome/.config/awesome/rc.lua +++ b/awesome/.config/awesome/rc.lua @@ -51,7 +51,20 @@ end -- {{{ Variable definitions -- Themes define colours, icons, font and wallpapers. -local theme = "theme_dark.lua" + +local function read_theme() + local theme = "theme_dark.lua" + local f = io.open(os.getenv('HOME') .. '/.config/alacritty/alacritty.toml') + if f then + if string.find(f:read('*all'), 'light') then + theme = 'theme_light.lua' + end + f:close() + return theme + end +end + +local theme = read_theme() beautiful.init(gears.filesystem.get_configuration_dir() .. theme) local function set_wallpaper(s)