Added widget-generic styles to AWMTK
This commit is contained in:
parent
8c827368dc
commit
92aed20ebb
|
@ -10,6 +10,8 @@ local wibox = require("wibox")
|
|||
local awful = require("awful")
|
||||
local gears = require("gears")
|
||||
local beautiful = require("beautiful")
|
||||
beautiful.widgets = beautiful.widgets or {}
|
||||
beautiful.templates = beautiful.templates or {}
|
||||
|
||||
local awmtk = {}
|
||||
|
||||
|
@ -41,7 +43,7 @@ awmtk.create_style = function(name,parent,overrides)
|
|||
-- A style is essentially a layer of deltas upon the previous (parent) style
|
||||
local new_style = {}
|
||||
local odelta = (overrides and overrides[name]) or {}
|
||||
local cdelta = (beautiful.widgets and beautiful.widgets[name]) or {}
|
||||
local cdelta = beautiful.widgets[name] or {}
|
||||
for name,parent_class in pairs(parent) do
|
||||
new_style[name] = awmtk.create_delta(
|
||||
name,
|
||||
|
@ -410,5 +412,14 @@ awmtk.proto_templates = {
|
|||
-- 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,{})
|
||||
|
||||
-- Generic styles for widgets that need them
|
||||
awmtk.generic = {}
|
||||
awmtk.generic.menu = awmtk.create_style("generic_menu",awmtk.default,{})
|
||||
awmtk.generic.button_list = awmtk.create_style("generic_button_list",awmtk.default,{})
|
||||
awmtk.generic.iconified_widget = awmtk.create_style("generic_iconified_widget",awmtk.default,{})
|
||||
awmtk.generic.status_widget = awmtk.create_style("generic_status_widget",awmtk.default,{})
|
||||
awmtk.generic.oneline_widget = awmtk.create_style("generic_oneline_widget",awmtk.default,{})
|
||||
awmtk.generic.composite_widget = awmtk.create_style("generic_composite_widget",awmtk.default,{})
|
||||
-- }}}
|
||||
return awmtk
|
||||
|
|
|
@ -39,7 +39,8 @@ end
|
|||
return function(args)
|
||||
-- A way to communicate that all widgets in menu got closed
|
||||
args.on_close = args.on_close or function() end
|
||||
local style = awmtk2.create_style("menu", awmtk2.default, args.style)
|
||||
local style = awmtk2.create_style("menu",
|
||||
awmtk2.generic.menu, args.style)
|
||||
local templates = awmtk2.create_template_lib("menu", awmtk2.templates, args.templates)
|
||||
local t = awmtk2.build_templates(templates,style)
|
||||
local function menu_builder(element,layer,root_layer)
|
||||
|
|
|
@ -336,6 +336,7 @@ theme.notification_height = 60
|
|||
theme.icon_default = gears.surface(themes_path.."reno98/icons/unknown-app.png")
|
||||
|
||||
theme.widgets = {
|
||||
-- {{{ Widget base
|
||||
default = {
|
||||
container = {
|
||||
bgimage = theme.bgimage_highlight,
|
||||
|
@ -394,12 +395,25 @@ theme.widgets = {
|
|||
bar_height = 6
|
||||
}
|
||||
},
|
||||
xdg_menu = {
|
||||
-- }}}
|
||||
-- {{{ Menus
|
||||
generic_menu = {
|
||||
base = {
|
||||
spacing = 2
|
||||
}
|
||||
spacing = 2,
|
||||
menu_slide = true
|
||||
},
|
||||
button = {
|
||||
forced_height = 20,
|
||||
forced_width = 160
|
||||
},
|
||||
},
|
||||
battery = {
|
||||
--}}}
|
||||
-- {{{ Status panel widgets
|
||||
generic_status_widget = {
|
||||
container = {
|
||||
bgimage = function() end,
|
||||
margins = 0
|
||||
},
|
||||
button = {
|
||||
margins = 0,
|
||||
onpress = function() end,
|
||||
|
@ -407,6 +421,7 @@ theme.widgets = {
|
|||
bgimage = function() end
|
||||
}
|
||||
},
|
||||
-- }}}
|
||||
soundclown = {
|
||||
base = {
|
||||
width = 140
|
||||
|
@ -427,22 +442,6 @@ theme.widgets = {
|
|||
desc_valign = "top"
|
||||
}
|
||||
},
|
||||
clock = {
|
||||
container = {
|
||||
bgimage = function() end,
|
||||
margins = 0
|
||||
}
|
||||
},
|
||||
root_menu = {
|
||||
base = {
|
||||
spacing = 2
|
||||
}
|
||||
},
|
||||
client_menu = {
|
||||
base = {
|
||||
spacing = 2
|
||||
}
|
||||
},
|
||||
taglist = {
|
||||
base = {
|
||||
spacing = 2
|
||||
|
@ -481,23 +480,6 @@ theme.widgets = {
|
|||
bgimage_minimize = theme.bgimage_outset
|
||||
}
|
||||
},
|
||||
menu = {
|
||||
base = {
|
||||
-- Enables the ability to just drag the mouse on an entry to open it
|
||||
menu_slide = true,
|
||||
spacing = 2
|
||||
},
|
||||
button = {
|
||||
forced_height = 20,
|
||||
forced_width = 160
|
||||
},
|
||||
},
|
||||
systray = {
|
||||
container = {
|
||||
bgimage = function() end,
|
||||
margins = 0
|
||||
}
|
||||
},
|
||||
lockscreen = {
|
||||
popup = {
|
||||
margins = 0
|
||||
|
|
|
@ -16,7 +16,8 @@ local DateTime = glib.DateTime
|
|||
local TimeZone = glib.TimeZone
|
||||
|
||||
return function(args)
|
||||
local style = awmtk2.create_style("clock",awmtk2.default,args.style)
|
||||
local style = awmtk2.create_style("clock",
|
||||
awmtk2.generic.status_widget,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
|
||||
|
|
|
@ -13,7 +13,8 @@ local awful = require("awful")
|
|||
local beautiful = require("beautiful")
|
||||
|
||||
return function(args)
|
||||
local style = awmtk2.create_style("systray",awmtk2.default,args.style)
|
||||
local style = awmtk2.create_style("systray",
|
||||
awmtk2.generic.status_widget,args.style)
|
||||
local templates = awmtk2.create_template_lib("systray",awmtk2.templates,args.templates)
|
||||
local t = awmtk2.build_templates(templates,style)
|
||||
local widget = wibox.widget(t.container({
|
||||
|
|
|
@ -41,7 +41,8 @@ local function get_virtual_icon(data)
|
|||
end
|
||||
|
||||
return function(args)
|
||||
local style = awmtk2.create_style("battery",awmtk2.default,args.style)
|
||||
local style = awmtk2.create_style("battery",
|
||||
awmtk2.generic.status_widget,args.style)
|
||||
local templates = awmtk2.create_template_lib("battery",awmtk2.templates,args.templates)
|
||||
local t = awmtk2.build_templates(templates,style)
|
||||
-- set up popup layout
|
||||
|
|
|
@ -13,7 +13,8 @@ local awful = require("awful")
|
|||
local beautiful = require("beautiful")
|
||||
|
||||
return function(args)
|
||||
local style = awmtk2.create_style("client_buttons",awmtk2.default,args.style)
|
||||
local style = awmtk2.create_style("client_buttons",
|
||||
awmtk2.generic.button_list,args.style)
|
||||
local templates = awmtk2.create_template_lib("client_buttons",awmtk2.templates,args.templates)
|
||||
local t = awmtk2.build_templates(templates,style)
|
||||
local floating_on = beautiful.titlebar_floating_button_normal_inactive
|
||||
|
|
|
@ -14,7 +14,8 @@ local beautiful = require("beautiful")
|
|||
local menugen = require("context_menu")
|
||||
|
||||
return function(args)
|
||||
local style = awmtk2.create_style("client_controls",awmtk2.default,args.style)
|
||||
local style = awmtk2.create_style("client_controls",
|
||||
awmtk2.generic.menu,args.style)
|
||||
local templates = awmtk2.create_template_lib("client_controls",awmtk2.templates,args.templates)
|
||||
local t = awmtk2.build_templates(templates,style)
|
||||
local move_to_tag = {}
|
||||
|
|
|
@ -13,7 +13,8 @@ local awful = require("awful")
|
|||
local beautiful = require("beautiful")
|
||||
local menugen = require("context_menu")
|
||||
local builder = require("builder")
|
||||
local style = awmtk2.create_style("client_menu",awmtk2.default,{})
|
||||
local style = awmtk2.create_style("client_menu",
|
||||
awmtk2.generic.menu,{})
|
||||
local templates = awmtk2.create_template_lib("client_menu",awmtk2.templates,{})
|
||||
local t = awmtk2.build_templates(templates,style)
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ local awful = require("awful")
|
|||
local wibox = require("wibox")
|
||||
local gears = require("gears")
|
||||
local awmtk2 = require("awmtk2")
|
||||
local beautiful = require("beautiful")
|
||||
local menubar_utils = require("menubar").utils
|
||||
|
||||
local function synchronous_ls(dir)
|
||||
|
@ -22,7 +23,8 @@ local function synchronous_ls(dir)
|
|||
end
|
||||
|
||||
return function(args)
|
||||
local style = awmtk2.create_style("launcher", awmtk2.default, args.style)
|
||||
local style = awmtk2.create_style("launcher",
|
||||
awmtk2.generic.button_list, args.style)
|
||||
local templates = awmtk2.create_template_lib("launcher", awmtk2.templates, args.templates)
|
||||
local t = awmtk2.build_templates(templates,style)
|
||||
local w = wibox.widget({
|
||||
|
|
|
@ -15,7 +15,8 @@ local awmtk2 = require("awmtk2")
|
|||
local naughty = require("naughty")
|
||||
|
||||
return function(args)
|
||||
local style = awmtk2.create_style("notifications",awmtk2.default,args.style)
|
||||
local style = awmtk2.create_style("notifications",
|
||||
awmtk2.generic.iconified_widget,args.style)
|
||||
local templates = awmtk2.create_template_lib("notifications",awmtk2.templates,args.templates)
|
||||
local t = awmtk2.build_templates(templates,style)
|
||||
local layout = wibox.widget({
|
||||
|
|
|
@ -13,7 +13,8 @@ local awful = require("awful")
|
|||
local beautiful = require("beautiful")
|
||||
|
||||
return function(args)
|
||||
local style = awmtk2.create_style("root_buttons",awmtk2.default,args.style)
|
||||
local style = awmtk2.create_style("root_buttons",
|
||||
awmtk2.generic.button_list,args.style)
|
||||
local templates = awmtk2.create_template_lib("root_buttons",awmtk2.templates,args.templates)
|
||||
local t = awmtk2.build_templates(templates,style)
|
||||
local poweroff = wibox.widget(t.button({
|
||||
|
|
|
@ -14,7 +14,8 @@ local beautiful = require("beautiful")
|
|||
local menugen = require("context_menu")
|
||||
|
||||
return function(args)
|
||||
local style = awmtk2.create_style("root_menu",awmtk2.default,args.style)
|
||||
local style = awmtk2.create_style("root_menu",
|
||||
awmtk2.generic.menu,args.style)
|
||||
local templates = awmtk2.create_template_lib("root_menu",awmtk2.templates,args.templates)
|
||||
local t = awmtk2.build_templates(templates,style)
|
||||
local widget = menugen({
|
||||
|
|
|
@ -14,7 +14,8 @@ local beautiful = require("beautiful")
|
|||
local builder = require("builder")
|
||||
|
||||
return function(args)
|
||||
local style = awmtk2.create_style("root_menu",awmtk2.default,{})
|
||||
local style = awmtk2.create_style("root_menu",
|
||||
awmtk2.generic.menu,{})
|
||||
local templates = awmtk2.create_template_lib("root_menu",awmtk2.templates,{})
|
||||
local t = awmtk2.build_templates(templates,style)
|
||||
local config_file = io.open(root_path.."/themes/"..global.theme.."/config/root_menu.json","r")
|
||||
|
|
|
@ -28,7 +28,8 @@ local function ls(path)
|
|||
end
|
||||
|
||||
return function(args)
|
||||
local style = awmtk2.create_style("wallpapers",awmtk2.default,args.style)
|
||||
local style = awmtk2.create_style("wallpapers",
|
||||
awmtk2.generic.iconified_widget,args.style)
|
||||
local templates = awmtk2.create_template_lib("wallpapers",awmtk2.templates,args.templates)
|
||||
local t = awmtk2.build_templates(templates,style)
|
||||
-- set wallpaper
|
||||
|
|
|
@ -15,7 +15,8 @@ local menugen = require("context_menu")
|
|||
local menuutils = require("menubar").utils
|
||||
|
||||
return function(args)
|
||||
local style = awmtk2.create_style("xdg_menu",awmtk2.default,args.style)
|
||||
local style = awmtk2.create_style("xdg_menu",
|
||||
awmtk2.generic.menu,args.style)
|
||||
local templates = awmtk2.create_template_lib("xdg_menu",awmtk2.templates,args.templates)
|
||||
local t = awmtk2.build_templates(templates,style)
|
||||
-- Add a "loading" indicator while XDG is still parsing data
|
||||
|
|
Loading…
Reference in New Issue