Browse Source

Added some extra project management utilities

master
Yessiest 1 year ago
parent
commit
0d3131a8f9
  1. 1
      .gitignore
  2. 4
      .ldoc.lua
  3. 31
      .luarc.json
  4. 49
      Rakefile
  5. 2
      desktop.conf
  6. 4
      extra/picom.conf
  7. 86
      libs/awmtk2.lua
  8. 13
      modules/binds.lua
  9. 83
      modules/desktop.lua
  10. 1
      themes/reno98/theme.lua
  11. 3
      themes/unity/WARNING.txt
  12. 32
      themes/unity/config/root_menu_test.json
  13. 1
      themes/unity/config/wibar_top.json
  14. BIN
      themes/unity/icons/reno.png
  15. BIN
      themes/unity/icons/volume-high-symbolic.png
  16. BIN
      themes/unity/icons/volume-low-symbolic.png
  17. BIN
      themes/unity/icons/volume-medium-symbolic.png
  18. BIN
      themes/unity/icons/volume-muted-symbolic.png
  19. BIN
      themes/unity/icons/volume.png
  20. 47
      themes/unity/theme.lua
  21. 38
      widgets/battery.lua
  22. 2
      widgets/clientbuttons.lua
  23. 25
      widgets/clientvolume.lua
  24. 106
      widgets/volume.lua

1
.gitignore

@ -3,3 +3,4 @@
/links /links
/libs/pam /libs/pam
/libs/pam.so /libs/pam.so
/doc

4
.ldoc.lua

@ -0,0 +1,4 @@
file = {"libs","modules","widgets"}
format = "markdown"
title = "Reno Desktop documentation"
description = "Reno Desktop is an AwesomeWM config that harnesses the power of AwesomeWM to bring the essential functionality of a desktop environment."

31
.luarc.json

@ -0,0 +1,31 @@
{
"diagnostics": {
"enable": true,
"globals": [
"awesome",
"button",
"dbus",
"client",
"mouse",
"screen",
"root"
]
},
"runtime": {
"version": "Lua 5.3",
"path": [
"/usr/share/awesome/lib/?/?.lua"
],
"pathStrict": true
},
"workspace": {
"library": [
"runtime/lua",
"/usr/share/awesome/lib"
],
"checkThirdParty": false,
"maxPreload": 2000,
"preloadFileSize": 1000
},
"telemetry.enable": true
}

49
Rakefile

@ -0,0 +1,49 @@
task default: [:install]
ConfigPath = (ENV["XDG_DATA_HOME"] or ENV["HOME"]+'/.config')
desc "Copy files to .config"
file "copy-config" => ["rc.lua"] do
sh "mkdir -p #{ConfigPath}/awesome"
["libs","modules","themes","widgets","rc.lua","desktop.conf"].each { |x|
cp_r "./#{x}" "#{ConfigPath}/awesome"
}
end
desc "Compile and install luapam"
file "build-luapam" => "#{ConfigPath}/libs/pam.so" do
sh "sh ./extra/install_luapam.sh"
end
desc "Install config"
task install: ["copy-config","build-luapam"]
desc "Build documentation"
task :doc do
sh "ldoc ./.ldoc.lua"
end
desc "Install extras"
task "install-extra" do
if Process.euid != 0
raise Exception, "You need to be root to install extras"
end
cp "./extra/udev/backlight.rules" "/etc/udev/rules.d"
mkdir "#{ConfigPath}/autostart"
begin
cp "/usr/share/applications/picom.desktop" "#{ConfigPath}/autostart/"
rescue
puts "picom not installed - ignoring"
else
cp "./extra/picom.conf" "#{ConfigPath}"
end
puts "Done! Reload awesome to complete installation"
end
desc "Uninstall from .config"
task :clean do
rm_rf "#{ConfigPath}/awesome"
end
desc "Wipe configuration and reinstall from scratch"
task reinstall: [:clean,:install]

2
desktop.conf

@ -17,6 +17,7 @@ modkey+Control+Down = ":root.screen_previous"
modkey+Tab = ":root.client_swap" modkey+Tab = ":root.client_swap"
modkey+Return = ":root.spawn_terminal" modkey+Return = ":root.spawn_terminal"
modkey+Shift+Return = ":root.spawn_browser" modkey+Shift+Return = ":root.spawn_browser"
modkey+Shift+y = ":root.toggle_titlebars"
# Client keys only work if a focused client exists # Client keys only work if a focused client exists
modkey+Shift+c = ":client.kill" modkey+Shift+c = ":client.kill"
@ -40,6 +41,7 @@ XF86MonBrightnessDown = ":battery.brightness_down"
XF86AudioPlay = ":mpc.play" XF86AudioPlay = ":mpc.play"
XF86AudioPrev = ":mpc.prev" XF86AudioPrev = ":mpc.prev"
XF86AudioNext = ":mpc.next" XF86AudioNext = ":mpc.next"
# Custom keys # Custom keys
Print = "flameshot gui" Print = "flameshot gui"
Shift+Print = "flameshot launcher" Shift+Print = "flameshot launcher"

4
extra/picom.conf

