Yessiest
2 years ago
19 changed files with 415 additions and 123 deletions
-
4desktop.conf
-
48libs/asckey.lua
-
14libs/awmtk2.lua
-
35modules/binds.lua
-
4modules/desktop.lua
-
3themes/reno98/config/global.json
-
2themes/reno98/config/wibar_bottom.json
-
128themes/reno98/theme.lua
-
24widgets/base/keypopup.lua
-
21widgets/base/popuptitle.lua
-
4widgets/base/tagswitcher.lua
-
9widgets/battery.lua
-
6widgets/dismal.lua
-
5widgets/notifications.lua
-
4widgets/rootmenu.lua
-
91widgets/start/xdgmenu.lua
-
89widgets/startbutton.lua
-
42widgets/wallpapers.lua
-
5widgets/xdgmenu.lua
@ -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 |
@ -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 |
@ -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 |
Write
Preview
Loading…
Cancel
Save
Reference in new issue