restructuring
This commit is contained in:
parent
688c01afc1
commit
683116b1cd
|
@ -27,6 +27,10 @@ modkey+f = ":client.fullscreen"
|
|||
modkey+n = ":client.minimize"
|
||||
modkey+m = ":client.maximize"
|
||||
|
||||
# Widget keys
|
||||
modkey+r = ":dismal.run"
|
||||
modkey+s = ":help.show"
|
||||
|
||||
# Custom keys
|
||||
Print = "flameshot gui"
|
||||
Shift+Print = "flameshot launcher"
|
||||
|
|
|
@ -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
|
|
@ -179,8 +179,9 @@ awmtk.proto_templates = {
|
|||
margins = style.container.margins,
|
||||
layout = wibox.container.margin
|
||||
},
|
||||
bgimage = style.container.bgimage,
|
||||
bgimage = style.container.bgimage_normal,
|
||||
bg = style.container.bg_normal,
|
||||
fg = style.container.fg_normal,
|
||||
shape = style.container.shape,
|
||||
widget = wibox.container.background
|
||||
},options or {})
|
||||
|
@ -198,8 +199,9 @@ awmtk.proto_templates = {
|
|||
margins = style.button.margins,
|
||||
layout = wibox.container.margin
|
||||
},
|
||||
bgimage = style.button.bgimage,
|
||||
bgimage = style.button.bgimage_normal,
|
||||
bg = style.button.bg_normal,
|
||||
fg = style.button.fg_normal,
|
||||
shape = style.button.shape,
|
||||
widget = wibox.container.background
|
||||
},options or {})
|
||||
|
@ -211,7 +213,7 @@ awmtk.proto_templates = {
|
|||
return function(options)
|
||||
return awmtk.merge({
|
||||
font = style.textbox.font,
|
||||
widget = wibox.widget.textbox
|
||||
widget = wibox.widget.textbox,
|
||||
},options or {})
|
||||
end
|
||||
end,
|
||||
|
@ -273,8 +275,6 @@ awmtk.proto_templates = {
|
|||
id = options.title_id,
|
||||
widget = wibox.widget.textbox,
|
||||
font = style.article.font,
|
||||
align = options.font_align or
|
||||
style.article.font_align,
|
||||
valign = style.article.title_valign or "center",
|
||||
align = style.article.title_align or "left"
|
||||
},
|
||||
|
@ -283,8 +283,6 @@ awmtk.proto_templates = {
|
|||
id = options.desc_id,
|
||||
widget = wibox.widget.textbox,
|
||||
font = style.article.small_font,
|
||||
align = options.small_font_align or
|
||||
style.article.small_font_align,
|
||||
valign = style.article.desc_valign or "center",
|
||||
align = style.article.desc_align or "left"
|
||||
}),
|
||||
|
@ -327,7 +325,7 @@ awmtk.proto_templates = {
|
|||
margins = style.popup.margins,
|
||||
layout = wibox.container.margin
|
||||
},
|
||||
bgimage = style.popup.bgimage,
|
||||
bgimage = style.popup.bgimage_normal,
|
||||
shape = style.popup.shape,
|
||||
visible = false,
|
||||
ontop = true
|
||||
|
|
|
@ -8,39 +8,12 @@
|
|||
-- Module that adds default keybindings
|
||||
local awful = require("awful")
|
||||
local gears = require("gears")
|
||||
local ask = require("asckey")
|
||||
global.modkey = global.modkey or "Mod4"
|
||||
|
||||
local function get_keycomb(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
|
||||
|
||||
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
|
||||
ask.keymap = keybindings
|
||||
local custom_keys = ask.custom_binds()
|
||||
local k = ask.k
|
||||
|
||||
local keys = gears.table.join(
|
||||
k(':root.client_next',
|
||||
|
|
|
@ -81,8 +81,8 @@ awful.screen.connect_for_each_screen(function(s)
|
|||
border_color = style[v].border_color,
|
||||
opacity = style[v].opacity or 1,
|
||||
shape = style[v].shape,
|
||||
bg = style[v].bg,
|
||||
bgimage = style[v].bgimage,
|
||||
bg = style[v].bg_normal,
|
||||
bgimage = style[v].bgimage_normal,
|
||||
fg = style[v].fg,
|
||||
input_passthrough = style[v].input_passthrough
|
||||
})
|
||||
|
|
|
@ -4,5 +4,6 @@
|
|||
"y":26
|
||||
},
|
||||
"widgets.rootmenu":{},
|
||||
"widgets.lockscreen":{}
|
||||
"widgets.lockscreen":{},
|
||||
"widgets.base.keypopup":{}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"align": {
|
||||
"left": [
|
||||
"left": [
|
||||
{
|
||||
"widget": "widgets.launcher"
|
||||
},
|
||||
|
|
|
@ -24,6 +24,7 @@ theme.bg_normal = "#c0c0c0"
|
|||
theme.bg_focus = "#808080"
|
||||
theme.bg_urgent = "#FFEDCC"
|
||||
theme.bg_minimize = "#efefef"
|
||||
theme.bg_highlight = "#dadada"
|
||||
theme.bg_highlight_shadow = "#000000FF"
|
||||
theme.bg_highlight_light = "#FFFFFFFF"
|
||||
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.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,...)
|
||||
local light = gears.color(theme.bg_highlight_light)
|
||||
local shadow = gears.color(theme.bg_highlight_shadow)
|
||||
|
@ -339,13 +345,14 @@ theme.widgets = {
|
|||
-- {{{ Widget base
|
||||
default = {
|
||||
container = {
|
||||
bgimage = theme.bgimage_highlight,
|
||||
bgimage_normal = theme.bgimage_highlight,
|
||||
shape = function(cr,width,height)
|
||||
return require("gears").shape.rounded_rect(cr,width,height,0)
|
||||
end
|
||||
end,
|
||||
bgimage_highlight = theme.bgimage_inset
|
||||
},
|
||||
button = {
|
||||
bgimage = theme.bgimage_outset,
|
||||
bgimage_normal = theme.bgimage_outset,
|
||||
shape = function(cr,width,height)
|
||||
return require("gears").shape.rounded_rect(cr,width,height,0)
|
||||
end,
|
||||
|
@ -359,13 +366,13 @@ theme.widgets = {
|
|||
end
|
||||
},
|
||||
popup = {
|
||||
bgimage = theme.bgimage_outset,
|
||||
bgimage_normal = theme.bgimage_outset,
|
||||
shape = function(cr,width,height)
|
||||
return gears.shape.rounded_rect(cr,width,height,0)
|
||||
end,
|
||||
},
|
||||
titlebar = {
|
||||
bgimage = theme.bgimage_outset,
|
||||
bgimage_normal = theme.bgimage_outset,
|
||||
--margins = 5,
|
||||
left = 4,
|
||||
right = 5,
|
||||
|
@ -380,7 +387,7 @@ theme.widgets = {
|
|||
shape = function(cr,width,height)
|
||||
return gears.shape.rounded_rect(cr,width,height,0)
|
||||
end,
|
||||
bgimage = theme.bgimage_outset,
|
||||
bgimage_normal = theme.bgimage_outset,
|
||||
stretch = true
|
||||
},
|
||||
slider = {
|
||||
|
@ -408,68 +415,101 @@ theme.widgets = {
|
|||
},
|
||||
},
|
||||
--}}}
|
||||
-- {{{ Bars/Panels/Menu popups
|
||||
generic_composite_widget = {
|
||||
base = {
|
||||
spacing = 2
|
||||
}
|
||||
},
|
||||
-- }}}
|
||||
-- {{{ Status panel widgets
|
||||
generic_status_widget = {
|
||||
container = {
|
||||
bgimage = function() end,
|
||||
bgimage_normal = function() end,
|
||||
margins = 0
|
||||
},
|
||||
button = {
|
||||
margins = 0,
|
||||
onpress = 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 = {
|
||||
--[[ --Uncomment to leetify that MPC
|
||||
container = {
|
||||
bg_normal = "#0c0c0c",
|
||||
fg_normal = "#00FF00"
|
||||
},
|
||||
]]
|
||||
base = {
|
||||
width = 140
|
||||
},
|
||||
container = {
|
||||
bgimage = theme.bgimage_inset,
|
||||
bg = "#9CA875"
|
||||
}
|
||||
},
|
||||
notifications = {
|
||||
button = {
|
||||
height = 40,
|
||||
width = 200
|
||||
},
|
||||
article = {
|
||||
icon_size = 50,
|
||||
title_valign = "top",
|
||||
desc_valign = "top"
|
||||
subpanel = {
|
||||
container = {
|
||||
bgimage_normal = theme.bgimage_inset,
|
||||
bg_normal = theme.bg_normal,
|
||||
margins = 2
|
||||
}
|
||||
},
|
||||
taglist = {
|
||||
base = {
|
||||
spacing = 2
|
||||
spacing = 2,
|
||||
layout = require("wibox").layout.flex.horizontal
|
||||
},
|
||||
button = {
|
||||
bgimage_focus = theme.bgimage_inset,
|
||||
bgimage_normal = theme.bgimage_outset,
|
||||
margins = 2
|
||||
},
|
||||
container = {
|
||||
margins = 3
|
||||
}
|
||||
},
|
||||
subpanel = {
|
||||
container = {
|
||||
bgimage = theme.bgimage_inset,
|
||||
bg = theme.bgimage_normal,
|
||||
margins = 2
|
||||
}
|
||||
},
|
||||
dismal = {
|
||||
container = {
|
||||
bg = theme.bg_focus
|
||||
},
|
||||
button = {
|
||||
height = 34
|
||||
}
|
||||
},
|
||||
tasklist = {
|
||||
button = {
|
||||
width = 160,
|
||||
|
@ -504,24 +544,6 @@ theme.widgets = {
|
|||
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_top = {
|
||||
bgimage_normal = theme.titlebar_bgimage_top,
|
||||
|
|
|
@ -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
|
|
@ -13,13 +13,26 @@ local awful = require("awful")
|
|||
local beautiful = require("beautiful")
|
||||
|
||||
return function(args)
|
||||
args.icon = args.icon or ""
|
||||
local style = awmtk2.create_style("popuptitle",
|
||||
awmtk2.generic.oneline_widget,args.style)
|
||||
local templates = awmtk2.create_template_lib("popuptitle",awmtk2.templates,args.templates)
|
||||
local t = awmtk2.build_templates(templates,style)
|
||||
local widget = wibox.widget(t.container(t.article({
|
||||
icon = root_path.."/themes/"..global.theme.."/"..args.icon,
|
||||
title = args.title
|
||||
})))
|
||||
local widget
|
||||
if not args.vertical then
|
||||
widget = wibox.widget(t.container(t.article({
|
||||
icon = root_path.."/themes/"..global.theme.."/"..args.icon,
|
||||
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
|
||||
end
|
||||
|
|
|
@ -39,6 +39,10 @@ return function(args)
|
|||
awful.tag.viewmore({tag})
|
||||
elseif b == 3 then
|
||||
awful.tag.viewtoggle(tag)
|
||||
elseif b == 4 then
|
||||
awful.tag.viewnext()
|
||||
elseif b == 5 then
|
||||
awful.tag.viewprev()
|
||||
end
|
||||
end)
|
||||
local bg = self:get_children_by_id("background")[1]
|
||||
|
|
|
@ -112,6 +112,9 @@ return function(args)
|
|||
id = "quality_id",
|
||||
}),
|
||||
layout = wibox.layout.fixed.vertical
|
||||
},{
|
||||
bg = style.container.bg_highlight,
|
||||
bgimage = style.container.bgimage_highlight
|
||||
}))
|
||||
layout:add(widget_map[data.name])
|
||||
percentage_map[data.name] = data.capacity
|
||||
|
@ -126,6 +129,9 @@ return function(args)
|
|||
id = "online_id",
|
||||
}),
|
||||
layout = wibox.layout.fixed.vertical
|
||||
},{
|
||||
bg = style.container.bg_highlight,
|
||||
bgimage = style.container.bgimage_highlight
|
||||
}))
|
||||
layout:add(widget_map[data.name])
|
||||
percentage_map["charge"] = data.online
|
||||
|
@ -199,6 +205,9 @@ return function(args)
|
|||
id = "slider"
|
||||
})),
|
||||
layout = wibox.layout.fixed.vertical
|
||||
},{
|
||||
bg = style.container.bg_highlight,
|
||||
bgimage = style.container.bgimage_highlight
|
||||
}))
|
||||
if data.writable then
|
||||
local slider = widget_map[data.name]:get_children_by_id("slider")[1]
|
||||
|
|
|
@ -12,6 +12,7 @@ local wibox = require("wibox")
|
|||
local gears = require("gears")
|
||||
local awful = require("awful")
|
||||
local beautiful = require("beautiful")
|
||||
local ask = require("asckey")
|
||||
|
||||
local xdg_search = function(name,rlimit)
|
||||
local results = {}
|
||||
|
@ -45,6 +46,7 @@ return function(args)
|
|||
spacing = style.container.spacing
|
||||
},{
|
||||
bg = style.container.bg_highlight,
|
||||
bgimage = style.container.bgimage_highlight,
|
||||
forced_width = style.button.width or 180
|
||||
}),
|
||||
t.textbox({
|
||||
|
@ -102,7 +104,7 @@ return function(args)
|
|||
local input_field = launchpad.widget:get_children_by_id("inputbox")[1]
|
||||
root.keys(gears.table.join(
|
||||
root.keys(),
|
||||
awful.key({ global.modkey }, "r", function()
|
||||
ask.k(":dismal.run", function()
|
||||
results_list:reset()
|
||||
launchpad.visible = true
|
||||
launchpad.x = args.x or 0
|
||||
|
@ -144,7 +146,7 @@ return function(args)
|
|||
history_max = 50
|
||||
}
|
||||
end
|
||||
end)
|
||||
end,{description = "open run menu", group = "widgets"})
|
||||
))
|
||||
return launchpad
|
||||
end
|
||||
|
|
|
@ -37,7 +37,10 @@ return function(args)
|
|||
((not result) and t.textbox({
|
||||
markup = "(xclip is not installed)"
|
||||
})),
|
||||
t.container(layout),
|
||||
t.container(layout,{
|
||||
bg = style.container.bg_highlight,
|
||||
bgimage = style.container.bgimage_highlight
|
||||
}),
|
||||
t.textbox({
|
||||
id = "page_id",
|
||||
markup = "Page 0/0"
|
||||
|
|
|
@ -36,15 +36,13 @@ return function(args)
|
|||
root_menu.visible = false
|
||||
end
|
||||
end)
|
||||
root_menu._menu_private = {}
|
||||
root_menu.widget = wibox.widget(t.popup(builder(
|
||||
config,
|
||||
{
|
||||
style = style.base,
|
||||
screen = mouse.screen,
|
||||
passthrough = {
|
||||
parent = root_menu,
|
||||
_tracking_layer = root_menu._menu_private
|
||||
parent = root_menu
|
||||
}
|
||||
}
|
||||
)).widget)
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -29,7 +29,7 @@ end
|
|||
|
||||
return function(args)
|
||||
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 t = awmtk2.build_templates(templates,style)
|
||||
-- set wallpaper
|
||||
|
@ -69,7 +69,10 @@ return function(args)
|
|||
})
|
||||
-- create layout 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({
|
||||
markup = "Page 0/0",
|
||||
id = "page_index"
|
||||
|
@ -120,20 +123,27 @@ return function(args)
|
|||
end
|
||||
end)
|
||||
-- create popup button
|
||||
local clip_widget = wibox.widget(t.button({
|
||||
image = beautiful.wallpapers_icon,
|
||||
resize = true,
|
||||
widget = wibox.widget.imagebox
|
||||
}))
|
||||
clip_widget:connect_signal("button::press",style.button.onpress)
|
||||
clip_widget:connect_signal("button::release",style.button.onrelease)
|
||||
clip_widget:connect_signal("button::press",function(self,x,y,button)
|
||||
if button == 1 then
|
||||
popup.visible = (not popup.visible)
|
||||
if popup.visible then
|
||||
popup:move_next_to(mouse.current_widget_geometry)
|
||||
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,
|
||||
resize = true,
|
||||
widget = wibox.widget.imagebox
|
||||
}))
|
||||
clip_widget:connect_signal("button::press",style.button.onpress)
|
||||
clip_widget:connect_signal("button::release",style.button.onrelease)
|
||||
clip_widget:connect_signal("button::press",function(self,x,y,button)
|
||||
if button == 1 then
|
||||
popup.visible = (not popup.visible)
|
||||
if popup.visible then
|
||||
popup:move_next_to(mouse.current_widget_geometry)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end
|
||||
return clip_widget
|
||||
end
|
||||
|
|
|
@ -88,7 +88,10 @@ return function(args)
|
|||
local appswitch = wibox.widget(t.button(t.textbox({
|
||||
markup = "Applications",
|
||||
id = "apptext"
|
||||
})))
|
||||
}),{
|
||||
forced_height = style.button.forced_height,
|
||||
forced_width = style.button.forced_width
|
||||
}))
|
||||
appswitch:connect_signal("button::press",function(self)
|
||||
menu.visible = (not menu.visible)
|
||||
local textbox = appswitch:get_children_by_id("apptext")[1]
|
||||
|
|
Loading…
Reference in New Issue