restructuring

This commit is contained in:
Yessiest 2022-09-07 21:43:25 +04:00
parent 688c01afc1
commit 683116b1cd
19 changed files with 418 additions and 126 deletions

View File

@ -27,6 +27,10 @@ modkey+f = ":client.fullscreen"
modkey+n = ":client.minimize" modkey+n = ":client.minimize"
modkey+m = ":client.maximize" modkey+m = ":client.maximize"
# Widget keys
modkey+r = ":dismal.run"
modkey+s = ":help.show"
# Custom keys # Custom keys
Print = "flameshot gui" Print = "flameshot gui"
Shift+Print = "flameshot launcher" Shift+Print = "flameshot launcher"

48
libs/asckey.lua Normal file
View File

@ -0,0 +1,48 @@
-- This file is part of Reno desktop.
--
-- Reno desktop is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
--
-- Reno desktop is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License along with Reno desktop. If not, see <https://www.gnu.org/licenses/>.
-- library for constructing bindable keys
local asckey = {
keymap = {}
}
local awful = require("awful")
asckey.get_keycomb = function(name)
local modifiers = {}
name = name:gsub("[^%s%+]+%+",function(v)
if v == "modkey+" then v = global.modkey.."+" end
table.insert(modifiers,v:sub(1,-2))
return ""
end)
return modifiers,name
end
asckey.k = function(name,callback,description)
if not asckey.keymap[name] then
return {}
end
local modifiers,key = asckey.get_keycomb(asckey.keymap[name])
return awful.key(modifiers,key,
callback,
description)
end
asckey.custom_binds = function()
local custom_keys = {}
for comm,bind in pairs(asckey.keymap) do
if not comm:match("^:.*") then
table.insert(custom_keys,asckey.k(comm,function()
awful.spawn(comm)
end,{description = comm, group = "custom"}))
end
end
return custom_keys
end
return asckey

View File

@ -179,8 +179,9 @@ awmtk.proto_templates = {
margins = style.container.margins, margins = style.container.margins,
layout = wibox.container.margin layout = wibox.container.margin
}, },
bgimage = style.container.bgimage, bgimage = style.container.bgimage_normal,
bg = style.container.bg_normal, bg = style.container.bg_normal,
fg = style.container.fg_normal,
shape = style.container.shape, shape = style.container.shape,
widget = wibox.container.background widget = wibox.container.background
},options or {}) },options or {})
@ -198,8 +199,9 @@ awmtk.proto_templates = {
margins = style.button.margins, margins = style.button.margins,
layout = wibox.container.margin layout = wibox.container.margin
}, },
bgimage = style.button.bgimage, bgimage = style.button.bgimage_normal,
bg = style.button.bg_normal, bg = style.button.bg_normal,
fg = style.button.fg_normal,
shape = style.button.shape, shape = style.button.shape,
widget = wibox.container.background widget = wibox.container.background
},options or {}) },options or {})
@ -211,7 +213,7 @@ awmtk.proto_templates = {
return function(options) return function(options)
return awmtk.merge({ return awmtk.merge({
font = style.textbox.font, font = style.textbox.font,
widget = wibox.widget.textbox widget = wibox.widget.textbox,
},options or {}) },options or {})
end end
end, end,
@ -273,8 +275,6 @@ awmtk.proto_templates = {
id = options.title_id, id = options.title_id,
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
font = style.article.font, font = style.article.font,
align = options.font_align or
style.article.font_align,
valign = style.article.title_valign or "center", valign = style.article.title_valign or "center",
align = style.article.title_align or "left" align = style.article.title_align or "left"
}, },
@ -283,8 +283,6 @@ awmtk.proto_templates = {
id = options.desc_id, id = options.desc_id,
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
font = style.article.small_font, font = style.article.small_font,
align = options.small_font_align or
style.article.small_font_align,
valign = style.article.desc_valign or "center", valign = style.article.desc_valign or "center",
align = style.article.desc_align or "left" align = style.article.desc_align or "left"
}), }),
@ -327,7 +325,7 @@ awmtk.proto_templates = {
margins = style.popup.margins, margins = style.popup.margins,
layout = wibox.container.margin layout = wibox.container.margin
}, },
bgimage = style.popup.bgimage, bgimage = style.popup.bgimage_normal,
shape = style.popup.shape, shape = style.popup.shape,
visible = false, visible = false,
ontop = true ontop = true

View File

