Skip to content

Commit

Permalink
fix(rofi): rofi_dynamic is now sync
Browse files Browse the repository at this point in the history
this fixes other issues on startup
  • Loading branch information
aarondill committed Dec 31, 2024
1 parent e4a2222 commit 4354826
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
13 changes: 5 additions & 8 deletions configuration/rofi_dynamic.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
local path = require("util.path")
local require = require("util.rel_require")

local ascreen = require("awful.screen")
local assertions = require("util.types.assertions")
local beautiful = require("beautiful")
local config_file_dir = require(..., "apps.conffile_dir") ---@module "configuration.apps.conffile_dir"
local path = require("util.path")
local strings = require("util.strings")
local write_async = require("util.file.write_async")
local write_sync = require("util.file.sync.write_sync")

---@param p string?
---@param v string|number|boolean?
Expand Down Expand Up @@ -36,11 +35,9 @@ do
end

---Write a new rofi config to `require("configuration.apps.conffile_dir") .. "/rofi/dynamic.rasi"`
---Note: this is async!
---Note: this is sync. It has to be so that the file is ready before rofi is started.
---@param opts DynamicRofiWriteOptions?
---@param cb fun(error?: userdata)? function to call when done.
local function write_conf(opts, cb)
assertions.iscallable(cb, true, "cb")
local function write_conf(opts)
opts = opts or {}
local panel_height = opts.panel_height
if not panel_height then
Expand All @@ -63,7 +60,7 @@ local function write_conf(opts, cb)
"// vim" .. ":ft=css commentstring=//%s:", -- hack to stop vim from processing this modeline here
})

return write_async(path.resolve(config_file_dir, "rofi", "dynamic.rasi"), conf, cb) -- this file should be ignored
assert(write_sync(path.resolve(config_file_dir, "rofi", "dynamic.rasi"), conf)) -- this file should be ignored
end

return write_conf
4 changes: 2 additions & 2 deletions rc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ require("util.dir_require")("module") -- Init all modules

-- Setup all configurations
-- require("configuration.apps.compositor").autostart() -- Start the compositor on startup
require("gears.timer").delayed_call(function() -- Wait until screens are setup
require("configuration.rofi_dynamic")() -- Async setup of rofi for current theme
require("gears.timer").delayed_call(function()
require("configuration.rofi_dynamic")() -- Setup of rofi for current theme (sync)
end)
require("widget.launcher") -- Sets up menubar.utils.term
require("configuration.keys.global") -- Setup the global keys
Expand Down

0 comments on commit 4354826

Please sign in to comment.