Search code examples
luaawesome-wm

Refresh image memory in awesome WM


Here's a function to create a widget (currently a wibox) based on screen #1. The floutage.sh script creates a blur image of a current screenshot of this screen. When using this function, it's always the same blurred image showed: 1st blurred image processed, yet screen.png content changes.

function widget.createWidget(args)
   local w = nil
   local file = "/tmp/screen.png"
   awful.spawn.easy_async_with_shell(
      "sh /home/david/.config/awesome/widgets/floutage.sh " .. file,
      function()
         w = wibox({
               x = 0,
               y = 0,
               width = 1200,
               height = 1920,
               border_width = 0,
               screen = screen[1],
               bgimage = file,
               ontop = true,
               visible = true
         })
         --
         w:buttons(
            gears.table.join(
               awful.button({}, 1,
                  function()
                     w.visible = false
                     w = nil
                  end
               )
            )
         )
         --
      end
   )
   --
   return w
end

If I change file variable using a different name, the correct blurred image is shown:

   local file = "/tmp/" .. os.date("%Y%m%d-%H%M%S") .. ".png"

How can I simply use "/tmp/screen.png"? (refresh image memory?)


Solution

  • bgimage = gears.surface.load_uncached(file),