X-Git-Url: https://git.rmz.io/dotfiles.git/blobdiff_plain/0122ea7401f34be9ea90de29cdf86189d8adb3b2..449e5a08ca88c158f6954eebfbf62b088fc333b6:/awesome/topbar.lua diff --git a/awesome/topbar.lua b/awesome/topbar.lua index 938e7ed..f48715b 100644 --- a/awesome/topbar.lua +++ b/awesome/topbar.lua @@ -8,9 +8,22 @@ local wibox = require("wibox") separator = wibox.widget.textbox() separator:set_markup('│') +local function client_menu_toggle_fn() + local instance = nil + + return function () + if instance and instance.wibox.visible then + instance:hide() + instance = nil + else + instance = awful.menu.clients({ theme = { width = 250 } }) + end + end +end + -- Wibox {{{1 -- Create a wibox for each screen and add it -local taglist_buttons = awful.util.table.join( +local taglist_buttons = gears.table.join( awful.button({ }, 1, function(t) t:view_only() end), awful.button({ modkey }, 1, function(t) if client.focus then @@ -27,7 +40,7 @@ local taglist_buttons = awful.util.table.join( awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end) ) -local tasklist_buttons = awful.util.table.join( +local tasklist_buttons = gears.table.join( awful.button({ }, 1, function (c) if c == client.focus then c.minimized = true @@ -45,14 +58,7 @@ local tasklist_buttons = awful.util.table.join( end end), awful.button({ }, 2, function (c) c:kill() end), - awful.button({ }, 3, function () - if instance and instance.wibox.visible then - instance:hide() - instance = nil - else - instance = awful.menu.clients({ theme = { width=250 }}) - end - end), + awful.button({ }, 3, client_menu_toggle_fn()), awful.button({ }, 4, function () awful.client.focus.byidx(1) end), @@ -67,13 +73,36 @@ awful.screen.connect_for_each_screen(function(s) -- Create an imagebox widget which will contains an icon indicating which layout we're using. -- We need one layoutbox per screen. s.mylayoutbox = awful.widget.layoutbox(s) - s.mylayoutbox:buttons(awful.util.table.join( - awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end), - awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end), - awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end), - awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end))) + s.mylayoutbox:buttons(gears.table.join( + awful.button({ }, 1, function () awful.layout.inc( 1) end), + awful.button({ }, 3, function () awful.layout.inc(-1) end), + awful.button({ }, 4, function () awful.layout.inc( 1) end), + awful.button({ }, 5, function () awful.layout.inc(-1) end))) -- Create a taglist widget - s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, taglist_buttons) + local theme = beautiful.get() + s.mytaglist = awful.widget.taglist{ + screen = s, + filter = awful.widget.taglist.filter.all, + buttons = taglist_buttons, + style = { + squares_resize = false + }, + widget_template = { + { + { + { + id = 'icon_role', + widget = wibox.widget.imagebox, + }, + layout = wibox.layout.fixed.horizontal, + }, + forced_width = theme.wibar_height, + widget = wibox.container.place, + }, + id = 'background_role', + widget = wibox.container.background, + }, + } -- Create a tasklist widget s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, tasklist_buttons) @@ -86,7 +115,6 @@ awful.screen.connect_for_each_screen(function(s) layout = wibox.layout.align.horizontal, { -- Left widgets layout = wibox.layout.fixed.horizontal, - -- mylauncher, s.mytaglist, s.mypromptbox, }, @@ -98,7 +126,8 @@ awful.screen.connect_for_each_screen(function(s) separator, require("widgets/pomodoro"), separator, - require("widgets/awesompd"), + require("widgets/mpd_widget"), + separator, require("widgets/volume_widget"), utils.has_battery() and { layout = wibox.layout.fixed.horizontal,