Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Mar 30th, 2020 102 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Signal function to execute when a client is started
  2. client.connect_signal("manage", function(c)
  3.   c.last_focus_date = unixtime()
  4. end)
  5.  
  6. -- Signal function to execute when a client is terminated
  7. client.connect_signal("unmanage", function (c)
  8.   focus_recent_client(awful.tag.selected(awful.screen.focused()))
  9. end)
  10.  
  11. -- Signal function to execute when a client gains focus
  12. client.connect_signal("focus", function (c)
  13.   c.last_focus_date = unixtime()
  14. end)
  15.  
  16. -- Unix timestamp
  17. function unixtime()
  18.   return os.time(os.date("!*t"))    
  19. end
  20.  
  21. function focus_recent_client(t)
  22.   local clientz = t:clients()
  23.   if #clientz > 0 then
  24.       local topc = clientz[1]
  25.       for k,c in pairs(clientz) do
  26.           if c.last_focus_date > topc.last_focus_date then
  27.               topc = c
  28.           end
  29.       end
  30.       client.focus = topc
  31.       client.focus:raise()
  32.   end
  33. end
  34.  
  35. -- Attach this to every screen
  36. for k,t in pairs(awful.tag.gettags(s)) do
  37.   t:connect_signal("property::selected", function(t)
  38.       focus_recent_client(t)
  39.   end)
  40. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top