Added rounding shapes to helpers

This commit is contained in:
Gokul Swaminathan 2020-11-23 16:13:34 -08:00
parent 22644a02ab
commit 66d5b17f10
1 changed files with 20 additions and 2 deletions

View File

@ -1,4 +1,5 @@
local awful = require("awful")
local gears = require("gears")
local helpers = {}
@ -6,7 +7,7 @@ local helpers = {}
helpers.turn_off = function(c)
local current_tag = awful.tag.selected(c.screen)
local ctags = {}
for k,tag in pairs(c:tags()) do
for k, tag in pairs(c:tags()) do
if tag ~= current_tag then table.insert(ctags, tag) end
end
c:tags(ctags)
@ -16,7 +17,7 @@ end
helpers.turn_on = function(c)
local current_tag = awful.tag.selected(c.screen)
ctags = {current_tag}
for k,tag in pairs(c:tags()) do
for k, tag in pairs(c:tags()) do
if tag ~= current_tag then table.insert(ctags, tag) end
end
c:tags(ctags)
@ -24,4 +25,21 @@ helpers.turn_on = function(c)
client.focus = c
end
-- Create rounded rectangle shape (in one line)
helpers.rrect = function(radius)
return function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, radius)
end
end
-- Create partially rounded rect
helpers.prrect = function(radius, tl, tr, br, bl)
return function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, tl, tr, br, bl,
radius)
end
end
return helpers