From fad09261cad390e0b4721a62726ba8176370ecdd Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 10 Aug 2022 15:58:56 +0300 Subject: [PATCH] screen refactoring --- .config/awesome/screen/init.lua | 463 +----------------- .config/awesome/screen/notif_icon/init.lua | 17 + .../screen/notifications/delete_btn.lua | 20 + .config/awesome/screen/notifications/init.lua | 56 +++ .config/awesome/screen/panels_switch/init.lua | 102 ++++ .config/awesome/screen/rclick_menu.lua | 20 + .config/awesome/screen/tags/buttons.lua | 24 + .config/awesome/screen/tags/init.lua | 61 +++ .config/awesome/screen/tasks/buttons.lua | 27 + .config/awesome/screen/tasks/init.lua | 41 ++ .config/awesome/screen/wibar/init.lua | 148 ++++++ .config/awesome/widgets/dev_bar/init.lua | 11 +- .config/awesome/widgets/stat_bar/init.lua | 7 +- .config/awesome/widgets/user_bar/init.lua | 6 +- 14 files changed, 556 insertions(+), 447 deletions(-) create mode 100644 .config/awesome/screen/notif_icon/init.lua create mode 100644 .config/awesome/screen/notifications/delete_btn.lua create mode 100644 .config/awesome/screen/notifications/init.lua create mode 100644 .config/awesome/screen/panels_switch/init.lua create mode 100644 .config/awesome/screen/rclick_menu.lua create mode 100644 .config/awesome/screen/tags/buttons.lua create mode 100644 .config/awesome/screen/tags/init.lua create mode 100644 .config/awesome/screen/tasks/buttons.lua create mode 100644 .config/awesome/screen/tasks/init.lua create mode 100644 .config/awesome/screen/wibar/init.lua diff --git a/.config/awesome/screen/init.lua b/.config/awesome/screen/init.lua index 700b9a4..5857ddc 100644 --- a/.config/awesome/screen/init.lua +++ b/.config/awesome/screen/init.lua @@ -1,469 +1,52 @@ local awful = require("awful") local gears = require("gears") local beautiful = require("beautiful") -local menubar = require("menubar") -local wibox = require("wibox") -local hotkeys_popup = require("awful.hotkeys_popup") -local bwf = require("widgets.battery") -local dpi = beautiful.xresources.apply_dpi -local shape_utils = require("commons.shape") -local icons = require("commons.icons") -local wbm = require("widgets.wibar_monitor") -local wb_player = require("widgets.player.wibar") -local naughty = require("naughty") -local notif_center = require("widgets.notification_center") +require("screen.rclick_menu") --- {{{ Menu --- Create a launcher widget and a main menu -myawesomemenu = { - { "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end }, - { "manual", terminal .. " -e man awesome" }, - { "edit config", editor_cmd .. " " .. awesome.conffile }, - { "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 - -- }}} - - -- Keyboard map indicator and switcher - mykeyboardlayout = awful.widget.keyboardlayout() - - -- {{{ Wibar - -- Create a textclock widget - mytextclock = wibox.widget.textclock() - - -- 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) - if c == client.focus then - c.minimized = true - else - c:emit_signal( - "request::activate", - "tasklist", - {raise = true} - ) - end - 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 tags = require("screen.tags") +local tasks = require("screen.tasks") +local notif = require("screen.notifications") +local notifi = require("screen.notif_icon") +local wibar = require("screen.wibar") +local stat_bar = require("widgets.stat_bar") +local dev_bar = require("widgets.dev_bar") +local user_bar = require("widgets.user_bar") 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 + gears.wallpaper.maximized( beautiful.wallpaper, s, true) 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) - -- Wallpaper set_wallpaper(s) - -- Each screen has its own tag table. awful.tag(cfg.tags.names, s, awful.layout.layouts[1]) - -- Create a promptbox for each screen - s.mypromptbox = awful.widget.prompt() - -- Create an imagebox widget which will contain an icon indicating which layout we're using. - -- We need one layoutbox per screen. + s.mylayoutbox = awful.widget.layoutbox(s) s.mylayoutbox:buttons(gears.table.join( 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 a taglist widget - s.mytaglist = awful.widget.taglist { - screen = s, - filter = awful.widget.taglist.filter.all, - buttons = taglist_buttons, - layout = {spacing = dpi(10), layout = wibox.layout.fixed.horizontal}, - widget_template = { - { - { - { - { - { - id = 'text_role', - widget = wibox.widget.textbox, - }, - layout = wibox.layout.fixed.horizontal, - }, - margins = dpi(8), - widget = wibox.container.margin - }, - - bg = beautiful.palette_c7, - shape = cfg.tags.shape, - widget = wibox.container.background - }, - margins = { - top = 5, - bottom = 5, - left = 6, - right = 6, - }, - widget = wibox.container.margin - }, - id = 'background_role', - widget = wibox.container.background, - } - } - - -- Create a tasklist widget - s.focused_task = awful.widget.tasklist { - screen = s, - filter = awful.widget.tasklist.filter.focused, - buttons = tasklist_buttons, - widget_template = { - { - { - layout = wibox.container.scroll.horizontal, - max_size = 400, - step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth, - speed = 300, - { - id = 'text_role', - widget = wibox.widget.textbox, - align = 'center', - valign = 'center', - } - }, - left = 10, - right = 10, - widget = wibox.container.margin - }, - shape = shape_utils.default_frr, - widget = wibox.container.background, - } - } - - -- Create the wibox - s.mywibox = awful.wibar({ - position = "top", - screen = s, - bg = beautiful.col_transparent, - height = dpi(40) - }) - - - local wbm_cpu = wbm.create("CPU: ") - awesome.connect_signal("sysstat::cpu", function(val, postfix) - wbm_cpu.wbm_body.wbm_labels.wbm_valtext.text = val .. postfix - wbm_cpu.wbm_body.wbm_graphs_margin.wbm_graphs.wbm_graph:add_value(val, 1) - end) - - local wbm_ram = wbm.create("RAM: ") - awesome.connect_signal("sysstat::ram", function(val, postfix) - wbm_ram.wbm_body.wbm_labels.wbm_valtext.text = val .. postfix - wbm_ram.wbm_body.wbm_graphs_margin.wbm_graphs.wbm_graph:add_value(val, 1) - end) - - - - s.notif = awful.wibar { - position = "right", - screen = s, - width = dpi(400), - height = dpi(1000), - margins = { - top = dpi(20), - right = dpi(10) - }, - visible = false - } - - - local delete_all_notif = wibox.widget{ - text = "Delete All", - font = beautiful.font, - align = "center", - opacity = 1, - widget = wibox.widget.textbox, - } - - delete_all_notif:buttons(gears.table.join(awful.button({ }, 1, function() - notif_center:reset() - end))) - - s.notif:setup { - layout = wibox.layout.fixed.vertical, - { - bg = beautiful.palette_c7, - widget = wibox.container.background, - { - widget = wibox.container.margin, - margins = dpi(10), - { - markup = "Notifications", - font = beautiful.font_famaly .. '20', - align = "center", - opacity = 1, - widget = wibox.widget.textbox, - } - }, - }, - delete_all_notif, - notif_center - } - - local notif_icon = icons.wbi("", 14) - - local notif_icon_box = { - notif_icon, - margins = 10, - widget = wibox.container.margin - }, - - notif_icon:buttons(gears.table.join(awful.button({ }, 1, function() - s.notif.visible = not s.notif.visible - end))) - - -- s.notif:bind_to_widget(notif_icon) - local create_munu_panel_button = function(glyph, text, btn_fn) - local btn = wibox.widget{ - { - { - icons.wbi(glyph, 12), - margins = dpi(5), - widget = wibox.container.margin - }, - bg = beautiful.palette_c7, - widget = wibox.container.background - }, - margins = dpi(5), - widget = wibox.container.margin - - } - - local myclock_t = awful.tooltip { - objects = { btn }, - timer_function = function() - return text - end, - } - - btn_fn(btn) - return btn - end - - - show_sub_panel = false - sub_panel_mode = 'dev' - - local stat_bar = require("widgets.stat_bar") - stat_bar.create(s) - - local dev_bar = require("widgets.dev_bar") - dev_bar.create(s) - - local user_bar = require("widgets.user_bar") - user_bar.create(s) - - local close_all_sub_panels = function() - s.stats.visible = false - s.dev.visible = false - s.user.visible = false - end - - - -- Add widgets to the wibox - s.mywibox:setup { - widget = wibox.container.margin, - top = dpi(4), - left = dpi(7), - right = dpi(7), - { - layout = wibox.layout.align.horizontal, - { -- Left widgets - layout = wibox.layout.fixed.horizontal, - { - widget = wibox.container.background, - bg = beautiful.pallete_c3, - shape = shape_utils.default_frr, - { - layout = wibox.layout.fixed.horizontal, - s.mytaglist, - -- s.mypromptbox, - }, - }, - { - widget = wibox.container.margin, - left = dpi(10), - { - widget = wibox.container.background, - bg = beautiful.pallete_c3, - shape = shape_utils.default_frr, - { - widget = wibox.container.margin, - left = dpi(10), - right = dpi(10), - { - layout = wibox.layout.fixed.horizontal, - - - create_munu_panel_button("", "User", function(btn) - btn:buttons(gears.table.join(awful.button({ }, 1, function() - if sub_panel_mode == 'user' and show_sub_panel then - s.user.visible = false - show_sub_panel = false - else - if not sub_panel_mode ~= 'user' then - close_all_sub_panels() - end - show_sub_panel = true - sub_panel_mode = 'user' - s.user.visible = true - - end - end))) - end), - create_munu_panel_button("", "Devtools", function(btn) - btn:buttons(gears.table.join(awful.button({ }, 1, function() - if sub_panel_mode == 'dev' and show_sub_panel then - s.dev.visible = false - show_sub_panel = false - else - if not sub_panel_mode ~= 'dev' then - close_all_sub_panels() - end - show_sub_panel = true - sub_panel_mode = 'dev' - s.dev.visible = true - end - end))) - end), + s.mytaglist = tags.create(s) + s.focused_task = tasks.create(s) - create_munu_panel_button("", "Stats", function(btn) - btn:buttons(gears.table.join(awful.button({ }, 1, function() - if sub_panel_mode == 'stat' and show_sub_panel then - s.stats.visible = false - show_sub_panel = false - else - if not sub_panel_mode ~= 'stat' then - close_all_sub_panels() - end - show_sub_panel = true - sub_panel_mode = 'stat' - s.stats.visible = true + show_sub_panel = false + sub_panel_mode = 'dev' - end - end))) - end), - } - } - } - }, - { - widget = wibox.container.margin, - left = dpi(10), - { - { - layout = wibox.layout.fixed.horizontal, - s.focused_task, - }, - widget = wibox.container.background, - bg = beautiful.pallete_c3, - shape = shape_utils.default_frr, - } - } - }, - nil, - { -- Right widgets - layout = wibox.layout.fixed.horizontal, - { - widget = wibox.container.margin, - right = dpi(10), - { - widget = wibox.container.background, - bg = beautiful.pallete_c3, - shape = shape_utils.default_frr, - wb_player - } - }, - { - widget = wibox.container.margin, - right = dpi(10), - { - widget = wibox.container.background, - bg = beautiful.pallete_c3, - shape = shape_utils.default_frr, - wbm_cpu - } - }, - { - widget = wibox.container.margin, - right = dpi(10), - { - widget = wibox.container.background, - bg = beautiful.pallete_c3, - shape = shape_utils.default_frr, - wbm_ram - } - }, - { - widget = wibox.container.background, - bg = beautiful.pallete_c3, - shape = shape_utils.default_frr, - { - layout = wibox.layout.fixed.horizontal, - mytextclock, - bwf.create({size = 20}), - notif_icon_box, - mykeyboardlayout, - wibox.widget.systray(), - -- s.mylayoutbox, - } - } - } - } - } + s.stats = stat_bar.create(s) + s.dev = dev_bar.create(s) + s.user = user_bar.create(s) + s.notif = notif.create(s) + + wibar.create(s) end) --- }}} diff --git a/.config/awesome/screen/notif_icon/init.lua b/.config/awesome/screen/notif_icon/init.lua new file mode 100644 index 0000000..e6392d4 --- /dev/null +++ b/.config/awesome/screen/notif_icon/init.lua @@ -0,0 +1,17 @@ +local awful = require("awful") +local gears = require("gears") +local wibox = require("wibox") +local icons = require("commons.icons") + +return { + create = function(s) + local notif_icon = icons.wbi("", 14) + + notif_icon:buttons(gears.table.join(awful.button({ }, 1, function() + s.notif.visible = not s.notif.visible + end))) + + return notif_icon + + end +} diff --git a/.config/awesome/screen/notifications/delete_btn.lua b/.config/awesome/screen/notifications/delete_btn.lua new file mode 100644 index 0000000..ebeb636 --- /dev/null +++ b/.config/awesome/screen/notifications/delete_btn.lua @@ -0,0 +1,20 @@ +local awful = require("awful") +local gears = require("gears") +local beautiful = require("beautiful") +local wibox = require("wibox") +local notif_center = require("widgets.notification_center") + + +local delete_all_notif = wibox.widget{ + text = "Delete All", + font = beautiful.font, + align = "center", + opacity = 1, + widget = wibox.widget.textbox, +} + +delete_all_notif:buttons(gears.table.join(awful.button({ }, 1, function() + notif_center:reset() +end))) + +return delete_all_notif; diff --git a/.config/awesome/screen/notifications/init.lua b/.config/awesome/screen/notifications/init.lua new file mode 100644 index 0000000..5a7b499 --- /dev/null +++ b/.config/awesome/screen/notifications/init.lua @@ -0,0 +1,56 @@ +local awful = require("awful") +local gears = require("gears") +local beautiful = require("beautiful") +local wibox = require("wibox") +local dpi = beautiful.xresources.apply_dpi +local notif_center = require("widgets.notification_center") +local delete_btn = require("screen.notifications.delete_btn") + +return { + + create = function(s) + + local notif = awful.wibar { + + position = "right", + screen = s, + width = dpi(400), + height = dpi(1000), + visible = false, + + margins = { + top = dpi(20), + right = dpi(10) + }, + } + + + local header = { + widget = wibox.container.margin, + margins = dpi(10), + { + markup = "Notifications", + font = beautiful.font_famaly .. '20', + align = "center", + opacity = 1, + widget = wibox.widget.textbox, + } + } + + + notif:setup { + layout = wibox.layout.fixed.vertical, + { + bg = beautiful.palette_c7, + widget = wibox.container.background, + header, + }, + delete_btn, + notif_center + } + + return notif + + + end +} diff --git a/.config/awesome/screen/panels_switch/init.lua b/.config/awesome/screen/panels_switch/init.lua new file mode 100644 index 0000000..a2d54c9 --- /dev/null +++ b/.config/awesome/screen/panels_switch/init.lua @@ -0,0 +1,102 @@ +local awful = require("awful") +local gears = require("gears") +local beautiful = require("beautiful") +local wibox = require("wibox") +local dpi = beautiful.xresources.apply_dpi +local icons = require("commons.icons") + + +local close_all_sub_panels = function(s) + s.stats.visible = false + s.dev.visible = false + s.user.visible = false +end + + +local create_munu_panel_button = function(glyph, text, btn_fn) + local btn = wibox.widget{ + { + { + icons.wbi(glyph, 12), + margins = dpi(5), + widget = wibox.container.margin + }, + bg = beautiful.palette_c7, + widget = wibox.container.background + }, + margins = dpi(5), + widget = wibox.container.margin + + } + + local myclock_t = awful.tooltip { + objects = { btn }, + timer_function = function() + return text + end, + } + + btn_fn(btn) + return btn +end + + +return { + create = function(s) + return { + layout = wibox.layout.fixed.horizontal, + + + create_munu_panel_button("", "User", function(btn) + btn:buttons(gears.table.join(awful.button({ }, 1, function() + if sub_panel_mode == 'user' and show_sub_panel then + s.user.visible = false + show_sub_panel = false + else + if not sub_panel_mode ~= 'user' then + close_all_sub_panels(s) + end + show_sub_panel = true + sub_panel_mode = 'user' + s.user.visible = true + + end + end))) + end), + + create_munu_panel_button("", "Devtools", function(btn) + btn:buttons(gears.table.join(awful.button({ }, 1, function() + if sub_panel_mode == 'dev' and show_sub_panel then + s.dev.visible = false + show_sub_panel = false + else + if not sub_panel_mode ~= 'dev' then + close_all_sub_panels(s) + end + show_sub_panel = true + sub_panel_mode = 'dev' + s.dev.visible = true + + end + end))) + end), + + create_munu_panel_button("", "Stats", function(btn) + btn:buttons(gears.table.join(awful.button({ }, 1, function() + if sub_panel_mode == 'stat' and show_sub_panel then + s.stats.visible = false + show_sub_panel = false + else + if not sub_panel_mode ~= 'stat' then + close_all_sub_panels(s) + end + show_sub_panel = true + sub_panel_mode = 'stat' + s.stats.visible = true + + end + end))) + end), + } + end +} diff --git a/.config/awesome/screen/rclick_menu.lua b/.config/awesome/screen/rclick_menu.lua new file mode 100644 index 0000000..348d775 --- /dev/null +++ b/.config/awesome/screen/rclick_menu.lua @@ -0,0 +1,20 @@ +local awful = require("awful") +local beautiful = require("beautiful") +local hotkeys_popup = require("awful.hotkeys_popup") +local menubar = require("menubar") + +myawesomemenu = { + { "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end }, + { "manual", terminal .. " -e man awesome" }, + { "edit config", editor_cmd .. " " .. awesome.conffile }, + { "restart", awesome.restart }, + { "quit", function() awesome.quit() end }, + } + + mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon }, + { "open terminal", terminal } + } + }) + + + menubar.utils.terminal = terminal diff --git a/.config/awesome/screen/tags/buttons.lua b/.config/awesome/screen/tags/buttons.lua new file mode 100644 index 0000000..cfe2924 --- /dev/null +++ b/.config/awesome/screen/tags/buttons.lua @@ -0,0 +1,24 @@ +local awful = require("awful") +local gears = require("gears") + +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) +) diff --git a/.config/awesome/screen/tags/init.lua b/.config/awesome/screen/tags/init.lua new file mode 100644 index 0000000..0b8237f --- /dev/null +++ b/.config/awesome/screen/tags/init.lua @@ -0,0 +1,61 @@ +local awful = require("awful") +local beautiful = require("beautiful") +local dpi = beautiful.xresources.apply_dpi +local gears = require("gears") +local wibox = require("wibox") + +require("screen.tags.buttons") + +return { + + create = function(s) + + + local name_section = { + { + { + id = 'text_role', + widget = wibox.widget.textbox, + }, + layout = wibox.layout.fixed.horizontal, + }, + margins = dpi(8), + widget = wibox.container.margin + } + + + local widget_template = { + id = 'background_role', + widget = wibox.container.background, + { + widget = wibox.container.margin, + margins = { + top = 5, + bottom = 5, + left = 6, + right = 6, + }, + { + name_section, + bg = beautiful.palette_c7, + shape = cfg.tags.shape, + widget = wibox.container.background + }, + }, + } + + + return awful.widget.taglist { + screen = s, + filter = awful.widget.taglist.filter.all, + buttons = taglist_buttons, + + layout = { + spacing = dpi(10), + layout = wibox.layout.fixed.horizontal + }, + + widget_template = widget_template + } + end +} diff --git a/.config/awesome/screen/tasks/buttons.lua b/.config/awesome/screen/tasks/buttons.lua new file mode 100644 index 0000000..885e314 --- /dev/null +++ b/.config/awesome/screen/tasks/buttons.lua @@ -0,0 +1,27 @@ +local awful = require("awful") +local gears = require("gears") + +tasklist_buttons = gears.table.join( + awful.button({ }, 1, function (c) + if c == client.focus then + c.minimized = true + else + c:emit_signal( + "request::activate", + "tasklist", + {raise = true} + ) + end + 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)) diff --git a/.config/awesome/screen/tasks/init.lua b/.config/awesome/screen/tasks/init.lua new file mode 100644 index 0000000..a901b55 --- /dev/null +++ b/.config/awesome/screen/tasks/init.lua @@ -0,0 +1,41 @@ +local awful = require("awful") +local wibox = require("wibox") +local shape = require("commons.shape") + +require("screen.tasks.buttons") + +return { + create = function(s) + local name_section = { + left = 10, + right = 10, + widget = wibox.container.margin, + { + layout = wibox.container.scroll.horizontal, + max_size = 400, + speed = 300, + step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth, + { + id = 'text_role', + widget = wibox.widget.textbox, + align = 'center', + valign = 'center', + } + } + } + + + local widget_template = { + name_section, + shape = shape.default_frr, + widget = wibox.container.background, + } + + return awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.focused, + buttons = tasklist_buttons, + widget_template = widget_template + } + end +} diff --git a/.config/awesome/screen/wibar/init.lua b/.config/awesome/screen/wibar/init.lua new file mode 100644 index 0000000..6c21a40 --- /dev/null +++ b/.config/awesome/screen/wibar/init.lua @@ -0,0 +1,148 @@ +local awful = require("awful") +local beautiful = require("beautiful") +local wibox = require("wibox") +local bwf = require("widgets.battery") +local dpi = beautiful.xresources.apply_dpi +local shape_utils = require("commons.shape") +local wbm = require("widgets.wibar_monitor") +local wb_player = require("widgets.player.wibar") + +local notifi = require("screen.notif_icon") +local panels_switch = require("screen.panels_switch") + + +return { + create = function(s) + + local notif_icon = notifi.create(s) + + local wbm_cpu = wbm.create("CPU: ") + awesome.connect_signal("sysstat::cpu", function(val, postfix) + wbm_cpu.wbm_body.wbm_labels.wbm_valtext.text = val .. postfix + wbm_cpu.wbm_body.wbm_graphs_margin.wbm_graphs.wbm_graph:add_value(val, 1) + end) + + local cpu_section = { + widget = wibox.container.background, + bg = beautiful.pallete_c3, + shape = shape_utils.default_frr, + wbm_cpu + } + + local wbm_ram = wbm.create("RAM: ") + awesome.connect_signal("sysstat::ram", function(val, postfix) + wbm_ram.wbm_body.wbm_labels.wbm_valtext.text = val .. postfix + wbm_ram.wbm_body.wbm_graphs_margin.wbm_graphs.wbm_graph:add_value(val, 1) + end) + + local ram_section = { + widget = wibox.container.background, + bg = beautiful.pallete_c3, + shape = shape_utils.default_frr, + wbm_ram + } + + local wibar = awful.wibar({ + + position = "top", + screen = s, + bg = beautiful.col_transparent, + height = dpi(40) + }) + + wibar:setup { + widget = wibox.container.margin, + top = dpi(4), + left = dpi(7), + right = dpi(7), + { + layout = wibox.layout.align.horizontal, + { -- Left widgets + layout = wibox.layout.fixed.horizontal, + { + widget = wibox.container.background, + bg = beautiful.pallete_c3, + shape = shape_utils.default_frr, + { + layout = wibox.layout.fixed.horizontal, + s.mytaglist, + }, + }, + { + widget = wibox.container.margin, + left = dpi(10), + { + widget = wibox.container.background, + bg = beautiful.pallete_c3, + shape = shape_utils.default_frr, + { + widget = wibox.container.margin, + left = dpi(10), + right = dpi(10), + panels_switch.create(s) + } + } + }, + { + widget = wibox.container.margin, + left = dpi(10), + { + { + layout = wibox.layout.fixed.horizontal, + s.focused_task, + }, + widget = wibox.container.background, + bg = beautiful.pallete_c3, + shape = shape_utils.default_frr, + } + } + }, + nil, + { -- Right widgets + layout = wibox.layout.fixed.horizontal, + { + widget = wibox.container.margin, + right = dpi(10), + { + widget = wibox.container.background, + bg = beautiful.pallete_c3, + shape = shape_utils.default_frr, + wb_player + } + }, + { + widget = wibox.container.margin, + right = dpi(10), + cpu_section + }, + { + widget = wibox.container.margin, + right = dpi(10), + ram_section + }, + { + widget = wibox.container.background, + bg = beautiful.pallete_c3, + shape = shape_utils.default_frr, + { + layout = wibox.layout.fixed.horizontal, + wibox.widget.textclock(), + bwf.create({size = 20}), + { + notif_icon, + margins = 10, + widget = wibox.container.margin + }, + awful.widget.keyboardlayout(), + wibox.widget.systray(), + -- s.mylayoutbox, + } + } + } + } + } + + return wibar + + end +} diff --git a/.config/awesome/widgets/dev_bar/init.lua b/.config/awesome/widgets/dev_bar/init.lua index b64e450..52b54d2 100644 --- a/.config/awesome/widgets/dev_bar/init.lua +++ b/.config/awesome/widgets/dev_bar/init.lua @@ -9,24 +9,29 @@ local repos = card.create_with_header("Repositories", require("widgets.repos").c return { create = function(s) - s.dev = awful.wibar({ + local dev = awful.wibar({ + position = "left", screen = s, shape = shape_utils.default_frr, visible = false, width = dpi(500), height = dpi(1000), + margins = { - left = dpi(15) + left = dpi(15) } + }) - s.dev:setup{ + dev:setup{ packs, repos, layout = wibox.layout.flex.vertical } + return dev + end } diff --git a/.config/awesome/widgets/stat_bar/init.lua b/.config/awesome/widgets/stat_bar/init.lua index 5d1f85c..7955bf6 100644 --- a/.config/awesome/widgets/stat_bar/init.lua +++ b/.config/awesome/widgets/stat_bar/init.lua @@ -58,7 +58,8 @@ local disks_stats_widget = card.create_with_header("Partitions", amp.create(disk return { create = function(s) - s.stats = awful.wibar({ + + local stat = awful.wibar({ position = "left", screen = s, shape = shape_utils.default_frr, @@ -70,12 +71,14 @@ return { } }) - s.stats:setup{ + stat:setup{ sys_stats_widget, processes_widget, disks_stats_widget, layout = wibox.layout.flex.vertical } + return stat + end } diff --git a/.config/awesome/widgets/user_bar/init.lua b/.config/awesome/widgets/user_bar/init.lua index 4ce97cb..6e7a9ba 100644 --- a/.config/awesome/widgets/user_bar/init.lua +++ b/.config/awesome/widgets/user_bar/init.lua @@ -16,7 +16,7 @@ local profile = require("widgets.profile") return { create = function(s) - s.user = awful.wibar({ + local user = awful.wibar({ position = "left", screen = s, shape = shape_utils.default_frr, @@ -51,7 +51,7 @@ return { layout = wibox.layout.flex.horizontal } - s.user:setup{ + user:setup{ layout = wibox.layout.align.vertical, header, { @@ -61,5 +61,7 @@ return { tasks, } } + + return user end }