@ -8,39 +8,12 @@
-- Module that adds default keybindings -- Module that adds default keybindings
local awful = require("awful") local awful = require("awful")
local gears = require("gears") local gears = require("gears")
local ask = require("asckey")
global.modkey = global.modkey or "Mod4" global.modkey = global.modkey or "Mod4"
local function get_keycomb(name) ask.keymap = keybindings
local modifiers = {} local custom_keys = ask.custom_binds()
name = name:gsub("[^%s%+]+%+",function(v) local k = ask.k
if v == "modkey+" then v = global.modkey.."+" end
table.insert(modifiers,v:sub(1,-2))
return ""
end)
return modifiers,name
end
local keymap = keybindings
local function k(name,callback,description)
if not keymap[name] then
return {}
end
local modifiers,key = get_keycomb(keymap[name])
return awful.key(modifiers,key,
callback,
description)
end
local custom_keys = {}
for comm,bind in pairs(keymap) do
if not comm:match("^:.*") then
table.insert(custom_keys,k(comm,function()
awful.spawn(comm)
end,{description = bind, group = "custom"}))
end
end
local keys = gears.table.join( local keys = gears.table.join(
k(':root.client_next', k(':root.client_next',

View File

@ -81,8 +81,8 @@ awful.screen.connect_for_each_screen(function(s)
border_color = style[v].border_color, border_color = style[v].border_color,
opacity = style[v].opacity or 1, opacity = style[v].opacity or 1,
shape = style[v].shape, shape = style[v].shape,
bg = style[v].bg, bg = style[v].bg_normal,
bgimage = style[v].bgimage, bgimage = style[v].bgimage_normal,
fg = style[v].fg, fg = style[v].fg,
input_passthrough = style[v].input_passthrough input_passthrough = style[v].input_passthrough
}) })

View File

@ -4,5 +4,6 @@
"y":26 "y":26
}, },
"widgets.rootmenu":{}, "widgets.rootmenu":{},
"widgets.lockscreen":{} "widgets.lockscreen":{},
"widgets.base.keypopup":{}
} }

View File

