Merge pull request #10 from JavaCafe01/master

Tabbed Bar Feature Update
This commit is contained in:
Nooo37 2020-11-26 15:58:23 +01:00 committed by GitHub
commit 6f6eb94cb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 63 additions and 18 deletions

View File

@ -83,6 +83,11 @@ You will find a list of all theme variables that are used in bling and comments
## 😲 Preview
### Tabbing
![](https://imgur.com/08AlNhQ.png)
screenshot by [javacafe](https://github.com/JavaCafe01)
### Mstab (dynamic tabbing layout)
![](https://imgur.com/HZRgApE.png)

View File

@ -12,7 +12,6 @@ of a function.
local wibox = require("wibox")
local gears = require("gears")
local beautiful = require("beautiful")
local helpers = require(tostring(...):match(".*bling.module") .. ".helpers")
local bar_style = beautiful.tabbar_style or "default"
@ -76,14 +75,15 @@ tabbed.pick = function()
local tabobj = client.focus.bling_tabbed
-- this function uses xprop to grab a client pid which is then
-- compared to all other client process ids
-- io.popen is normally discouraged. Works fine for now
local handle = io.popen("xprop _NET_WM_PID | cut -d' ' -f3")
local output = handle:read("*a")
handle:close()
-- search the client that was picked
local xprop_cmd = [[ xprop _NET_WM_PID | cut -d' ' -f3 ]]
awful.spawn.easy_async_with_shell(xprop_cmd, function(output)
for _, c in ipairs(client.get()) do
if tonumber(c.pid) == tonumber(output) then tabbed.add(c, tabobj) end
if tonumber(c.pid) == tonumber(output) then
tabbed.add(c, tabobj)
end
end
end)
end
-- update everything about one tab object

View File

@ -50,6 +50,11 @@ local function create_title_button(c, color_focus, color_unfocus)
c:connect_signal("focus", update)
c:connect_signal("unfocus", update)
tb:connect_signal("mouse::enter",
function() tb_color.bg = color_focus .. "70" end)
tb:connect_signal("mouse::leave", function() tb_color.bg = color_focus end)
tb.visible = true
return tb
end
@ -123,6 +128,24 @@ local function create(c, focused_bool, buttons)
local wid_temp = wibox.widget({
buttons = buttons,
{
{
{
bg = bg_normal,
shape = helpers.prrect(border_radius, false, false, true,
false),
widget = wibox.container.background
},
bg = bg_temp,
shape = gears.rectangle,
widget = wibox.container.background
},
width = border_radius + (border_radius / 2),
height = size,
strategy = "exact",
layout = wibox.layout.constraint
},
{
{
tab_content,
bg = bg_temp,
@ -130,10 +153,27 @@ local function create(c, focused_bool, buttons)
widget = wibox.container.background
},
top = dpi(8),
left = dpi(5),
right = dpi(5),
bottom = dpi(0),
widget = wibox.container.margin
},
{
{
{
bg = bg_normal,
shape = helpers.prrect(border_radius, false, false, false,
true),
widget = wibox.container.background
},
bg = bg_temp,
shape = gears.rectangle,
widget = wibox.container.background
},
width = border_radius + (border_radius / 2),
height = size,
strategy = "exact",
layout = wibox.layout.constraint
},
layout = wibox.layout.align.horizontal
})
return wid_temp
end