Commit 80be8237 authored by epsi sayidina's avatar epsi sayidina

awesome: 4.3: vicious statusbar

parent bd13e5a8
-- {{{ Required libraries
-- Standard awesome library
local awful = require("awful")
local beautiful = require("beautiful")
-- Wibox handling library
local wibox = require("wibox")
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
local WB = wibox_package
-- Create a textclock widget
mytextclock = wibox.widget.textclock()
-- Keyboard map indicator and switcher
mykeyboardlayout = awful.widget.keyboardlayout()
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function WB.add_widgets_left (s)
return { -- Left widgets
layout = wibox.layout.fixed.horizontal,
RC.launcher,
s.taglist,
wibox.widget.textbox(" | "),
s.promptbox,
}
end
function WB.add_widgets_middle (s)
return s.tasklist -- Middle widget
end
function WB.add_widgets_right (s)
return { -- Right widgets
layout = wibox.layout.fixed.horizontal,
mykeyboardlayout,
wibox.widget.systray(),
mytextclock,
s.layoutbox,
}
end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function WB.generate_wibox (s)
-- layout: l_left, tasklist, l_right
-- Create the wibox
s.wibox_top = awful.wibar({ position = "top", screen = s })
-- Add widgets to the wibox
s.wibox_top:setup {
layout = wibox.layout.align.horizontal,
WB.add_widgets_left (s),
WB.add_widgets_middle (s),
WB.add_widgets_right (s),
}
end
-- Standard awesome library
local gears = require("gears")
local awful = require("awful")
local awful = require("awful")
-- Wibox handling library
local wibox = require("wibox")
......@@ -18,19 +18,15 @@ local _M = {}
local WB = {}
-- Spacer
WB.spacer = wibox.widget.textbox(" ")
wibox_package = WB -- global object name
-- default statusbar
require("anybox.default.helper_default")
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- {{{ Wibar
-- Create a textclock widget
mytextclock = wibox.widget.textclock()
-- Keyboard map indicator and switcher
mykeyboardlayout = awful.widget.keyboardlayout()
function WB.setup_common_boxes (s)
-- Wallpaper
set_wallpaper(s)
......@@ -63,44 +59,6 @@ function WB.setup_common_boxes (s)
}
end
function WB.add_widgets_left (s)
return { -- Left widgets
layout = wibox.layout.fixed.horizontal,
RC.launcher,
s.taglist,
s.promptbox,
}
end
function WB.add_widgets_middle (s)
return s.tasklist -- Middle widget
end
function WB.add_widgets_right (s)
return { -- Right widgets
layout = wibox.layout.fixed.horizontal,
mykeyboardlayout,
wibox.widget.systray(),
mytextclock,
s.layoutbox,
}
end
function WB.generate_wibox (s)
-- layout: l_left, tasklist, l_right
-- Create the wibox
s.wibox_top = awful.wibar({ position = "top", screen = s })
-- Add widgets to the wibox
s.wibox_top:setup {
layout = wibox.layout.align.horizontal,
WB.add_widgets_left (s),
WB.add_widgets_middle (s),
WB.add_widgets_right (s),
}
end
-- }}}
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
......
-- {{{ Required libraries
-- Standard awesome library
local awful = require("awful")
local beautiful = require("beautiful")
-- Wibox handling library
local wibox = require("wibox")
-- Custom Local Library
local vw = require("anybox.vicious.vicious")
-- }}}
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
local WB = wibox_package
function WB.initdeco ()
-- Spacer
WB.spacer = wibox.widget.textbox(" ")
WB.spacerline = wibox.widget.textbox(" | ")
-- Separators png
WB.arrl_pre = wibox.widget.imagebox()
WB.arrl_pre:set_image(beautiful.arrl_lr_pre)
WB.arrl_post = wibox.widget.imagebox()
WB.arrl_post:set_image(beautiful.arrl_lr_post)
end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- Create a wibox for each screen and add it
-- we name it one and two, because both can be switched, top or bottom
WB.one = {}
WB.two = {}
--
WB.promptbox = {}
WB.layoutbox = {}
WB.txtlayoutbox = {}
-- Writes a string representation of the current layout in a textbox widget
function WB.updatelayoutbox (layout, s)
local screen = s or 1
local name_l = awful.layout.getname(awful.layout.get(screen))
local text_l = beautiful["layout_txt_" .. name_l] or ""
layout:set_text(text_l)
end
function WB.setup_common_boxes (s)
-- Create a promptbox for each screen
WB.promptbox[s] = awful.widget.prompt()
WB.txtlayoutbox[s] = wibox.widget.textbox(
awful.layout.getname(awful.layout.get(s))
)
awful.tag.attached_connect_signal(s, "property::selected", function ()
WB.updatelayoutbox(WB.txtlayoutbox[s], s)
end)
awful.tag.attached_connect_signal(s, "property::layout", function ()
WB.updatelayoutbox(WB.txtlayoutbox[s], s)
end)
WB.layoutbox[s] = awful.widget.layoutbox(s)
WB.layoutbox[s]:buttons(awful.util.table.join(
awful.button({ }, 1, function () awful.layout.inc(RC.layouts, 1) end),
awful.button({ }, 3, function () awful.layout.inc(RC.layouts, -1) end),
awful.button({ }, 4, function () awful.layout.inc(RC.layouts, 1) end),
awful.button({ }, 5, function () awful.layout.inc(RC.layouts, -1) end)
))
-- Create a taglist widget
-- [filter.all, filter.noempty, filter.selected], or use eminent
WB.taglist[s] = awful.widget.taglist(
s, awful.widget.taglist.filter.all, WB.taglist.buttons)
-- Create a tasklist widget
WB.tasklist[s] = awful.widget.tasklist(
s, awful.widget.tasklist.filter.currenttags, WB.tasklist.buttons)
end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function WB.add_widgets_main (line, s)
line:add(RC.launcher)
line:add(WB.taglist[s])
line:add(WB.arrl_pre)
line:add(WB.promptbox[s])
line:add(WB.arrl_post)
return line
end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function WB.add_widgets_monitor (line, s)
line:add(vw.cpu)
line:add(vw.hddtemp)
line:add(WB.spacerline)
line:add(vw.mem)
line:add(WB.spacerline)
line:add(vw.battery)
line:add(WB.spacerline)
line:add(vw.net)
return line
end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function WB.add_widgets_systray (line, s)
line:add(vw.mpd)
line:add(WB.spacerline)
line:add(vw.date)
line:add(WB.spacerline)
if s == 1 then
line:add(wibox.widget.systray())
line:add(WB.spacerline)
end
line:add(WB.txtlayoutbox[s])
line:add(WB.spacer)
line:add(WB.layoutbox[s])
return line
end
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
-- {{{ Required libraries
-- Standard awesome library
local awful = require("awful")
local beautiful = require("beautiful")
-- Wibox handling library
local wibox = require("wibox")
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
local WB = wibox_package
-- Create a textclock widget
mytextclock = wibox.widget.textclock()
-- Keyboard map indicator and switcher
mykeyboardlayout = awful.widget.keyboardlayout()
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function WB.add_widgets_left (s)
return { -- Left widgets
layout = wibox.layout.fixed.horizontal,
RC.launcher,
s.taglist,
wibox.widget.textbox(" | "),
s.promptbox,
}
end
function WB.add_widgets_middle (s)
return s.tasklist -- Middle widget
end
function WB.add_widgets_right (s)
return { -- Right widgets
layout = wibox.layout.fixed.horizontal,
mykeyboardlayout,
wibox.widget.systray(),
mytextclock,
s.layoutbox,
}
end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function WB.generate_wibox_one (s)
-- layout: l_left, tasklist, l_right
-- Create the wibox
s.wibox_one = awful.wibar({ position = "top", screen = s })
-- Add widgets to the wibox
s.wibox_one:setup {
layout = wibox.layout.align.horizontal,
WB.add_widgets_left (s),
WB.add_widgets_middle (s),
WB.add_widgets_right (s),
}
end
-- {{{ Required libraries
-- Standard awesome library
local awful = require("awful")
local beautiful = require("beautiful")
-- Wibox handling library
local wibox = require("wibox")
-- Custom Local Library
local vw = require("anybox.vicious.vicious")
-- }}}
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
local WB = wibox_package
function WB.initdeco ()
-- Spacer
WB.spacer = wibox.widget.textbox(" ")
WB.spacerline = wibox.widget.textbox(" | ")
-- Separators png
WB.arrl_pre = wibox.widget.imagebox()
WB.arrl_pre:set_image(beautiful.arrl_lr_pre)
WB.arrl_post = wibox.widget.imagebox()
WB.arrl_post:set_image(beautiful.arrl_lr_post)
end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function WB.add_widgets_main (s)
return {
layout = wibox.layout.fixed.horizontal,
-- RC.launcher,
-- s.taglist,
WB.arrl_pre,
s.promptbox,
WB.arrl_post
}
end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function WB.add_widgets_monitor_left (line, s)
return {
layout = wibox.layout.fixed.horizontal,
WB.spacer,
vw.hddtemp,
WB.spacer,
vw.graph_cpu,
WB.spacer,
vw.cpu,
WB.spacerline,
vw.graph_mem,
WB.spacer,
vw.mem,
WB.spacerline,
vw.battery,
WB.spacerline,
vw.net
}
end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function WB.add_widgets_monitor_right (line, s)
return {
layout = wibox.layout.fixed.horizontal,
vw.mpd,
WB.spacerline,
vw.date,
WB.spacer,
}
end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function WB.generate_wibox_two (s)
-- layout: l_left, l_mid, tasklist
-- Create the wibox
s.wibox_two = awful.wibar({ position = "bottom", screen = s })
-- Add widgets to the wibox
s.wibox_two:setup {
layout = wibox.layout.align.horizontal,
WB.add_widgets_monitor_left (s),
WB.spacer,
WB.add_widgets_monitor_right (s),
}
end
-- {{{ Required libraries
-- Standard awesome library
local awful = require("awful")
local beautiful = require("beautiful")
-- Wibox handling library
local wibox = require("wibox")
-- Custom Local Library: Keys and Mouse Binding
local deco = {
taglist = require("deco.taglist"),
tasklist = require("deco.tasklist")
}
local taglist_buttons = deco.taglist()
local tasklist_buttons = deco.tasklist()
-- }}}
local _M = {}
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
local WB = {}
wibox_package = WB -- global object name
-- split module, to make each file shorter,
-- all must have same package name
local config_path = awful.util.getdir("config") .. "/anybox/vicious/"
dofile(config_path .. "helper.lua")
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function WB.generate_wibox_one (s)
-- layout: l_left, l_mid, l_right
-- Widgets that are aligned to the top left
local l_left = wibox.layout.fixed.horizontal()
l_left = WB.add_widgets_main(l_left, s)
-- Widgets that are aligned to the top right
-- in helper.lua
local l_right = wibox.layout.fixed.horizontal()
l_right = WB.add_widgets_systray(l_right, s)
local l_mid = wibox.layout.fixed.horizontal()
l_mid:add(WB.spacer)
-- Now bring it all together (with the tasklist in the middle)
local layout = wibox.layout.align.horizontal()
layout:set_left(l_left)
layout:set_middle(l_mid)
layout:set_right(l_right)
WB.one[s] = awful.wibox({ position = "top", screen = s }) -- , height = "28"
WB.one[s]:set_widget(layout)
end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function WB.generate_wibox_two (s)
-- layout: l_left, l_mid, tasklist
-- Widgets that are aligned to the bottom left
-- in helper.lua
local l_left = wibox.layout.fixed.horizontal()
l_left = WB.add_widgets_monitor(l_left, s)
local l_mid = wibox.layout.fixed.horizontal()
l_mid:add(WB.spacer)
-- Now bring it all together (with the tasklist in the middle)
local layout = wibox.layout.align.horizontal()
layout:set_left(l_left)
layout:set_middle(l_mid)
layout:set_right(WB.tasklist[s])
WB.two[s] = awful.wibox({ position = "bottom", screen = s })
WB.two[s]:set_widget(layout)
end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- {{{ Main
function _M.init()
WB.taglist = taglist_buttons()
WB.tasklist = tasklist_buttons()
WB.initdeco()
for s = 1, screen.count() do
-- in helper.lua
WB.setup_common_boxes(s)
-- Create the top wibox
WB.generate_wibox_one(s)
-- Create the bottom wibox
WB.generate_wibox_two(s)
end
end
-- }}}
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
return setmetatable({}, { __call = function(_, ...) return _M.init(...) end })
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
-- Standard awesome library
local gears = require("gears")
local awful = require("awful")
local beautiful = require("beautiful")
-- Wibox handling library
local wibox = require("wibox")
......@@ -17,92 +18,18 @@ local _M = {}
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
local WB = {}
wibox_package = WB -- global object name
-- Spacer
WB.spacer = wibox.widget.textbox(" ")
-- default statusbar
require("anybox.vicious.helper_default")
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
--Helper
-- Custom Local Library
local vw = require("anybox.vicious.vicious")
-- }}}
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function WB.initdeco ()
-- Spacer
WB.spacer = wibox.widget.textbox(" ")
WB.spacerline = wibox.widget.textbox(" | ")
-- Separators png
WB.arrl_pre = wibox.widget.imagebox()
WB.arrl_pre:set_image(beautiful.arrl_lr_pre)
WB.arrl_post = wibox.widget.imagebox()
WB.arrl_post:set_image(beautiful.arrl_lr_post)
end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function WB.add_widgets_main (s)
return {
layout = wibox.layout.fixed.horizontal,
-- RC.launcher,
-- s.taglist,
WB.arrl_pre,
s.promptbox,
WB.arrl_post
}
end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function WB.add_widgets_monitor (line, s)
return {
layout = wibox.layout.fixed.horizontal,
vw.cpu,
vw.hddtemp,
WB.spacerline,
vw.mem,
WB.spacerline,
vw.battery,
WB.spacerline,
vw.net
}
end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function WB.add_widgets_systray (line, s)
-- if s == 1 then
-- line:add(wibox.widget.systray())
-- line:add(WB.spacerline)
-- end
return {
layout = wibox.layout.fixed.horizontal,
vw.mpd,
WB.spacerline,
vw.date,
-- WB.spacerline,
-- s.txtlayoutbox,
-- WB.spacerline,
-- s.layoutbox,
}
end
-- vicious statusbar
require("anybox.vicious.helper_vicious")
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- {{{ Wibar
-- Create a textclock widget
mytextclock = wibox.widget.textclock()
-- Keyboard map indicator and switcher
mykeyboardlayout = awful.widget.keyboardlayout()
function WB.setup_common_boxes (s)
-- Wallpaper
set_wallpaper(s)
......@@ -135,59 +62,6 @@ function WB.setup_common_boxes (s)
}
end
function WB.add_widgets_left (s)
return { -- Left widgets
layout = wibox.layout.fixed.horizontal,
RC.launcher,
s.taglist,
s.promptbox,
}
end
function WB.add_widgets_middle (s)
return s.tasklist -- Middle widget
end
function WB.add_widgets_right (s)
return { -- Right widgets
layout = wibox.layout.fixed.horizontal,
mykeyboardlayout,
wibox.widget.systray(),
mytextclock,
s.layoutbox,
}
end
function WB.generate_wibox_one (s)
-- layout: taglist, l_mid, l_right
-- Create the wibox
s.wibox_one = awful.wibar({ position = "top", screen = s })
-- Add widgets to the wibox
s.wibox_one:setup {
layout = wibox.layout.align.horizontal,
WB.add_widgets_left (s),
WB.add_widgets_middle (s),
WB.add_widgets_right (s),
}
end
function WB.generate_wibox_two (s)
-- layout: l_left, l_mid, tasklist
-- Create the wibox
s.wibox_two = awful.wibar({ position = "bottom", screen = s })
-- Add widgets to the wibox
s.wibox_two:setup {
layout = wibox.layout.align.horizontal,
WB.add_widgets_monitor (s),
WB.spacer,
WB.add_widgets_systray (s),
}
end
-- }}}
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
......@@ -196,6 +70,7 @@ end
function _M.init()
WB.taglist = deco.taglist()
WB.tasklist = deco.tasklist()
WB.initdeco ()
awful.screen.connect_for_each_screen(function(s)
WB.setup_common_boxes (s)
......
......@@ -7,25 +7,36 @@
-- {{{ Required libraries
local awful = require("awful")
local wibox = require("wibox")
local awful = require("awful")
local wibox = require("wibox")
local vicious = require("vicious")
local gmc = require("themes.gmc")