@ -1,6 +1,5 @@
backend = "xrender"; backend = "xrender";
vsync = true; vsync = true;
# Shadow # Shadow
shadow = true; # Enabled client-side shadows on windows. shadow = true; # Enabled client-side shadows on windows.
shadow-radius = 12; # The blur radius for shadows. (default 12) shadow-radius = 12; # The blur radius for shadows. (default 12)
@ -31,7 +30,8 @@ shadow-exclude = [
# This list includes all the affected apps I found in my testing. The "! name~=''" part excludes shadows on any "Unknown" windows, this prevents a visual glitch with the XFWM alt tab switcher. # This list includes all the affected apps I found in my testing. The "! name~=''" part excludes shadows on any "Unknown" windows, this prevents a visual glitch with the XFWM alt tab switcher.
# Fading # Fading
fading = true# Fade windows during opacity changes.
fading = true;
# Fade windows during opacity changes.
fade-delta = 4; # The time between steps in a fade in milliseconds. (default 10). fade-delta = 4; # The time between steps in a fade in milliseconds. (default 10).
fade-in-step = 0.03; # Opacity change between steps while fading in. (default 0.028). fade-in-step = 0.03; # Opacity change between steps while fading in. (default 0.028).
fade-out-step = 0.03; # Opacity change between steps while fading out. (default 0.03). fade-out-step = 0.03; # Opacity change between steps while fading out. (default 0.03).

86
libs/awmtk2.lua

@ -19,7 +19,6 @@ local awmtk = {}
awmtk.create_delta = function(name,instance_delta,class_delta,parent_delta) awmtk.create_delta = function(name,instance_delta,class_delta,parent_delta)
-- to save memory, we create proxies for lower layers called "deltas" -- to save memory, we create proxies for lower layers called "deltas"
-- this function creates that proxy layer using metatables -- this function creates that proxy layer using metatables
-- fun story - i used instance_delta instead of {} at first. -- fun story - i used instance_delta instead of {} at first.
-- the results were horrifying and confusing. -- the results were horrifying and confusing.
return setmetatable({},{ return setmetatable({},{
@ -28,7 +27,7 @@ awmtk.create_delta = function(name,instance_delta,class_delta,parent_delta)
if rawget(instance_delta,k) then if rawget(instance_delta,k) then
return rawget(instance_delta,k) return rawget(instance_delta,k)
-- class-wide overrides are second in priority -- class-wide overrides are second in priority
elseif type(class_delta[name]) == "table"
elseif type(class_delta[name]) == "table"
and rawget(class_delta[name],k) then and rawget(class_delta[name],k) then
return rawget(class_delta[name],k) return rawget(class_delta[name],k)
-- parent is fallback -- parent is fallback
@ -44,7 +43,7 @@ awmtk.create_style = function(name,parent,overrides)
local new_style = {} local new_style = {}
local odelta = (overrides and overrides[name]) or {} local odelta = (overrides and overrides[name]) or {}
local cdelta = beautiful.widgets[name] or {} local cdelta = beautiful.widgets[name] or {}
for name,parent_class in pairs(parent) do
for name,parent_class in pairs(parent) do
new_style[name] = awmtk.create_delta( new_style[name] = awmtk.create_delta(
name, name,
odelta, odelta,
@ -53,7 +52,7 @@ awmtk.create_style = function(name,parent,overrides)
) )
end end
return new_style return new_style
end
end
awmtk.create_template_lib = function(name,parent,overrides) awmtk.create_template_lib = function(name,parent,overrides)
-- same thing but beautiful.templates -- same thing but beautiful.templates
@ -85,9 +84,9 @@ awmtk.mask_object_call = function(obj,call)
end end
awmtk.wrap_hooks = function(w,callbacks) awmtk.wrap_hooks = function(w,callbacks)
-- attach hooks to function
local mcall = getmetatable(w).__call
return awmtk.mask_object_call(w,function(...)
-- attach hooks to function
local mcall = (getmetatable(w) and getmetatable(w).__call) or w
local call_wrapper = function(...)
if callbacks and callbacks.on_create_pre then if callbacks and callbacks.on_create_pre then
callbacks.on_create_pre(...) callbacks.on_create_pre(...)
end end
@ -96,8 +95,12 @@ awmtk.wrap_hooks = function(w,callbacks)
callbacks.on_create(widget,...) callbacks.on_create(widget,...)
end end
if callbacks and callbacks.on_ready then if callbacks and callbacks.on_ready then
callbacks._on_ready_called = false
local func = function() local func = function()
callbacks.on_ready(widget)
if not callbacks._on_ready_called then
callbacks.on_ready(widget)
callbacks._on_ready_called = true
end
end end
widget:connect_signal("widget::layout_changed",func) widget:connect_signal("widget::layout_changed",func)
widget:connect_signal("widget::layout_changed",function() widget:connect_signal("widget::layout_changed",function()
@ -105,7 +108,9 @@ awmtk.wrap_hooks = function(w,callbacks)
end) end)
end end
return widget return widget
end)
end
return (getmetatable(w) and awmtk.mask_object_call(w,call_wrapper)) or
call_wrapper
end end
awmtk.merge = gears.table.join awmtk.merge = gears.table.join
@ -245,7 +250,7 @@ awmtk.proto_templates = {
shape = style.button.shape, shape = style.button.shape,
shape_border_color = style.button.shape_border_color, shape_border_color = style.button.shape_border_color,
shape_border_width = style.button.shape_border_width, shape_border_width = style.button.shape_border_width,
widget = wibox.container.background
widget = awmtk.wrap_hooks(wibox.container.background,options)
},options or {}) },options or {})
end end
end, end,
@ -255,7 +260,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 = awmtk.wrap_hooks(wibox.widget.textbox,options)
},options or {}) },options or {})
end end
end, end,
@ -264,7 +269,7 @@ awmtk.proto_templates = {
-- wow, i guess? -- wow, i guess?
return function(options) return function(options)
return awmtk.merge({ return awmtk.merge({
widget = wibox.widget.separator,
widget = awmtk.wrap_hooks(wibox.widget.separator,options),
orientation = "horizontal", orientation = "horizontal",
thickness = style.separator.thickness, thickness = style.separator.thickness,
color = style.separator.color, color = style.separator.color,
@ -272,12 +277,12 @@ awmtk.proto_templates = {
},options or {}) },options or {})
end end
end, end,
vseparator = function(style) vseparator = function(style)
-- i'm running out of comments -- i'm running out of comments
return function(options) return function(options)
return awmtk.merge({ return awmtk.merge({
widget = wibox.widget.separator,
widget = awmtk.wrap_hooks(wibox.widget.separator,options),
orientation = "vertical", orientation = "vertical",
thickness = style.separator.thickness, thickness = style.separator.thickness,
color = style.separator.color, color = style.separator.color,
@ -303,9 +308,9 @@ awmtk.proto_templates = {
strategy = "exact", strategy = "exact",
height = options.icon_size or height = options.icon_size or
style.article.icon_size, style.article.icon_size,
width = options.icon_size or
width = options.icon_size or
style.article.icon_size, style.article.icon_size,
widget = wibox.container.constraint
widget = wibox.container.constraint
}, },
widget = wibox.container.place, widget = wibox.container.place,
valign = "center", valign = "center",
@ -332,7 +337,10 @@ awmtk.proto_templates = {
layout = wibox.layout.flex.vertical layout = wibox.layout.flex.vertical
}, },
spacing = style.article.spacing, spacing = style.article.spacing,
layout = wibox.layout.fixed.horizontal,
layout = awmtk.wrap_hooks(
wibox.layout.fixed.horizontal,
options
)
}, options or {}) }, options or {})
end end
end, end,
@ -346,11 +354,14 @@ awmtk.proto_templates = {
strategy = "exact", strategy = "exact",
height = options.height or height = options.height or
style.center.height, style.center.height,
width = options.width or
width = options.width or
style.center.width, style.center.width,
widget = wibox.container.constraint
widget = wibox.container.constraint
}, },
widget = wibox.container.place,
widget = awmtk.wrap_hooks(
wibox.container.place,
options
),
valign = "center", valign = "center",
halign = "center" halign = "center"
},options or {}) },options or {})
@ -365,7 +376,7 @@ awmtk.proto_templates = {
widget = { widget = {
widget, widget,
margins = style.popup.margins, margins = style.popup.margins,
layout = wibox.container.margin
layout = awmtk.wrap_hooks(wibox.container.margin,options)
}, },
bgimage = style.popup.bgimage_normal, bgimage = style.popup.bgimage_normal,
shape = style.popup.shape, shape = style.popup.shape,
@ -384,16 +395,16 @@ awmtk.proto_templates = {
-- bugs i manage to uncover by some sort of miraculous accident. -- 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 -- this one fixes a race condition in margins+(left/right/bottom/top) configuration scenario
local margins = style.titlebar.margins local margins = style.titlebar.margins
if (style.titlebar.left or
style.titlebar.right or
style.titlebar.bottom or
if (style.titlebar.left or
style.titlebar.right or
style.titlebar.bottom or
style.titlebar.top) then style.titlebar.top) then
margins = nil margins = nil
end end
return awmtk.merge({ return awmtk.merge({
layout, layout,
margins = margins, margins = margins,
layout = wibox.container.margin,
layout = awmtk.wrap_hooks(wibox.container.margin,options),
left = style.titlebar.left, left = style.titlebar.left,
right = style.titlebar.right, right = style.titlebar.right,
bottom = style.titlebar.bottom, bottom = style.titlebar.bottom,
@ -406,16 +417,16 @@ awmtk.proto_templates = {
-- just you regular old wibar, but as a style template. -- just you regular old wibar, but as a style template.
return function(layout,options) return function(layout,options)
local margins = style.wibar.margins local margins = style.wibar.margins
if (style.wibar.left or
style.wibar.right or
style.wibar.bottom or
if (style.wibar.left or
style.wibar.right or
style.wibar.bottom or
style.wibar.top) then style.wibar.top) then
margins = nil margins = nil
end end
return awmtk.merge({ return awmtk.merge({
layout, layout,
margins = margins, margins = margins,
layout = wibox.container.margin,
layout = awmtk.wrap_hooks(wibox.container.margin,options),
left = style.wibar.left, left = style.wibar.left,
right = style.wibar.right, right = style.wibar.right,
bottom = style.wibar.bottom, bottom = style.wibar.bottom,
@ -442,7 +453,7 @@ awmtk.proto_templates = {
bar_border_color = style.slider.bar_border_color, bar_border_color = style.slider.bar_border_color,
forced_width = style.slider.width, forced_width = style.slider.width,
forced_height = style.slider.height, forced_height = style.slider.height,
widget = wibox.widget.slider
widget = awmtk.wrap_hooks(wibox.widget.slider,args)
},args or {}) },args or {})
end end
end, end,
@ -450,13 +461,16 @@ awmtk.proto_templates = {
checkbox = function(style) checkbox = function(style)
return function(args) return function(args)
return awmtk.merge({ return awmtk.merge({
color = style.checkbox.bg_focus,
padding = 2,
color = style.checkbox.color or style.checkbox.bg_normal,
paddings = style.checkbox.paddings,
shape = style.checkbox.shape, shape = style.checkbox.shape,
border_width = style.checkbox.shape_border_width,
bg = style.checkbox.shape_border_color,
widget = wibox.widget.checkbox
},args or {})
border_width = style.checkbox.border_width,
border_color = style.checkbox.border_color or style.checkbox.bg_normal,
bg = style.checkbox.bg or style.checkbox.bg_focus,
check_color = style.checkbox.check_color or style.checkbox.bg_normal,
check_shape = style.checkbox.check_shape,
widget = awmtk.wrap_hooks(wibox.widget.checkbox,args)
},args)
end end
end end
} }

13
modules/binds.lua

@ -14,6 +14,7 @@ global.modkey = global.modkey or "Mod4"
ask.set_keymap(config.keys) ask.set_keymap(config.keys)
local custom_keys = ask.custom_binds() local custom_keys = ask.custom_binds()
local k = ask.k local k = ask.k
local titlebar_states = {}
local keys = gears.table.join( local keys = gears.table.join(
k(':root.client_next', k(':root.client_next',
@ -54,6 +55,11 @@ local keys = gears.table.join(
awful.spawn(global.browser) awful.spawn(global.browser)
end, end,
{description = "open browser", group = "launcher"}), {description = "open browser", group = "launcher"}),
k(":root.toggle_titlebars",
function (c)
awesome.emit_signal("titlebar::toggle")
end ,
{description = "(un)hide all titlebars", group = "client"}),
table.unpack(custom_keys)) table.unpack(custom_keys))
root.keys(keys) root.keys(keys)
@ -109,14 +115,9 @@ local clientkeys = gears.table.join(
{description = "(un)pin", group = "client"}), {description = "(un)pin", group = "client"}),
k(":client.toggle_titlebars", k(":client.toggle_titlebars",
function (c) function (c)
if (not c.titlebar_top.visible) then
c:emit_signal("titlebar::unhide")
else
c:emit_signal("titlebar::hide")
end
c:emit_signal("titlebar::toggle")
end , end ,
{description = "(un)hide titlebars", group = "client"})) {description = "(un)hide titlebars", group = "client"}))
awful.rules.rules[1].properties.keys = clientkeys awful.rules.rules[1].properties.keys = clientkeys
local clientbuttons = gears.table.join( local clientbuttons = gears.table.join(

83
modules/desktop.lua

@ -116,15 +116,47 @@ table.insert(awful.rules.rules,
} }
) )
local window_shape_hide = function(cr, width, height)
return gears.shape.partially_rounded_rect(cr,width,height,
false,false,false,false,0)
end
local window_shape = beautiful.window_shape or function(cr, width, height)
return gears.shape.partially_rounded_rect(cr,width,height,
true,true,false,false,beautiful.window_rounding)
end
client.connect_signal("manage", function(c) client.connect_signal("manage", function(c)
local shape = beautiful.window_shape or function(cr, width, height)
return gears.shape.partially_rounded_rect(cr,width,height,
true,true,false,false,beautiful.window_rounding)
c.shape = window_shape
end)
local titlebars_on = true
awesome.connect_signal("titlebar::toggle",function()
titlebars_on = not titlebars_on
for _,c in ipairs(client.get()) do
if titlebars_on then
for _, pos in ipairs({"top","bottom","left","right"}) do
awful.titlebar.show(c,pos)
end
c.shape = window_shape
c:emit_signal("titlebar::perform_action",function(titlebar)
titlebar.widget.visible = true
end)
else
for _, pos in ipairs({"top","bottom","left","right"}) do
awful.titlebar.hide(c,pos)
end
c.shape = window_shape_hide
c:emit_signal("titlebar::perform_action",function(titlebar)
titlebar.widget.visible = false
end)
end
end end
c.shape = shape
end) end)
client.connect_signal("request::titlebars",function(c)
-- Second manage call to create hidden titlebars
client.connect_signal("manage",function(c)
-- Drag and resize buttons
local buttons = gears.table.join( local buttons = gears.table.join(
awful.button({}, 1, function() awful.button({}, 1, function()
c:emit_signal("request::activate","titlebar",{raise=true}) c:emit_signal("request::activate","titlebar",{raise=true})
@ -135,8 +167,10 @@ client.connect_signal("request::titlebars",function(c)
awful.mouse.client.resize(c) awful.mouse.client.resize(c)
end) end)
) )
-- Building the titlebars
for k,v in pairs({"titlebar_top","titlebar_bottom","titlebar_left","titlebar_right"}) do for k,v in pairs({"titlebar_top","titlebar_bottom","titlebar_left","titlebar_right"}) do
local contents = { widget = wibox.container.background }
-- Build content of the titlebar
local contents = { widget = wibox.widget.textbox, text = "" }
if titlebar_config[v] then if titlebar_config[v] then
contents = builder(titlebar_config[v],{ contents = builder(titlebar_config[v],{
client = c, client = c,
@ -145,6 +179,7 @@ client.connect_signal("request::titlebars",function(c)
buttons = buttons buttons = buttons
}) })
end end
-- Create the base
local titlebar = awful.titlebar(c,{ local titlebar = awful.titlebar(c,{
size = style[v].size or 0, size = style[v].size or 0,
position = v:gsub("titlebar_",""), position = v:gsub("titlebar_",""),
@ -156,8 +191,14 @@ client.connect_signal("request::titlebars",function(c)
fg_focus = style[v].fg_focus, fg_focus = style[v].fg_focus,
font = style[v].font font = style[v].font
}) })
c[v] = titlebar:setup(t.titlebar(contents))
-- Compile and build titlebar
titlebar:setup(t.titlebar({
contents,
widget = wibox.container.background
}))
-- Since new clients will be placed without titlebars, we need to apply placement rules again
awful.rules.rules[1].properties.placement(c) awful.rules.rules[1].properties.placement(c)
-- Callbacks for focus/unfocus of titlebars
if style[v].onfocus then if style[v].onfocus then
c:connect_signal("focus",function() c:connect_signal("focus",function()
style[v].onfocus(titlebar) style[v].onfocus(titlebar)
@ -168,12 +209,32 @@ client.connect_signal("request::titlebars",function(c)
style[v].onunfocus(titlebar) style[v].onunfocus(titlebar)
end) end)
end end
c:connect_signal("titlebar::hide",function(c)
c[v].visible = false
-- Activate focus callback if our client is focused
if (c == client.focus) and (style[v].onfocus) then
style[v].onfocus(titlebar)
end
-- Add a titlebar toggle signal
c:connect_signal("titlebar::toggle",function(c)
titlebar.widget.visible = not titlebar.widget.visible
if titlebar.widget.visible then
awful.titlebar.show(c,v:gsub("titlebar_",""))
c.shape = window_shape
else
awful.titlebar.hide(c,v:gsub("titlebar_",""))
c.shape = window_shape_hide
end
end) end)
c:connect_signal("titlebar::unhide",function(c)
c[v].visible = true
c:connect_signal("titlebar::perform_action",function(c,f)
f(titlebar)
end) end)
-- Add rules for hiding titlebars on creation
if (not titlebars_on) or
(c.titlebars_enabled == false) or
(c.requests_no_titlebar == true) then
titlebar.widget.visible = false
c.shape = window_shape_hide
awful.titlebar.hide(c,v:gsub("titlebar_",""))
end
end end
end) end)
end --}}} end --}}}

1
themes/reno98/theme.lua

@ -374,6 +374,7 @@ theme.widgets = {
end, end,
}, },
titlebar = { titlebar = {
hidden_size = 2,
bgimage_normal = theme.bgimage_outset, bgimage_normal = theme.bgimage_outset,
--margins = 5, --margins = 5,
left = 4, left = 4,

3
themes/unity/WARNING.txt

@ -1,2 +1,3 @@
A compositor (like compton) is ***required*** for this theme to work as intended. A compositor (like compton) is ***required*** for this theme to work as intended.
This is in part due to the fact that it makes the top bar look less bland, and in part due to the fact that your titlebar corners will look weird otherwise.
This is in part due to the fact that it makes the top bar look less bland, and in part due to the fact that your titlebar corners will look weird otherwise (the corners won't be properly cut).
You may, of course, dismiss using a compositor, but don't tell me about not exactly round corners being a "bug" in this theme afterwards - it's the best you can get with Awesome.

32
themes/unity/config/root_menu_test.json

@ -0,0 +1,32 @@
{
"list": [
{
"list": [
{"widget": "widgets.base.popuptitle",
"options":{
"title":"Reno Unity"
}
},
{"widget": "widgets.rootcontrols"},
{"widget": "widgets.xdgmenu",
"options": {
"exclude_category": [
"Other"
]
}
}
],
"vertical": true
},
{
"list":[
{"widget": "widgets.base.tagswitcher",
"screen":true
},
{"widget": "widgets.rootbuttons"}
],
"vertical":true
}
],
"vertical":false
}

1
themes/unity/config/wibar_top.json

@ -7,6 +7,7 @@
], ],
"right": [ "right": [
{ "widget":"widgets.volume" },
{ "widget": "widgets.notifications", { "widget": "widgets.notifications",
"screen": true "screen": true
}, },

BIN
themes/unity/icons/reno.png

After

Width: 48  |  Height: 48  |  Size: 1.3 KiB

BIN
themes/unity/icons/volume-high-symbolic.png

After

Width: 48  |  Height: 48  |  Size: 1.3 KiB

BIN
themes/unity/icons/volume-low-symbolic.png

After

Width: 48  |  Height: 48  |  Size: 819 B

BIN
themes/unity/icons/volume-medium-symbolic.png

After

Width: 48  |  Height: 48  |  Size: 1.0 KiB

BIN
themes/unity/icons/volume-muted-symbolic.png

After

Width: 48  |  Height: 48  |  Size: 959 B

BIN
themes/unity/icons/volume.png

After

Width: 48  |  Height: 48  |  Size: 1.1 KiB

47
themes/unity/theme.lua

@ -12,8 +12,6 @@ local theme_assets = require("beautiful.theme_assets")
local xresources = require("beautiful.xresources") local xresources = require("beautiful.xresources")
local dpi = xresources.apply_dpi local dpi = xresources.apply_dpi
local gears = require("gears") local gears = require("gears")
local gfs = require("gears.filesystem")
local themes_path = root_path.."/themes/" local themes_path = root_path.."/themes/"
local theme = {} local theme = {}
@ -22,8 +20,8 @@ theme.font = "Ubuntu 8"
theme.bg_normal = "#19191D" theme.bg_normal = "#19191D"
theme.bg_focus = "#3E3E3E" theme.bg_focus = "#3E3E3E"
theme.bg_urgent = "#2E2E2E"
theme.bg_minimize = "#2E2E2E"
theme.bg_urgent = "#2E2E2E"
theme.bg_minimize = "#2E2E2E"
theme.bg_highlight = "#45433D" theme.bg_highlight = "#45433D"
theme.bg_systray = theme.bg_normal theme.bg_systray = theme.bg_normal
@ -47,23 +45,23 @@ theme.button_bg_focus = {
type = "radial", type = "radial",
from = {bsize/2,-0.5*bsize,bsize/10}, from = {bsize/2,-0.5*bsize,bsize/10},
to = {bsize/2,-0.5*bsize,bsize*2}, to = {bsize/2,-0.5*bsize,bsize*2},
stops = {
stops = {
{ 0 , "#FFFFFFBB"}, { 0 , "#FFFFFFBB"},
{ 0.45, "#DF744E99"}, { 0.45, "#DF744E99"},
{ 0.55, "#DF744E99"}, { 0.55, "#DF744E99"},
{ 1, "#FFFFFF44"} { 1, "#FFFFFF44"}
}
}
} }
theme.button_bg_normal = { theme.button_bg_normal = {
type = "radial", type = "radial",
from = {bsize/2,-0.5*bsize,bsize/10}, from = {bsize/2,-0.5*bsize,bsize/10},
to = {bsize/2,-0.2*bsize,bsize*1.5}, to = {bsize/2,-0.2*bsize,bsize*1.5},
stops = {
stops = {
{ 0 , "#FFFFFFFF"}, { 0 , "#FFFFFFFF"},
{ 0.5, "#33333333"}, { 0.5, "#33333333"},
{ 1, "#FFFFFF22"} { 1, "#FFFFFF22"}
}
}
} }
theme.button_shape = function(cr,width,height) theme.button_shape = function(cr,width,height)
@ -103,10 +101,10 @@ theme.bar_border_color = {
type = "radial", type = "radial",
from = {bsize/2,bsize/(-3),bsize/8}, from = {bsize/2,bsize/(-3),bsize/8},
to = {bsize/2,bsize/(-5),bsize*1}, to = {bsize/2,bsize/(-5),bsize*1},
stops = {
stops = {
{ 0 , "#FFFFFF66"}, { 0 , "#FFFFFF66"},
{ 1, "#43434366"}, { 1, "#43434366"},
}
}
} }
theme.titlebar_bg_focus = theme.bar_bg_focus theme.titlebar_bg_focus = theme.bar_bg_focus
@ -214,6 +212,12 @@ theme["mpc-next-symbolic"] = themes_path.."unity/icons/mpc-next-symbolic.png"
theme["action-poweroff-symbolic"] = themes_path.."unity/icons/action-poweroff-symbolic.png" theme["action-poweroff-symbolic"] = themes_path.."unity/icons/action-poweroff-symbolic.png"
theme["action-lock-screen-symbolic"] = themes_path.."unity/icons/action-lock-screen-symbolic.png" theme["action-lock-screen-symbolic"] = themes_path.."unity/icons/action-lock-screen-symbolic.png"
theme["action-suspend-symbolic"] = themes_path.."unity/icons/action-suspend-symbolic.png" theme["action-suspend-symbolic"] = themes_path.."unity/icons/action-suspend-symbolic.png"
theme["volume-high-symbolic"] = themes_path.."unity/icons/volume-high-symbolic.png"
theme["volume-medium-symbolic"] = themes_path.."unity/icons/volume-medium-symbolic.png"
theme["volume-low-symbolic"] = themes_path.."unity/icons/volume-low-symbolic.png"
theme["volume-muted-symbolic"] = themes_path.."unity/icons/volume-muted-symbolic.png"
theme.wallpaper = themes_path.."unity/background.png" theme.wallpaper = themes_path.."unity/background.png"
theme.wallpapers_icon = themes_path.."unity/icons/wallpapers.png" theme.wallpapers_icon = themes_path.."unity/icons/wallpapers.png"
-- Default icon for clients -- Default icon for clients
@ -244,7 +248,11 @@ for k,v in pairs({
"action-lock-screen-symbolic", "action-lock-screen-symbolic",
"action-suspend-symbolic", "action-suspend-symbolic",
"wallpapers_icon", "wallpapers_icon",
"icon_default"}) do
"icon_default",
"volume-high-symbolic",
"volume-medium-symbolic",
"volume-low-symbolic",
"volume-muted-symbolic"}) do
if theme[v] and gears.filesystem.file_readable(theme[v]) then if theme[v] and gears.filesystem.file_readable(theme[v]) then
theme[v] = gears.color.recolor_image(theme[v],theme.fg_normal) theme[v] = gears.color.recolor_image(theme[v],theme.fg_normal)
end end
@ -281,6 +289,7 @@ theme.widgets = {
end, end,
}, },
titlebar = { titlebar = {
hidden_size = 2,
root_shape = function(cr,width,height) root_shape = function(cr,width,height)
return gears.shape.partially_rounded_rect(cr,width,height, return gears.shape.partially_rounded_rect(cr,width,height,
true,true,false,false,6) end, true,true,false,false,6) end,
@ -316,9 +325,12 @@ theme.widgets = {
bar_border_width = 2 bar_border_width = 2
}, },
checkbox = { checkbox = {
width = 15,
height = 15,
shape = gears.shape.circle, shape = gears.shape.circle,
shape_border_width = 3,
shaoe_border_color = theme.bg_focus
border_width = 3,
border_color = theme.bg_normal,
paddings = {2,2,2,2}
}, },
}, },
-- }}} -- }}}
@ -528,7 +540,7 @@ theme.widgets = {
end, end,
shape_border_color = theme.bg_normal, shape_border_color = theme.bg_normal,
shape_border_width = dpi(2) shape_border_width = dpi(2)
}
}
}, },
lock_clock = { lock_clock = {
textbox = { textbox = {
@ -541,15 +553,16 @@ theme.widgets = {
local root = titlebar:get_children_by_id("titlebar_root")[1] local root = titlebar:get_children_by_id("titlebar_root")[1]
root:set_bg(theme.titlebar_bg_focus) root:set_bg(theme.titlebar_bg_focus)
root:set_shape(function(cr,width,height) root:set_shape(function(cr,width,height)
return gears.shape.partially_rounded_rect(cr,width,height,
return gears.shape.partially_rounded_rect(
cr,width,height,
true,true,false,false,6) end) true,true,false,false,6) end)
end, end,
onunfocus = function(titlebar) onunfocus = function(titlebar)
local root = titlebar:get_children_by_id("titlebar_root")[1] local root = titlebar:get_children_by_id("titlebar_root")[1]
root:set_bg(theme.titlebar_bg_normal) root:set_bg(theme.titlebar_bg_normal)
root:set_shape(function(cr,width,height) root:set_shape(function(cr,width,height)
return gears.shape.partially_rounded_rect(cr,width,height,
return gears.shape.partially_rounded_rect(
cr,width,height,
true,true,false,false,6) end) true,true,false,false,6) end)
end, end,
bg_focus = "#00000000", bg_focus = "#00000000",

38
widgets/battery.lua

@ -19,14 +19,14 @@ local function get_virtual_icon(data)
local count = 0 local count = 0
local cumulative = 0 local cumulative = 0
local name = "battery-" local name = "battery-"
for k,v in pairs(data) do
for _,v in pairs(data) do
if type(v) == "number" then if type(v) == "number" then
cumulative = cumulative + v cumulative = cumulative + v
count = count + 1 count = count + 1
end end
end end
local percentage = math.floor((cumulative/(count*100))*100) local percentage = math.floor((cumulative/(count*100))*100)
if percentage < 15 then
if percentage < 15 then
name = name.."caution-" name = name.."caution-"
elseif percentage < 30 then elseif percentage < 30 then
name = name.."low-" name = name.."low-"
@ -60,7 +60,7 @@ return function(args)
local templates = awmtk2.create_template_lib("battery",awmtk2.templates,args.templates) local templates = awmtk2.create_template_lib("battery",awmtk2.templates,args.templates)
local t = awmtk2.build_templates(templates,style) local t = awmtk2.build_templates(templates,style)
battery_widget = wibox.widget(t.button({ battery_widget = wibox.widget(t.button({
{
{
image = beautiful["battery-missing-symbolic"], image = beautiful["battery-missing-symbolic"],
resize = true, resize = true,
widget = wibox.widget.imagebox, widget = wibox.widget.imagebox,
@ -77,7 +77,7 @@ return function(args)
-- make it possible to press the button and make it toggle the popup -- make it possible to press the button and make it toggle the popup
battery_widget:connect_signal("button::press",style.button.onpress) battery_widget:connect_signal("button::press",style.button.onpress)
battery_widget:connect_signal("button::release",style.button.onrelease) battery_widget:connect_signal("button::release",style.button.onrelease)
battery_widget:connect_signal("button::press",function(self,x,y,button)
battery_widget:connect_signal("button::press",function(_,_,_,button)
if button == 1 then if button == 1 then
popup.visible = (not popup.visible) popup.visible = (not popup.visible)
if popup.visible then if popup.visible then
@ -94,7 +94,7 @@ return function(args)
local power_devices = syscontrol.power_supply.enumerate() local power_devices = syscontrol.power_supply.enumerate()
for _,device in pairs(power_devices) do for _,device in pairs(power_devices) do
local data = syscontrol.power_supply.read_attribs(device) local data = syscontrol.power_supply.read_attribs(device)
if data.type == "Battery" then
if data.type == "Battery" then
widget_map[data.name] = wibox.widget(t.container({ widget_map[data.name] = wibox.widget(t.container({
t.article({ t.article({
icon = get_virtual_icon({ icon = get_virtual_icon({
@ -154,7 +154,7 @@ return function(args)
timeout = args.power_polling or 2, timeout = args.power_polling or 2,
autostart = true, autostart = true,
callback = function() callback = function()
for k,v in pairs(power_devices) do
for _,v in pairs(power_devices) do
local data,err = syscontrol.power_supply.read_attribs(v) local data,err = syscontrol.power_supply.read_attribs(v)
if data and data.type == "Mains" then if data and data.type == "Mains" then
local w = widget_map[data.name] local w = widget_map[data.name]
@ -184,7 +184,7 @@ return function(args)
-- {{{ Backlight -- {{{ Backlight
local backlight_devices = syscontrol.backlight.enumerate() local backlight_devices = syscontrol.backlight.enumerate()
local default_backlight_device local default_backlight_device
for k,v in pairs(backlight_devices) do
for _,v in pairs(backlight_devices) do
local data = syscontrol.backlight.read_attribs(v) local data = syscontrol.backlight.read_attribs(v)
if data then if data then
widget_map[data.name] = wibox.widget(t.container({ widget_map[data.name] = wibox.widget(t.container({
@ -193,12 +193,18 @@ return function(args)
icon = beautiful["backlight-symbolic"], icon = beautiful["backlight-symbolic"],
title = "Backlight", title = "Backlight",
}), }),
(data.writable and t.checkbox({
checked = true,
id = "checkbox",
forced_height = style.article.icon_size,
forced_width = style.article.icon_size
})),
(data.writable and t.center(
t.checkbox({
checked = false,
id = "checkbox",
forced_height = style.article.icon_size,
forced_width = style.article.icon_size
}),
{
width = style.checkbox.width,
height = style.checkbox.height
})
),
layout = wibox.layout.fixed.horizontal, layout = wibox.layout.fixed.horizontal,
spacing = style.base.spacing spacing = style.base.spacing
}, },
@ -234,7 +240,7 @@ return function(args)
if default_backlight_device then if default_backlight_device then
local check2 = widget_map[default_backlight_device.name] local check2 = widget_map[default_backlight_device.name]
:get_children_by_id("checkbox")[1] :get_children_by_id("checkbox")[1]
check2.checked = false
check2.checked = true
end end
default_backlight_device = data default_backlight_device = data
end) end)
@ -247,7 +253,7 @@ return function(args)
timeout = args.backlight_polling or 2, timeout = args.backlight_polling or 2,
autostart = true, autostart = true,
callback = function() callback = function()
for k,v in pairs(backlight_devices) do
for _,v in pairs(backlight_devices) do
local data,err = syscontrol.backlight.read_attribs(v) local data,err = syscontrol.backlight.read_attribs(v)
if data then if data then
local w = widget_map[data.name] local w = widget_map[data.name]
@ -299,7 +305,7 @@ return function(args)
if count(widget_map) == 0 then if count(widget_map) == 0 then
backlight_update:stop() backlight_update:stop()
power_update:stop() power_update:stop()
return
return
end end
return battery_widget return battery_widget
end end

2
widgets/clientbuttons.lua

@ -8,8 +8,6 @@
-- Additional client controls, hidden for cleaner UI in the submenu. -- Additional client controls, hidden for cleaner UI in the submenu.
local awmtk2 = require("awmtk2") local awmtk2 = require("awmtk2")
local wibox = require("wibox") local wibox = require("wibox")
local gears = require("gears")
local awful = require("awful")
local beautiful = require("beautiful") local beautiful = require("beautiful")
return function(args) return function(args)

25
widgets/clientvolume.lua

@ -13,12 +13,11 @@ local awmtk2 = require("awmtk2")
local fastyaml = require("parsers").fast_split_yaml local fastyaml = require("parsers").fast_split_yaml
local beautiful = require("beautiful") local beautiful = require("beautiful")
local ask = require("asckey") local ask = require("asckey")
local pactl_data = {}
local test_pactl = os.execute("pactl --version") local test_pactl = os.execute("pactl --version")
local result = test_pactl local result = test_pactl
if _VERSION:match("5.1") then if _VERSION:match("5.1") then
result = (test_pactl == 0)
result = (test_pactl == 0)
end end
if not result then if not result then
return return
@ -45,6 +44,7 @@ return function(args)
local widget = wibox.widget(t.container({ local widget = wibox.widget(t.container({
t.center({ t.center({
id = "client_volume_icon", id = "client_volume_icon",
resize = true,
widget = wibox.widget.imagebox widget = wibox.widget.imagebox
}), }),
t.textbox({ t.textbox({
@ -62,16 +62,12 @@ return function(args)
local icon = widget:get_children_by_id("client_volume_icon")[1] local icon = widget:get_children_by_id("client_volume_icon")[1]
local slider = widget:get_children_by_id("client_volume")[1] local slider = widget:get_children_by_id("client_volume")[1]
-- Local tracking value to prevent zero volume on start -- Local tracking value to prevent zero volume on start
local slider_touched = false
-- Get initial pactl data
awful.spawn.easy_async("pactl list sink-inputs",function(stdout)
local pactl_data = fastyaml(stdout)
end)
local touched = false
-- Attach to focus change -- Attach to focus change
client.connect_signal("update_volume",function(c) client.connect_signal("update_volume",function(c)
awful.spawn.easy_async("pactl list sink-inputs",function(stdout) awful.spawn.easy_async("pactl list sink-inputs",function(stdout)
local pactl_data = fastyaml(stdout) local pactl_data = fastyaml(stdout)
local cl
local cl
for k,v in pairs(pactl_data) do for k,v in pairs(pactl_data) do
if not c then return end if not c then return end
if v:match("application.process.id = \""..tostring(c.pid).."\"") then if v:match("application.process.id = \""..tostring(c.pid).."\"") then
@ -109,22 +105,21 @@ return function(args)
-- Async lock to prevent callback interference -- Async lock to prevent callback interference
local volume_lock = false local volume_lock = false
-- Function to set client volume -- Function to set client volume
local function volume(volume)
local function volume(value)
if volume_lock then return end if volume_lock then return end
volume_lock = true volume_lock = true
awful.spawn.easy_async("pactl list sink-inputs",function(stdout) awful.spawn.easy_async("pactl list sink-inputs",function(stdout)
local pactl_data = fastyaml(stdout) local pactl_data = fastyaml(stdout)
local cl = {}
if not (client.focus and client.focus.pid) then if not (client.focus and client.focus.pid) then
volume_lock = false volume_lock = false
return return
end end
for k,v in pairs(pactl_data) do
for _,v in pairs(pactl_data) do
if v:match("application.process.id = \""..tostring(client.focus.pid).."\"") then if v:match("application.process.id = \""..tostring(client.focus.pid).."\"") then
local sink_id = v:match("^%s*Sink Input #(%d+)") local sink_id = v:match("^%s*Sink Input #(%d+)")
if sink_id then if sink_id then
print(sink_id, volume)
awful.spawn("pactl set-sink-input-volume "..tostring(sink_id).." "..tostring(volume).."%")
print(sink_id, value)
awful.spawn("pactl set-sink-input-volume "..tostring(sink_id).." "..tostring(value).."%")
end end
end end
end end
@ -132,7 +127,7 @@ return function(args)
end) end)
end end
-- Attach change to slider -- Attach change to slider
slider:connect_signal("widget::redraw_needed",function(widget)
slider:connect_signal("widget::redraw_needed",function()
if touched then if touched then
volume(slider.value) volume(slider.value)
update_timer:again() update_timer:again()
@ -150,5 +145,5 @@ return function(args)
volume(0) volume(0)
end,{description = "mute client", group = "client"}) end,{description = "mute client", group = "client"})
)) ))
return widget
return widget
end end

106
widgets/volume.lua

@ -0,0 +1,106 @@
-- 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/>.
-- Pulseaudio per-client volume setting
local awful = require("awful")
local gears = require("gears")
local wibox = require("wibox")
local awmtk2 = require("awmtk2")
local fastyaml = require("parsers").fast_split_yaml
local beautiful = require("beautiful")
local ask = require("asckey")
local pactl_data = {}
local test_pactl = os.execute("pactl --version")
local pactl_found = test_pactl
if _VERSION:match("5.1") then
pactl_found = (test_pactl == 0)
end
local test_amixer = os.execute("amixer --version")
local amixer_found = test_amixer
if _VERSION:match("5.1") then
amixer_found = (test_amixer == 0)
end
if (not (amixer_found or pactl_found)) then
return
end
local try_launch = [[which pavucontrol && pavucontrol || which pulsemixer && ]]..global.terminal..[[ -e pulsemixer || which alsamixer && ]]..global.terminal..[[ -e alsamixer ]]
local function get_icon(percent)
if percent >= 66 then
return beautiful["volume-high-symbolic"]
elseif percent >= 33 then
return beautiful["volume-medium-symbolic"]
elseif percent > 0 then
return beautiful["volume-low-symbolic"]
else
return beautiful["volume-muted-symbolic"]
end
end
return function(args)
local style = awmtk2.create_style("volume",
awmtk2.generic.oneline_widget, args.style)
local templates = awmtk2.create_template_lib("volume",awmtk2.templates,args.templates)
local t = awmtk2.build_templates(templates,style)
local widget = wibox.widget({
t.button({
image = get_icon(0),
id = "volume_icon",
resize = true,
widget = wibox.widget.imagebox
}),
t.container({
t.slider({
minimum = 0,
maximum = 100,
id = "volume",
value = -1
}),
layout = wibox.layout.fixed.horizontal
},{
visible = false,
id = "slidercontainer"
}),
layout = wibox.layout.fixed.horizontal
})
local icon = widget:get_children_by_id("volume_icon")[1]
local slider = widget:get_children_by_id("volume")[1]
local container = widget:get_children_by_id("slidercontainer")[1]
-- Alsa master handle
args.device = args.device or "default"
gears.timer {
autostart = true,
timeout = 0.5,
call_now = true,
callback = function()
awful.spawn.easy_async_with_shell("amixer -D "..args.device.." sget Master",function(stdout)
local volume_percent = stdout:match("%[(%d+)%%%]")
volume_percent = tonumber(volume_percent)
if not volume_percent then
return
end
slider.value = volume_percent
icon.image = get_icon(volume_percent)
end)
end
}
slider:connect_signal("widget::redraw_needed",function()
awful.spawn("amixer -D "..args.device.." sset Master "..slider.value.."%")
icon.image = get_icon(slider.value)
end)
icon:connect_signal("button::press",function(self,lx,ly,button)
if button == 1 then
container.visible = not container.visible
end
if button == 2 then
awful.spawn.with_shell(args.mixer or try_launch)
end
end)
return widget
end
Loading…
Cancel
Save