Copy awesomewm notifications to the clipboard

Friday, 28 January 2022

function copy_naughty()
-- Copy naughty notification(s) to clipboard in v4.3; API changes in
-- later versions should simplify. Multiple notifications are outputed
-- to a table, then concatenated as one string sent to xclip.

  local cs -- "combined string"
  local output = {}
  for s in pairs(naughty.notifications) do
    for p in pairs(naughty.notifications[s]) do
      local ntfs = naughty.notifications[s][p]
      for i, notify in pairs(ntfs) do
           table.insert(output, notify.textbox.text)
      end
    end
  end

  if output[1] == nil then return nil end
  local lb = "\n" ; for i = 1, #output do
      if cs == nil then cs = output[i] else
          cs = cs .. lb .. output[i]
      end
  end

  io.popen('xclip -selection clipboard','w'):write(cs):close()
  naughty.notify({ position = "bottom_middle", timeout = 1, text = "Copied" })

end

Control the awesomewm system tray using only the keyboard

Monday, 24 January 2022

We are surprised at the time of this writing that the system tray remains such an obvious bottleneck in the nevertheless ubiquitous fight against mouse-dependency among neckbeards the world over.

I present accordingly, systray_hints.

The AwesomeWM signal they don’t want you to know about!

Sunday, 16 January 2022

-- Replace registration popup in Sublime Text with less obtrusive reminder
-- Tested in Build 4126
client.connect_signal("manage", function(c)
    if c.class == "Sublime_text" and c.name == nil and c.floating then
        c.hidden = true
        local prop = "WM_TRANSIENT_FOR" -- Trial popups lack this property
        local id = c.window
        local cmd = "xprop -id " .. id .. " | grep " .. prop
        awful.spawn.easy_async_with_shell(cmd, function(o, e, r, exitcode)
            if exitcode == 1 then
                c:kill() -- TO DO: Add a less annoying trial reminder here
            else
                c.hidden = false; c:jump_to() -- Unhide other dialog boxes
            end
        end)
    end
end)