1
0
Fork 0
mirror of https://github.com/lcpz/awesome-copycats.git synced 2024-12-22 19:22:32 +00:00

#159: delayed call for vertical wibox creation

This commit is contained in:
Luke Bonham 2017-02-18 16:05:37 +01:00
parent ce53375917
commit 8b0764ff23

View file

@ -10,7 +10,7 @@ local gears = require("gears")
local lain = require("lain") local lain = require("lain")
local awful = require("awful") local awful = require("awful")
local wibox = require("wibox") local wibox = require("wibox")
local math, string, tonumber, type, os = math, string, tonumber, type, os local math, string, tag, tonumber, type, os = math, string, tag, tonumber, type, os
local theme = {} local theme = {}
theme.default_dir = require("awful.util").get_themes_dir() .. "default" theme.default_dir = require("awful.util").get_themes_dir() .. "default"
@ -320,6 +320,68 @@ local dockshape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, false, true, true, false, 6) gears.shape.partially_rounded_rect(cr, width, height, false, true, true, false, 6)
end end
function theme.vertical_wibox(s)
-- Create the vertical wibox
s.dockheight = (40 * s.workarea.height)/100
s.myleftwibox = wibox({ screen = s, x=0, y=s.workarea.height/2 - s.dockheight/2, width = 6, height = s.dockheight, fg = theme.fg_normal, bg = barcolor2, ontop = true, visible = true, type = "dock" })
if s.index > 1 and s.myleftwibox.y == 0 then
s.myleftwibox.y = screen[1].myleftwibox.y
end
-- Add widgets to the vertical wibox
s.myleftwibox:setup {
layout = wibox.layout.align.vertical,
{
layout = wibox.layout.fixed.vertical,
lspace1,
s.mytaglist,
lspace2,
s.layoutb,
wibox.container.margin(mylauncher, 5, 8, 13, 0),
},
}
-- Add toggling functionalities
s.docktimer = gears.timer{ timeout = 2 }
s.docktimer:connect_signal("timeout", function()
local s = awful.screen.focused()
s.myleftwibox.width = 6
s.layoutb.visible = false
mylauncher.visible = false
if s.docktimer.started then
s.docktimer:stop()
end
end)
tag.connect_signal("property::selected", function(t)
local s = t.screen or awful.screen.focused()
s.myleftwibox.width = 46
s.layoutb.visible = true
mylauncher.visible = true
gears.surface.apply_shape_bounding(s.myleftwibox, dockshape)
if not s.docktimer.started then
s.docktimer:start()
end
end)
s.myleftwibox:connect_signal("mouse::leave", function()
local s = awful.screen.focused()
s.myleftwibox.width = 6
s.layoutb.visible = false
mylauncher.visible = false
end)
s.myleftwibox:connect_signal("mouse::enter", function()
local s = awful.screen.focused()
s.myleftwibox.width = 46
s.layoutb.visible = true
mylauncher.visible = true
gears.surface.apply_shape_bounding(s.myleftwibox, dockshape)
end)
end
function theme.at_screen_connect(s) function theme.at_screen_connect(s)
-- Quake application -- Quake application
s.quake = lain.util.quake({ app = awful.util.terminal, border = theme.border_width }) s.quake = lain.util.quake({ app = awful.util.terminal, border = theme.border_width })
@ -393,62 +455,7 @@ function theme.at_screen_connect(s)
}, },
} }
-- Create the vertical wibox gears.timer.delayed_call(theme.vertical_wibox, s)
s.dockheight = (40 * s.workarea.height)/100
s.myleftwibox = wibox({ screen = s, x=0, y=s.workarea.height/2 - s.dockheight/2, width = 6, height = s.dockheight, fg = theme.fg_normal, bg = barcolor2, ontop = true, visible = true, type = "dock" })
if s.index > 1 and s.myleftwibox.y == 0 then
s.myleftwibox.y = screen[1].myleftwibox.y
end
-- Add widgets to the vertical wibox
s.myleftwibox:setup {
layout = wibox.layout.align.vertical,
{
layout = wibox.layout.fixed.vertical,
lspace1,
s.mytaglist,
lspace2,
s.layoutb,
wibox.container.margin(mylauncher, 5, 8, 13, 0),
},
}
-- Add toggling functionalities
s.docktimer = gears.timer{ timeout = 2 }
s.docktimer:connect_signal("timeout", function()
local s = awful.screen.focused()
s.myleftwibox.width = 6
s.layoutb.visible = false
mylauncher.visible = false
s.docktimer:stop()
end)
tag.connect_signal("property::selected", function(t)
local s = t.screen or awful.screen.focused()
s.myleftwibox.width = 46
s.layoutb.visible = true
mylauncher.visible = true
gears.surface.apply_shape_bounding(s.myleftwibox, dockshape)
if not s.docktimer.started then
s.docktimer:start()
end
end)
s.myleftwibox:connect_signal("mouse::leave", function()
local s = awful.screen.focused()
s.myleftwibox.width = 6
s.layoutb.visible = false
mylauncher.visible = false
end)
s.myleftwibox:connect_signal("mouse::enter", function()
local s = awful.screen.focused()
s.myleftwibox.width = 46
s.layoutb.visible = true
mylauncher.visible = true
gears.surface.apply_shape_bounding(s.myleftwibox, dockshape)
end)
end end
return theme return theme