Advertisement
Staninna

Untitled

Jun 25th, 2022
987
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.17 KB | None
  1. function fullscreen(c)
  2.     -- Not fullscreen -> fullscreen
  3.     if c.fullscreen then
  4.         awful.util.spawn("polybar-msg cmd hide")
  5.  
  6.     -- Fullscreen -> not fullscreen
  7.     else
  8.         awful.util.spawn("polybar-msg cmd show")
  9.     end
  10. end
  11.  
  12. client.connect_signal("property::fullscreen", function(c)
  13.     fullscreen(c)
  14. end)
  15.  
  16. client.connect_signal("request::activate", function(c)
  17.     fullscreen(c)
  18. end)
  19.  
  20. screen.connect_signal("tag::history::update", function()
  21.     local screen = awful.screen.focused()
  22.     local tags = screen.selected_tags
  23.     local hide = false
  24.  
  25.     if tags then
  26.         for _,t in ipairs(tags) do --go through selected tags
  27.             local clients = t:clients()
  28.             if #clients > 0 then for _, client in ipairs(clients) do --ignore case where c is the only present client
  29.                     if client.fullscreen then --if one client is fullscreened the bar needs to be hidden
  30.                         hide = true
  31.                     end
  32.                 end
  33.             end
  34.         end
  35.     end
  36.     if hide then
  37.         awful.util.spawn("polybar-msg cmd hide")
  38.     else
  39.         awful.util.spawn("polybar-msg cmd show")
  40.     end
  41. end)
Advertisement
RAW Paste Data Copied
Advertisement