local awful = require("awful") local wibox = require("wibox") local beautiful = require("beautiful") -- load widgets --local mylauncher = require("widgets.button") local widget_cpu_usage = require("widgets.cpu") local widget_ram_usage = require("widgets.ram") local widget_temperature = require("widgets.temperature") local widget_battery = require("widgets.battery") local classiclayoutbox = require("widgets.classiclayouts") local volume_control = require("widgets.pavolctld") local widget_volume = volume_control.textbox -- store widgets here local spacing = 8 local separator = { widget = wibox.widget.separator, opacity = 0 } local widgets = { spacing = spacing, -- constant layoutlist = wibox.widget { layout = wibox.layout.fixed.horizontal, buttons = layout_buttons, wibox.container.margin( classiclayoutbox(s), spacing, spacing, 0, 0 ), }, taglist = function(s) return awful.widget.taglist { screen = s, 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 = wibox.widget.textclock("%A, %B %e, %-I:%M %p"), cpu = wibox.widget { layout = wibox.layout.fixed.horizontal, wibox.widget.textbox "CPU: ", widget_cpu_usage, wibox.widget.textbox "% ", widget_temperature "/sys/class/hwmon/hwmon2/temp1_input", -- FIXME wibox.widget.textbox "°", }, ram = { layout = wibox.layout.fixed.horizontal, wibox.widget.textbox "RAM: ", widget_ram_usage, wibox.widget.textbox "%", }, vol = { layout = wibox.layout.fixed.horizontal, buttons = volume_buttons, wibox.widget.textbox "VOL: ", widget_volume, wibox.widget.textbox "%", }, bat = { layout = wibox.layout.fixed.horizontal, buttons = volume_buttons, wibox.widget.textbox "BAT: ", widget_battery, }, } -- left widget group func function widgets.left_widgets(s) return wibox.widget { layout = wibox.layout.fixed.horizontal, spacing = spacing, { layout = wibox.layout.fixed.horizontal, widgets.layoutlist, widgets.taglist(s), }, widgets.tasklist(s), } end -- miggle widget group func function widgets.middle_widgets(s) return wibox.widget { layout = wibox.layout.fixed.horizontal, widgets.textclock, } end -- right widget group func function widgets.right_widgets(s) return wibox.widget { layout = wibox.layout.fixed.horizontal, { layout = wibox.layout.fixed.horizontal, spacing = spacing, widgets.cpu, widgets.ram, widgets.vol, widgets.bat, }, { widget = wibox.widget.separator, opacity = 0, forced_width = spacing }, --mylauncher, } end -- 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]) s.mypromptbox = awful.widget.prompt() -- create the wibox s.mywibox = awful.wibar({ position = "top", screen = s }) -- add widgets to the wibox s.mywibox:setup { layout = wibox.layout.align.horizontal, expand = "none", spacing = spacing, widgets.left_widgets(s), widgets.middle_widgets(s), 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