From 4beaea3229ac2939f3ec061a40895d50d25d5321 Mon Sep 17 00:00:00 2001 From: Yessiest Date: Sun, 21 Aug 2022 16:28:28 +0400 Subject: [PATCH] humble beginnings --- libs/awmtk2.lua | 82 +++++-- libs/builder.lua | 118 ++++++++++ modules/desktop.lua | 221 ++++++++---------- modules/global.lua | 2 +- themes/default/config/titlebar_top.json | 36 +++ themes/default/config/wibar_top.json | 13 ++ themes/default/theme.lua | 18 ++ themes/reno98/config/titlebar_top.json | 36 +++ themes/reno98/config/wibar_bottom.json | 16 ++ themes/reno98/config/wibar_top.json | 19 ++ themes/reno98/theme.lua | 126 ++++++---- themes/reno98/titlebar/close_focus.png | Bin 966 -> 369 bytes themes/reno98/titlebar/close_normal.png | Bin 966 -> 369 bytes .../titlebar/maximized_focus_active.png | Bin 480 -> 217 bytes .../titlebar/maximized_focus_inactive.png | Bin 452 -> 206 bytes .../titlebar/maximized_normal_active.png | Bin 480 -> 217 bytes .../titlebar/maximized_normal_inactive.png | Bin 452 -> 206 bytes themes/reno98/titlebar/minimize_focus.png | Bin 234 -> 190 bytes themes/reno98/titlebar/minimize_normal.png | Bin 225 -> 190 bytes widgets/base/base.lua | 14 ++ widgets/base/clock.lua | 43 ++++ widgets/base/subpanel.lua | 14 ++ widgets/dismal.lua | 2 + widgets/tasklist.lua | 122 ++++++++++ 24 files changed, 695 insertions(+), 187 deletions(-) create mode 100644 libs/builder.lua create mode 100644 themes/default/config/titlebar_top.json create mode 100644 themes/default/config/wibar_top.json create mode 100644 themes/reno98/config/titlebar_top.json create mode 100644 themes/reno98/config/wibar_bottom.json create mode 100644 themes/reno98/config/wibar_top.json create mode 100644 widgets/base/base.lua create mode 100644 widgets/base/clock.lua create mode 100644 widgets/base/subpanel.lua create mode 100644 widgets/tasklist.lua diff --git a/libs/awmtk2.lua b/libs/awmtk2.lua index c04fc43..480184c 100644 --- a/libs/awmtk2.lua +++ b/libs/awmtk2.lua @@ -1,3 +1,4 @@ +-- RenoTK (formerly AWMTK2) - Template/Granular styling library for Reno local wibox = require("wibox") local awful = require("awful") local gears = require("gears") @@ -63,18 +64,14 @@ awmtk.build_templates = function(templates,style) return new_templates end -awmtk.merge = function(base,overrides) - for k,v in pairs(overrides) do - base[k] = v - end - return base -end +awmtk.merge = gears.table.join -- }}} -- {{{ Default style --- Default style +-- Prototype style +-- Notice that it's not awmtk.default style - it's used as a base for default. awmtk.proto_style = { base = setmetatable({ -- { Backgrounds @@ -88,13 +85,13 @@ awmtk.proto_style = { -- Borders for popups shape_border_width = beautiful.shape_border_width or 0, shape_border_color = beautiful.shape_border_color or beautiful.bg_normal, + -- } -- { Callbacks -- a tiny bit more complex thing to account for more extensibility -- the stub functions do nothing - you should implement functionality inside theme onpress = function() end, onrelease = function() end, -- } - -- } -- { Shapes margins = 5, spacing = 5, @@ -140,6 +137,10 @@ awmtk.proto_style.popup = awmtk.create_delta("popup", { awmtk.proto_style.titlebar = awmtk.create_delta("titlebar", { margins = 1 }, awmtk.proto_style,awmtk.proto_style.base) + +awmtk.proto_style.wibar = awmtk.create_delta("wibar", { + margins = 1 +}, awmtk.proto_style,awmtk.proto_style.base) -- }}} -- {{{ Generic templates @@ -154,8 +155,8 @@ awmtk.proto_templates = { return awmtk.merge({ { layout, - margins = (options and options.margins) or style.container.margins, - widget = wibox.container.margin + margins = style.container.margins, + layout = wibox.container.margin }, bgimage = style.container.bgimage, bg = style.container.bg_normal, @@ -173,8 +174,8 @@ awmtk.proto_templates = { return awmtk.merge({ { layout, - margins = (options and options.margins) or style.button.margins, - widget = wibox.container.margin + margins = style.button.margins, + layout = wibox.container.margin }, bgimage = style.button.bgimage, bg = style.button.bg_normal, @@ -223,13 +224,14 @@ awmtk.proto_templates = { article = function(style) -- Article is a template that combines 3 common pieces of a full item: -- Icon, name and description. Designed to be placed within a container - -- or a button. + -- or a button. Also supports usage in tasklist via _id suffixes. return function(options) return awmtk.merge({ (options.icon and { { { image = options.icon, + id = options.icon_id, resize = options.resize, widget = wibox.widget.imagebox }, @@ -247,16 +249,18 @@ awmtk.proto_templates = { { { markup = options.title or "", + id = options.title_id, widget = wibox.widget.textbox, - font = options.font or style.article.font, + font = style.article.font, align = options.font_align or style.article.font_align, valign = "center" }, (options.description and { - markup = options.description, + markup = options.description or "", + id = options.desc_id, widget = wibox.widget.textbox, - font = options.small_font or style.article.small_font, + font = style.article.small_font, align = options.small_font_align or style.article.small_font_align, valign = "center" @@ -277,8 +281,8 @@ awmtk.proto_templates = { return awmtk.merge({ widget = { widget, - margins = (options and options.margins) or style.popup.margins, - widget = wibox.container.margin + margins = style.popup.margins, + layout = wibox.container.margin }, bgimage = style.popup.bgimage, shape = style.popup.shape, @@ -293,21 +297,53 @@ awmtk.proto_templates = { -- titlebars. The decision to make it a separate class was due to -- the fact that much customization is done through default theme table return function(layout,options) + -- If there's one thing that fascinates me, it's how much weird + -- bugs i manage to uncover by some sort of miraculous accident. + -- This one fixes a race condition in margins+(left/right/bottom/top) configuration scenario + local margins = style.titlebar.margins + if (style.titlebar.left or + style.titlebar.right or + style.titlebar.bottom or + style.titlebar.top) then + margins = nil + end return awmtk.merge({ layout, - margins = (options and options.margins) or - style.titlebar.margins, - widget = wibox.container.margin, + margins = margins, + layout = wibox.container.margin, left = style.titlebar.left, right = style.titlebar.right, bottom = style.titlebar.bottom, top = style.titlebar.top },options or {}) end - end + end, + + wibar = function(style) + -- Just you regular old wibar, but as a style template. + return function(layout,options) + local margins = style.wibar.margins + if (style.wibar.left or + style.wibar.right or + style.wibar.bottom or + style.wibar.top) then + margins = nil + end + return awmtk.merge({ + layout, + margins = margins, + layout = wibox.container.margin, + left = style.wibar.left, + right = style.wibar.right, + bottom = style.wibar.bottom, + top = style.wibar.top + },options or {}) + end + end, } --- yes +-- Last but not least - we export a default template lib and default style. +-- This is done in order to allow overriding default style behaviour from theme awmtk.default = awmtk.create_style("default",awmtk.proto_style,{}) awmtk.templates = awmtk.create_template_lib("templates",awmtk.proto_templates,{}) -- }}} diff --git a/libs/builder.lua b/libs/builder.lua new file mode 100644 index 0000000..0e0956d --- /dev/null +++ b/libs/builder.lua @@ -0,0 +1,118 @@ +-- JSON layout builder +local json = require("dkjson") +local gears = require("gears") +local wibox = require("wibox") +local awful = require("awful") + +local builtins = { + h_spacer = function(o) + return { + forced_width = o.size or 3, + widget = wibox.container.background + } + end, + v_spacer = function(o) + return { + forced_height = o.size or 3, + widget = wibox.container.background + } + end + -- Insert your other builtins here +} +-- Load a bunch of builtins from awful.titlebar +for _,name in pairs({ + "titlewidget","iconwidget","floatingbutton", + "maximizedbutton","minimizebutton","closebutton", + "ontopbutton","stickybutton" +}) do + builtins[name] = function(o) + o.widget = awful.titlebar.widget[name](o.client) + return o + end +end + +return function(description,opts) + local style = opts.style or {} + local c = opts.client + local s = opts.screen + local buttons = opts.buttons + -- Build a layout given a JSON description, a style and client + -- (if applicable) + local layout = {} + local test,err = json.decode(description) + if not test then + error("Builder failure: "..err) + end + local function inner_builder(struct) + if struct.widget then -- External widget descriptions + return require(struct.widget)(gears.table.join({ + layout = (struct.layout and inner_builder(struct.layout)), client = (struct.client and c), + screen = (struct.screen and s) + },struct.options or {})) + elseif struct.list then -- List descriptions + local list = { + layout = wibox.layout.fixed[( + (struct.vertical and "vertical") or + "horizontal" + )], + spacing = style.spacing + } + for k,v in pairs(struct.list) do + if v.draggable then + list.buttons = buttons + else + table.insert(list,inner_builder(v)) + end + end + return list + elseif struct.align then -- Align structure descriptions + local orient = ( + (struct.vertical and "vertical") or + "horizontal" + ) + local list = { + { + layout = wibox.layout.fixed[orient], + spacing = style.spacing + },{ + layout = wibox.layout.flex[orient], + spacing = style.spacing + },{ + -- Simulating "spacing" parameter + widget = builtins[(struct.vertical and "v_spacer") or + "h_spacer"]({size = style.spacing}), + layout = wibox.layout.fixed[orient], + spacing = style.spacing + }, + layout = wibox.layout.align[orient] + } + for k,v in pairs({"left","center","right"}) do + for _,obj in pairs(struct.align[v]) do + if obj.draggable then + list[k].buttons = buttons + else + table.insert(list[k],inner_builder(obj)) + end + end + end + -- Part of simulating "spacing" parameter + table.insert(list[1],builtins[(struct.vertical and "v_spacer") or + "h_spacer"]({size = style.spacing})) + + return list + elseif struct.builtin then -- Builtin widget descriptions + if not builtins[struct.builtin] then + error("Builtin not defined: "..struct.builtin) + end + return builtins[struct.builtin](gears.table.join({ + client = (struct.client and c) + },struct.options or {})) + end + -- If this gets interpreted it's safe to say none of the constructions + -- above got matched. + print("Object where the error occured: ") + gears.debug.dump(struct) + error("Builder error: invalid object description") + end + return inner_builder(test,layout),test.context_options +end diff --git a/modules/desktop.lua b/modules/desktop.lua index b344e4c..57a942f 100644 --- a/modules/desktop.lua +++ b/modules/desktop.lua @@ -1,26 +1,51 @@ -local awmtk2 = require("awmtk2") local gears = require("gears") +local awmtk2 = require("awmtk2") local wibox = require("wibox") local awful = require("awful") local beautiful = require("beautiful") +local builder = require("builder") +local mbarutils = require("menubar").utils --- {{{ Global widgets -local runmenu = require("widgets.dismal")({}) - +local function read_file(fname) + local fhandler = io.open(fname,"r") + if fhandler then + local data = fhandler:read("*a") + fhandler:close() + return data + end +end +-- {{{ Placeholder Icons +client.connect_signal("request::titlebars",function(c) + if (not c.icon) and beautiful.icon_default then + local icon = gears.surface(beautiful.icon_default) + if icon then + c.icon = icon._native + end + end +end) -- }}} --- {{{ Titlebars +-- {{{ Global widgets +local runmenu = require("widgets.dismal")({ + x = 0, + y = 26 +}) +-- }}} + +do -- {{{ Titlebars +local titlebar_config = {} local style = awmtk2.create_style("titlebar",awmtk2.default,{}) -style.titlebar_top = awmtk2.create_delta("titlebar_top", {}, - (beautiful.widgets and beautiful.widgets.titlebar) or {}, style.titlebar) -style.titlebar_left = awmtk2.create_delta("titlebar_left", {}, - (beautiful.widgets and beautiful.widgets.titlebar) or {}, style.titlebar) -style.titlebar_right = awmtk2.create_delta("titlebar_right", {}, - (beautiful.widgets and beautiful.widgets.titlebar) or {}, style.titlebar) -style.titlebar_bottom = awmtk2.create_delta("titlebar_bottom", {}, - (beautiful.widgets and beautiful.widgets.titlebar) or {}, style.titlebar) +for k,v in pairs({"titlebar_top","titlebar_left","titlebar_right","titlebar_bottom"}) do + -- Create styles for each titlebar + style[v] = awmtk2.create_delta(v, {}, + (beautiful.widgets and beautiful.widgets.titlebar) or {}, + style.titlebar) + -- Load in json layouts for titlebars + titlebar_config[v] = read_file(root_path.."/themes/"..global.theme.."/config/"..v..".json") +end local templates = awmtk2.create_template_lib("titlebar",awmtk2.templates,{}) local t = awmtk2.build_templates(templates,style) +-- Add titlebars to normal windows table.insert(awful.rules.rules, { rule_any = {type = { "normal", "dialog" } }, properties = { titlebars_enabled = true } @@ -37,112 +62,72 @@ client.connect_signal("request::titlebars",function(c) awful.mouse.client.resize(c) end) ) - - awful.titlebar(c,{ - size = style.titlebar_top.size or 16, - bg_normal = style.titlebar_top.bg_normal, - bg_focus = style.titlebar_top.bg_focus, - bgimage_normal = style.titlebar_top.bgimage_normal, - bgimage_focus = style.titlebar_top.bgimage_focus, - fg_normal = style.titlebar_top.fg_normal, - fg_focus = style.titlebar_top.fg_focus, - font = style.titlebar_top.font - }):setup(t.titlebar({ - { -- Left - awful.titlebar.widget.iconwidget(c), - buttons = buttons, - layout = wibox.layout.fixed.horizontal - }, - { -- Middle - { -- Title - align = "center", - widget = awful.titlebar.widget.titlewidget(c) - }, - buttons = buttons, - layout = wibox.layout.flex.horizontal - }, - { -- Right - awful.titlebar.widget.floatingbutton (c), - awful.titlebar.widget.maximizedbutton(c), - awful.titlebar.widget.stickybutton (c), - awful.titlebar.widget.ontopbutton (c), - awful.titlebar.widget.closebutton (c), - layout = wibox.layout.fixed.horizontal() - }, - layout = wibox.layout.align.horizontal - })) - awful.titlebar(c,{ - size = style.titlebar_right.size or 0, - position = "right", - bg_normal = style.titlebar_right.bg_normal, - bg_focus = style.titlebar_right.bg_focus, - bgimage_normal = style.titlebar_right.bgimage_normal, - bgimage_focus = style.titlebar_right.bgimage_focus, - fg_normal = style.titlebar_right.fg_normal, - fg_focus = style.titlebar_right.fg_focus, - font = style.titlebar_right.font - }):setup(t.titlebar({widget = wibox.container.background})) - awful.titlebar(c,{ - size = style.titlebar_bottom.size or 0, - position = "bottom", - bg_normal = style.titlebar_bottom.bg_normal, - bg_focus = style.titlebar_bottom.bg_focus, - bgimage_normal = style.titlebar_bottom.bgimage_normal, - bgimage_focus = style.titlebar_bottom.bgimage_focus, - fg_normal = style.titlebar_bottom.fg_normal, - fg_focus = style.titlebar_bottom.fg_focus, - font = style.titlebar_bottom.font - }):setup(t.titlebar({widget = wibox.container.background})) - awful.titlebar(c,{ - size = style.titlebar_left.size or 0, - position = "left", - bg_normal = style.titlebar_left.bg_normal, - bg_focus = style.titlebar_left.bg_focus, - bgimage_normal = style.titlebar_left.bgimage_normal, - bgimage_focus = style.titlebar_left.bgimage_focus, - fg_normal = style.titlebar_left.fg_normal, - fg_focus = style.titlebar_left.fg_focus, - font = style.titlebar_left.font - }):setup(t.titlebar({widget = wibox.container.background})) + for k,v in pairs({"titlebar_top","titlebar_bottom","titlebar_left","titlebar_right"}) do + local contents = { widget = wibox.container.background } + if titlebar_config[v] then + contents = builder(titlebar_config[v],{ + client = c, + style = style[v], + buttons = buttons + }) + end + awful.titlebar(c,{ + size = style[v].size or 0, + position = v:gsub("titlebar_",""), + bg_normal = style[v].bg_normal, + bg_focus = style[v].bg_focus, + bgimage_normal = style[v].bgimage_normal, + bgimage_focus = style[v].bgimage_focus, + fg_normal = style[v].fg_normal, + fg_focus = style[v].fg_focus, + font = style[v].font + }):setup(t.titlebar(contents)) + end end) ---}}} +end --}}} + +do --{{{ Screen +local wibar_config = {} +local style = awmtk2.create_style("wibar",awmtk2.default,{}) +for k,v in pairs({"wibar_top","wibar_bottom","wibar_left","wibar_right"}) do + style[v] = awmtk2.create_delta(v, {}, + (beautiful.widgets and beautiful.widgets.wibar) or {}, + style.wibar) + wibar_config[v] = read_file(root_path.."/themes/"..global.theme.."/config/"..v..".json") +end +local templates = awmtk2.create_template_lib("wibar",awmtk2.templates,{}) +local t = awmtk2.build_templates(templates,style) ---{{{ Screen awful.screen.connect_for_each_screen(function(s) - -- Top bar - s.topbar = awful.wibar({ - position = "top", - screen = s, - visible = false - }) - s.topbar:setup { - layout = wibox.layout.flex.horizontal - } - -- Bottom bar - s.bottombar = awful.wibar({ - position = "bottom", - screen = s, - visible = false - }) - s.bottombar:setup { - layout = wibox.layout.flex.horizontal - } - -- Left bar - s.leftbar = awful.wibar({ - position = "left", - screen = s, - visible = false - }) - s.leftbar:setup { - layout = wibox.layout.flex.horizontal - } - -- Right bar - s.rightbar = awful.wibar({ - position = "right", - screen = s, - visible = false - }) - s.rightbar:setup { - layout = wibox.layout.flex.horizontal - } + for k,v in pairs({"wibar_top","wibar_bottom","wibar_left","wibar_right"}) do + local contents = { widget = wibox.container.background } + if wibar_config[v] then + contents = builder(wibar_config[v],{ + client = c, + style = style[v], + buttons = buttons, + screen = s + }) + s[v] = awful.wibar({ + -- There really isn't a better way to do this. I wish there was. + position = v:gsub("wibar_",""), + screen = s, + visible = true, + stretch = style[v].stretch or true, + ontop = style[v].ontop or true, + width = style[v].width, + height = style[v].height, + border_width = style[v].border_width, + border_color = style[v].border_color, + opacity = style[v].opacity or 1, + shape = style[v].shape, + bg = style[v].bg, + bgimage = style[v].bgimage, + fg = style[v].fg, + input_passthrough = style[v].input_passthrough + }) + s[v]:setup(t.wibar(contents)) + end + end end) +end -- }}} diff --git a/modules/global.lua b/modules/global.lua index b4d193a..68a60c0 100644 --- a/modules/global.lua +++ b/modules/global.lua @@ -1,6 +1,6 @@ -- Global settings global = {} -global.terminal = "xfce4-terminal" --Mod+Enter (spawn terminal) +global.terminal = os.getenv("HOME").."/.local/bin/st" --Mod+Enter (spawn terminal) global.browser = "prime-run librewolf" --Mod+Shift+Enter (spawn browser) global.modkey = "Mod4" -- Default modifier key global.theme = "reno98" diff --git a/themes/default/config/titlebar_top.json b/themes/default/config/titlebar_top.json new file mode 100644 index 0000000..c55f941 --- /dev/null +++ b/themes/default/config/titlebar_top.json @@ -0,0 +1,36 @@ +{ +"align": { + "left": [ + { + "builtin": "iconwidget", + "client": true + } + ], + "center": [ + { + "draggable": true + }, + { + "builtin": "titlewidget", + "client" : true, + "options": { + "align": "left" + } + } + ], + "right": [ + { + "builtin": "minimizebutton", + "client": true + }, + { + "builtin": "maximizedbutton", + "client": true + }, + { + "builtin": "closebutton", + "client": true + } + ] +} +} diff --git a/themes/default/config/wibar_top.json b/themes/default/config/wibar_top.json new file mode 100644 index 0000000..8bc6a7b --- /dev/null +++ b/themes/default/config/wibar_top.json @@ -0,0 +1,13 @@ +{ + "align": { + "left": [ + { "widget": "widgets.base.base" } + ], + "center": [ + + ], + "right": [ + { "widget": "widgets.base.clock" } + ] + } +} diff --git a/themes/default/theme.lua b/themes/default/theme.lua index b0be480..d076f8f 100644 --- a/themes/default/theme.lua +++ b/themes/default/theme.lua @@ -126,6 +126,24 @@ theme.awesome_icon = theme_assets.awesome_icon( -- from /usr/share/icons and /usr/share/icons/hicolor will be used. theme.icon_theme = nil +theme.widgets = { + default = { + titlebar = { + margins = 2, + spacing = 1 + }, + wibar = { + height = 24, + margins = 2, + width = 60 + } + }, + titlebar = { + titlebar_top = { + size = 24 + } + } +} return theme -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/themes/reno98/config/titlebar_top.json b/themes/reno98/config/titlebar_top.json new file mode 100644 index 0000000..c55f941 --- /dev/null +++ b/themes/reno98/config/titlebar_top.json @@ -0,0 +1,36 @@ +{ +"align": { + "left": [ + { + "builtin": "iconwidget", + "client": true + } + ], + "center": [ + { + "draggable": true + }, + { + "builtin": "titlewidget", + "client" : true, + "options": { + "align": "left" + } + } + ], + "right": [ + { + "builtin": "minimizebutton", + "client": true + }, + { + "builtin": "maximizedbutton", + "client": true + }, + { + "builtin": "closebutton", + "client": true + } + ] +} +} diff --git a/themes/reno98/config/wibar_bottom.json b/themes/reno98/config/wibar_bottom.json new file mode 100644 index 0000000..e951aad --- /dev/null +++ b/themes/reno98/config/wibar_bottom.json @@ -0,0 +1,16 @@ +{ + "align": { + "left": [ + { + "widget": "widgets.tasklist", + "screen": true, + } + ], + "center": [ + + ], + "right": [ + + ] + } +} diff --git a/themes/reno98/config/wibar_top.json b/themes/reno98/config/wibar_top.json new file mode 100644 index 0000000..67264e1 --- /dev/null +++ b/themes/reno98/config/wibar_top.json @@ -0,0 +1,19 @@ +{ + "align": { + "left": [ + { "widget": "widgets.base.base" } + ], + "center": [ + + ], + "right": [ + { "widget": "widgets.base.subpanel", + "layout": { + "list": [ + { "widget": "widgets.base.clock" } + ] + } + } + ] + } +} diff --git a/themes/reno98/theme.lua b/themes/reno98/theme.lua index 1f4a6cc..9bc3be9 100644 --- a/themes/reno98/theme.lua +++ b/themes/reno98/theme.lua @@ -4,7 +4,7 @@ local dpi = xresources.apply_dpi local gears = require("gears") local gfs = require("gears.filesystem") -local themes_path = gfs.get_themes_dir() +local themes_path = root_path.."/themes/" local theme = {} @@ -13,7 +13,7 @@ theme.font = "Liberation Sans 8" theme.bg_normal = "#c0c0c0" theme.bg_focus = "#808080" theme.bg_urgent = "#FFEDCC" -theme.bg_minimize = "#dfdfdf" +theme.bg_minimize = "#efefef" theme.bg_highlight_shadow = "#000000FF" theme.bg_highlight_light = "#FFFFFFFF" theme.bg_highlight_outline = "#808080FF" @@ -52,56 +52,55 @@ theme.taglist_squares_sel = theme_assets.taglist_squares_sel( theme.taglist_squares_unsel = theme_assets.taglist_squares_unsel( taglist_square_size, theme.fg_normal ) -theme.menu_submenu_icon = themes_path.."default/submenu.png" theme.menu_height = dpi(15) theme.menu_width = dpi(100) -- Define the image to load -theme.titlebar_close_button_normal = themes_path.."default/titlebar/close_normal.png" -theme.titlebar_close_button_focus = themes_path.."default/titlebar/close_focus.png" +theme.titlebar_close_button_normal = themes_path.."reno98/titlebar/close_normal.png" +theme.titlebar_close_button_focus = themes_path.."reno98/titlebar/close_focus.png" -theme.titlebar_minimize_button_normal = themes_path.."default/titlebar/minimize_normal.png" -theme.titlebar_minimize_button_focus = themes_path.."default/titlebar/minimize_focus.png" +theme.titlebar_minimize_button_normal = themes_path.."reno98/titlebar/minimize_normal.png" +theme.titlebar_minimize_button_focus = themes_path.."reno98/titlebar/minimize_focus.png" -theme.titlebar_ontop_button_normal_inactive = themes_path.."default/titlebar/ontop_normal_inactive.png" -theme.titlebar_ontop_button_focus_inactive = themes_path.."default/titlebar/ontop_focus_inactive.png" -theme.titlebar_ontop_button_normal_active = themes_path.."default/titlebar/ontop_normal_active.png" -theme.titlebar_ontop_button_focus_active = themes_path.."default/titlebar/ontop_focus_active.png" +theme.titlebar_ontop_button_normal_inactive = themes_path.."reno98/titlebar/ontop_normal_inactive.png" +theme.titlebar_ontop_button_focus_inactive = themes_path.."reno98/titlebar/ontop_focus_inactive.png" +theme.titlebar_ontop_button_normal_active = themes_path.."reno98/titlebar/ontop_normal_active.png" +theme.titlebar_ontop_button_focus_active = themes_path.."reno98/titlebar/ontop_focus_active.png" -theme.titlebar_sticky_button_normal_inactive = themes_path.."default/titlebar/sticky_normal_inactive.png" -theme.titlebar_sticky_button_focus_inactive = themes_path.."default/titlebar/sticky_focus_inactive.png" -theme.titlebar_sticky_button_normal_active = themes_path.."default/titlebar/sticky_normal_active.png" -theme.titlebar_sticky_button_focus_active = themes_path.."default/titlebar/sticky_focus_active.png" +theme.titlebar_sticky_button_normal_inactive = themes_path.."reno98/titlebar/sticky_normal_inactive.png" +theme.titlebar_sticky_button_focus_inactive = themes_path.."reno98/titlebar/sticky_focus_inactive.png" +theme.titlebar_sticky_button_normal_active = themes_path.."reno98/titlebar/sticky_normal_active.png" +theme.titlebar_sticky_button_focus_active = themes_path.."reno98/titlebar/sticky_focus_active.png" -theme.titlebar_floating_button_normal_inactive = themes_path.."default/titlebar/floating_normal_inactive.png" -theme.titlebar_floating_button_focus_inactive = themes_path.."default/titlebar/floating_focus_inactive.png" -theme.titlebar_floating_button_normal_active = themes_path.."default/titlebar/floating_normal_active.png" -theme.titlebar_floating_button_focus_active = themes_path.."default/titlebar/floating_focus_active.png" +theme.titlebar_floating_button_normal_inactive = themes_path.."reno98/titlebar/floating_normal_inactive.png" +theme.titlebar_floating_button_focus_inactive = themes_path.."reno98/titlebar/floating_focus_inactive.png" +theme.titlebar_floating_button_normal_active = themes_path.."reno98/titlebar/floating_normal_active.png" +theme.titlebar_floating_button_focus_active = themes_path.."reno98/titlebar/floating_focus_active.png" -theme.titlebar_maximized_button_normal_inactive = themes_path.."default/titlebar/maximized_normal_inactive.png" -theme.titlebar_maximized_button_focus_inactive = themes_path.."default/titlebar/maximized_focus_inactive.png" -theme.titlebar_maximized_button_normal_active = themes_path.."default/titlebar/maximized_normal_active.png" -theme.titlebar_maximized_button_focus_active = themes_path.."default/titlebar/maximized_focus_active.png" +theme.titlebar_maximized_button_normal_inactive = themes_path.."reno98/titlebar/maximized_normal_inactive.png" +theme.titlebar_maximized_button_focus_inactive = themes_path.."reno98/titlebar/maximized_focus_inactive.png" +theme.titlebar_maximized_button_normal_active = themes_path.."reno98/titlebar/maximized_normal_active.png" +theme.titlebar_maximized_button_focus_active = themes_path.."reno98/titlebar/maximized_focus_active.png" -theme.wallpaper = themes_path.."default/background.png" +theme.wallpaper = themes_path.."reno98/background.png" -- You can use your own layout icons like this: -theme.layout_fairh = themes_path.."default/layouts/fairhw.png" -theme.layout_fairv = themes_path.."default/layouts/fairvw.png" -theme.layout_floating = themes_path.."default/layouts/floatingw.png" -theme.layout_magnifier = themes_path.."default/layouts/magnifierw.png" -theme.layout_max = themes_path.."default/layouts/maxw.png" -theme.layout_fullscreen = themes_path.."default/layouts/fullscreenw.png" -theme.layout_tilebottom = themes_path.."default/layouts/tilebottomw.png" -theme.layout_tileleft = themes_path.."default/layouts/tileleftw.png" -theme.layout_tile = themes_path.."default/layouts/tilew.png" -theme.layout_tiletop = themes_path.."default/layouts/tiletopw.png" -theme.layout_spiral = themes_path.."default/layouts/spiralw.png" -theme.layout_dwindle = themes_path.."default/layouts/dwindlew.png" -theme.layout_cornernw = themes_path.."default/layouts/cornernww.png" -theme.layout_cornerne = themes_path.."default/layouts/cornernew.png" -theme.layout_cornersw = themes_path.."default/layouts/cornersww.png" -theme.layout_cornerse = themes_path.."default/layouts/cornersew.png" +theme.layout_fairh = themes_path.."reno98/layouts/fairhw.png" +theme.layout_fairv = themes_path.."reno98/layouts/fairvw.png" +theme.layout_floating = themes_path.."reno98/layouts/floatingw.png" +theme.layout_magnifier = themes_path.."reno98/layouts/magnifierw.png" +theme.layout_max = themes_path.."reno98/layouts/maxw.png" +theme.layout_fullscreen = themes_path.."reno98/layouts/fullscreenw.png" +theme.layout_tilebottom = themes_path.."reno98/layouts/tilebottomw.png" +theme.layout_tileleft = themes_path.."reno98/layouts/tileleftw.png" +theme.layout_tile = themes_path.."reno98/layouts/tilew.png" +theme.layout_tiletop = themes_path.."reno98/layouts/tiletopw.png" +theme.layout_spiral = themes_path.."reno98/layouts/spiralw.png" +theme.layout_dwindle = themes_path.."reno98/layouts/dwindlew.png" +theme.layout_cornernw = themes_path.."reno98/layouts/cornernww.png" +theme.layout_cornerne = themes_path.."reno98/layouts/cornernew.png" +theme.layout_cornersw = themes_path.."reno98/layouts/cornersww.png" +theme.layout_cornerse = themes_path.."reno98/layouts/cornersew.png" -- Generate Awesome icon: theme.awesome_icon = theme_assets.awesome_icon( @@ -283,7 +282,10 @@ end ---theme.bgimage_outset -- Define the icon theme for application icons. If not set then the icons -- from /usr/share/icons and /usr/share/icons/hicolor will be used. -theme.icon_theme = nil +theme.icon_theme = "Chicago95" + +-- Default icon for clients +theme.icon_default = "/usr/share/icons/Chicago95/apps/22/terminal.png" theme.widgets = { default = { @@ -315,9 +317,33 @@ theme.widgets = { }, titlebar = { bgimage = theme.bgimage_outset, - margins = 4, - left = 5, - right = 5 + --margins = 5, + left = 4, + right = 5, + top = 4, + bottom = 3, + spacing = 1 + }, + wibar = { + height = 26, + width = 60, + margins = 3, + shape = function(cr,width,height) + return gears.shape.rounded_rect(cr,width,height,0) + end, + bgimage = theme.bgimage_outset + } + }, + clock = { + container = { + bgimage = function() end, + margins = 0 + } + }, + subpanel = { + container = { + bgimage = theme.bgimage_inset, + bg = theme.bgimage_normal } }, dismal = { @@ -328,6 +354,16 @@ theme.widgets = { height = 34 } }, + tasklist = { + button = { + width = 140, + height = 50, + bgimage_focus = theme.bgimage_inset, + bgimage_normal = theme.bgimage_outset, + bgimage_urgent = theme.bgimage_outset, + bgimage_minimize = theme.bgimage_outset + } + }, titlebar = { titlebar_top = { bgimage_normal = theme.titlebar_bgimage_top, @@ -336,7 +372,7 @@ theme.widgets = { bg_normal = theme.titlebar_bg_normal, fg_focus = "#FAFAFA", fg_normal = theme.fg_normal, - size = 24 + size = 22, }, titlebar_left = { bgimage_normal = theme.titlebar_bgimage_left, diff --git a/themes/reno98/titlebar/close_focus.png b/themes/reno98/titlebar/close_focus.png index 01ef82565db041f356c02173b69cc60d4275ebac..9640cd5cdabc6f497fa4ac784bff45a5f0591b6b 100644 GIT binary patch delta 341 zcmV-b0jmDS2k`kLIosH1rR_7bN~{N zQ351X06h>Qi#`bc1}C^(AA8bqlUepWYsTM7M1-4CN?`%a^ZaM?G)(|J?%sar0U#pO zb&c=))OC%S>bHFhzOtlgic*Tc@7edAJkL=|AtE$Q!!Qg4L2#aX1AiQlBuN11`yPNS z%V^v7G#}7cS+5HdvMdW)>yPHM0}~R*F`nn4wZ?HAvMjqaUjjsgwryG071wpywvDQ) zeiVBNFbnItjwp&4$C0uuFCo?^^O4ys*6hME&0!e6J=Fmb5r$#Fwr$ch{q9UeqPshNL3U{FYCQgTXKdPaFeQ*%peTYJaEt=o6(+_ih}zWoO-U%7hy z#+|$O9z1;V^x5+luU@}-`|kaRkDoq&`TFhqkKcd(%3u2Y02uTqJzX3_A`ZWumK)CK zDAKTo?C#?C@7}z4eJ{WIoz3|>H+LIbPkPcO zT_)&}qW5a;_xEL6XWZuNx^(aFB?+E|;X!eXH9vRoYuItE?)%BEu=r(R){Pf|e-z%; z@J?}TnJ=+R=YD_p)<)BgPiq|Km`jU2>}6a2N9eOmXnm#WDM<_N`sBH57|+V*{qS&< zvs&XgPvV#1wD1R0bR3v-I##Xt$H||6<($>5Y2Ca!@`1}9^Kl&1oxnD!J$p{%<%5lh z#|}&6zumikS^1$FIfcfe=LgKsRGwInlKJmp)Y?M_4y&HJC%ug?ws~T^l-GWy;|Y%z zwtk9F$T#?G;LR)G9UvRc4KRow-fb&cb*-4*ICvIvpQT&i8az9j~`PpLr(2)OI5~f;Q zIrk#@Z|Bq0)<3!~vlxG|R_es<6ne-rr9xhAmE(l?GYYfo-alfSxig_dDy8IT;P!vV zyCpT^jy%Y`B!2dI>TkLIosH1rR_7bN~{N zQ351X06h>Qi#`bc1}C^(AA8bqlUepWYsTM7M1-4CN?`%a^ZaM?G)(|J?%sar0U#pO zb&c=))OC%S>bHFhzOtlgic*Tc@7edAJkL=|AtE$Q!!Qg4L2#aX1AiQlBuN11`yPNS z%V^v7G#}7cS+5HdvMdW)>yPHM0}~R*F`nn4wZ?HAvMjqaUjjsgwryG071wpywvDQ) zeiVBNFbnItjwp&4$C0uuFCo?^^O4ys*6hME&0!e6J=Fmb5r$#Fwr$ch{q9UeFMGa z5^?zLwA^q;N0El@9DzBVFM97y2yvM>Ws;6}Zs50n|Ko+!Wp@|9fA{9a>wEdt?`+QB zxw+fedeW0N=`ul&6unn#zrQcrI^#B9*QI-ZFG=t$3=fK9togZvU&D@Tb>B~Rg~cxm zvu?Zy{G;%$hIfi%%Y2DlI`{j#w>Fw~d|Kl;$6Q+MVK3YAKSG~nLhCC{Pf1#E*C)?i z!+2Ic?}vw@oYfk~c@n=2r-eV5qT|4v)3IvBKTiJqE9b0cP3z{>kq=z-YuyScjQ6lCGoSzQsT!(5~#Z=DoQvI1HYyelF{r5}E*-qWlX0 diff --git a/themes/reno98/titlebar/maximized_focus_active.png b/themes/reno98/titlebar/maximized_focus_active.png index d7dffd75563da170dd3287f488c32aefb9289776..728e508a03edeb8d19180a561b482b3722426343 100644 GIT binary patch delta 186 zcmaFBe3Q|vGr-TCmrII^fq{Y7)59eQNDF{42OE%-|NK7@NO2Z;L>4nJ@ErzW#^d=b zQYN};RHu2mIEGmC?w#z&cR+!IrTtj@$C4UJ+b@?UEXufb?(B?Mx5ba%ol{eCVt%n# zzx^!F1Fen~S(-crI{kb$Qb#n)7sZ}7dt{|u^PMB~?Ry@#6tSmG^?HThnA%xqCap{` h=TSKDt(?t*aeKSm7Kv=xe?WIIc)I$ztaD0e0sz#ZLRbI* delta 451 zcmcb~_<-59Gr-TCmrII^fq{Y7)59eQNIQTq2Q!eIyS?!ZkYX-&@(khN;JE$J{{fK8 zS>O>_3{-v{gc+SQW>-u!)2KHN@Ck7R%02^w=P>Z}=~EyRB8ZjTH?998P@6zWkY6x^ zo4co%w{Lvf($$Y1Kl%Ri+Ge>W3=E9So-U3d5r^MizsuLGz{C3BmgO9K>mUF8cXPYU z407D1bNbNEtMzrA+c<=-USZj3|D1c~EoOtW(~aa99=bW~n7|ov*?~F2S%o9A!PI5a z1m+!8jwcvuYGXW@qiaJvm=bG!JQ&}96;x#9>5pyOGg3sk#6^dLspR4(FoOnKbo?pr^M}YC#*U3yP8if*G z$Tcpk?&OJ;mfYo-^ulfC!e}3!yG3a=kDEX7%U?a8qw{-h@50+LlDpo{4g4fz-WYg| zRo}qt_6rubpE423SD(w9Nbd4HWB+Ou|LwP`iF>ZfFPUYa-`!n(+hfzRBw%1Mc)I$z JtaD0e0sx3g#lipp diff --git a/themes/reno98/titlebar/maximized_focus_inactive.png b/themes/reno98/titlebar/maximized_focus_inactive.png index 844389f1fb02fae94cd7c715e7f28ed04c991b02..b158e4396178e8c46287c1f9acec40caeb83288c 100644 GIT binary patch delta 175 zcmX@Ye2&qqGr-TCmrII^fq{Y7)59eQNDF{42OE%-|NK7@NO2Z;L>4nJ@ErzW#^d=b zQYN};6hwQvIEGmCzP)TH)Sw{Xd~rJ;`{Ne{MmjkH$0ZLQJ5&<=B)>}~D*NmrC8wsS z*IRZ@VPa<}I(Iqk#3zc*2ze!T5|z W} z<}C^G3ua(fQ8hL#uW#sBvUJ&!k^@FSiO-%cjv*e$-(K45%VH?t@bLMOO)QPw3s{1L z3Z$nby!6_^=C+8%Yk`=`mLh|_0&jlSNBkFdEE2Y_z0||I{bg@;G|MEhhF5b0u5Mv? z*0REnbGemz3jZZ03E@f2M|J<@&uKp{;KcEe)n|7{#k4nJ@ErzW#^d=b zQYN};RHu2mIEGmC?w#z&cR+!IrTtj@$C4UJ+b@?UEXufb?(B?Mx5ba%ol{eCVt%n# zzx^!F1Fen~S(-crI{kb$Qb#n)7sZ}7dt{|u^PMB~?Ry@#6tSmG^?HThnA%xqCap{` h=TSKDt(?t*aeKSm7Kv=xe?WIIc)I$ztaD0e0sz#ZLRbI* delta 451 zcmcb~_<-59Gr-TCmrII^fq{Y7)59eQNIQTq2Q!eIyS?!ZkYX-&@(khN;JE$J{{fK8 zS>O>_3{-v{gc+SQW>-u!)2KHN@Ck7R%5L7gdCQh9n>KBNFd!sQ1jxV&j(+>%2Gk}{ z666=m;O6e>6|{a^J;xv=Qa+Zt5;Zd+CS%>d5hWL>~teJhKFtrJ0@^OTy|iNa8}`n zY%q11G=X_XmE#G9n%Wo-=IGiG52nOg9}mX&Uj-FedHQ49HaSlEe3_wYiqSA`;%&gW`A9Vea-pXZk{%n@L`_H{DT zibkP?7jlgYt2=pOr6qScCcSW*xiH#?=WbD2&Ew`z{PI`N=ji-i+q>{~jO4Dja|1sK znKuSrW7RkCy8VL1?WatH^3~_^CX%~6&)C0O#ee&)YT}-&@=InJ=y!Kl-}czFED0D` N44$rjF6*2UngH)@yi))G diff --git a/themes/reno98/titlebar/maximized_normal_inactive.png b/themes/reno98/titlebar/maximized_normal_inactive.png index 4c1ab1f91f3191b9f1324a7aebdc82fb5cf83baf..b158e4396178e8c46287c1f9acec40caeb83288c 100644 GIT binary patch delta 175 zcmX@Ye2&qqGr-TCmrII^fq{Y7)59eQNDF{42OE%-|NK7@NO2Z;L>4nJ@ErzW#^d=b zQYN};6hwQvIEGmCzP)TH)Sw{Xd~rJ;`{Ne{MmjkH$0ZLQJ5&<=B)>}~D*NmrC8wsS z*IRZ@VPa<}I(Iqk#3zc*2ze!T5|z W?Ea+Uv_=DB$q$`H@X5 zjok}af`kgBrzE`e+QH_wh{bDxn97zSgS`T8e%43)7j`TXwy(X^!@K=uZ*?@wB(a89 za|Et#VR+WE!jE&gm3j*QB_;{sNzF%f|K-nVKQ7?J@sQPLcSps$&tmd3(gc^!TP{&pCxTlln`ZYhL12#d6QX$oP=El^k@|3_e>e9rX)-L_5uclYmS@^Yv=D~QmA@Y^r3HM^D3B?6b z0?H4(cpAA4+4PREG+3}7&|~N*X1Fu+_LpbUyq&IPwU<9W2L=Fxr>mdKI;Vst0GGb4 A8UO$Q diff --git a/themes/reno98/titlebar/minimize_focus.png b/themes/reno98/titlebar/minimize_focus.png index caaceb296dc2e49a723b425a62aa12b6cc060ce0..5112464a24b42781f215e3388e540034f07e483a 100644 GIT binary patch literal 190 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9F5he4R}c>anMprB-l zYeY$Kep*R+Vo@qXd3m{BW?pu2a$-TMUVc&f>~}U&KtBlY3LQ}3VLn)@ z#{c-`2czXDE-c}a^SW~XWUI`~nO&V6<~@ef9^SLwvFfd{djU(ubdI%K;}66<_{Y8P inX02`o5Rn!4;k}b2x=Tm&i@QFmci52&t;ucLK6TF>qAWd literal 234 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0J3?w7mbKU|e&H|6fVxatW5N34Jm|X!BWH0gb zb!ETL!6vN4lv}Np1Qe1E@Ck7R($AhfdkzLb1_S_k|NsAg{Cl4PP@1hI$S;_IJuCau zkH}&{GoT1#lDE4HN87!rRX~ojr;B5V$MNI@3D(64B0LfXp5EN9tcjVKejZ$RE^TNK zQDM!DVASL~m9f5Ifiy=|Fzall^eYEMT-ccwbLNQjFx_HgDAf=9bAA4*y+Gp_JYD@< J);T3K0RS~8P4fT% diff --git a/themes/reno98/titlebar/minimize_normal.png b/themes/reno98/titlebar/minimize_normal.png index 36621d0f3993fb0739d99558b5b46838c3a87e41..5112464a24b42781f215e3388e540034f07e483a 100644 GIT binary patch literal 190 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9F5he4R}c>anMprB-l zYeY$Kep*R+Vo@qXd3m{BW?pu2a$-TMUVc&f>~}U&KtBlY3LQ}3VLn)@ z#{c-`2czXDE-c}a^SW~XWUI`~nO&V6<~@ef9^SLwvFfd{djU(ubdI%K;}66<_{Y8P inX02`o5Rn!4;k}b2x=Tm&i@QFmci52&t;ucLK6TF>qAWd literal 225 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0J3?w7mbKU|e&H|6fVxatW5N34Jm|X!BWH0gb zb!ETL!6vM#^Y6{ZETE7?fKP}kklws`^QKLkfFvCJ|NsB$-P_VYIku7@zhDOTtn5!e zB8vshfFg`Z-tI2!Vu>BEfgD>;7sn8f*71 zni+90AlTu;Y^@t27K>X{7b~zyym%oCRBge`kiI-@?}V!_n1BW`c)I$ztaD0e0sz}E BN7?`Y diff --git a/widgets/base/base.lua b/widgets/base/base.lua new file mode 100644 index 0000000..08764c2 --- /dev/null +++ b/widgets/base/base.lua @@ -0,0 +1,14 @@ +-- Base for widgets +local awmtk2 = require("awmtk2") +local wibox = require("wibox") +local gears = require("gears") +local awful = require("awful") +local beautiful = require("beautiful") + +return function(args) + local style = awmtk2.create_style("base",awmtk2.default,args.style) + local templates = awmtk2.create_template_lib("base",awmtk2.templates,args.templates) + local t = awmtk2.build_templates(templates,style) + local widget = wibox.widget(t.container(t.textbox({markup = "Why are you loading this widget bruh"}))) + return widget +end diff --git a/widgets/base/clock.lua b/widgets/base/clock.lua new file mode 100644 index 0000000..1180081 --- /dev/null +++ b/widgets/base/clock.lua @@ -0,0 +1,43 @@ +-- wibox.widget.textclock but with awmtk2 templates. +local awmtk2 = require("awmtk2") +local wibox = require("wibox") +local gears = require("gears") +local awful = require("awful") +local beautiful = require("beautiful") +local glib = require("lgi").GLib +local DateTime = glib.DateTime +local TimeZone = glib.TimeZone + +return function(args) + local style = awmtk2.create_style("clock",awmtk2.default,args.style) + local templates = awmtk2.create_template_lib("clock",awmtk2.templates,args.templates) + local t = awmtk2.build_templates(templates,style) + -- Don't mind me just stealing default library code + local format = args.format or "%a %b %d, %H:%M" + local refresh = args.refresh or 60 + local tzid = args.tzid + local timezone = (tzid and TimeZone.new(tzid)) or TimeZone.new_local() + + -- Seriously, was it so hard to add a font parameter for textclock? + -- Do you actually expect of nobody to change the font to something like + -- idk, 7-segment display? Goddamnit awesome. I trusted you. + local widget = wibox.widget(t.container(t.textbox({ + id = "clocktext" + }))) + local textbox = widget:get_children_by_id("clocktext")[1] + widget.clocktimer = gears.timer { + timeout = refresh, + call_now = true, + autostart = true, + callback = function() + local str = DateTime.new_now(timezone):format(format) + if str == nil then + require("gears.debug").print_warning("clock: " + .. "g_date_time_format() failed for format " + .. "'" .. format .. "'") + end + textbox:set_markup(str) + end + } + return widget +end diff --git a/widgets/base/subpanel.lua b/widgets/base/subpanel.lua new file mode 100644 index 0000000..c0a4e6d --- /dev/null +++ b/widgets/base/subpanel.lua @@ -0,0 +1,14 @@ +-- For those rare occasions when you want to group widgets in a panel +local awmtk2 = require("awmtk2") +local wibox = require("wibox") +local gears = require("gears") +local awful = require("awful") +local beautiful = require("beautiful") + +return function(args) + local style = awmtk2.create_style("subpanel",awmtk2.default,args.style) + local templates = awmtk2.create_template_lib("subpanel",awmtk2.templates,args.templates) + local t = awmtk2.build_templates(templates,style) + local widget = wibox.widget(t.container(args.layout)) + return widget +end diff --git a/widgets/dismal.lua b/widgets/dismal.lua index 683f4b5..6bcaae8 100644 --- a/widgets/dismal.lua +++ b/widgets/dismal.lua @@ -96,6 +96,8 @@ return function(args) awful.key({ global.modkey }, "r", function() results_list:reset() launchpad.visible = true + launchpad.x = args.x or 0 + launchpad.y = args.y or 0 if launchpad.visible then awful.prompt.run { prompt = "Run: ", diff --git a/widgets/tasklist.lua b/widgets/tasklist.lua new file mode 100644 index 0000000..c688600 --- /dev/null +++ b/widgets/tasklist.lua @@ -0,0 +1,122 @@ +local awful = require("awful") +local wibox = require("wibox") +local gears = require("gears") +local awmtk2 = require("awmtk2") +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({}, 4, function() + awful.client.focus.byidx(1) + end), + awful.button({}, 5, function() + awful.client.focus.byidx(-1) + end) +) + +return function(args) + local style = awmtk2.create_style("tasklist", awmtk2.default, args.style) + local templates = awmtk2.create_template_lib("tasklist", awmtk2.templates, args.templates) + local t = awmtk2.build_templates(templates,style) + local button = t.button({ + { + { + id = "clienticon", + widget = awful.widget.clienticon + }, + (not args.vertical) and t.textbox({ + id = "text_role" + }), + layout = wibox.layout.fixed.horizontal + }, + widget = wibox.container.constraint, + strategy="exact", + width = style.button.width, + height = style.button.height, + id = "constraint_task" + },{ + create_callback = function(self, c, index, objects) + self:get_children_by_id('clienticon')[1].client = c + -- If for some ungodly reason you enabled the behaviour of the original awesomewm, this script will just stop after setting the client icon. + if self.id == "background_role" then + return + end + local textbox = self:get_children_by_id("text_role")[1] or {} + -- Apparently the original system for changing bgimage is + -- 1) broken + -- 2) uses deprecated functions (nice code practices awesomewm) + -- Solution: write my own. I blame material design for all this. + -- (P.S: Not to bullshit you, check it yourself - replicatable + -- by adding theme.tasklist_bg_image_normal or + -- theme.tasklist_bg_image_focus in current beautiful theme.) + local onfocus = function() + self.bgimage = style.button.bgimage_focus + self.bg = style.button.bg_focus + self.shape = style.button.shape_focus + self.shape_border_width = style.button.shape_border_width_focus + self.shape_border_color = style.button.shape_border_color_focus + textbox.font = style.textbox.font_focus + end + local onunfocus = function() + self.bgimage = style.button.bgimage_normal + self.bg = style.button.bg_normal + self.shape = style.button.shape_normal + self.shape_border_width = style.button.shape_border_width_normal + self.shape_border_color = style.button.shape_border_color_normal + textbox.font = style.textbox.font_normal + end + local onurgent = function() + if not c.urgent then return end + self.bgimage = style.button.bgimage_urgent + self.bg = style.button.bg_urgent + self.shape = style.button.shape_urgent + self.shape_border_width = style.button.shape_border_width_urgent + self.shape_border_color = style.button.shape_border_color_urgent + textbox.font = style.textbox.font_urgent + end + local onminimize = function() + if not c.minimized then return end + self.bgimage = style.button.bgimage_minimize + self.bg = style.button.bg_minimize + self.shape = style.button.shape_minimize + self.shape_border_width = style.button.shape_border_width_minimize + self.shape_border_color = style.button.shape_border_color_minimize + textbox.font = style.textbox.font_minimize + end + c:connect_signal("focus",onfocus) + c:connect_signal("unfocus",onunfocus) + c:connect_signal("property::urgent",onurgent) + c:connect_signal("property::minimized",onminimize) + onfocus() + end, + -- Uncomment this only, and **ONLY** if you actually need it. + --id = "background_role" + }) + return awful.widget.tasklist { + screen = args.screen, + filter = awful.widget.tasklist.filter.currenttags, + buttons = tasklist_buttons, + layout = { + -- basically we just map every property of this to beautiful.tasklist.base + spacing = style.base.spacing, + spacing_widget = style.base.spacing_widget, + -- Now THIS is shit racing + layout = ( + (args.vertical and style.base.layout_vertical) or + style.base.layout_horizontal + ) or ( + (args.vertical and wibox.layout.fixed.vertical) or + wibox.layout.fixed.horizontal + ) + }, + widget_template = button + } +end