diff options
author | Timmy Keller <tjk@tjkeller.xyz> | 2024-09-17 19:17:49 -0500 |
---|---|---|
committer | Timmy Keller <tjk@tjkeller.xyz> | 2024-09-17 19:17:49 -0500 |
commit | 36b45cb895303f4b8bdd99a737259740129e1fb9 (patch) | |
tree | c463be93caa340eb389a7b85ba155d2855b1e244 /awesome/bar.lua | |
parent | 3d98a08123c0c79641dd27516ef776747710ad4a (diff) | |
download | dotconfig-36b45cb895303f4b8bdd99a737259740129e1fb9.tar.xz dotconfig-36b45cb895303f4b8bdd99a737259740129e1fb9.zip |
add current awesome configs
Diffstat (limited to 'awesome/bar.lua')
-rw-r--r-- | awesome/bar.lua | 184 |
1 files changed, 184 insertions, 0 deletions
diff --git a/awesome/bar.lua b/awesome/bar.lua new file mode 100644 index 0000000..e9465d3 --- /dev/null +++ b/awesome/bar.lua @@ -0,0 +1,184 @@ +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) |