From 42690613050ca0bf44ebaf1f13cfc7dd848d8aa0 Mon Sep 17 00:00:00 2001 From: Yessiest Date: Wed, 9 Feb 2022 14:47:30 +0000 Subject: [PATCH] fixed awmtk, somehow. also added prototype for drawers. --- core/layout.lua | 32 ++++------------- core/vars.lua | 2 +- libs/awmtk.lua | 11 ++---- themes/unity/theme.lua | 8 ++++- widgets/drawer.lua | 38 ++++++++++++++++++++ widgets/mailbox.lua | 2 +- widgets/{current_window.lua => wintitle.lua} | 4 +-- 7 files changed, 58 insertions(+), 39 deletions(-) create mode 100644 widgets/drawer.lua rename widgets/{current_window.lua => wintitle.lua} (89%) diff --git a/core/layout.lua b/core/layout.lua index 61de031..faf5f8f 100644 --- a/core/layout.lua +++ b/core/layout.lua @@ -87,11 +87,7 @@ awful.screen.connect_for_each_screen(function(s) --require("widgets.polylauncher")({vertical = false}), --s.mytaglist, s.mypromptbox, - require("widgets.current_window")({ - style = { - icon_bg_normal = beautiful.topbar_bg - } - }), + require("widgets.wintitle")({}), spacing = 3 }, -- Middle widget @@ -108,38 +104,24 @@ awful.screen.connect_for_each_screen(function(s) { -- Right widgets layout = wibox.layout.fixed.horizontal, awful.widget.keyboardlayout(), + require("widgets.drawer")({ + wibox.widget.systray(), + vertical = false + }), require("widgets.wallpapers")({ screen = s, path = os.getenv("HOME").."/Pictures/Wallpapers/", - style = { - icon_bg_normal = beautiful.topbar_bg - } }), require("widgets.mailbox")({ screen = s, - style = { - rounding = 1, - icon_bg_normal = beautiful.topbar_bg - } }), --wibox.widget.systray(), - require("widgets.volume")({ - style = { - icon_bg_normal = beautiful.topbar_bg - } - }), + require("widgets.volume")({}), require("widgets.battery")({ percentage = true, - style = { - icon_bg_normal = beautiful.topbar_bg - } }), wibox.widget.textclock(), - require("widgets.username")({ - style = { - icon_bg_normal = beautiful.topbar_bg - } - }), + require("widgets.username")({}), s.mylayoutbox, spacing = 4 }, diff --git a/core/vars.lua b/core/vars.lua index 9c6ef06..c8eac77 100644 --- a/core/vars.lua +++ b/core/vars.lua @@ -5,7 +5,7 @@ global = {} global.awesome_dir = os.getenv("HOME").."/.config/awesome/" global.config_dir = os.getenv("HOME").."/.awesome/" global.themes_dir = os.getenv("HOME").."/.config/awesome/themes/" -global.theme = global.awesome_dir .. "themes/unity/theme.lua" +global.theme = global.awesome_dir .. "themes/unity_simplified/theme.lua" global.terminal = "xterm" global.editor = os.getenv("EDITOR") or "vim" global.editor_cmd = global.terminal .. " -e ".. global.editor diff --git a/libs/awmtk.lua b/libs/awmtk.lua index 4923782..04e96ac 100644 --- a/libs/awmtk.lua +++ b/libs/awmtk.lua @@ -187,7 +187,7 @@ awmtk.create_prefix = function(style,prefix,index) -- Create a prefix for new widgets to use local keys = index for _,k in pairs(keys) do - style[prefix..k] = style[prefix..k] or style[k] or parent[k] + style[prefix..k] = style[prefix..k] or style[k] end return style end @@ -235,22 +235,15 @@ defaults.shape_border_color = defaults.shape_border_color or defaults.bg_normal -- Extra variables defaults.inner_margin = defaults.inner_margin or 5 defaults.rounding = defaults.rounding or 0 -local new_defaults = {} -- Generate classes variables for _,class in pairs(classes) do for parameter,value in pairs(defaults) do - new_defaults[class..parameter] = ( + defaults[class..parameter] = ( defaults[class..parameter] or value ) end end -for parameter,value in pairs(defaults) do - new_defaults[parameter] = value -end -defaults = setmetatable(new_defaults,{ - __index = beautiful -}) --make icons look less weird defaults.icon_inner_margin = beautiful.icon_inner_margin or 0 --add spacing for lists diff --git a/themes/unity/theme.lua b/themes/unity/theme.lua index ce295b5..c7914b5 100644 --- a/themes/unity/theme.lua +++ b/themes/unity/theme.lua @@ -142,7 +142,13 @@ theme.topbar_bg = { theme.titlebar_rounding = 6 theme.bg_systray = "#3A3A36" -theme.prompt_bg = theme.titlebar_bg_normal +theme.prompt_bg = theme.topbar_bg +theme.wintitle_icon_bg_normal = theme.topbar_bg +theme.wallpapers_icon_bg_normal = theme.topbar_bg +theme.mailbox_icon_bg_normal = theme.topbar_bg +theme.volume_icon_bg_normal = theme.topbar_bg +theme.battery_icon_bg_normal = theme.topbar_bg +theme.username_icon_bg_normal = theme.topbar_bg -- Generate taglist squares: local taglist_square_size = dpi(4) theme.taglist_squares_sel = theme_assets.taglist_squares_sel( diff --git a/widgets/drawer.lua b/widgets/drawer.lua new file mode 100644 index 0000000..efde98e --- /dev/null +++ b/widgets/drawer.lua @@ -0,0 +1,38 @@ +local awful = require("awful") +local wibox = require("wibox") +local awmtk = require("awmtk") + +return function(args) + local style = awmtk.style(awmtk.defaults, args.style or {},"drawer_") + local contained_widget = { + id = "contents", + widget = wibox.container.background, + layout = (args.vertical and wibox.layout.fixed.vertical) or + wibox.layout.fixed.horizontal, + visible = false + } + for k,v in ipairs(args) do + table.insert(contained_widget,v) + end + local widget = style.icon { + contained_widget, + { + widget = wibox.widget.imagebox, + image = style["battery_missing_symbolic"], + id = "widget_toggle", + resize = true + }, + layout = (args.vertical and wibox.layout.fixed.vertical) or + wibox.layout.fixed.horizontal, + spacing = style.drawer_container_spacing_horizontal + } + widget:get_children_by_id("widget_toggle")[1]:buttons( + awful.util.table.join( + awful.button({},1,function() + local subwidget = widget:get_children_by_id("contents")[1] + subwidget.visible = not subwidget.visible + end) + ) + ) + return widget +end diff --git a/widgets/mailbox.lua b/widgets/mailbox.lua index 66f1f3a..0ba821e 100644 --- a/widgets/mailbox.lua +++ b/widgets/mailbox.lua @@ -10,7 +10,7 @@ local widget = {} local function worker(args) local args = args or {} -- Set up style variables - style = awmtk.style(awmtk.defaults,args.style,"mailbox_") + style = awmtk.style(awmtk.defaults,args.style or {},"mailbox_") style.mailbox_container_width = style.mailbox_container_width or 260 style.mailbox_button_height = style.mailbox_button_heihgt or 40 args.mail_limit = args.mail_limit or 8 diff --git a/widgets/current_window.lua b/widgets/wintitle.lua similarity index 89% rename from widgets/current_window.lua rename to widgets/wintitle.lua index ff68dab..1d4205a 100644 --- a/widgets/current_window.lua +++ b/widgets/wintitle.lua @@ -4,7 +4,7 @@ local wibox = require("wibox") local awmtk = require("awmtk") return function(args) - local style = awmtk.style(awmtk.defaults, args.style or {},"username_") + local style = awmtk.style(awmtk.defaults, args.style or {},"wintitle_") local icon = style.icon({ { widget = wibox.widget.textbox, @@ -12,7 +12,7 @@ return function(args) id = "widget_text" }, layout = wibox.layout.fixed.horizontal, - spacing = style.username_container_spacing_horizontal or 4 + spacing = style.wintitle_container_spacing_horizontal or 4 }) local text = icon:get_children_by_id("widget_text")[1] client.connect_signal("focus", function()