@ -24,6 +24,7 @@ theme.bg_normal = "#c0c0c0"
theme.bg_focus = "#808080" theme.bg_focus = "#808080"
theme.bg_urgent = "#FFEDCC" theme.bg_urgent = "#FFEDCC"
theme.bg_minimize = "#efefef" theme.bg_minimize = "#efefef"
theme.bg_highlight = "#dadada"
theme.bg_highlight_shadow = "#000000FF" theme.bg_highlight_shadow = "#000000FF"
theme.bg_highlight_light = "#FFFFFFFF" theme.bg_highlight_light = "#FFFFFFFF"
theme.bg_highlight_outline = "#808080FF" theme.bg_highlight_outline = "#808080FF"
@ -123,6 +124,11 @@ theme.awesome_icon = theme_assets.awesome_icon(
theme.menu_height, theme.bg_focus, theme.fg_focus theme.menu_height, theme.bg_focus, theme.fg_focus
) )
theme.hotkeys_border_width = 3
theme.hotkeys_border_color = theme.bg_focus
theme.hotkeys_modifiers_fg = theme.fg_normal
theme.hotkeys_label_fg = theme.fg_normal
theme.bgimage_outset = function(context, cr, width, height,...) theme.bgimage_outset = function(context, cr, width, height,...)
local light = gears.color(theme.bg_highlight_light) local light = gears.color(theme.bg_highlight_light)
local shadow = gears.color(theme.bg_highlight_shadow) local shadow = gears.color(theme.bg_highlight_shadow)
@ -339,13 +345,14 @@ theme.widgets = {
-- {{{ Widget base -- {{{ Widget base
default = { default = {
container = { container = {
bgimage = theme.bgimage_highlight, bgimage_normal = theme.bgimage_highlight,
shape = function(cr,width,height) shape = function(cr,width,height)
return require("gears").shape.rounded_rect(cr,width,height,0) return require("gears").shape.rounded_rect(cr,width,height,0)
end end,
bgimage_highlight = theme.bgimage_inset
}, },
button = { button = {
bgimage = theme.bgimage_outset, bgimage_normal = theme.bgimage_outset,
shape = function(cr,width,height) shape = function(cr,width,height)
return require("gears").shape.rounded_rect(cr,width,height,0) return require("gears").shape.rounded_rect(cr,width,height,0)
end, end,
@ -359,13 +366,13 @@ theme.widgets = {
end end
}, },
popup = { popup = {
bgimage = theme.bgimage_outset, bgimage_normal = theme.bgimage_outset,
shape = function(cr,width,height) shape = function(cr,width,height)
return gears.shape.rounded_rect(cr,width,height,0) return gears.shape.rounded_rect(cr,width,height,0)
end, end,
}, },
titlebar = { titlebar = {
bgimage = theme.bgimage_outset, bgimage_normal = theme.bgimage_outset,
--margins = 5, --margins = 5,
left = 4, left = 4,
right = 5, right = 5,
@ -380,7 +387,7 @@ theme.widgets = {
shape = function(cr,width,height) shape = function(cr,width,height)
return gears.shape.rounded_rect(cr,width,height,0) return gears.shape.rounded_rect(cr,width,height,0)
end, end,
bgimage = theme.bgimage_outset, bgimage_normal = theme.bgimage_outset,
stretch = true stretch = true
}, },
slider = { slider = {
@ -408,68 +415,101 @@ theme.widgets = {
}, },
}, },
--}}} --}}}
-- {{{ Bars/Panels/Menu popups
generic_composite_widget = {
base = {
spacing = 2
}
},
-- }}}
-- {{{ Status panel widgets -- {{{ Status panel widgets
generic_status_widget = { generic_status_widget = {
container = { container = {
bgimage = function() end, bgimage_normal = function() end,
margins = 0 margins = 0
}, },
button = { button = {
margins = 0, margins = 0,
onpress = function() end, onpress = function() end,
onrelease = function() end, onrelease = function() end,
bgimage = function() end bgimage_normal = function() end
} }
}, },
-- }}} -- }}}
-- {{{ Various button lists
generic_button_list = {
button = {
forced_width = 20,
forced_height = 20
},
base = {
spacing = 2
}
},
-- }}}
-- {{{ All widgets that fit into a single line
generic_oneline_widget = {
container = {
bgimage_normal = theme.bgimage_inset
}
},
-- }}}
-- {{{ All kinds of widget popups
generic_popup = {
button = {
width = 180,
height = 40
},
article = {
icon_size = 30
},
},
-- }}}
popuptitle = {
container = {
bg_normal = {
type = "linear",
from = { 0, 0 },
to = { 90, 0 },
stops = { {0, "#040582"}, {1, "#0F7FCD"} }
},
-- awesomewm: yo pass me that pango markup
-- pango: you better not make unintuitive cryptic shit
-- awesomewm: *attach foreground setting to drawable container*
fg_normal = "#FAFAFA"
}
},
soundclown = { soundclown = {
--[[ --Uncomment to leetify that MPC
container = {
bg_normal = "#0c0c0c",
fg_normal = "#00FF00"
},
]]
base = { base = {
width = 140 width = 140
}, },
},
subpanel = {
container = { container = {
bgimage = theme.bgimage_inset, bgimage_normal = theme.bgimage_inset,
bg = "#9CA875" bg_normal = theme.bg_normal,
} margins = 2
},
notifications = {
button = {
height = 40,
width = 200
},
article = {
icon_size = 50,
title_valign = "top",
desc_valign = "top"
} }
}, },
taglist = { taglist = {
base = { base = {
spacing = 2 spacing = 2,
layout = require("wibox").layout.flex.horizontal
}, },
button = { button = {
bgimage_focus = theme.bgimage_inset, bgimage_focus = theme.bgimage_inset,
bgimage_normal = theme.bgimage_outset, bgimage_normal = theme.bgimage_outset,
margins = 2
}, },
container = { container = {
margins = 3 margins = 3
} }
}, },
subpanel = {
container = {
bgimage = theme.bgimage_inset,
bg = theme.bgimage_normal,
margins = 2
}
},
dismal = {
container = {
bg = theme.bg_focus
},
button = {
height = 34
}
},
tasklist = { tasklist = {
button = { button = {
width = 160, width = 160,
@ -504,24 +544,6 @@ theme.widgets = {
font = "Terminus 20" font = "Terminus 20"
} }
}, },
client_buttons = {
button = {
forced_width = 20,
forced_height = 20
},
base = {
spacing = 2
}
},
root_buttons = {
button = {
forced_width = 20,
forced_height = 20
},
base = {
spacing = 2
}
},
titlebar = { titlebar = {
titlebar_top = { titlebar_top = {
bgimage_normal = theme.titlebar_bgimage_top, bgimage_normal = theme.titlebar_bgimage_top,

24
widgets/base/keypopup.lua Normal file
View File

@ -0,0 +1,24 @@
-- This file is part of Reno desktop.
--
-- Reno desktop is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
--
-- Reno desktop is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License along with Reno desktop. If not, see <https://www.gnu.org/licenses/>.
local awful = require("awful")
local gears = require("gears")
local beautiful = require("beautiful")
local ask = require("asckey")
return function(args)
local hotkeys_popup = require("awful.hotkeys_popup")
require("awful.hotkeys_popup.keys")
root.keys(gears.table.join(
root.keys(),
ask.k(":help.show",function()
hotkeys_popup.show_help()
end,{description = "show help",group = "widgets"})
))
return hotkeys_popup
end

View File

@ -13,13 +13,26 @@ local awful = require("awful")
local beautiful = require("beautiful") local beautiful = require("beautiful")
return function(args) return function(args)
args.icon = args.icon or ""
local style = awmtk2.create_style("popuptitle", local style = awmtk2.create_style("popuptitle",
awmtk2.generic.oneline_widget,args.style) awmtk2.generic.oneline_widget,args.style)
local templates = awmtk2.create_template_lib("popuptitle",awmtk2.templates,args.templates) local templates = awmtk2.create_template_lib("popuptitle",awmtk2.templates,args.templates)
local t = awmtk2.build_templates(templates,style) local t = awmtk2.build_templates(templates,style)
local widget = wibox.widget(t.container(t.article({ local widget
if not args.vertical then
widget = wibox.widget(t.container(t.article({
icon = root_path.."/themes/"..global.theme.."/"..args.icon, icon = root_path.."/themes/"..global.theme.."/"..args.icon,
title = args.title title = args.title
}))) })))
else
widget = wibox.widget({
t.container(t.article({
icon = root_path.."/themes/"..global.theme.."/"..args.icon,
title = args.title
})),
widget = wibox.container.rotate,
direction = "east"
})
end
return widget return widget
end end

View File

@ -39,6 +39,10 @@ return function(args)
awful.tag.viewmore({tag}) awful.tag.viewmore({tag})
elseif b == 3 then elseif b == 3 then
awful.tag.viewtoggle(tag) awful.tag.viewtoggle(tag)
elseif b == 4 then
awful.tag.viewnext()
elseif b == 5 then
awful.tag.viewprev()
end end
end) end)
local bg = self:get_children_by_id("background")[1] local bg = self:get_children_by_id("background")[1]

View File

@ -112,6 +112,9 @@ return function(args)
id = "quality_id", id = "quality_id",
}), }),
layout = wibox.layout.fixed.vertical layout = wibox.layout.fixed.vertical
},{
bg = style.container.bg_highlight,
bgimage = style.container.bgimage_highlight
})) }))
layout:add(widget_map[data.name]) layout:add(widget_map[data.name])
percentage_map[data.name] = data.capacity percentage_map[data.name] = data.capacity
@ -126,6 +129,9 @@ return function(args)
id = "online_id", id = "online_id",
}), }),
layout = wibox.layout.fixed.vertical layout = wibox.layout.fixed.vertical
},{
bg = style.container.bg_highlight,
bgimage = style.container.bgimage_highlight
})) }))
layout:add(widget_map[data.name]) layout:add(widget_map[data.name])
percentage_map["charge"] = data.online percentage_map["charge"] = data.online
@ -199,6 +205,9 @@ return function(args)
id = "slider" id = "slider"
})), })),
layout = wibox.layout.fixed.vertical layout = wibox.layout.fixed.vertical
},{
bg = style.container.bg_highlight,
bgimage = style.container.bgimage_highlight
})) }))
if data.writable then if data.writable then
local slider = widget_map[data.name]:get_children_by_id("slider")[1] local slider = widget_map[data.name]:get_children_by_id("slider")[1]

