diff --git a/rc.lua b/rc.lua index 751b414..1149495 100644 --- a/rc.lua +++ b/rc.lua @@ -259,54 +259,112 @@ awful.screen.connect_for_each_screen(function(s) s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, tasklist_buttons) -- Create the wibox - local wibar_width = s.geometry.width / 4 local wibar_height = 15 - s.mywibox = wibox({ - x = s.geometry.x + s.geometry.width - wibar_width, - y = s.geometry.y + s.geometry.height - wibar_height, - width = wibar_width, - height = wibar_height, - expand = true, - visible = true, - ontop = true, - screen = s - }) + if s == screen.primary then + local wibar_width = s.geometry.width / 5 + local wibar_height = 15 + s.mywibox = wibox({ + x = s.geometry.x + s.geometry.width - wibar_width, + y = s.geometry.y + s.geometry.height - wibar_height, + width = wibar_width, + height = wibar_height, + expand = true, + visible = true, + ontop = true, + screen = s + }) - s.textclock = awful.widget.textclock(" %a %d %b %H:%M ") - calendar({position = "bottom_right"}):attach(s.textclock) + s.textclock = awful.widget.textclock(" %a %d %b %H:%M ") + calendar({position = "bottom_right"}):attach(s.textclock) - -- Add widgets to the wibox - s.mywibox:setup { - layout = wibox.layout.align.horizontal, - { -- Left widgets - layout = wibox.layout.fixed.horizontal, - -- mylauncher, - s.mytaglist, - }, - s.mytasklist, -- Middle widget - { -- Right widgets - layout = wibox.layout.fixed.horizontal, - -- delimiter, - -- email_widget.icon, - -- delimiter2, - -- email_widget.widget, - delimiter, - ram_widget, - delimiter2, - cpu_widget, - delimiter, - volume_widget, - -- delimiter2, - -- volume_bar_widget, - delimiter, - battery_widget, - delimiter, - mykeyboardlayout, - wibox.widget.systray(), - s.textclock, - s.mylayoutbox, - }, - } + s.mywibox:setup { + layout = wibox.layout.align.horizontal, + { -- Left widgets + layout = wibox.layout.fixed.horizontal, + -- mylauncher, + s.mytaglist, + }, + s.mytasklist, -- Middle widget + { -- Right widgets + layout = wibox.layout.fixed.horizontal, + -- delimiter, + -- email_widget.icon, + -- delimiter2, + -- email_widget.widget, + -- delimiter, + ram_widget, + -- delimiter2, + cpu_widget, + -- delimiter, + volume_widget, + -- delimiter2, + -- volume_bar_widget, + -- delimiter, + battery_widget, + -- delimiter, + -- mykeyboardlayout, + wibox.widget.systray(), + s.textclock, + s.mylayoutbox, + }, + } + else + -- Light wibox for secondary screen + local wibar_width = 200 + s.mywibox = wibox({ + x = s.geometry.x + s.geometry.width - wibar_width, + y = s.geometry.y + s.geometry.height - wibar_height, + width = wibar_width, + height = wibar_height, + expand = true, + visible = true, + ontop = true, + screen = s + }) + s.mywibox:setup { + layout = wibox.layout.align.horizontal, + { -- Left widgets + layout = wibox.layout.fixed.horizontal, + -- mylauncher, + s.mytaglist, + }, + s.mytasklist, -- Middle widget + { -- Right widgets + layout = wibox.layout.fixed.horizontal, + s.mylayoutbox, + }, + } + end + +s.detect = gears.timer { + timeout = 0.35, + callback = function () + if (mouse.screen ~= s) or + (mouse.coords().y < s.geometry.y + s.geometry.height - wibar_height) + then + s.mywibox.visible = false + s.detect:stop() + end + end +} + +s.enable_wibar = function () + s.mywibox.visible = true + if not s.detect.started then + s.detect:start() + end +end + +s.activation_zone = wibox ({ + x = s.geometry.x, y = s.geometry.y + s.geometry.height - 1, + opacity = 0.0, width = s.geometry.width, height = 1, + screen = s, input_passthrough = false, visible = true, + ontop = true, type = "dock", +}) + +s.activation_zone:connect_signal("mouse::enter", function () + s.enable_wibar() +end) -- update_background_widget(s)