local gears = require("gears") local awful = require("awful") require("awful.autofocus") -- Widget and layout library local wibox = require("wibox") -- Theme handling library local beautiful = require("beautiful") -- Notification library local naughty = require("naughty") local menubar = require("menubar") local hotkeys_popup = require("awful.hotkeys_popup") -- Enable hotkeys help widget for VIM and other apps -- when client with a matching name is opened: require("awful.hotkeys_popup.keys") -- Load widgets local widget_cpu_usage = require("widgets.cpu") local widget_ram_usage = require("widgets.ram") local widget_temperature = require("widgets.temperature") local classiclayoutbox = require("widgets.classiclayoutbox") -- Menu -- Create a launcher widget and a main menu myawesomemenu = { { "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end }, { "restart", awesome.restart }, { "quit", function() awesome.quit() end }, } mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon }, { "open terminal", terminal } } }) mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, menu = mymainmenu }) -- Menubar configuration menubar.utils.terminal = terminal -- Set the terminal for applications that require it -- Wibar -- Create a textclock widget --mytextclock = wibox.widget.textclock("%A, %B %e, %-I:%M %p") -- x60 mytextclock = wibox.widget.textclock("%a, %b %e, %-H:%M") -- Create a wibox for each screen and add it 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 client.focus:move_to_tag(t) end end), awful.button({ }, 3, awful.tag.viewtoggle), awful.button({ modkey }, 3, function(t) if client.focus then client.focus:toggle_tag(t) end end), awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end), awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end) ) local tasklist_buttons = gears.table.join( awful.button({ }, 1, function (c) c:emit_signal("request::activate", "tasklist", {raise = true}) end), awful.button({ }, 3, function() awful.menu.client_list({ theme = { width = 250 } }) end), awful.button({ }, 4, function () awful.client.focus.byidx(1) end), awful.button({ }, 5, function () awful.client.focus.byidx(-1) end) ) --local function set_wallpaper(s) -- -- Wallpaper -- if beautiful.wallpaper then -- local wallpaper = beautiful.wallpaper -- -- If wallpaper is a function, call it with the screen -- if type(wallpaper) == "function" then -- wallpaper = wallpaper(s) -- end -- gears.wallpaper.maximized(wallpaper, s, true) -- end --end -- Re-set wallpaper when a screen's geometry changes (e.g. different resolution) --screen.connect_signal("property::geometry", set_wallpaper) 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() --s.mylayoutbox = awful.widget.layoutbox { -- screen = s, -- buttons = { -- 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 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 = 8, -- Left widgets { layout = wibox.layout.fixed.horizontal, spacing = 8, { layout = wibox.layout.fixed.horizontal, --awful.widget.layoutbox(s), classiclayoutbox(s), awful.widget.taglist { screen = s, filter = awful.widget.taglist.filter.noempty, buttons = taglist_buttons, }, }, { layout = wibox.layout.align.horizontal, expand = "outside", wibox.widget { widget = wibox.widget.separator, opacity = 0 }, 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", }, }, wibox.widget { widget = wibox.widget.separator, opacity = 0 }, }, }, -- Middle widget { layout = wibox.layout.fixed.horizontal, mytextclock, }, -- Right widgets { layout = wibox.layout.fixed.horizontal, spacing = 8, { layout = wibox.layout.fixed.horizontal, wibox.widget.textbox "CPU: ", widget_cpu_usage, wibox.widget.textbox "% ", widget_temperature "/sys/class/hwmon/hwmon2/temp1_input", wibox.widget.textbox "°", }, { layout = wibox.layout.fixed.horizontal, wibox.widget.textbox "RAM: ", widget_ram_usage, wibox.widget.textbox "%", }, mylauncher, }, } ---- Signal for changing tasklist filter based on layout ---- DOESNT WORK TODO --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 --) end)