View File

@ -12,6 +12,7 @@ local wibox = require("wibox")
local gears = require("gears") local gears = require("gears")
local awful = require("awful") local awful = require("awful")
local beautiful = require("beautiful") local beautiful = require("beautiful")
local ask = require("asckey")
local xdg_search = function(name,rlimit) local xdg_search = function(name,rlimit)
local results = {} local results = {}
@ -45,6 +46,7 @@ return function(args)
spacing = style.container.spacing spacing = style.container.spacing
},{ },{
bg = style.container.bg_highlight, bg = style.container.bg_highlight,
bgimage = style.container.bgimage_highlight,
forced_width = style.button.width or 180 forced_width = style.button.width or 180
}), }),
t.textbox({ t.textbox({
@ -102,7 +104,7 @@ return function(args)
local input_field = launchpad.widget:get_children_by_id("inputbox")[1] local input_field = launchpad.widget:get_children_by_id("inputbox")[1]
root.keys(gears.table.join( root.keys(gears.table.join(
root.keys(), root.keys(),
awful.key({ global.modkey }, "r", function() ask.k(":dismal.run", function()
results_list:reset() results_list:reset()
launchpad.visible = true launchpad.visible = true
launchpad.x = args.x or 0 launchpad.x = args.x or 0
@ -144,7 +146,7 @@ return function(args)
history_max = 50 history_max = 50
} }
end end
end) end,{description = "open run menu", group = "widgets"})
)) ))
return launchpad return launchpad
end end

View File

@ -37,7 +37,10 @@ return function(args)
((not result) and t.textbox({ ((not result) and t.textbox({
markup = "(xclip is not installed)" markup = "(xclip is not installed)"
})), })),
t.container(layout), t.container(layout,{
bg = style.container.bg_highlight,
bgimage = style.container.bgimage_highlight
}),
t.textbox({ t.textbox({
id = "page_id", id = "page_id",
markup = "Page 0/0" markup = "Page 0/0"

View File

@ -36,15 +36,13 @@ return function(args)
root_menu.visible = false root_menu.visible = false
end end
end) end)
root_menu._menu_private = {}
root_menu.widget = wibox.widget(t.popup(builder( root_menu.widget = wibox.widget(t.popup(builder(
config, config,
{ {
style = style.base, style = style.base,
screen = mouse.screen, screen = mouse.screen,
passthrough = { passthrough = {
parent = root_menu, parent = root_menu
_tracking_layer = root_menu._menu_private
} }
} }
)).widget) )).widget)

91
widgets/start/xdgmenu.lua Normal file
View File

@ -0,0 +1,91 @@
-- This file is part of Reno desktop.
--
-- Reno desktop is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
--
-- Reno desktop is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License along with Reno desktop. If not, see <https://www.gnu.org/licenses/>.
-- XDG application menu for the global context menu
local awmtk2 = require("awmtk2")
local wibox = require("wibox")
local gears = require("gears")
local awful = require("awful")
local beautiful = require("beautiful")
local menugen = require("context_menu")
local menuutils = require("menubar").utils
return function(args)
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
local widget = wibox.widget({
t.container({
markup = "Loading XDG menu...",
widget = wibox.widget.textbox
}),
layout = wibox.layout.fixed.vertical,
spacing = style.base.spacing,
id = "xdg_menu_root"
})
local function exclude(name)
for k,v in pairs(args.exclude or {}) do
if name:match(v) then
return true
end
end
return false
end
awesome.connect_signal("xdg::all_finished",function()
if not args.parent then return end
local items = {}
for k,v in pairs(xdg.categories) do
local noprocess = false
for k2,v2 in pairs(args.exclude_category or {}) do
if k == v2 then
noprocess = true
end
end
if (not noprocess) and (#v.apps > 0) then
local category = {k,{},menuutils.lookup_icon_uncached(v.icon)}
for _,item in pairs(v.apps) do
if not exclude(item.name) then
table.insert(category[2], {
item.name,
item.exec:gsub("%%%w","") or "",
gears.filesystem.file_readable(item.icon or "") and item.icon
})
end
end
table.insert(items,category)
end
end
-- uhhh there's a lot of things about async, some of which i can't explain
local xdg_menu_root = widget:get_children_by_id("xdg_menu_root")[1]
xdg_menu_root:reset()
local menu = wibox.widget(menugen({
items = items,
}))
local menu_root = menu:get_children_by_id("menu_root")[1]
for k,v in pairs(menu_root.children) do
v:connect_signal("cascade::kill",function()
args.parent.visible = false
end)
args.parent:connect_signal("property::visible",function()
if not args.parent.visible then
v:emit_signal("cascade::close")
end
end)
menu:connect_signal("widget::redraw_needed",function()
if not menu.visible then
v:emit_signal("cascade::close")
end
end)
end
xdg_menu_root:add(menu)
end)
return widget
end

89
widgets/startbutton.lua Normal file
View File

@ -0,0 +1,89 @@
-- This file is part of Reno desktop.
--
-- Reno desktop is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
--
-- Reno desktop is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License along with Reno desktop. If not, see <https://www.gnu.org/licenses/>.
-- Start button that summons the root menu or any other menu if needed
local awmtk2 = require("awmtk2")
local wibox = require("wibox")
local gears = require("gears")
local awful = require("awful")
local beautiful = require("beautiful")
local builder = require("builder")
return function(args)
local popup
do
local style = awmtk2.create_style("startbutton",
awmtk2.generic.popup,args.style)
local templates = awmtk2.create_template_lib("startbutton",awmtk2.templates,args.templates)
local t = awmtk2.build_templates(templates,style)
local config_file = io.open(root_path.."/themes/"..global.theme.."/config/startbutton.lua","r")
local config
if config_file then
config = config_file:read("*a")
config_file:close()
else
config = [[{"list": [{"widget": "widgets.base.popuptitle","options":{"vertical":true}},{"widget":"widgets.start.xdgmenu"}]}]]
end
popup = awful.popup(t.popup({
markup = "brainhurt 2",
widget = wibox.widget.textbox
}))
popup.widget = wibox.widget(t.popup(builder(
config,
{
style = style.base,
screen = mouse.screen,
passthrough = {
parent = popup
}
}
)).widget)
for _,layout in pairs(popup.widget:get_children_by_id("menu_root")) do
for _,button in pairs(layout.children) do
button:connect_signal("cascade::kill",function()
popup.visible = false
end)
end
end
popup:connect_signal("property::visible",function()
local roots = popup.widget:get_children_by_id("menu_root")
for k,v in pairs(roots) do
for _,w in ipairs(v.children) do
w:emit_signal("cascade::close")
end
end
end)
end
local style = awmtk2.create_style("startbutton",
awmtk2.generic.iconified_widget,args.style)
local templates = awmtk2.create_template_lib("startbutton",awmtk2.templates,args.templates)
local t = awmtk2.build_templates(templates,style)
local widget = wibox.widget(t.button(t.article({
icon = style.article.icon,
title = style.article.title or "Start"
})))
widget:connect_signal("button::press",style.button.onpress)
widget:connect_signal("button::release",style.button.onrelease)
widget:connect_signal("button::press",function()
popup.visible = (not popup.visible)
if popup.visible then
local _, corner = awful.placement.closest_corner(
mouse,
{parent = mouse.screen,pretend = true}
)
if corner then
(awful.placement[corner]+
awful.placement.no_offscreen+
awful.placement.no_overlap) (
popup,
{parent = mouse.screen}
)
end
end
end)
return widget
end

View File

@ -29,7 +29,7 @@ end
return function(args) return function(args)
local style = awmtk2.create_style("wallpapers", local style = awmtk2.create_style("wallpapers",
awmtk2.generic.iconified_widget,args.style) awmtk2.generic.popup,args.style)
local templates = awmtk2.create_template_lib("wallpapers",awmtk2.templates,args.templates) local templates = awmtk2.create_template_lib("wallpapers",awmtk2.templates,args.templates)
local t = awmtk2.build_templates(templates,style) local t = awmtk2.build_templates(templates,style)
-- set wallpaper -- set wallpaper
@ -69,7 +69,10 @@ return function(args)
}) })
-- create layout popup -- create layout popup
local popup = awful.popup(t.popup({ local popup = awful.popup(t.popup({
t.container(layout), t.container(layout,{
bg = style.container.bg_highlight,
bgimage = style.container.bgimage_highlight
}),
t.textbox({ t.textbox({
markup = "Page 0/0", markup = "Page 0/0",
id = "page_index" id = "page_index"
@ -120,7 +123,13 @@ return function(args)
end end
end) end)
-- create popup button -- create popup button
local clip_widget = wibox.widget(t.button({ local clip_widget
do
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)
clip_widget = wibox.widget(t.button({
image = beautiful.wallpapers_icon, image = beautiful.wallpapers_icon,
resize = true, resize = true,
widget = wibox.widget.imagebox widget = wibox.widget.imagebox
@ -135,5 +144,6 @@ return function(args)
end end
end end
end) end)
end
return clip_widget return clip_widget
end end

View File

@ -88,7 +88,10 @@ return function(args)
local appswitch = wibox.widget(t.button(t.textbox({ local appswitch = wibox.widget(t.button(t.textbox({
markup = "Applications", markup = "Applications",
id = "apptext" id = "apptext"
}))) }),{
forced_height = style.button.forced_height,
forced_width = style.button.forced_width
}))
appswitch:connect_signal("button::press",function(self) appswitch:connect_signal("button::press",function(self)
menu.visible = (not menu.visible) menu.visible = (not menu.visible)
local textbox = appswitch:get_children_by_id("apptext")[1] local textbox = appswitch:get_children_by_id("apptext")[1]