summaryrefslogtreecommitdiff
path: root/bar.lua
diff options
context:
space:
mode:
Diffstat (limited to 'bar.lua')
-rw-r--r--bar.lua73
1 files changed, 24 insertions, 49 deletions
diff --git a/bar.lua b/bar.lua
index 698fb2e..a3e2e18 100644
--- a/bar.lua
+++ b/bar.lua
@@ -1,7 +1,7 @@
local awful = require("awful")
local wibox = require("wibox")
local beautiful = require("beautiful")
-local buttons = require("buttons")
+require("buttons")
-- load widgets
--local mylauncher = require("widgets.button")
@@ -11,21 +11,19 @@ local widget_temperature = require("widgets.temperature")
local widget_battery = require("widgets.battery")
local classiclayoutbox = require("widgets.classiclayouts")
local volume_control = require("widgets.pavolctld")
+local tasklist = require("widgets.tasklist")
local widget_volume = volume_control.textbox
-- store widgets here
-local spacing = 8
-local separator = { widget = wibox.widget.separator, opacity = 0 }
-
local widgets = {
temperature_file = nil;
- spacing = spacing, -- constant
+ spacing = beautiful.margin_leftright, -- constant
layoutlist = wibox.widget {
layout = wibox.layout.fixed.horizontal,
buttons = layout_buttons,
wibox.container.margin(
classiclayoutbox(s),
- spacing, spacing, 0, 0
+ beautiful.margin_leftright, beautiful.margin_leftright, 0, 0
),
},
taglist = function(s) return awful.widget.taglist {
@@ -33,26 +31,11 @@ local widgets = {
filter = awful.widget.taglist.filter.noempty,
buttons = taglist_buttons,
} end,
- tasklist = function(s) return wibox.widget {
- layout = wibox.layout.align.horizontal,
- expand = "outside",
- separator,
- awful.widget.tasklist {
- screen = s,
- filter = awful.widget.tasklist.filter.focused,
- buttons = tasklist_buttons,
- widget_template = {
- id = "text_role",
- widget = wibox.widget.textbox,
- align = "center",
- },
- },
- separator,
- } end,
- textclock = {
- widget = wibox.widget.textclock,
+ tasklist = tasklist,
+ textclock = wibox.widget {
format = "%A, %B %-e, %-I:%M %p",
font = beautiful.textclock_font,
+ widget = wibox.widget.textclock,
},
cpu = {
layout = wibox.layout.fixed.horizontal,
@@ -67,7 +50,7 @@ local widgets = {
widget_ram_usage,
wibox.widget.textbox "%",
},
- vol = {
+ vol = wibox.widget {
layout = wibox.layout.fixed.horizontal,
buttons = volume_buttons,
wibox.widget.textbox "VOL: ",
@@ -84,7 +67,7 @@ local widgets = {
-- left widget group func
function widgets.left_widgets(s) return wibox.widget {
layout = wibox.layout.fixed.horizontal,
- spacing = spacing,
+ spacing = beautiful.margin_leftright,
{
layout = wibox.layout.fixed.horizontal,
widgets.layoutlist,
@@ -93,7 +76,7 @@ function widgets.left_widgets(s) return wibox.widget {
widgets.tasklist(s),
} end
--- miggle widget group func
+-- middle widget group func
function widgets.middle_widgets(s) return wibox.widget {
layout = wibox.layout.fixed.horizontal,
widgets.textclock,
@@ -104,7 +87,7 @@ function widgets.right_widgets(s) return wibox.widget {
layout = wibox.layout.fixed.horizontal,
{
layout = wibox.layout.fixed.horizontal,
- spacing = spacing * 2,
+ spacing = beautiful.margin_leftright * 2,
{
layout = wibox.layout.fixed.horizontal,
widgets.cpu,
@@ -117,11 +100,18 @@ function widgets.right_widgets(s) return wibox.widget {
{
widget = wibox.widget.separator,
opacity = 0,
- forced_width = spacing
+ forced_width = beautiful.margin_leftright
},
--mylauncher,
} end
+-- create calendar popup on textclock
+local month_calendar = awful.widget.calendar_popup.month()
+month_calendar:attach(widgets.textclock, "t", { on_hover = false })
+
+-- bind volume popup to volume block
+volume_control.dropdown.dropdown:bind_to_widget(widgets.vol)
+
-- create a wibox for each screen and add it
awful.screen.connect_for_each_screen(function (s)
awful.tag({"1", "2", "3", "4", "5", "6", "7", "8", "9"}, s, awful.layout.layouts[1])
@@ -134,29 +124,14 @@ awful.screen.connect_for_each_screen(function (s)
s.mywibox:setup {
layout = wibox.layout.align.horizontal,
expand = "none",
- spacing = spacing,
+ spacing = beautiful.margin_leftright,
widgets.left_widgets(s),
- widgets.middle_widgets(s),
+ wibox.container.margin(
+ widgets.middle_widgets(s),
+ beautiful.margin_leftright, beautiful.margin_leftright, 0, 0
+ ),
widgets.right_widgets(s),
}
end)
----- signal for changing tasklist filter based on layout
----- DOESNT WORK TODO
---local naughty = require("naughty")
---s:connect_signal("property::layout", function()
--- naughty.notify({
--- title = "Hello, AwesomeWM!",
--- text = "This is a notification.",
--- timeout = 5, -- Timeout in seconds
--- position = "top_right" -- Position on the screen
--- })
--- if awful.layout.get(s) == awful.layout.suit.max then
--- s.mytasklist.filter = awful.widget.tasklist.filter.currenttags
--- else
--- s.mytasklist.filter = awful.widget.tasklist.filter.focused
--- end
---end
---)
-
return widgets