local _M = {} local awful = require'awful' local gears = require'gears' local hotkeys_popup = require'awful.hotkeys_popup' local beautiful = require'beautiful' local wibox = require'wibox' local lain = require'lain' local dpi = require("beautiful.xresources").apply_dpi local apps = require'config.apps' local mod = require'bindings.mod' local markup = lain.util.markup local gray = "#928374" local first = wibox.widget.textbox(markup.font("Symbols Nerd Font 10", "  ")) local spr = wibox.widget.textbox(' ') local shape1 = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 2) end _M.textclock = wibox.widget.textclock( " %H:%M " ) _M.textclock.font = "JetBrainsMono Nerd Font 10" _M.vol = lain.widget.pulse { settings = function() header = " Vol " vlevel = volume_now.left .. "% " if volume_now.muted == "yes" then vlevel = vlevel .. " M" end widget:set_markup(markup.font("JetBrainsMono Nerd Font 10", markup(gray, header) .. vlevel)) end } -- MPD _M.mpd = lain.widget.mpd({ settings = function() album = mpd_now.album .. " " title = mpd_now.title .. " " if mpd_now.state == "pause" then artist = "mpd " title = "paused " elseif mpd_now.state == "stop" then artist = "" title = "" end widget:set_markup(markup.font("JetBrainsMono Nerd Font 10", markup(gray, artist) .. title)) end }) function _M.create_taglist(s) return awful.widget.taglist{ screen = s, filter = awful.widget.taglist.filter.all, forced_height = 10, buttons = { awful.button{ modifiers = {}, button = 1, on_press = function(t) t:view_only() end, }, awful.button{ modifiers = {mod.super}, button = 1, on_press = function(t) if client.focus then client.focus:move_to_tag(t) end end, }, awful.button{ modifiers = {}, button = 3, on_press = awful.tag.viewtoggle, }, awful.button{ modifiers = {mod.super}, button = 3, on_press = function(t) if client.focus then client.focus:toggle_tag(t) end end }, awful.button{ modifiers = {}, button = 4, on_press = function(t) awful.tag.viewprev(t.screen) end, }, awful.button{ modifiers = {}, button = 5, on_press = function(t) awful.tag.viewnext(t.screen) end, }, } } end function _M.create_wibox(s) return awful.wibar{ screen = s, position = 'top', height = dpi(35), widget = { layout = wibox.layout.stack, { layout = wibox.layout.align.horizontal, { -- left widgets layout = wibox.layout.fixed.horizontal, first, { { {s.taglist, left = 5, right = 5, top = 4, bottom = 4, widget = wibox.container.margin }, bg = "#282828", shape = shape1, widget = wibox.container.background }, layout = wibox.container.place }, s.promptbox, spr, }, nil, { -- right widgets layout = wibox.layout.fixed.horizontal, { { {_M.textclock, left = 5, right = 5, top = 3, bottom = 3, widget = wibox.container.margin }, valign = "center", halign = "center", bg = "#282828", shape = shape1, widget = wibox.container.background }, layout = wibox.container.place }, spr, wibox.widget.systray(), }, }, { { {_M.vol, left = 5, right = 5, top = 3, bottom = 3, widget = wibox.container.margin }, valign = "center", halign = "center", bg = "#282828", shape = shape1, widget = wibox.container.background }, layout = wibox.container.place }, { { {_M.mpd, left = 5, right = 5, top = 3, bottom = 3, widget = wibox.container.margin }, valign = "center", halign = "center", bg = "#282828", shape = shape1, widget = wibox.container.background }, layout = wibox.container.place } } } end return _M