fix #10 and #13. Various other fixes and small changes

This commit is contained in:
Kievits Rene
2022-05-25 11:27:03 +02:00
parent b5f513a344
commit ff202de163
28 changed files with 1664 additions and 1280 deletions

View File

@@ -44,7 +44,7 @@ return function(screen, programs)
widget = wibox.container.margin widget = wibox.container.margin
} }
for k, c in ipairs(client.get()) do for _, c in ipairs(client.get()) do
if string.lower(c.class):match(program) and c == client.focus then if string.lower(c.class):match(program) and c == client.focus then
dock_element.background.bg = color["Grey800"] dock_element.background.bg = color["Grey800"]
end end
@@ -55,12 +55,12 @@ return function(screen, programs)
dock_element:connect_signal( dock_element:connect_signal(
"button::press", "button::press",
function() function()
if is_steam then if is_steam then
awful.spawn("steam steam://rungameid/" .. program) awful.spawn("steam steam://rungameid/" .. program)
else else
awful.spawn(program) awful.spawn(program)
end
end end
end
) )
awful.tooltip { awful.tooltip {
@@ -181,13 +181,20 @@ return function(screen, programs)
} }
local function check_for_dock_hide(s) local function check_for_dock_hide(s)
for _, client in ipairs(s.selected_tag:clients()) do
if client.fullscreen then
dock.visible = false
fakedock.visible = false
else
fakedock.visible = true
end
end
if #s.selected_tag:clients() < 1 then if #s.selected_tag:clients() < 1 then
dock.visible = true dock.visible = true
return return
end end
if s == mouse.screen then if s == mouse.screen then
local visible = false for _, c in ipairs(s.selected_tag:clients()) do
for j, c in ipairs(s.selected_tag:clients()) do
if c.maximized or c.fullscreen then if c.maximized or c.fullscreen then
dock.visible = false dock.visible = false
@@ -219,63 +226,63 @@ return function(screen, programs)
fakedock:connect_signal( fakedock:connect_signal(
"mouse::enter", "mouse::enter",
function() function()
for index, c in ipairs(screen.clients) do for _, c in ipairs(screen.clients) do
if not c.fullscreen then if not c.fullscreen then
dock_intelligent_hide:stop() dock_intelligent_hide:stop()
dock.visible = true dock.visible = true
end
end end
end end
end
) )
client.connect_signal( client.connect_signal(
"manage", "manage",
function() function()
check_for_dock_hide(screen) check_for_dock_hide(screen)
dock:setup { dock:setup {
dock_elements, dock_elements,
create_incicator_widget(programs), create_incicator_widget(programs),
layout = wibox.layout.fixed.vertical layout = wibox.layout.fixed.vertical
} }
end end
) )
client.connect_signal( client.connect_signal(
"unmanage", "unmanage",
function() function()
check_for_dock_hide(screen) check_for_dock_hide(screen)
dock:setup { dock:setup {
dock_elements, dock_elements,
create_incicator_widget(programs), create_incicator_widget(programs),
layout = wibox.layout.fixed.vertical layout = wibox.layout.fixed.vertical
} }
end end
) )
client.connect_signal( client.connect_signal(
"focus", "focus",
function() function()
check_for_dock_hide(screen) check_for_dock_hide(screen)
dock:setup { dock:setup {
dock_elements, dock_elements,
create_incicator_widget(programs), create_incicator_widget(programs),
layout = wibox.layout.fixed.vertical layout = wibox.layout.fixed.vertical
} }
end end
) )
dock:connect_signal( dock:connect_signal(
"mouse::enter", "mouse::enter",
function() function()
dock_intelligent_hide:stop() dock_intelligent_hide:stop()
end end
) )
dock:connect_signal( dock:connect_signal(
"mouse::leave", "mouse::leave",
function() function()
dock_intelligent_hide:again() dock_intelligent_hide:again()
end end
) )
dock:setup { dock:setup {

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M20 2H4C2.9 2 2 2.9 2 4V22L6 18H20C21.1 18 22 17.1 22 16V4C22 2.9 21.1 2 20 2M20 16H5.2L4 17.2V4H20V16Z" /></svg>

After

Width:  |  Height:  |  Size: 398 B

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M20,2H4A2,2 0 0,0 2,4V22L6,18H20A2,2 0 0,0 22,16V4C22,2.89 21.1,2 20,2Z" /></svg>

After

Width:  |  Height:  |  Size: 366 B

View File

@@ -1 +1 @@
Lutris;Steam;Io.elementary.appcenter;Repoman;Com.github.donadigo.eddy;Sysmontask;join?action=join&confno=9992624875&confid=dXRpZD1VVElEXzM0ODYxOTgyYzg0YzQ1Y2NiYmM0YWNiMzczODNiYjgxJnVzcz1TaU1YUnNEWG5BQWNBYnRpYklBNWE0MjRDNkpBMzMyVXRUc2pCX1YxVm5JY0hWeVRybGN5WjZZS2VBa1pvNkszOXdNWEVkVE9hTU54Z3BROFZFckhPR3Y4eGo0MlB0emNCZjNRLnNlM28yNy13YWpGYy1ReXEmdGlkPTcyNjEzNGRjYWJkZTQyYTNhNzJmZjVjYjVkNTU2YTYw&browser=join?action=join&confno=9992624875&confid=dXRpZD1VVElEXzM0ODYxOTgyYzg0YzQ1Y2NiYmM0YWNiMzczODNiYjgxJnVzcz1TaU1YUnNEWG5BQWNBYnRpYklBNWE0MjRDNkpBMzMyVXRUc2pCX1YxVm5JY0hWeVRybGN5WjZZS2VBa1pvNkszOXdNWEVkVE9hTU54Z3BROFZFckhPR3Y4eGo0MlB0emNCZjNRLnNlM28yNy13YWpGYy1ReXEmdGlkPTcyNjEzNGRjYWJkZTQyYTNhNzJmZjVjYjVkNTU2YTYw&browser=Gnome-calculator;Virt-manager;Gwe;whatsdesk;Totem; Lutris;Steam;Io.elementary.appcenter;Repoman;Com.github.donadigo.eddy;Sysmontask;join?action=join&confno=9992624875&confid=dXRpZD1VVElEXzM0ODYxOTgyYzg0YzQ1Y2NiYmM0YWNiMzczODNiYjgxJnVzcz1TaU1YUnNEWG5BQWNBYnRpYklBNWE0MjRDNkpBMzMyVXRUc2pCX1YxVm5JY0hWeVRybGN5WjZZS2VBa1pvNkszOXdNWEVkVE9hTU54Z3BROFZFckhPR3Y4eGo0MlB0emNCZjNRLnNlM28yNy13YWpGYy1ReXEmdGlkPTcyNjEzNGRjYWJkZTQyYTNhNzJmZjVjYjVkNTU2YTYw&browser=join?action=join&confno=9992624875&confid=dXRpZD1VVElEXzM0ODYxOTgyYzg0YzQ1Y2NiYmM0YWNiMzczODNiYjgxJnVzcz1TaU1YUnNEWG5BQWNBYnRpYklBNWE0MjRDNkpBMzMyVXRUc2pCX1YxVm5JY0hWeVRybGN5WjZZS2VBa1pvNkszOXdNWEVkVE9hTU54Z3BROFZFckhPR3Y4eGo0MlB0emNCZjNRLnNlM28yNy13YWpGYy1ReXEmdGlkPTcyNjEzNGRjYWJkZTQyYTNhNzJmZjVjYjVkNTU2YTYw&browser=Gnome-calculator;Virt-manager;Gwe;whatsdesk;Totem;steam_app_431960;

View File

@@ -1,7 +1,6 @@
------------------------------- -------------------------------
-- The Notification defaults -- -- The Notification defaults --
------------------------------- -------------------------------
-- Awesome Libs -- Awesome Libs
local awful = require("awful") local awful = require("awful")
local color = require("src.theme.colors") local color = require("src.theme.colors")
@@ -14,7 +13,6 @@ local wibox = require("wibox")
local icondir = awful.util.getdir("config") .. "src/assets/icons/notifications/" local icondir = awful.util.getdir("config") .. "src/assets/icons/notifications/"
-- TODO: Figure out how to use hover effects without messing up the actions -- TODO: Figure out how to use hover effects without messing up the actions
naughty.config.defaults.ontop = true naughty.config.defaults.ontop = true
naughty.config.defaults.icon_size = dpi(80) naughty.config.defaults.icon_size = dpi(80)
naughty.config.defaults.timeout = 3 naughty.config.defaults.timeout = 3
@@ -31,334 +29,383 @@ naughty.config.defaults.spacing = dpi(10)
naughty.connect_signal( naughty.connect_signal(
'request::icon', 'request::icon',
function(n, context, hints) function(n, context, hints)
if context ~= 'app_icon' then return end if context ~= 'app_icon' then
local path = menubar.utils.lookup_icon(hints.app_icon) or return
menubar.utils.lookup_icon(hints.app_icon:lower()) end
if path then local path = menubar.utils.lookup_icon(hints.app_icon) or menubar.utils.lookup_icon(hints.app_icon:lower())
n.icon = path if path then
n.icon = path
end
end end
end
) )
naughty.connect_signal( naughty.connect_signal(
"request::display", "request::display",
function(n) function(n)
if n.urgency == "critical" then
n.title = string.format("<span foreground='%s' font='JetBrainsMono Nerd Font, ExtraBold 16'>%s</span>",
color["RedA200"], n.title) or ""
n.message = string.format("<span foreground='%s'>%s</span>", color["Red200"], n.message) or ""
n.app_name = string.format("<span foreground='%s'>%s</span>", color["RedA400"], n.app_name) or ""
n.bg = color["Grey900"]
else
n.title = string.format("<span foreground='%s' font='JetBrainsMono Nerd Font, ExtraBold 16'>%s</span>",
color["Pink200"], n.title) or ""
n.message = string.format("<span foreground='%s'>%s</span>", "#ffffffaa", n.message) or ""
n.bg = color["Grey900"]
n.timeout = n.timeout or 3
end
if n.urgency == "critical" then local use_image = false
n.title = string.format("<span foreground='%s' font='JetBrainsMono Nerd Font, ExtraBold 16'>%s</span>", color["RedA200"], n.title) or ""
n.message = string.format("<span foreground='%s'>%s</span>", color["Red200"], n.message) or ""
n.app_name = string.format("<span foreground='%s'>%s</span>", color["RedA400"], n.app_name) or ""
n.bg = color["Grey900"]
else
n.title = string.format("<span foreground='%s' font='JetBrainsMono Nerd Font, ExtraBold 16'>%s</span>", color["Pink200"], n.title) or ""
n.message = string.format("<span foreground='%s'>%s</span>", "#ffffffaa", n.message) or ""
n.bg = color["Grey900"]
n.timeout = n.timeout or 3
end
local use_image = false if n.app_name == "Spotify" then
n.actions = { naughty.action {
if n.app_name == "Spotify" then
n.actions = {
naughty.action {
program = "Spotify", program = "Spotify",
id = "skip-prev", id = "skip-prev",
icon = gears.color.recolor_image(icondir .. "skip-prev.svg", color["Cyan200"]), icon = gears.color.recolor_image(icondir .. "skip-prev.svg", color["Cyan200"])
}, }, naughty.action {
naughty.action {
program = "Spotify", program = "Spotify",
id = "play-pause", id = "play-pause",
icon = gears.color.recolor_image(icondir .. "play-pause.svg", color["Cyan200"]), icon = gears.color.recolor_image(icondir .. "play-pause.svg", color["Cyan200"])
}, }, naughty.action {
naughty.action {
program = "Spotify", program = "Spotify",
id = "skip-next", id = "skip-next",
icon = gears.color.recolor_image(icondir .. "skip-next.svg", color["Cyan200"]), icon = gears.color.recolor_image(icondir .. "skip-next.svg", color["Cyan200"])
}, } }
} use_image = true
use_image = true end
end
local action_template_widget = {} local action_template_widget = {}
if use_image then if use_image then
action_template_widget = { action_template_widget = {
{
{
{
{
id = "icon_role",
widget = wibox.widget.imagebox
},
id = "centered",
valign = "center",
halign = "center",
widget = wibox.container.place
},
margins = dpi(5),
widget = wibox.container.margin
},
forced_height = dpi(35),
forced_width = dpi(35),
fg = color["Cyan200"],
bg = color["Grey800"],
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background,
id = "bgrnd"
},
id = "mrgn",
top = dpi(10),
bottom = dpi(10),
widget = wibox.container.margin,
}
else
action_template_widget = {
{
{
{
{
id = "text_role",
font = "JetBrainsMono Nerd Font, Regular 12",
widget = wibox.widget.textbox
},
id = "centered",
widget = wibox.container.place
},
margins = dpi(5),
widget = wibox.container.margin
},
fg = color["Green200"],
bg = color["Grey800"],
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background,
id = "bgrnd"
},
id = "mrgn",
top = dpi(10),
bottom = dpi(10),
widget = wibox.container.margin,
}
end
local actions_template = wibox.widget {
notification = n,
base_layout = wibox.widget {
spacing = dpi(40),
layout = wibox.layout.fixed.horizontal
},
widget_template = action_template_widget,
style = {
underline_normal = false,
underline_selected = true,
bg_normal = color["Grey100"],
bg_selected = color["Grey200"]
},
widget = naughty.list.actions
}
local w_template = wibox.widget {
{
{
{ {
{ {
{ {
{ {
{ id = "icon_role",
{ widget = wibox.widget.imagebox
markup = n.app_name or 'System Notification',
align = "center",
valign = "center",
widget = wibox.widget.textbox
},
fg = color["Teal200"],
widget = wibox.container.background
},
margins = dpi(10),
widget = wibox.container.margin
}, },
nil, id = "centered",
valign = "center",
halign = "center",
widget = wibox.container.place
},
margins = dpi(5),
widget = wibox.container.margin
},
forced_height = dpi(35),
forced_width = dpi(35),
fg = color["Cyan200"],
bg = color["Grey800"],
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background,
id = "bgrnd"
},
id = "mrgn",
top = dpi(10),
bottom = dpi(10),
widget = wibox.container.margin
}
else
action_template_widget = {
{
{
{
{
id = "text_role",
font = "JetBrainsMono Nerd Font, Regular 12",
widget = wibox.widget.textbox
},
id = "centered",
widget = wibox.container.place
},
margins = dpi(5),
widget = wibox.container.margin
},
fg = color["Green200"],
bg = color["Grey800"],
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background,
id = "bgrnd"
},
id = "mrgn",
top = dpi(10),
bottom = dpi(10),
widget = wibox.container.margin
}
end
local actions_template = wibox.widget {
notification = n,
base_layout = wibox.widget {
spacing = dpi(40),
layout = wibox.layout.fixed.horizontal
},
widget_template = action_template_widget,
style = {
underline_normal = false,
underline_selected = true,
bg_normal = color["Grey100"],
bg_selected = color["Grey200"]
},
widget = naughty.list.actions
}
local w_template = wibox.widget {
{
{
{
{
{ {
{ {
{ {
{ {
{ {
font = user_vars.font.specify .. ", 10", {
text = "", image = gears.color.recolor_image(icondir .. "notification-outline.svg", color["Teal200"]),
resize = false,
widget = wibox.widget.imagebox
},
right = dpi(5),
widget = wibox.container.margin
},
{
markup = n.app_name or 'System Notification',
align = "center", align = "center",
valign = "center", valign = "center",
widget = wibox.widget.textbox widget = wibox.widget.textbox
}, },
start_angle = 4.71239, layout = wibox.layout.fixed.horizontal
thickness = dpi(2), },
min_value = 0, fg = color["Teal200"],
max_value = 360, widget = wibox.container.background
value = 360, },
widget = wibox.container.arcchart, margins = dpi(10),
id = "arc_chart" widget = wibox.container.margin
},
nil,
{
{
{
text = os.date("%H:%M"),
widget = wibox.widget.textbox
}, },
id = "background", id = "background",
fg = color["Teal200"], fg = color["Teal200"],
bg = color["Grey900"],
widget = wibox.container.background widget = wibox.container.background
}, },
strategy = "exact", {
width = dpi(20), {
height = dpi(20), {
widget = wibox.container.constraint, {
id = "const" {
font = user_vars.font.specify .. ", 10",
text = "",
align = "center",
valign = "center",
widget = wibox.widget.textbox
},
start_angle = 4.71239,
thickness = dpi(2),
min_value = 0,
max_value = 360,
value = 360,
widget = wibox.container.arcchart,
id = "arc_chart"
},
id = "background",
fg = color["Teal200"],
bg = color["Grey900"],
widget = wibox.container.background
},
strategy = "exact",
width = dpi(20),
height = dpi(20),
widget = wibox.container.constraint,
id = "const"
},
margins = dpi(10),
widget = wibox.container.margin,
id = "arc_margin"
},
layout = wibox.layout.fixed.horizontal,
id = "arc_app_layout_2"
}, },
margins = dpi(10), id = "arc_app_layout",
widget = wibox.container.margin, layout = wibox.layout.align.horizontal
id = "arc_margin"
}, },
id = "arc_app_layout", id = "arc_app_bg",
layout = wibox.layout.align.horizontal border_color = color["Grey800"],
border_width = dpi(2),
widget = wibox.container.background
}, },
id = "arc_app_bg",
border_color = color["Grey800"],
border_width = dpi(2),
widget = wibox.container.background
},
{
{ {
{ {
{ {
{ {
image = n.icon, {
resize = true, image = n.icon,
widget = wibox.widget.imagebox, resize = true,
clip_shape = function(cr, width, height) widget = wibox.widget.imagebox,
gears.shape.rounded_rect(cr, width, height, 10) clip_shape = function(cr, width, height)
end, gears.shape.rounded_rect(cr, width, height, 10)
end
},
width = naughty.config.defaults.icon_size,
height = naughty.config.defaults.icon_size,
strategy = "exact",
widget = wibox.container.constraint
}, },
width = naughty.config.defaults.icon_size, halign = "center",
height = naughty.config.defaults.icon_size, valign = "top",
strategy = "exact",
widget = wibox.container.constraint
},
halign = "center",
valign = "top",
widget = wibox.container.place,
},
left = dpi(20),
bottom = dpi(15),
top = dpi(15),
right = dpi(10),
widget = wibox.container.margin
},
{
{
{
widget = naughty.widget.title,
align = "left"
},
{
widget = naughty.widget.message,
align = "left"
},
{
actions_template,
widget = wibox.container.place widget = wibox.container.place
}, },
layout = wibox.layout.fixed.vertical left = dpi(20),
bottom = dpi(15),
top = dpi(15),
right = dpi(10),
widget = wibox.container.margin
}, },
left = dpi(10), {
bottom = dpi(10), {
top = dpi(10), {
right = dpi(20), widget = naughty.widget.title,
widget = wibox.container.margin align = "left"
},
{
widget = naughty.widget.message,
align = "left"
},
{
actions_template,
widget = wibox.container.place
},
layout = wibox.layout.fixed.vertical
},
left = dpi(10),
bottom = dpi(10),
top = dpi(10),
right = dpi(20),
widget = wibox.container.margin
},
layout = wibox.layout.fixed.horizontal
}, },
layout = wibox.layout.fixed.horizontal id = "widget_layout",
layout = wibox.layout.fixed.vertical
}, },
id = "widget_layout", id = "min_size",
layout = wibox.layout.fixed.vertical strategy = "min",
width = dpi(100),
widget = wibox.container.constraint
}, },
id = "min_size", id = "max_size",
strategy = "min", strategy = "max",
width = dpi(100), width = Theme.notification_max_width or dpi(500),
widget = wibox.container.constraint widget = wibox.container.constraint
}, },
id = "max_size", id = "background",
strategy = "max", bg = color["Grey900"],
width = Theme.notification_max_width or dpi(500), border_color = color["Grey800"],
widget = wibox.container.constraint, border_width = dpi(4),
}, shape = function(cr, width, height)
id = "background", gears.shape.rounded_rect(cr, width, height, 4)
bg = color["Grey900"], end,
border_color = color["Grey800"], widget = wibox.container.background
border_width = dpi(4),
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4)
end,
widget = wibox.container.background
}
local close = w_template.max_size.min_size.widget_layout.arc_app_bg.arc_app_layout.arc_margin.const.background
local arc = close.arc_chart
local timeout = n.timeout
local remove_time = timeout
if timeout ~= 0 then
arc.value = 360
gears.timer {
timeout = 0.1,
call_now = true,
autostart = true,
callback = function()
arc.value = (remove_time - 0) / (timeout - 0) * 360
remove_time = remove_time - 0.1
end
} }
end
Hover_signal(close, color["Grey900"], color["Teal200"]) local close = w_template.max_size.min_size.widget_layout.arc_app_bg.arc_app_layout.arc_app_layout_2.arc_margin.const.background
local arc = close.arc_chart
close:connect_signal( local timeout = n.timeout
"button::press", local remove_time = timeout
function()
n:destroy()
end
)
w_template:connect_signal( if timeout ~= 0 then
"button::press", arc.value = 360
function(c, d, e, key) local arc_timer = gears.timer {
if key == 3 then timeout = 0.1,
n:destroy() call_now = true,
autostart = true,
callback = function()
arc.value = (remove_time - 0) / (timeout - 0) * 360
remove_time = remove_time - 0.1
end
}
w_template:connect_signal(
"mouse::enter",
function()
-- Setting to 0 doesn't work
arc_timer:stop()
n.timeout = 99999
end
)
w_template:connect_signal(
"mouse::leave",
function()
arc_timer:start()
n.timeout = remove_time
end
)
end end
Hover_signal(close, color["Grey900"], color["Teal200"])
close:connect_signal(
"button::press",
function()
n:destroy()
end
)
w_template:connect_signal(
"button::press",
function(c, d, e, key)
if key == 3 then
n:destroy()
end
-- TODO: Find out how to get the associated client
--[[ if key == 1 then
if n.clients then
n.clients[1]:activate {
switch_to_tag = true,
raise = true
}
end
end ]]
end
)
local box = naughty.layout.box {
notification = n,
timeout = 3,
type = "notification",
screen = awful.screen.focused(),
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 10)
end,
widget_template = w_template
}
box.buttons = {}
n.buttons = {}
end end
)
local box = naughty.layout.box {
notification = n,
timeout = 3,
type = "notification",
screen = awful.screen.focused(),
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 10)
end,
widget_template = w_template
}
box.buttons = {}
n.buttons = {}
end
) )
naughty.connect_signal( naughty.connect_signal(
"destroyed", "destroyed",
function() function()
end end
) )
-- Test notification -- Test notification
--[[ naughty.notification { naughty.notification {
app_name = "System Notification", app_name = "System Notification",
title = "A notification 2", title = "A notification 2",
message = "This is very informative and overflowing", message = "This is very informative and overflowing",
@@ -376,21 +423,21 @@ end
name = "Ignore", name = "Ignore",
}, },
} }
} ]] }
naughty.connect_signal( naughty.connect_signal(
"invoked", "invoked",
function(_, action) function(_, action)
if action.program == "Spotify" then if action.program == "Spotify" then
if action.id == "skip-prev" then if action.id == "skip-prev" then
awful.spawn("playerctl previous") awful.spawn("playerctl previous")
end end
if action.id == "play-pause" then if action.id == "play-pause" then
awful.spawn("playerctl play-pause") awful.spawn("playerctl play-pause")
end end
if action.id == "skip-next" then if action.id == "skip-next" then
awful.spawn("playerctl next") awful.spawn("playerctl next")
end
end end
end end
end
) )

View File

@@ -1,89 +1,108 @@
---@diagnostic disable: undefined-field
-- Awesome Libs -- Awesome Libs
local awful = require("awful") local awful = require("awful")
local beautiful = require("beautiful") local beautiful = require("beautiful")
local gears = require("gears") local gears = require("gears")
local wibox = require("wibox")
screen.connect_signal( screen.connect_signal(
"added", "added",
function() function()
awesome.restart() awesome.restart()
end end
) )
screen.connect_signal( screen.connect_signal(
"removed", "removed",
function() function()
awesome.restart() awesome.restart()
end end
) )
client.connect_signal( client.connect_signal(
"manage", "manage",
function(c) function(c)
if awesome.startup and not c.size_hints.user_porition and not c.size_hints.program_position then if awesome.startup and not c.size_hints.user_porition and not c.size_hints.program_position then
awful.placement.no_offscreen(c) awful.placement.no_offscreen(c)
end end
c.shape = function(cr, width, height) c.shape = function(cr, width, height)
if c.fullscreen or c.maximized then if c.fullscreen or c.maximized then
gears.shape.rectangle(cr, width, height) gears.shape.rectangle(cr, width, height)
else else
gears.shape.rounded_rect(cr, width, height, 10) gears.shape.rounded_rect(cr, width, height, 10)
end
end end
end end
end
) )
client.connect_signal( client.connect_signal(
'unmanage', 'unmanage',
function(c) function(c)
if #awful.screen.focused().clients > 0 then if #awful.screen.focused().clients > 0 then
awful.screen.focused().clients[1]:emit_signal( awful.screen.focused().clients[1]:emit_signal(
'request::activate', 'request::activate',
'mouse_enter', 'mouse_enter',
{ {
raise = true raise = true
} }
) )
end
end end
end
) )
client.connect_signal( client.connect_signal(
'tag::switched', 'tag::switched',
function(c) function(c)
if #awful.screen.focused().clients > 0 then if #awful.screen.focused().clients > 0 then
awful.screen.focused().clients[1]:emit_signal( awful.screen.focused().clients[1]:emit_signal(
'request::activate', 'request::activate',
'mouse_enter', 'mouse_enter',
{ {
raise = true raise = true
} }
) )
end
end end
end
) )
-- Sloppy focus -- Sloppy focus
client.connect_signal("mouse::enter", function(c) client.connect_signal(
c:emit_signal("request::activate", "mouse_enter", { raise = false }) "mouse::enter",
end) function(c)
c:emit_signal(
"request::activate",
"mouse_enter",
{
raise = false
}
)
end
)
-- Workaround for focused border color, why in the love of god doesnt it work with -- Workaround for focused border color, why in the love of god doesnt it work with
-- beautiful.border_focus -- beautiful.border_focus
client.connect_signal("focus", function(c) client.connect_signal(
c.border_color = "#616161" "focus",
end) function(c)
c.border_color = "#616161"
end
)
client.connect_signal("unfocus", function(c) client.connect_signal(
c.border_color = beautiful.border_normal "unfocus",
end) function(c)
c.border_color = beautiful.border_normal
end
)
--- Takes a wibox.container.background and connects four signals to it
---@param widget widget.container.background
---@param bg string
---@param fg string
function Hover_signal(widget, bg, fg) function Hover_signal(widget, bg, fg)
local old_wibox, old_cursor, old_bg, old_fg local old_wibox, old_cursor, old_bg, old_fg
widget:connect_signal(
"mouse::enter", local mouse_enter = function()
function()
if bg then if bg then
old_bg = widget.bg old_bg = widget.bg
if string.len(bg) == 7 then if string.len(bg) == 7 then
@@ -102,11 +121,8 @@ function Hover_signal(widget, bg, fg)
w.cursor = "hand1" w.cursor = "hand1"
end end
end end
)
widget:connect_signal( local button_press = function()
"button::press",
function()
if bg then if bg then
if bg then if bg then
if string.len(bg) == 7 then if string.len(bg) == 7 then
@@ -120,11 +136,8 @@ function Hover_signal(widget, bg, fg)
widget.fg = fg widget.fg = fg
end end
end end
)
widget:connect_signal( local button_release = function()
"button::release",
function()
if bg then if bg then
if bg then if bg then
if string.len(bg) == 7 then if string.len(bg) == 7 then
@@ -138,11 +151,8 @@ function Hover_signal(widget, bg, fg)
widget.fg = fg widget.fg = fg
end end
end end
)
widget:connect_signal( local mouse_leave = function()
"mouse::leave",
function()
if bg then if bg then
widget.bg = old_bg widget.bg = old_bg
end end
@@ -154,5 +164,21 @@ function Hover_signal(widget, bg, fg)
old_wibox = nil old_wibox = nil
end end
end end
)
widget:disconnect_signal("mouse::enter", mouse_enter)
widget:disconnect_signal("button::press", button_press)
widget:disconnect_signal("button::release", button_release)
widget:disconnect_signal("mouse::leave", mouse_leave)
widget:connect_signal("mouse::enter", mouse_enter)
widget:connect_signal("button::press", button_press)
widget:connect_signal("button::release", button_release)
widget:connect_signal("mouse::leave", mouse_leave)
end end

View File

@@ -40,67 +40,28 @@ return function(s)
-- TODO: If the user doesnt have AccountsService look into $HOME/.faces -- TODO: If the user doesnt have AccountsService look into $HOME/.faces
local update_profile_picture = function() local update_profile_picture = function()
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell(
[=[ "./.config/awesome/src/scripts/pfp.sh 'userPfp'",
iconPath="/var/lib/AccountsService/icons/${USER}"
userIconPath="${HOME}/.config/awesome/src/assets/userpfp/"
if [[ -f "${userIconPath}" ]];
then
if [[ -f "${iconPath}" ]];
then
if ! cmp --silent "${userIconPath}.png" "${iconPath}";
then
cp "${iconPath}" "${userIconPath}${USER}.png"
fi
printf "${userIconPath}.png"
else
printf "${userIconPath}.png"
fi
exit;
else
if [[ -f "${iconPath}" ]];
then
cp "${iconPath}" "${userIconPath}${USER}.png"
printf "${userIconPath}${USER}.png"
exit;
fi
fi
]=],
function(stdout) function(stdout)
if stdout then if stdout then
profile_picture:set_image(stdout:gsub("\n", "")) profile_picture:set_image(stdout:gsub("\n", ""))
else else
profile_picture:set_image(icondir .. "defaultpfp.svg") profile_picture:set_image(icondir .. "defaultpfp.svg")
end
end end
end
) )
end end
update_profile_picture() update_profile_picture()
-- Will determin the display style
local namestyle = user_vars.namestyle
-- Get the full username(if set) and the username + hostname -- Get the full username(if set) and the username + hostname
local update_user_name = function() local update_user_name = function()
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell(
[=[ "./.config/awesome/src/scripts/pfp.sh 'userName' '" .. user_vars.namestyle .. "'",
fullname="$(getent passwd `whoami` | cut -d ':' -f 5)"
user="$(whoami)"
host="$(hostname)"
if [[ "]=] .. namestyle .. [=[" == "userhost" ]];
then
printf "$user@$host"
elif [[ "]=] .. namestyle .. [=[" == "fullname" ]];
then
printf "$fullname"
else
printf "Rick Astley"
fi
]=],
function(stdout) function(stdout)
if stdout:gsub("\n", "") == "Rick Astley" then if stdout:gsub("\n", "") == "Rick Astley" then
profile_picture:set_image(awful.util.getdir("config") .. "src/assets/userpfp/" .. "rickastley.jpg") profile_picture:set_image(awful.util.getdir("config") .. "src/assets/userpfp/" .. "rickastley.jpg")
end
profile_name:set_text(stdout)
end end
profile_name:set_text(stdout)
end
) )
end end
update_user_name() update_user_name()
@@ -154,8 +115,8 @@ return function(s)
item:connect_signal( item:connect_signal(
"button::release", "button::release",
function() function()
callback() callback()
end end
) )
return item return item
@@ -163,7 +124,7 @@ return function(s)
-- Create the power menu actions -- Create the power menu actions
local suspend_command = function() local suspend_command = function()
awful.spawn("dm-tool lock & systemctl suspend") awful.spawn("systemctl suspend")
awesome.emit_signal("module::powermenu:hide") awesome.emit_signal("module::powermenu:hide")
end end
@@ -194,11 +155,11 @@ return function(s)
local lock_button = button("Lock", icondir .. "lock.svg", color["Orange200"], lock_command) local lock_button = button("Lock", icondir .. "lock.svg", color["Orange200"], lock_command)
-- Signals to change color on hover -- Signals to change color on hover
Hover_signal(shutdown_button.background, color["Blue200"]) Hover_signal(shutdown_button.background, color["Blue200"], color["Grey900"])
Hover_signal(reboot_button.background, color["Red200"]) Hover_signal(reboot_button.background, color["Red200"], color["Grey900"])
Hover_signal(suspend_button.background, color["Yellow200"]) Hover_signal(suspend_button.background, color["Yellow200"], color["Grey900"])
Hover_signal(logout_button.background, color["Green200"]) Hover_signal(logout_button.background, color["Green200"], color["Grey900"])
Hover_signal(lock_button.background, color["Orange200"]) Hover_signal(lock_button.background, color["Orange200"], color["Grey900"])
-- The powermenu widget -- The powermenu widget
local powermenu = wibox.widget { local powermenu = wibox.widget {
@@ -283,8 +244,8 @@ return function(s)
{}, {},
3, 3,
function() function()
awesome.emit_signal("module::powermenu:hide") awesome.emit_signal("module::powermenu:hide")
end end
) )
) )
) )
@@ -304,18 +265,18 @@ return function(s)
awesome.connect_signal( awesome.connect_signal(
"module::powermenu:show", "module::powermenu:show",
function() function()
if s == mouse.screen then if s == mouse.screen then
powermenu_container.visible = true powermenu_container.visible = true
powermenu_keygrabber:start() powermenu_keygrabber:start()
end
end end
end
) )
awesome.connect_signal( awesome.connect_signal(
"module::powermenu:hide", "module::powermenu:hide",
function() function()
powermenu_keygrabber:stop() powermenu_keygrabber:stop()
powermenu_container.visible = false powermenu_container.visible = false
end end
) )
end end

View File

@@ -26,9 +26,9 @@ local double_click_event_handler = function(double_click_event)
double_click_timer = gears.timer.start_new( double_click_timer = gears.timer.start_new(
0.20, 0.20,
function() function()
double_click_timer = nil double_click_timer = nil
return false return false
end end
) )
end end
@@ -38,23 +38,23 @@ local create_click_events = function(c)
{}, {},
1, 1,
function() function()
double_click_event_handler(function() double_click_event_handler(function()
if c.floating then if c.floating then
c.float = false c.float = false
return return
end end
c.maximized = not c.maximized c.maximized = not c.maximized
c:raise() c:raise()
end) end)
c:activate { context = 'titlebar', action = 'mouse_move' } c:activate { context = 'titlebar', action = 'mouse_move' }
end end
), ),
awful.button( awful.button(
{}, {},
3, 3,
function() function()
c:activate { context = 'titlebar', action = 'mouse_resize' } c:activate { context = 'titlebar', action = 'mouse_resize' }
end end
) )
) )
return buttons return buttons
@@ -119,9 +119,9 @@ local create_titlebar = function(c, bg, size)
layout = wibox.layout.align.vertical, layout = wibox.layout.align.vertical,
id = "main" id = "main"
} }
Hover_signal(titlebar.main.margin.spacing.closebutton, color["Red200"]) Hover_signal(titlebar.main.margin.spacing.closebutton, color["Red200"], color["Grey900"])
Hover_signal(titlebar.main.margin.spacing.maximizebutton, color["Yellow200"]) Hover_signal(titlebar.main.margin.spacing.maximizebutton, color["Yellow200"], color["Grey900"])
Hover_signal(titlebar.main.margin.spacing.minimizebutton, color["Green200"]) Hover_signal(titlebar.main.margin.spacing.minimizebutton, color["Green200"], color["Grey900"])
end end
local create_titlebar_dialog = function(c, bg, size) local create_titlebar_dialog = function(c, bg, size)
@@ -174,8 +174,8 @@ local create_titlebar_dialog = function(c, bg, size)
layout = wibox.layout.align.vertical, layout = wibox.layout.align.vertical,
id = "main" id = "main"
} }
Hover_signal(titlebar.main.margin.spacing.closebutton, color["Red200"]) Hover_signal(titlebar.main.margin.spacing.closebutton, color["Red200"], color["Grey900"])
Hover_signal(titlebar.main.margin.spacing.minimizebutton, color["Green200"]) Hover_signal(titlebar.main.margin.spacing.minimizebutton, color["Green200"], color["Grey900"])
end end
local draw_titlebar = function(c) local draw_titlebar = function(c)
@@ -199,54 +199,54 @@ end
client.connect_signal( client.connect_signal(
"property::maximized", "property::maximized",
function(c) function(c)
if c.maximized then if c.maximized then
Theme.titlebar_maximized_button_normal = icondir .. "unmaximize.svg" Theme.titlebar_maximized_button_normal = icondir .. "unmaximize.svg"
Theme.titlebar_maximized_button_active = icondir .. "unmaximize.svg" Theme.titlebar_maximized_button_active = icondir .. "unmaximize.svg"
Theme.titlebar_maximized_button_inactive = icondir .. "unmaximize.svg" Theme.titlebar_maximized_button_inactive = icondir .. "unmaximize.svg"
elseif not c.minimized then elseif not c.minimized then
Theme.titlebar_maximized_button_normal = icondir .. "maximize.svg" Theme.titlebar_maximized_button_normal = icondir .. "maximize.svg"
Theme.titlebar_maximized_button_active = icondir .. "maximize.svg" Theme.titlebar_maximized_button_active = icondir .. "maximize.svg"
Theme.titlebar_maximized_button_inactive = icondir .. "maximize.svg" Theme.titlebar_maximized_button_inactive = icondir .. "maximize.svg"
end
end end
end
) )
client.connect_signal( client.connect_signal(
"request::titlebars", "request::titlebars",
function(c) function(c)
if c.maximized then if c.maximized then
Theme.titlebar_maximized_button_normal = icondir .. "unmaximize.svg" Theme.titlebar_maximized_button_normal = icondir .. "unmaximize.svg"
Theme.titlebar_maximized_button_active = icondir .. "unmaximize.svg" Theme.titlebar_maximized_button_active = icondir .. "unmaximize.svg"
Theme.titlebar_maximized_button_inactive = icondir .. "unmaximize.svg" Theme.titlebar_maximized_button_inactive = icondir .. "unmaximize.svg"
draw_titlebar(c) draw_titlebar(c)
elseif not c.minimized then elseif not c.minimized then
Theme.titlebar_maximized_button_normal = icondir .. "maximize.svg" Theme.titlebar_maximized_button_normal = icondir .. "maximize.svg"
Theme.titlebar_maximized_button_active = icondir .. "maximize.svg" Theme.titlebar_maximized_button_active = icondir .. "maximize.svg"
Theme.titlebar_maximized_button_inactive = icondir .. "maximize.svg" Theme.titlebar_maximized_button_inactive = icondir .. "maximize.svg"
draw_titlebar(c) draw_titlebar(c)
end
if not c.floating or c.maximized then
awful.titlebar.hide(c, 'left')
awful.titlebar.hide(c, 'right')
awful.titlebar.hide(c, 'top')
awful.titlebar.hide(c, 'bottom')
end
end end
if not c.floating or c.maximized then
awful.titlebar.hide(c, 'left')
awful.titlebar.hide(c, 'right')
awful.titlebar.hide(c, 'top')
awful.titlebar.hide(c, 'bottom')
end
end
) )
client.connect_signal( client.connect_signal(
'property::floating', 'property::floating',
function(c) function(c)
if c.floating or (c.floating and c.maximized) then if c.floating or (c.floating and c.maximized) then
awful.titlebar.show(c, 'left') awful.titlebar.show(c, 'left')
awful.titlebar.hide(c, 'right') awful.titlebar.hide(c, 'right')
awful.titlebar.hide(c, 'top') awful.titlebar.hide(c, 'top')
awful.titlebar.hide(c, 'bottom') awful.titlebar.hide(c, 'bottom')
else else
awful.titlebar.hide(c, 'left') awful.titlebar.hide(c, 'left')
awful.titlebar.hide(c, 'right') awful.titlebar.hide(c, 'right')
awful.titlebar.hide(c, 'top') awful.titlebar.hide(c, 'top')
awful.titlebar.hide(c, 'bottom') awful.titlebar.hide(c, 'bottom')
end
end end
end
) )

View File

@@ -7,6 +7,7 @@ local awful = require("awful")
local color = require("src.theme.colors") local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears") local gears = require("gears")
local naughty = require("naughty")
local wibox = require("wibox") local wibox = require("wibox")
require("src.core.signals") require("src.core.signals")
@@ -16,6 +17,7 @@ local icondir = awful.util.getdir("config") .. "src/assets/icons/audio/"
-- Returns the volume controller -- Returns the volume controller
return function(s) return function(s)
-- Function to create source/sink devices
local function create_device(name, node, sink) local function create_device(name, node, sink)
local device = wibox.widget { local device = wibox.widget {
{ {
@@ -53,10 +55,10 @@ return function(s)
device:connect_signal( device:connect_signal(
"button::press", "button::press",
function() function()
awful.spawn.spawn("./.config/awesome/src/scripts/vol.sh set_sink " .. node) awful.spawn.spawn("./.config/awesome/src/scripts/vol.sh set_sink " .. node)
awesome.emit_signal("update::background:vol", node) awesome.emit_signal("update::background:vol", node)
end end
) )
--#region Signal Functions --#region Signal Functions
@@ -146,47 +148,47 @@ return function(s)
awesome.connect_signal( awesome.connect_signal(
"update::background:vol", "update::background:vol",
function(new_node) function(new_node)
if node == new_node then if node == new_node then
old_bg = color["Purple200"] old_bg = color["Purple200"]
old_fg = color["Grey900"] old_fg = color["Grey900"]
bg = color["Purple200"] bg = color["Purple200"]
fg = color["Grey900"] fg = color["Grey900"]
device.background:set_bg(color["Purple200"]) device.background:set_bg(color["Purple200"])
device.background:set_fg(color["Grey900"]) device.background:set_fg(color["Grey900"])
else else
fg = color["Purple200"] fg = color["Purple200"]
bg = color["Grey700"] bg = color["Grey700"]
device.background:set_fg(color["Purple200"]) device.background:set_fg(color["Purple200"])
device.background:set_bg(color["Grey700"]) device.background:set_bg(color["Grey700"])
end
end end
end
) )
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell(
[[ pactl get-default-sink ]], [[ pactl get-default-sink ]],
function(stdout) function(stdout)
local node_active = stdout:gsub("\n", "") local node_active = stdout:gsub("\n", "")
if node == node_active then if node == node_active then
bg = color["Purple200"] bg = color["Purple200"]
fg = color["Grey900"] fg = color["Grey900"]
device.background:set_bg(color["Purple200"]) device.background:set_bg(color["Purple200"])
device.background:set_fg(color["Grey900"]) device.background:set_fg(color["Grey900"])
else else
fg = color["Purple200"] fg = color["Purple200"]
bg = color["Grey700"] bg = color["Grey700"]
device.background:set_fg(color["Purple200"]) device.background:set_fg(color["Purple200"])
device.background:set_bg(color["Grey700"]) device.background:set_bg(color["Grey700"])
end
end end
end
) )
else else
device:connect_signal( device:connect_signal(
"button::press", "button::press",
function() function()
awful.spawn.spawn("./.config/awesome/src/scripts/mic.sh set_source " .. node) awful.spawn.spawn("./.config/awesome/src/scripts/mic.sh set_source " .. node)
awesome.emit_signal("update::background:mic", node) awesome.emit_signal("update::background:mic", node)
end end
) )
--#region Signal Functions --#region Signal Functions
@@ -276,42 +278,43 @@ return function(s)
awesome.connect_signal( awesome.connect_signal(
"update::background:mic", "update::background:mic",
function(new_node) function(new_node)
if node == new_node then if node == new_node then
old_bg = color["Blue200"] old_bg = color["Blue200"]
old_fg = color["Grey900"] old_fg = color["Grey900"]
bg = color["Blue200"] bg = color["Blue200"]
fg = color["Grey900"] fg = color["Grey900"]
device.background:set_bg(color["Blue200"]) device.background:set_bg(color["Blue200"])
device.background:set_fg(color["Grey900"]) device.background:set_fg(color["Grey900"])
else else
fg = color["Blue200"] fg = color["Blue200"]
bg = color["Grey700"] bg = color["Grey700"]
device.background:set_fg(color["Blue200"]) device.background:set_fg(color["Blue200"])
device.background:set_bg(color["Grey700"]) device.background:set_bg(color["Grey700"])
end
end end
end
) )
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell(
[[ pactl get-default-source ]], [[ pactl get-default-source ]],
function(stdout) function(stdout)
local node_active = stdout:gsub("\n", "") local node_active = stdout:gsub("\n", "")
if node == node_active then if node == node_active then
bg = color["Blue200"] bg = color["Blue200"]
fg = color["Grey900"] fg = color["Grey900"]
device.background:set_bg(color["Blue200"]) device.background:set_bg(color["Blue200"])
device.background:set_fg(color["Grey900"]) device.background:set_fg(color["Grey900"])
else else
fg = color["Blue200"] fg = color["Blue200"]
bg = color["Grey700"] bg = color["Grey700"]
device.background:set_fg(color["Blue200"]) device.background:set_fg(color["Blue200"])
device.background:set_bg(color["Grey700"]) device.background:set_bg(color["Grey700"])
end
end end
end
) )
end end
return device return device
end end
-- Container for the source devices
local dropdown_list_volume = wibox.widget { local dropdown_list_volume = wibox.widget {
{ {
{ {
@@ -330,6 +333,7 @@ return function(s)
widget = wibox.container.margin widget = wibox.container.margin
} }
-- Container for the sink devices
local dropdown_list_microphone = wibox.widget { local dropdown_list_microphone = wibox.widget {
{ {
{ {
@@ -550,19 +554,19 @@ return function(s)
audio_selector_margin:connect_signal( audio_selector_margin:connect_signal(
"button::press", "button::press",
function() function()
volume_list.visible = not volume_list.visible volume_list.visible = not volume_list.visible
if volume_list.visible then if volume_list.visible then
audio_bg.shape = function(cr, width, height) audio_bg.shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 4) gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 4)
end
audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["Teal200"]))
else
audio_bg.shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4)
end
audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["Teal200"]))
end end
audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["Teal200"]))
else
audio_bg.shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4)
end
audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["Teal200"]))
end end
end
) )
-- Variables for easier access and better readability -- Variables for easier access and better readability
@@ -575,19 +579,19 @@ return function(s)
mic_selector_margin:connect_signal( mic_selector_margin:connect_signal(
"button::press", "button::press",
function() function()
mic_list.visible = not mic_list.visible mic_list.visible = not mic_list.visible
if mic_list.visible then if mic_list.visible then
mic_selector_margin.mic_bg.shape = function(cr, width, height) mic_selector_margin.mic_bg.shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 4) gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 4)
end
mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["Teal200"]))
else
mic_bg.shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4)
end
mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["Teal200"]))
end end
mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["Teal200"]))
else
mic_bg.shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4)
end
mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["Teal200"]))
end end
end
) )
local audio_slider_margin = volume_controller:get_children_by_id("audio_volume_margin")[1].audio_volume.slider_margin.slider local audio_slider_margin = volume_controller:get_children_by_id("audio_volume_margin")[1].audio_volume.slider_margin.slider
@@ -596,9 +600,9 @@ return function(s)
audio_slider_margin:connect_signal( audio_slider_margin:connect_signal(
"property::value", "property::value",
function() function()
local volume = audio_slider_margin.value local volume = audio_slider_margin.value
awful.spawn("pactl set-sink-volume @DEFAULT_SINK@ " .. tonumber(volume) .. "%") awful.spawn("pactl set-sink-volume @DEFAULT_SINK@ " .. tonumber(volume) .. "%")
end end
) )
local mic_slider_margin = volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.slider_margin.slider local mic_slider_margin = volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.slider_margin.slider
@@ -607,10 +611,10 @@ return function(s)
mic_slider_margin:connect_signal( mic_slider_margin:connect_signal(
"property::value", "property::value",
function() function()
local volume = mic_slider_margin.value local volume = mic_slider_margin.value
awful.spawn("pactl set-source-volume @DEFAULT_SOURCE@ " .. tonumber(volume) .. "%") awful.spawn("pactl set-source-volume @DEFAULT_SOURCE@ " .. tonumber(volume) .. "%")
awesome.emit_signal("get::mic_volume", volume) awesome.emit_signal("get::mic_volume", volume)
end end
) )
-- Main container -- Main container
@@ -627,87 +631,98 @@ return function(s)
end end
} }
-- Get all audio devices from all sinks -- Get all source devices
local function get_devices() local function get_source_devices()
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell(
[[ pactl list sinks | grep -E 'node.name|alsa.card_name' | awk '{gsub(/"/, ""); for(i = 3;i < NF;i++) printf $i " "; print $NF}' ]], [[ pactl list sinks | grep -E 'node.name|alsa.card_name' | awk '{gsub(/"/, ""); for(i = 3;i < NF;i++) printf $i " "; print $NF}' ]],
function(stdout) function(stdout)
local i, j = 1, 1 local i, j = 1, 1
local device_list = { layout = wibox.layout.fixed.vertical } local device_list = { layout = wibox.layout.fixed.vertical }
local node_names, alsa_names = {}, {} local node_names, alsa_names = {}, {}
for node_name in stdout:gmatch("[^\n]+") do for node_name in stdout:gmatch("[^\n]+") do
if (i % 2) == 0 then if (i % 2) == 0 then
table.insert(node_names, node_name) table.insert(node_names, node_name)
end
i = i + 1
end end
i = i + 1
end
for alsa_name in stdout:gmatch("[^\n]+") do for alsa_name in stdout:gmatch("[^\n]+") do
if (j % 2) == 1 then if (j % 2) == 1 then
table.insert(alsa_names, alsa_name) table.insert(alsa_names, alsa_name)
end
j = j + 1
end end
j = j + 1
end
for k = 1, #alsa_names, 1 do for k = 1, #alsa_names, 1 do
device_list[#device_list + 1] = create_device(alsa_names[k], node_names[k], true) device_list[#device_list + 1] = create_device(alsa_names[k], node_names[k], true)
end
dropdown_list_volume.volume_device_background.volume_device_list.children = device_list
end end
dropdown_list_volume.volume_device_background.volume_device_list.children = device_list
end
) )
end end
get_devices() get_source_devices()
-- Get all input devices from all sources -- Get all input devices
local function get_input_devices() local function get_input_devices()
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell(
[[ pactl list sources | grep -E "node.name|alsa.card_name" | awk '{gsub(/"/, ""); for(i = 3;i < NF;i++) printf $i " "; print $NF}' ]], [[ pactl list sources | grep -E "node.name|alsa.card_name" | awk '{gsub(/"/, ""); for(i = 3;i < NF;i++) printf $i " "; print $NF}' ]],
function(stdout) function(stdout)
local i, j = 1, 1 local i, j = 1, 1
local device_list = { layout = wibox.layout.fixed.vertical } local device_list = { layout = wibox.layout.fixed.vertical }
local node_names, alsa_names = {}, {} local node_names, alsa_names = {}, {}
for node_name in stdout:gmatch("[^\n]+") do for node_name in stdout:gmatch("[^\n]+") do
if (i % 2) == 0 then if (i % 2) == 0 then
table.insert(node_names, node_name) table.insert(node_names, node_name)
end
i = i + 1
end end
i = i + 1
end
for alsa_name in stdout:gmatch("[^\n]+") do for alsa_name in stdout:gmatch("[^\n]+") do
if (j % 2) == 1 then if (j % 2) == 1 then
table.insert(alsa_names, alsa_name) table.insert(alsa_names, alsa_name)
end
j = j + 1
end end
j = j + 1
end
for k = 1, #alsa_names, 1 do for k = 1, #alsa_names, 1 do
device_list[#device_list + 1] = create_device(alsa_names[k], node_names[k], false) device_list[#device_list + 1] = create_device(alsa_names[k], node_names[k], false)
end
dropdown_list_microphone.volume_device_background.volume_device_list.children = device_list
end end
dropdown_list_microphone.volume_device_background.volume_device_list.children = device_list
end
) )
end end
get_input_devices() get_input_devices()
-- Event watcher, detects when device is addes/removed
awful.spawn.with_line_callback(
[[bash -c "LC_ALL=C pactl subscribe | grep --line-buffered 'on server'"]],
{
stdout = function(line)
get_input_devices()
get_source_devices()
end
}
)
-- Get microphone volume -- Get microphone volume
local function get_mic_volume() local function get_mic_volume()
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell(
"./.config/awesome/src/scripts/mic.sh volume", "./.config/awesome/src/scripts/mic.sh volume",
function(stdout) function(stdout)
local volume = stdout:gsub("%%", ""):gsub("\n", "") local volume = stdout:gsub("%%", ""):gsub("\n", "")
volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.slider_margin.slider:set_value(tonumber(volume)) volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.slider_margin.slider:set_value(tonumber(volume))
if volume > 0 then if volume > 0 then
volume_controller:get_children_by_id("mic_volume_margin")[1].icon:set_image(gears.color.recolor_image(icondir .. "microphone.svg", color["LightBlue200"])) volume_controller:get_children_by_id("mic_volume_margin")[1].icon:set_image(gears.color.recolor_image(icondir .. "microphone.svg", color["LightBlue200"]))
else else
volume_controller:get_children_by_id("mic_volume_margin")[1].icon:set_image(gears.color.recolor_image(icondir .. "microphone-off.svg", color["LightBlue200"])) volume_controller:get_children_by_id("mic_volume_margin")[1].icon:set_image(gears.color.recolor_image(icondir .. "microphone-off.svg", color["LightBlue200"]))
end
end end
end
) )
end end
@@ -718,75 +733,122 @@ return function(s)
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell(
"./.config/awesome/src/scripts/mic.sh mute", "./.config/awesome/src/scripts/mic.sh mute",
function(stdout) function(stdout)
if stdout:match("yes") then if stdout:match("yes") then
volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.slider_margin.slider:set_value(tonumber(0)) volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.slider_margin.slider:set_value(tonumber(0))
volume_controller:get_children_by_id("mic_volume_margin")[1].icon:set_image(gears.color.recolor_image(icondir .. "microphone-off.svg", color["LightBlue200"])) volume_controller:get_children_by_id("mic_volume_margin")[1].icon:set_image(gears.color.recolor_image(icondir .. "microphone-off.svg", color["LightBlue200"]))
else else
get_mic_volume() get_mic_volume()
end
end end
end
) )
end end
get_mic_mute() get_mic_mute()
-- When the mouse leaves the popup it stops the mousegrabber and hides the popup.
volume_controller_container:connect_signal(
"mouse::leave",
function()
mousegrabber.run(
function()
awesome.emit_signal("volume_controller::toggle", s)
mousegrabber.stop()
return true
end,
"arrow"
)
end
)
volume_controller_container:connect_signal(
"mouse::enter",
function()
mousegrabber.stop()
end
)
-- Grabs all keys and hides popup when anything is pressed
-- TODO: Make it possible to navigate and select using the kb
local volume_controller_keygrabber = awful.keygrabber {
autostart = false,
stop_event = 'release',
keypressed_callback = function(self, mod, key, command)
awesome.emit_signal("volume_controller::toggle", s)
mousegrabber.stop()
end
}
-- Draw the popup
volume_controller_container:setup { volume_controller_container:setup {
volume_controller, volume_controller,
layout = wibox.layout.fixed.horizontal layout = wibox.layout.fixed.horizontal
} }
-- Global signal called from src.widgets.audio.lua --[[ awesome.connect_signal(
"volume_controller::toggle:keygrabber",
function()
if awful.keygrabber.is_running then
volume_controller_keygrabber:stop()
else
volume_controller_keygrabber:start()
end
end
) ]]
-- Set the volume and icon
awesome.connect_signal( awesome.connect_signal(
"get::volume", "get::volume",
function(volume) function(volume)
volume = tonumber(volume) volume = tonumber(volume)
local icon = icondir .. "volume" local icon = icondir .. "volume"
if volume < 1 then if volume < 1 then
icon = icon .. "-mute" icon = icon .. "-mute"
elseif volume >= 1 and volume < 34 then elseif volume >= 1 and volume < 34 then
icon = icon .. "-low" icon = icon .. "-low"
elseif volume >= 34 and volume < 67 then elseif volume >= 34 and volume < 67 then
icon = icon .. "-medium" icon = icon .. "-medium"
elseif volume >= 67 then elseif volume >= 67 then
icon = icon .. "-high" icon = icon .. "-high"
end
volume_controller.controller_margin.controller_layout.audio_volume_margin.audio_volume.slider_margin.slider:set_value(volume)
volume_controller.controller_margin.controller_layout.audio_volume_margin.audio_volume.icon:set_image(gears.color.recolor_image(icon .. ".svg", color["Purple200"]))
end end
volume_controller.controller_margin.controller_layout.audio_volume_margin.audio_volume.slider_margin.slider:set_value(volume)
volume_controller.controller_margin.controller_layout.audio_volume_margin.audio_volume.icon:set_image(gears.color.recolor_image(icon .. ".svg", color["Purple200"]))
end
) )
-- Global signal called from src.widgets.audio.lua -- Check if the volume is muted
awesome.connect_signal( awesome.connect_signal(
"get::volume_mute", "get::volume_mute",
function(mute) function(mute)
if mute then if mute then
volume_controller.controller_margin.controller_layout.audio_volume_margin.audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "volume-mute.svg", color["Purple200"])) volume_controller.controller_margin.controller_layout.audio_volume_margin.audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "volume-mute.svg", color["Purple200"]))
end
end end
end
) )
-- Set the microphone volume
awesome.connect_signal( awesome.connect_signal(
"get::mic_volume", "get::mic_volume",
function(volume) function(volume)
if volume > 0 then if volume > 0 then
volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "microphone.svg", color["LightBlue200"])) volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "microphone.svg", color["LightBlue200"]))
else else
volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "microphone-off.svg", color["LightBlue200"])) volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "microphone-off.svg", color["LightBlue200"]))
end
end end
end
) )
-- Toggle container visibility -- Toggle container visibility
awesome.connect_signal( awesome.connect_signal(
"volume_controller::toggle", "volume_controller::toggle",
function(scr) function(scr)
if scr == s then if scr == s then
volume_controller_container.visible = not volume_controller_container.visible volume_controller_container.visible = not volume_controller_container.visible
end end
end end
) )
end end

48
awesome/src/scripts/pfp.sh Executable file
View File

@@ -0,0 +1,48 @@
#!/bin/bash
case $1 in
"userPfp")
iconPath="/var/lib/AccountsService/icons/$USER"
userIconPath="$HOME/.config/awesome/src/assets/userpfp/"
if [[ -f "$userIconPath" ]];
then
if [[ -f "$iconPath" ]];
then
if ! cmp --silent "$userIconPath.png" "$iconPath";
then
cp "$iconPath" "$userIconPath$USER.png"
fi
printf "$userIconPath.png"
else
printf "$userIconPath.png"
fi
exit;
else
if [[ -f "$iconPath" ]];
then
cp "$iconPath" "$userIconPath$USER.png"
printf "$userIconPath$USER.png"
exit;
fi
fi
;;
"userName")
fullname="$(getent passwd `whoami` | cut -d ':' -f 5)"
user="$(whoami)"
host="$(hostname)"
if [[ "$2" == "userhost" ]];
then
printf "$user@$host"
elif [[ "$2" == "fullname" ]];
then
printf "$fullname"
else
printf "Rick Astley"
fi
;;
esac

View File

@@ -37,14 +37,14 @@ function Get_icon(theme, client, program_string, class_string, is_steam)
end end
end end
for index, icon in ipairs(icon_cache) do for _, icon in ipairs(icon_cache) do
if icon:match(clientName) then if icon:match(clientName) then
return icon return icon
end end
end end
local resolutions = { "128x128", "96x96", "64x64", "48x48", "42x42", "32x32", "24x24", "16x16" } local resolutions = { "128x128", "96x96", "64x64", "48x48", "42x42", "32x32", "24x24", "16x16" }
for i, res in ipairs(resolutions) do for _, res in ipairs(resolutions) do
local iconDir = "/usr/share/icons/" .. theme .. "/" .. res .. "/apps/" local iconDir = "/usr/share/icons/" .. theme .. "/" .. res .. "/apps/"
local ioStream = io.open(iconDir .. clientName, "r") local ioStream = io.open(iconDir .. clientName, "r")
if ioStream ~= nil then if ioStream ~= nil then

View File

@@ -1,7 +1,6 @@
------------------------------ ------------------------------
-- This is the audio widget -- -- This is the audio widget --
------------------------------ ------------------------------
-- Awesome Libs -- Awesome Libs
local awful = require("awful") local awful = require("awful")
local color = require("src.theme.colors") local color = require("src.theme.colors")
@@ -60,26 +59,27 @@ return function(s)
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell(
"./.config/awesome/src/scripts/vol.sh volume", "./.config/awesome/src/scripts/vol.sh volume",
function(stdout) function(stdout)
local icon = icondir .. "volume" local icon = icondir .. "volume"
stdout = stdout:gsub("%%", "") stdout = stdout:gsub("%%", "")
local volume = tonumber(stdout) or 0 local volume = tonumber(stdout) or 0
audio_widget.container.audio_layout.spacing = dpi(5) audio_widget.container.audio_layout.spacing = dpi(5)
audio_widget.container.audio_layout.label.visible = true audio_widget.container.audio_layout.label.visible = true
if volume < 1 then if volume < 1 then
icon = icon .. "-mute" icon = icon .. "-mute"
audio_widget.container.audio_layout.spacing = dpi(0) audio_widget.container.audio_layout.spacing = dpi(0)
audio_widget.container.audio_layout.label.visible = false audio_widget.container.audio_layout.label.visible = false
elseif volume >= 1 and volume < 34 then elseif volume >= 1 and volume < 34 then
icon = icon .. "-low" icon = icon .. "-low"
elseif volume >= 34 and volume < 67 then elseif volume >= 34 and volume < 67 then
icon = icon .. "-medium" icon = icon .. "-medium"
elseif volume >= 67 then elseif volume >= 67 then
icon = icon .. "-high" icon = icon .. "-high"
end
audio_widget.container.audio_layout.label:set_text(volume .. "%")
audio_widget.container.audio_layout.icon_margin.icon_layout.icon:set_image(
gears.color.recolor_image(icon .. ".svg", color["Grey900"]))
awesome.emit_signal("get::volume", volume)
end end
audio_widget.container.audio_layout.label:set_text(volume .. "%")
audio_widget.container.audio_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icon .. ".svg", color["Grey900"]))
awesome.emit_signal("get::volume", volume)
end
) )
end end
@@ -87,30 +87,32 @@ return function(s)
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell(
"./.config/awesome/src/scripts/vol.sh mute", "./.config/awesome/src/scripts/vol.sh mute",
function(stdout) function(stdout)
if stdout:match("yes") then if stdout:match("yes") then
audio_widget.container.audio_layout.label.visible = false audio_widget.container.audio_layout.label.visible = false
audio_widget.container:set_right(0) audio_widget.container:set_right(0)
audio_widget.container.audio_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icondir .. "volume-mute" .. ".svg", color["Grey900"])) audio_widget.container.audio_layout.icon_margin.icon_layout.icon:set_image(
awesome.emit_signal("get::volume_mute", true) gears.color.recolor_image(icondir .. "volume-mute" .. ".svg", color["Grey900"]))
else awesome.emit_signal("get::volume_mute", true)
audio_widget.container:set_right(10) else
awesome.emit_signal("get::volume_mute", false) audio_widget.container:set_right(10)
get_volume() awesome.emit_signal("get::volume_mute", false)
get_volume()
end
end end
end
) )
end end
-- Signals -- Signals
Hover_signal(audio_widget, color["Yellow200"]) Hover_signal(audio_widget, color["Yellow200"], color["Grey900"])
audio_widget:connect_signal( audio_widget:connect_signal(
"button::press", "button::press",
function() function()
awesome.emit_signal("module::slider:update") awesome.emit_signal("module::slider:update")
awesome.emit_signal("widget::volume_osd:rerun") awesome.emit_signal("widget::volume_osd:rerun")
awesome.emit_signal("volume_controller::toggle", s) awesome.emit_signal("volume_controller::toggle", s)
end awesome.emit_signal("volume_controller::toggle:keygrabber")
end
) )
gears.timer { gears.timer {

View File

@@ -1,7 +1,6 @@
-------------------------------- --------------------------------
-- This is the battery widget -- -- This is the battery widget --
-------------------------------- --------------------------------
-- Awesome Libs -- Awesome Libs
local awful = require("awful") local awful = require("awful")
local color = require("src.theme.colors") local color = require("src.theme.colors")
@@ -71,23 +70,23 @@ return function()
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell(
[[ upower -i $(upower -e | grep BAT) | grep "time to " ]], [[ upower -i $(upower -e | grep BAT) | grep "time to " ]],
function(stdout) function(stdout)
if stdout == nil or stdout == '' then if stdout == nil or stdout == '' then
battery_tooltip:set_text('No Battery Found') battery_tooltip:set_text('No Battery Found')
return return
end
local rem_time = ""
if stdout:match("hour") then
rem_time = "Hours"
else
rem_time = "Minutes"
end
local bat_time = stdout:match("%d+,%d") or stdout:match("%d+.%d") or ""
if stdout:match("empty") then
battery_tooltip:set_text("Remaining battery time: " .. bat_time .. " " .. rem_time)
elseif stdout:match("time to full") then
battery_tooltip:set_text("Battery fully charged in: " .. bat_time .. " " .. rem_time)
end
end end
local rem_time = ""
if stdout:match("hour") then
rem_time = "Hours"
else
rem_time = "Minutes"
end
local bat_time = stdout:match("%d+,%d") or stdout:match("%d+.%d") or ""
if stdout:match("empty") then
battery_tooltip:set_text("Remaining battery time: " .. bat_time .. " " .. rem_time)
elseif stdout:match("time to full") then
battery_tooltip:set_text("Battery fully charged in: " .. bat_time .. " " .. rem_time)
end
end
) )
end end
get_battery_info() get_battery_info()
@@ -109,92 +108,96 @@ return function()
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell(
[[sh -c "upower -i $(upower -e | grep BAT) | grep percentage | awk '{print \$2}' |tr -d '\n%'"]], [[sh -c "upower -i $(upower -e | grep BAT) | grep percentage | awk '{print \$2}' |tr -d '\n%'"]],
function(stdout) function(stdout)
local battery_percentage = tonumber(stdout) local battery_percentage = tonumber(stdout)
if not battery_percentage then if not battery_percentage then
return return
end
battery_widget.container.battery_layout.spacing = dpi(5)
battery_widget.container.battery_layout.label.visible = true
battery_widget.container.battery_layout.label:set_text(battery_percentage .. '%')
local icon = 'battery'
if status == 'fully-charged' or status == 'charging' and battery_percentage == 100 then
icon = icon .. '-' .. 'charging'
battery_widget.container.battery_layout.icon_margin.icon_layout.icon:set_image(gears.surface.load_uncached(gears.color.recolor_image(icondir .. icon .. '.svg', "#212121")))
return
end
if battery_percentage > 0 and battery_percentage < 10 and status == 'discharging' then
icon = icon .. '-' .. 'alert'
if (os.difftime(os.time(), last_battery_check) > 300 or notify_critical_battery) then
last_battery_check = os.time()
notify_critical_battery = false
battery_warning()
end end
battery_widget.container.battery_layout.icon_margin.icon_layout.icon:set_image(gears.surface.load_uncached(gears.color.recolor_image(icondir .. icon .. '.svg', "#212121")))
return battery_widget.container.battery_layout.spacing = dpi(5)
battery_widget.container.battery_layout.label.visible = true
battery_widget.container.battery_layout.label:set_text(battery_percentage .. '%')
local icon = 'battery'
if status == 'fully-charged' or status == 'charging' and battery_percentage == 100 then
icon = icon .. '-' .. 'charging'
battery_widget.container.battery_layout.icon_margin.icon_layout.icon:set_image(gears.surface.load_uncached(
gears.color.recolor_image(icondir .. icon .. '.svg', "#212121")))
return
end
if battery_percentage > 0 and battery_percentage < 10 and status == 'discharging' then
icon = icon .. '-' .. 'alert'
if (os.difftime(os.time(), last_battery_check) > 300 or notify_critical_battery) then
last_battery_check = os.time()
notify_critical_battery = false
battery_warning()
end
battery_widget.container.battery_layout.icon_margin.icon_layout.icon:set_image(gears.surface.load_uncached(
gears.color.recolor_image(icondir .. icon .. '.svg', "#212121")))
return
end
if battery_percentage > 0 and battery_percentage < 10 then
icon = icon .. '-' .. status .. '-' .. 'outline'
elseif battery_percentage >= 10 and battery_percentage < 20 then
icon = icon .. '-' .. status .. '-' .. '10'
elseif battery_percentage >= 20 and battery_percentage < 30 then
icon = icon .. '-' .. status .. '-' .. '20'
elseif battery_percentage >= 30 and battery_percentage < 40 then
icon = icon .. '-' .. status .. '-' .. '30'
elseif battery_percentage >= 40 and battery_percentage < 50 then
icon = icon .. '-' .. status .. '-' .. '40'
elseif battery_percentage >= 50 and battery_percentage < 60 then
icon = icon .. '-' .. status .. '-' .. '50'
elseif battery_percentage >= 60 and battery_percentage < 70 then
icon = icon .. '-' .. status .. '-' .. '60'
elseif battery_percentage >= 70 and battery_percentage < 80 then
icon = icon .. '-' .. status .. '-' .. '70'
elseif battery_percentage >= 80 and battery_percentage < 90 then
icon = icon .. '-' .. status .. '-' .. '80'
elseif battery_percentage >= 90 and battery_percentage < 100 then
icon = icon .. '-' .. status .. '-' .. '90'
end
battery_widget.container.battery_layout.icon_margin.icon_layout.icon:set_image(gears.surface.load_uncached(
gears.color.recolor_image(icondir .. icon .. '.svg', "#212121")))
end end
if battery_percentage > 0 and battery_percentage < 10 then
icon = icon .. '-' .. status .. '-' .. 'outline'
elseif battery_percentage >= 10 and battery_percentage < 20 then
icon = icon .. '-' .. status .. '-' .. '10'
elseif battery_percentage >= 20 and battery_percentage < 30 then
icon = icon .. '-' .. status .. '-' .. '20'
elseif battery_percentage >= 30 and battery_percentage < 40 then
icon = icon .. '-' .. status .. '-' .. '30'
elseif battery_percentage >= 40 and battery_percentage < 50 then
icon = icon .. '-' .. status .. '-' .. '40'
elseif battery_percentage >= 50 and battery_percentage < 60 then
icon = icon .. '-' .. status .. '-' .. '50'
elseif battery_percentage >= 60 and battery_percentage < 70 then
icon = icon .. '-' .. status .. '-' .. '60'
elseif battery_percentage >= 70 and battery_percentage < 80 then
icon = icon .. '-' .. status .. '-' .. '70'
elseif battery_percentage >= 80 and battery_percentage < 90 then
icon = icon .. '-' .. status .. '-' .. '80'
elseif battery_percentage >= 90 and battery_percentage < 100 then
icon = icon .. '-' .. status .. '-' .. '90'
end
battery_widget.container.battery_layout.icon_margin.icon_layout.icon:set_image(gears.surface.load_uncached(gears.color.recolor_image(icondir .. icon .. '.svg', "#212121")))
end
) )
end end
Hover_signal(battery_widget, color["Purple200"]) Hover_signal(battery_widget, color["Purple200"], color["Grey900"])
battery_widget:connect_signal( battery_widget:connect_signal(
'button::press', 'button::press',
function() function()
awful.spawn("xfce4-power-manager-settings") awful.spawn("xfce4-power-manager-settings")
end end
) )
battery_widget:connect_signal( battery_widget:connect_signal(
"mouse::enter", "mouse::enter",
function() function()
get_battery_info() get_battery_info()
end end
) )
watch( watch(
[[sh -c "upower -i $(upower -e | grep BAT) | grep state | awk '{print \$2}' | tr -d '\n'"]], [[sh -c "upower -i $(upower -e | grep BAT) | grep state | awk '{print \$2}' | tr -d '\n'"]],
5, 5,
function(widget, stdout) function(widget, stdout)
local status = stdout:gsub('%\n', '') local status = stdout:gsub('%\n', '')
if status == nil or status == '' then if status == nil or status == '' then
battery_widget.container.battery_layout.spacing = dpi(0) battery_widget.container.battery_layout.spacing = dpi(0)
battery_widget.container.battery_layout.label.visible = false battery_widget.container.battery_layout.label.visible = false
battery_tooltip:set_text('No battery found') battery_tooltip:set_text('No battery found')
battery_widget.container.battery_layout.icon_margin.icon_layout.icon:set_image(gears.surface.load_uncached(gears.color.recolor_image(icondir .. 'battery-off' .. '.svg', "#212121"))) battery_widget.container.battery_layout.icon_margin.icon_layout.icon:set_image(gears.surface.load_uncached(
gears.color.recolor_image(icondir .. 'battery-off' .. '.svg', "#212121")))
end
update_battery(status)
end end
update_battery(status)
end
) )
return battery_widget return battery_widget

View File

@@ -67,13 +67,13 @@ return function()
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell(
'./.config/awesome/src/scripts/bt.sh', './.config/awesome/src/scripts/bt.sh',
function(stdout2) function(stdout2)
if stdout2 == nil or stdout2:gsub("\n", "") == "" then if stdout2 == nil or stdout2:gsub("\n", "") == "" then
bluetooth_tooltip:set_text("Bluetooth is turned " .. bluetooth_state .. "\n" .. "You are currently not connected") bluetooth_tooltip:set_text("Bluetooth is turned " .. bluetooth_state .. "\n" .. "You are currently not connected")
else else
connected_device = stdout2:gsub("%(", ""):gsub("%)", "") connected_device = stdout2:gsub("%(", ""):gsub("%)", "")
bluetooth_tooltip:set_text("Bluetooth is turned " .. bluetooth_state .. "\n" .. "You are currently connected to:\n" .. connected_device) bluetooth_tooltip:set_text("Bluetooth is turned " .. bluetooth_state .. "\n" .. "You are currently connected to:\n" .. connected_device)
end
end end
end
) )
end end
bluetooth_widget.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icon .. ".svg", color["Grey900"])) bluetooth_widget.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icon .. ".svg", color["Grey900"]))
@@ -82,49 +82,49 @@ return function()
) )
-- Signals -- Signals
Hover_signal(bluetooth_widget, color["Blue200"]) Hover_signal(bluetooth_widget, color["Blue200"], color["Grey900"])
bluetooth_widget:connect_signal( bluetooth_widget:connect_signal(
"button::press", "button::press",
function() function()
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell(
"rfkill list bluetooth", "rfkill list bluetooth",
function(stdout) function(stdout)
if stdout:gsub("\n", "") ~= '' then if stdout:gsub("\n", "") ~= '' then
if bluetooth_state == "off" then if bluetooth_state == "off" then
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell(
[[ [[
rfkill unblock bluetooth rfkill unblock bluetooth
sleep 1 sleep 1
bluetoothctl power on bluetoothctl power on
]], ]] ,
function() function()
naughty.notification { naughty.notification {
title = "System Notification", title = "System Notification",
app_name = "Bluetooth", app_name = "Bluetooth",
message = "Bluetooth activated" message = "Bluetooth activated"
} }
end end
) )
else else
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell(
[[ [[
bluetoothctl power off bluetoothctl power off
rfkill block bluetooth rfkill block bluetooth
]], ]] ,
function() function()
naughty.notification { naughty.notification {
title = "System Notification", title = "System Notification",
app_name = "Bluetooth", app_name = "Bluetooth",
message = "Bluetooth deactivated" message = "Bluetooth deactivated"
} }
end
)
end
end end
)
end end
end )
end end
)
end
) )
return bluetooth_widget return bluetooth_widget

View File

@@ -39,7 +39,8 @@ return function()
id = "label", id = "label",
align = "center", align = "center",
valign = "center", valign = "center",
widget = wibox.widget.textbox format = "%H:%M",
widget = wibox.widget.textclock
}, },
id = "clock_layout", id = "clock_layout",
layout = wibox.layout.fixed.horizontal layout = wibox.layout.fixed.horizontal
@@ -57,22 +58,7 @@ return function()
widget = wibox.container.background widget = wibox.container.background
} }
local set_clock = function() Hover_signal(clock_widget, color["Orange200"], color["Grey900"])
clock_widget.container.clock_layout.label:set_text(os.date("%H:%M"))
end
-- Updates the clock every 5 seconds, worst case you are 5 seconds behind
-- ¯\_(ツ)_/¯
gears.timer {
timeout = 5,
autostart = true,
call_now = true,
callback = function()
set_clock()
end
}
Hover_signal(clock_widget, color["Orange200"])
return clock_widget return clock_widget
end end

View File

@@ -145,21 +145,21 @@ return function(widget, clock_mode)
[[ cat "/proc/stat" | grep '^cpu ' ]], [[ cat "/proc/stat" | grep '^cpu ' ]],
3, 3,
function(_, stdout) function(_, stdout)
local user, nice, system, idle, iowait, irq, softirq, steal, guest, guest_nice = local user, nice, system, idle, iowait, irq, softirq, steal, guest, guest_nice =
stdout:match("(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s") stdout:match("(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s")
local total = user + nice + system + idle + iowait + irq + softirq + steal local total = user + nice + system + idle + iowait + irq + softirq + steal
local diff_idle = idle - idle_prev local diff_idle = idle - idle_prev
local diff_total = total - total_prev local diff_total = total - total_prev
local diff_usage = (1000 * (diff_total - diff_idle) / diff_total + 5) / 10 local diff_usage = (1000 * (diff_total - diff_idle) / diff_total + 5) / 10
cpu_usage_widget.container.cpu_layout.label.text = tostring(math.floor(diff_usage)) .. "%" cpu_usage_widget.container.cpu_layout.label.text = tostring(math.floor(diff_usage)) .. "%"
total_prev = total total_prev = total
idle_prev = idle idle_prev = idle
collectgarbage("collect") collectgarbage("collect")
end end
) )
watch( watch(
@@ -167,53 +167,53 @@ return function(widget, clock_mode)
3, 3,
function(_, stdout) function(_, stdout)
local temp_icon local temp_icon
local temp_color local temp_color
local temp_num = tonumber(stdout:match("%d+")) local temp_num = tonumber(stdout:match("%d+"))
if temp_num < 50 then if temp_num < 50 then
temp_color = color["Green200"] temp_color = color["Green200"]
temp_icon = icon_dir .. "thermometer-low.svg" temp_icon = icon_dir .. "thermometer-low.svg"
elseif temp_num >= 50 and temp_num < 80 then elseif temp_num >= 50 and temp_num < 80 then
temp_color = color["Orange200"] temp_color = color["Orange200"]
temp_icon = icon_dir .. "thermometer.svg" temp_icon = icon_dir .. "thermometer.svg"
elseif temp_num >= 80 then elseif temp_num >= 80 then
temp_color = color["Red200"] temp_color = color["Red200"]
temp_icon = icon_dir .. "thermometer-high.svg" temp_icon = icon_dir .. "thermometer-high.svg"
end
Hover_signal(cpu_temp, temp_color, color["Grey900"])
cpu_temp.container.cpu_layout.icon_margin.icon_layout.icon:set_image(temp_icon)
cpu_temp:set_bg(temp_color)
cpu_temp.container.cpu_layout.label.text = math.floor(temp_num) .. "°C"
end end
Hover_signal(cpu_temp, temp_color)
cpu_temp.container.cpu_layout.icon_margin.icon_layout.icon:set_image(temp_icon)
cpu_temp:set_bg(temp_color)
cpu_temp.container.cpu_layout.label.text = math.floor(temp_num) .. "°C"
end
) )
watch( watch(
[[ bash -c "cat /proc/cpuinfo | grep "MHz" | awk '{print int($4)}'" ]], [[ bash -c "cat /proc/cpuinfo | grep "MHz" | awk '{print int($4)}'" ]],
3, 3,
function(_, stdout) function(_, stdout)
local cpu_freq = {} local cpu_freq = {}
for value in stdout:gmatch("%d+") do for value in stdout:gmatch("%d+") do
table.insert(cpu_freq, value) table.insert(cpu_freq, value)
end end
local average = 0 local average = 0
if clock_mode == "average" then if clock_mode == "average" then
for i = 1, #cpu_freq do for i = 1, #cpu_freq do
average = average + cpu_freq[i] average = average + cpu_freq[i]
end
average = math.floor(average / #cpu_freq)
cpu_clock.container.cpu_layout.label.text = tonumber(average) .. "Mhz"
elseif clock_mode then
cpu_clock.container.cpu_layout.label.text = tonumber(cpu_freq[clock_mode]) .. "Mhz"
end end
average = math.floor(average / #cpu_freq)
cpu_clock.container.cpu_layout.label.text = tonumber(average) .. "Mhz"
elseif clock_mode then
cpu_clock.container.cpu_layout.label.text = tonumber(cpu_freq[clock_mode]) .. "Mhz"
end end
end
) )
Hover_signal(cpu_usage_widget, color["Blue200"]) Hover_signal(cpu_usage_widget, color["Blue200"], color["Grey900"])
Hover_signal(cpu_clock, color["Purple200"]) Hover_signal(cpu_clock, color["Purple200"], color["Grey900"])
if widget == "usage" then if widget == "usage" then
return cpu_usage_widget return cpu_usage_widget

View File

@@ -72,20 +72,20 @@ return function()
} }
-- Signals -- Signals
Hover_signal(date_widget, color["Teal200"]) Hover_signal(date_widget, color["Teal200"], color["Grey900"])
date_widget:connect_signal( date_widget:connect_signal(
"mouse::enter", "mouse::enter",
function() function()
awesome.emit_signal("widget::calendar_osd:stop", true) awesome.emit_signal("widget::calendar_osd:stop", true)
end end
) )
date_widget:connect_signal( date_widget:connect_signal(
"mouse::leave", "mouse::leave",
function() function()
awesome.emit_signal("widget::calendar_osd:rerun", true) awesome.emit_signal("widget::calendar_osd:rerun", true)
end end
) )
return date_widget return date_widget

View File

@@ -54,7 +54,7 @@ return function(widget)
end, end,
widget = wibox.container.background widget = wibox.container.background
} }
Hover_signal(gpu_usage_widget, color["Green200"]) Hover_signal(gpu_usage_widget, color["Green200"], color["Grey900"])
local gpu_temp_widget = wibox.widget { local gpu_temp_widget = wibox.widget {
{ {
@@ -102,8 +102,8 @@ return function(widget)
[[ bash -c "nvidia-smi -q -d UTILIZATION | grep Gpu | awk '{print $3}'"]], [[ bash -c "nvidia-smi -q -d UTILIZATION | grep Gpu | awk '{print $3}'"]],
3, 3,
function(_, stdout) function(_, stdout)
gpu_usage_widget.container.gpu_layout.label.text = stdout:gsub("\n", "") .. "%" gpu_usage_widget.container.gpu_layout.label.text = stdout:gsub("\n", "") .. "%"
end end
) )
-- GPU Temperature -- GPU Temperature
@@ -112,26 +112,26 @@ return function(widget)
3, 3,
function(_, stdout) function(_, stdout)
local temp_icon local temp_icon
local temp_color local temp_color
local temp_num = tonumber(stdout) local temp_num = tonumber(stdout)
if temp_num < 50 then if temp_num < 50 then
temp_color = color["Green200"] temp_color = color["Green200"]
temp_icon = icon_dir .. "thermometer-low.svg" temp_icon = icon_dir .. "thermometer-low.svg"
elseif temp_num >= 50 and temp_num < 80 then elseif temp_num >= 50 and temp_num < 80 then
temp_color = color["Orange200"] temp_color = color["Orange200"]
temp_icon = icon_dir .. "thermometer.svg" temp_icon = icon_dir .. "thermometer.svg"
elseif temp_num >= 80 then elseif temp_num >= 80 then
temp_color = color["Red200"] temp_color = color["Red200"]
temp_icon = icon_dir .. "thermometer-high.svg" temp_icon = icon_dir .. "thermometer-high.svg"
end
Hover_signal(gpu_temp_widget, temp_color, color["Grey900"])
gpu_temp_widget.container.gpu_layout.icon_margin.icon_layout.icon:set_image(temp_icon)
gpu_temp_widget:set_bg(temp_color)
gpu_temp_widget.container.gpu_layout.label.text = tostring(temp_num) .. "°C"
end end
Hover_signal(gpu_temp_widget, temp_color)
gpu_temp_widget.container.gpu_layout.icon_margin.icon_layout.icon:set_image(temp_icon)
gpu_temp_widget:set_bg(temp_color)
gpu_temp_widget.container.gpu_layout.label.text = tostring(temp_num) .. "°C"
end
) )
if widget == "usage" then if widget == "usage" then

View File

@@ -59,10 +59,10 @@ return function(s)
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell(
[[ setxkbmap -query | grep layout | awk '{print $2}' ]], [[ setxkbmap -query | grep layout | awk '{print $2}' ]],
function(stdout) function(stdout)
local layout = stdout:gsub("\n", "") local layout = stdout:gsub("\n", "")
kblayout_widget.container.kblayout_layout.label.text = layout kblayout_widget.container.kblayout_layout.label.text = layout
awesome.emit_signal("update::background:kblayout") awesome.emit_signal("update::background:kblayout")
end end
) )
end end
@@ -72,12 +72,12 @@ return function(s)
local xkeyboard_country_code = { local xkeyboard_country_code = {
{ "af", "أفغانيش(Afghanistan)", "AFG" }, -- Afghanistan { "af", "أفغانيش(Afghanistan)", "AFG" }, -- Afghanistan
{ "al", "shqip(Albania)", "ALB" }, -- Albania { "al", "Shqip(Albania)", "ALB" }, -- Albania
{ "am", "հայերեն(Armenia)", "ARM" }, -- Armenia { "am", "Hայերեն(Armenia)", "ARM" }, -- Armenia
{ "ara", "عربي(Arab)", "ARB" }, -- Arabic { "ara", "عربي(Arab)", "ARB" }, -- Arabic
{ "at", "Österreichisch (Austria)", "AUT" }, -- Austria { "at", "Österreichisch (Austria)", "AUT" }, -- Austria
{ "az", "Azərbaycan(Azerbaijan)", "AZE" }, -- Azerbaijan { "az", "Azərbaycan(Azerbaijan)", "AZE" }, -- Azerbaijan
{ "ba", "bosanski(Bosnia and Herzegovina)", "BIH" }, -- Bosnia and Herzegovina { "ba", "Bosanski(Bosnia and Herzegovina)", "BIH" }, -- Bosnia and Herzegovina
{ "bd", "", "BGD" }, -- Bangladesh { "bd", "", "BGD" }, -- Bangladesh
{ "be", "", "BEL" }, -- Belgium { "be", "", "BEL" }, -- Belgium
{ "bg", "", "BGR" }, -- Bulgaria { "bg", "", "BGR" }, -- Bulgaria
@@ -219,22 +219,22 @@ return function(s)
awesome.connect_signal( awesome.connect_signal(
"update::background:kblayout", "update::background:kblayout",
function() function()
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell(
[[ setxkbmap -query | grep layout | awk '{print $2}' ]], [[ setxkbmap -query | grep layout | awk '{print $2}' ]],
function(stdout) function(stdout)
local layout = stdout:gsub("\n", "") local layout = stdout:gsub("\n", "")
if kb_layout_item.keymap == layout then if kb_layout_item.keymap == layout then
kb_layout_item.bg = color["DeepPurple200"] kb_layout_item.bg = color["DeepPurple200"]
kb_layout_item:get_children_by_id("background2")[1].fg = color["Grey900"] kb_layout_item:get_children_by_id("background2")[1].fg = color["Grey900"]
kb_layout_item:get_children_by_id("background1")[1].fg = color["Grey900"] kb_layout_item:get_children_by_id("background1")[1].fg = color["Grey900"]
else else
kb_layout_item.bg = color["Grey800"] kb_layout_item.bg = color["Grey800"]
kb_layout_item:get_children_by_id("background2")[1].fg = color["Red200"] kb_layout_item:get_children_by_id("background2")[1].fg = color["Red200"]
kb_layout_item:get_children_by_id("background1")[1].fg = color["Purple200"] kb_layout_item:get_children_by_id("background1")[1].fg = color["Purple200"]
end end
end
)
end end
)
end
) )
get_kblayout() get_kblayout()
@@ -242,15 +242,15 @@ return function(s)
kb_layout_item:connect_signal( kb_layout_item:connect_signal(
"button::press", "button::press",
function() function()
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell(
"setxkbmap " .. keymap, "setxkbmap " .. keymap,
function() function()
awesome.emit_signal("kblayout::hide:kbmenu") awesome.emit_signal("kblayout::hide:kbmenu")
mousegrabber.stop() mousegrabber.stop()
get_kblayout() get_kblayout()
end
)
end end
)
end
) )
return kb_layout_item return kb_layout_item
end end
@@ -294,25 +294,23 @@ return function(s)
kb_menu_widget:connect_signal( kb_menu_widget:connect_signal(
"mouse::leave", "mouse::leave",
function() function()
mousegrabber.run( mousegrabber.run(
function() function()
kblayout_widget.bg = color["Green200"] kblayout_widget.bg = color["Green200"]
if mouse.is_left_mouse_button_pressed then
awesome.emit_signal("kblayout::hide:kbmenu") awesome.emit_signal("kblayout::hide:kbmenu")
mousegrabber.stop() mousegrabber.stop()
end return true
return true end,
end, "arrow"
"arrow" )
) end
end
) )
kb_menu_widget:connect_signal( kb_menu_widget:connect_signal(
"mouse::enter", "mouse::enter",
function() function()
mousegrabber.stop() mousegrabber.stop()
end end
) )
kb_menu_widget:setup( kb_menu_widget:setup(
@@ -323,38 +321,38 @@ return function(s)
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell(
"setxkbmap -query | grep layout: | awk '{print $2}'", "setxkbmap -query | grep layout: | awk '{print $2}'",
function(stdout) function(stdout)
for j, n in ipairs(user_vars.kblayout) do for j, n in ipairs(user_vars.kblayout) do
if stdout:match(n) then if stdout:match(n) then
if j == #user_vars.kblayout then if j == #user_vars.kblayout then
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell(
"setxkbmap " .. user_vars.kblayout[1], "setxkbmap " .. user_vars.kblayout[1],
function() function()
get_kblayout() get_kblayout()
end
)
else
awful.spawn.easy_async_with_shell(
"setxkbmap " .. user_vars.kblayout[j + 1],
function()
get_kblayout()
end
)
end end
)
else
awful.spawn.easy_async_with_shell(
"setxkbmap " .. user_vars.kblayout[j + 1],
function()
get_kblayout()
end
)
end end
end end
end end
end
) )
end end
awesome.connect_signal( awesome.connect_signal(
"kblayout::toggle", "kblayout::toggle",
function() function()
toggle_kb_layout() toggle_kb_layout()
end end
) )
-- Signals -- Signals
Hover_signal(kblayout_widget, color["Green200"]) Hover_signal(kblayout_widget, color["Green200"], color["Grey900"])
local kblayout_keygrabber = awful.keygrabber { local kblayout_keygrabber = awful.keygrabber {
autostart = false, autostart = false,
@@ -368,23 +366,23 @@ return function(s)
kblayout_widget:connect_signal( kblayout_widget:connect_signal(
"button::press", "button::press",
function() function()
mousegrabber.stop() mousegrabber.stop()
if kb_menu_widget.visible then if kb_menu_widget.visible then
kb_menu_widget.visible = false kb_menu_widget.visible = false
kblayout_keygrabber:stop() kblayout_keygrabber:stop()
else else
kb_menu_widget.visible = true kb_menu_widget.visible = true
kblayout_keygrabber:start() kblayout_keygrabber:start()
end
end end
end
) )
awesome.connect_signal( awesome.connect_signal(
"kblayout::hide:kbmenu", "kblayout::hide:kbmenu",
function() function()
kb_menu_widget.visible = false kb_menu_widget.visible = false
kblayout_keygrabber:stop() kblayout_keygrabber:stop()
end end
) )
get_kblayout() get_kblayout()

View File

@@ -33,13 +33,13 @@ return function()
} }
-- Signals -- Signals
Hover_signal(layout, color["LightBlue200"]) Hover_signal(layout, color["LightBlue200"], color["Grey900"])
layout:connect_signal( layout:connect_signal(
"button::press", "button::press",
function() function()
awful.layout.inc(-1) awful.layout.inc(-1)
end end
) )
return layout return layout

View File

@@ -131,21 +131,21 @@ return function()
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell(
[[ iw dev ]] .. interfaces.wlan_interface .. [[ link ]], [[ iw dev ]] .. interfaces.wlan_interface .. [[ link ]],
function(stdout) function(stdout)
local essid = stdout:match("SSID: (.-)\n") or "N/A" local essid = stdout:match("SSID: (.-)\n") or "N/A"
local bitrate = stdout:match("tx bitrate: (.+/s)") or "N/A" local bitrate = stdout:match("tx bitrate: (.+/s)") or "N/A"
local message = "Connected to <b>" .. essid .. "</b>\nSignal strength <b>" .. tostring(wifi_strength) .. "%</b>\n" .. "Bit rate <b>" .. tostring(bitrate) .. "</b>" local message = "Connected to <b>" .. essid .. "</b>\nSignal strength <b>" .. tostring(wifi_strength) .. "%</b>\n" .. "Bit rate <b>" .. tostring(bitrate) .. "</b>"
if healthy then if healthy then
update_tooltip(message) update_tooltip(message)
else else
update_tooltip("You are connected but have no internet" .. message) update_tooltip("You are connected but have no internet" .. message)
end end
if reconnect_startup or startup then if reconnect_startup or startup then
notify_connected(essid) notify_connected(essid)
update_reconnect_startup(false) update_reconnect_startup(false)
end
end end
end
) )
end end
@@ -153,20 +153,20 @@ return function()
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell(
check_for_internet, check_for_internet,
function(stdout) function(stdout)
local icon = "wifi-strength" local icon = "wifi-strength"
if not stdout:match("Connected but no internet") then if not stdout:match("Connected but no internet") then
if startup or reconnect_startup then if startup or reconnect_startup then
awesome.emit_signal("system::network_connected") awesome.emit_signal("system::network_connected")
end
icon = icon .. '-' .. tostring(strength)
update_wireless_data(true)
else
icon = icon .. "-" .. tostring(strength)
update_wireless_data(false)
end end
icon = icon .. '-' .. tostring(strength) network_widget.container.network_layout.spacing = dpi(8)
update_wireless_data(true) network_widget.container.network_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icondir .. icon .. ".svg", color["Grey900"]))
else
icon = icon .. "-" .. tostring(strength)
update_wireless_data(false)
end end
network_widget.container.network_layout.spacing = dpi(8)
network_widget.container.network_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icondir .. icon .. ".svg", color["Grey900"]))
end
) )
end end
@@ -174,16 +174,16 @@ return function()
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell(
[[ awk 'NR==3 {printf "%3.0f", ($3/70)*100}' /proc/net/wireless ]], [[ awk 'NR==3 {printf "%3.0f", ($3/70)*100}' /proc/net/wireless ]],
function(stdout) function(stdout)
if not tonumber(stdout) then if not tonumber(stdout) then
return return
end
wifi_strength = tonumber(stdout)
network_widget.container.network_layout.spacing = dpi(8)
network_widget.container.network_layout.label.visible = true
network_widget.container.network_layout.label:set_text(tostring(wifi_strength .. "%"))
local wifi_strength_rounded = math.floor(wifi_strength / 25 + 0.5)
update_wireless_icon(wifi_strength_rounded)
end end
wifi_strength = tonumber(stdout)
network_widget.container.network_layout.spacing = dpi(8)
network_widget.container.network_layout.label.visible = true
network_widget.container.network_layout.label:set_text(tostring(wifi_strength .. "%"))
local wifi_strength_rounded = math.floor(wifi_strength / 25 + 0.5)
update_wireless_icon(wifi_strength_rounded)
end
) )
end end
@@ -205,26 +205,26 @@ return function()
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell(
check_for_internet, check_for_internet,
function(stdout) function(stdout)
local icon = "ethernet" local icon = "ethernet"
if stdout:match("Connected but no internet") then if stdout:match("Connected but no internet") then
icon = "no-internet" icon = "no-internet"
update_tooltip( update_tooltip(
"No internet" "No internet"
) )
else else
update_tooltip("You are connected to:\nEthernet Interface <b>" .. interfaces.lan_interface .. "</b>") update_tooltip("You are connected to:\nEthernet Interface <b>" .. interfaces.lan_interface .. "</b>")
if startup or reconnect_startup then if startup or reconnect_startup then
awesome.emit_signal("system::network_connected") awesome.emit_signal("system::network_connected")
notify_connected() notify_connected()
update_startup() update_startup()
end
update_reconnect_startup(false)
end end
update_reconnect_startup(false) network_widget.container.network_layout.label.visible = false
network_widget.container.network_layout.spacing = dpi(0)
network_widget.container.network_layout.icon_margin.icon_layout.icon:set_image(icondir .. icon .. ".svg")
end end
network_widget.container.network_layout.label.visible = false
network_widget.container.network_layout.spacing = dpi(0)
network_widget.container.network_layout.icon_margin.icon_layout.icon:set_image(icondir .. icon .. ".svg")
end
) )
end end
@@ -302,15 +302,15 @@ return function()
print_network_mode print_network_mode
]=], ]=],
function(stdout) function(stdout)
local mode = stdout:gsub("%\n", "") local mode = stdout:gsub("%\n", "")
if stdout:match("No internet connected") then if stdout:match("No internet connected") then
update_disconnected() update_disconnected()
elseif stdout:match("wireless") then elseif stdout:match("wireless") then
update_wireless() update_wireless()
elseif stdout:match("wired") then elseif stdout:match("wired") then
update_wired() update_wired()
end
end end
end
) )
end end
@@ -324,13 +324,13 @@ return function()
} }
-- Signals -- Signals
Hover_signal(network_widget, color["Red200"]) Hover_signal(network_widget, color["Red200"], color["Grey900"])
network_widget:connect_signal( network_widget:connect_signal(
"button::press", "button::press",
function() function()
awful.spawn("gnome-control-center wlan") awful.spawn("gnome-control-center wlan")
end end
) )
return network_widget return network_widget

View File

@@ -50,13 +50,13 @@ return function()
} }
-- Signals -- Signals
Hover_signal(power_widget, color["Red200"]) Hover_signal(power_widget, color["Red200"], color["Grey900"])
power_widget:connect_signal( power_widget:connect_signal(
"button::release", "button::release",
function() function()
awesome.emit_signal("module::powermenu:show") awesome.emit_signal("module::powermenu:show")
end end
) )
return power_widget return power_widget

View File

@@ -55,17 +55,17 @@ return function()
widget = wibox.container.background widget = wibox.container.background
} }
Hover_signal(ram_widget, color["Red200"]) Hover_signal(ram_widget, color["Red200"], color["Grey900"])
watch( watch(
[[ bash -c "cat /proc/meminfo| grep Mem | awk '{print $2}'" ]], [[ bash -c "cat /proc/meminfo| grep Mem | awk '{print $2}'" ]],
3, 3,
function(_, stdout) function(_, stdout)
local MemTotal, MemFree, MemAvailable = stdout:match("(%d+)\n(%d+)\n(%d+)\n") local MemTotal, MemFree, MemAvailable = stdout:match("(%d+)\n(%d+)\n(%d+)\n")
ram_widget.container.ram_layout.label.text = tostring(string.format("%.1f", ((MemTotal - MemAvailable) / 1024 / 1024)) .. "/" .. string.format("%.1f", (MemTotal / 1024 / 1024)) .. "GB"):gsub(",", ".") ram_widget.container.ram_layout.label.text = tostring(string.format("%.1f", ((MemTotal - MemAvailable) / 1024 / 1024)) .. "/" .. string.format("%.1f", (MemTotal / 1024 / 1024)) .. "GB"):gsub(",", ".")
end end
) )
return ram_widget return ram_widget

View File

@@ -30,7 +30,7 @@ return function(s)
bg = color["BlueGrey800"] bg = color["BlueGrey800"]
} }
-- Signals -- Signals
Hover_signal(systray.container, color["Red200"]) Hover_signal(systray.container, color["Red200"], color["Grey900"])
awesome.connect_signal("systray::update", function() awesome.connect_signal("systray::update", function()
local num_entries = awesome.systray() local num_entries = awesome.systray()

View File

@@ -1,3 +1,8 @@
--------------------------------
-- This is the taglist widget --
--------------------------------
-- Awesome Libs
local wibox = require("wibox") local wibox = require("wibox")
local awful = require("awful") local awful = require("awful")
local gears = require("gears") local gears = require("gears")
@@ -8,52 +13,29 @@ require("src.tools.icon_handler")
local list_update = function(widget, buttons, label, data, objects) local list_update = function(widget, buttons, label, data, objects)
widget:reset() widget:reset()
for i, object in ipairs(objects) do for _, object in ipairs(objects) do
local tag_icon = wibox.widget {
nil,
{
id = "icon",
resize = true,
widget = wibox.widget.imagebox
},
nil,
layout = wibox.layout.align.horizontal
}
local tag_icon_margin = wibox.widget {
tag_icon,
forced_width = dpi(33),
margins = dpi(3),
widget = wibox.container.margin
}
local tag_label = wibox.widget {
text = "",
align = "center",
valign = "center",
visible = true,
font = user_vars.font.extrabold,
forced_width = dpi(25),
widget = wibox.widget.textbox
}
local tag_label_margin = wibox.widget {
tag_label,
left = dpi(5),
right = dpi(5),
widget = wibox.container.margin
}
local tag_widget = wibox.widget { local tag_widget = wibox.widget {
id = "widget_margin",
{ {
{
{
text = "",
align = "center",
valign = "center",
visible = true,
font = user_vars.font.extrabold,
forced_width = dpi(25),
id = "label",
widget = wibox.widget.textbox
},
id = "margin",
left = dpi(5),
right = dpi(5),
widget = wibox.container.margin
},
id = "container", id = "container",
tag_label_margin,
layout = wibox.layout.fixed.horizontal layout = wibox.layout.fixed.horizontal
}, },
fg = color["White"], fg = color["White"],
shape = function(cr, width, height) shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5) gears.shape.rounded_rect(cr, width, height, 5)
@@ -83,8 +65,7 @@ local list_update = function(widget, buttons, label, data, objects)
tag_widget:buttons(create_buttons(buttons, object)) tag_widget:buttons(create_buttons(buttons, object))
local text, bg_color, bg_image, icon, args = label(object, tag_label) tag_widget.container.margin.label:set_text(object.index)
tag_label:set_text(object.index)
if object.urgent == true then if object.urgent == true then
tag_widget:set_bg(color["RedA200"]) tag_widget:set_bg(color["RedA200"])
tag_widget:set_fg(color["Grey900"]) tag_widget:set_fg(color["Grey900"])
@@ -97,7 +78,7 @@ local list_update = function(widget, buttons, label, data, objects)
-- Set the icon for each client -- Set the icon for each client
for _, client in ipairs(object:clients()) do for _, client in ipairs(object:clients()) do
tag_label_margin:set_right(0) tag_widget.container.margin:set_right(0)
local icon = wibox.widget { local icon = wibox.widget {
{ {
id = "icon_container", id = "icon_container",
@@ -108,7 +89,6 @@ local list_update = function(widget, buttons, label, data, objects)
}, },
widget = wibox.container.place widget = wibox.container.place
}, },
tag_icon_margin,
forced_width = dpi(33), forced_width = dpi(33),
margins = dpi(6), margins = dpi(6),
widget = wibox.container.margin widget = wibox.container.margin
@@ -121,63 +101,65 @@ local list_update = function(widget, buttons, label, data, objects)
}) })
end end
--#region Hover_signal
local old_wibox, old_cursor, old_bg local old_wibox, old_cursor, old_bg
tag_widget:connect_signal( tag_widget:connect_signal(
"mouse::enter", "mouse::enter",
function() function()
old_bg = tag_widget.bg old_bg = tag_widget.bg
if object == awful.screen.focused().selected_tag then if object == awful.screen.focused().selected_tag then
tag_widget.bg = '#dddddd' .. 'dd' tag_widget.bg = '#dddddd' .. 'dd'
else else
tag_widget.bg = '#3A475C' .. 'dd' tag_widget.bg = '#3A475C' .. 'dd'
end
local w = mouse.current_wibox
if w then
old_cursor, old_wibox = w.cursor, w
w.cursor = "hand1"
end
end end
local w = mouse.current_wibox
if w then
old_cursor, old_wibox = w.cursor, w
w.cursor = "hand1"
end
end
) )
tag_widget:connect_signal( tag_widget:connect_signal(
"button::press", "button::press",
function() function()
if object == awful.screen.focused().selected_tag then if object == awful.screen.focused().selected_tag then
tag_widget.bg = '#bbbbbb' .. 'dd' tag_widget.bg = '#bbbbbb' .. 'dd'
else else
tag_widget.bg = '#3A475C' .. 'dd' tag_widget.bg = '#3A475C' .. 'dd'
end
end end
end
) )
tag_widget:connect_signal( tag_widget:connect_signal(
"button::release", "button::release",
function() function()
if object == awful.screen.focused().selected_tag then if object == awful.screen.focused().selected_tag then
tag_widget.bg = '#dddddd' .. 'dd' tag_widget.bg = '#dddddd' .. 'dd'
else else
tag_widget.bg = '#3A475C' .. 'dd' tag_widget.bg = '#3A475C' .. 'dd'
end
end end
end
) )
tag_widget:connect_signal( tag_widget:connect_signal(
"mouse::leave", "mouse::leave",
function() function()
tag_widget.bg = old_bg tag_widget.bg = old_bg
if old_wibox then if old_wibox then
old_wibox.cursor = old_cursor old_wibox.cursor = old_cursor
old_wibox = nil old_wibox = nil
end
end end
end
) )
--#endregion
widget:add(tag_widget) widget:add(tag_widget)
widget:set_spacing(dpi(6)) widget:set_spacing(dpi(6))
end end
end end
local tag_list = function(s) return function(s)
return awful.widget.taglist( return awful.widget.taglist(
s, s,
awful.widget.taglist.filter.noempty, awful.widget.taglist.filter.noempty,
@@ -186,49 +168,49 @@ local tag_list = function(s)
{}, {},
1, 1,
function(t) function(t)
t:view_only() t:view_only()
end end
), ),
awful.button( awful.button(
{ modkey }, { modkey },
1, 1,
function(t) function(t)
if client.focus then if client.focus then
client.focus:move_to_tag(t) client.focus:move_to_tag(t)
end
end end
end
), ),
awful.button( awful.button(
{}, {},
3, 3,
function(t) function(t)
if client.focus then if client.focus then
client.focus:toggle_tag(t) client.focus:toggle_tag(t)
end
end end
end
), ),
awful.button( awful.button(
{ modkey }, { modkey },
3, 3,
function(t) function(t)
if client.focus then if client.focus then
client.focus:toggle_tag(t) client.focus:toggle_tag(t)
end
end end
end
), ),
awful.button( awful.button(
{}, {},
4, 4,
function(t) function(t)
awful.tag.viewnext(t.screen) awful.tag.viewnext(t.screen)
end end
), ),
awful.button( awful.button(
{}, {},
5, 5,
function(t) function(t)
awful.tag.viewprev(t.screen) awful.tag.viewprev(t.screen)
end end
) )
), ),
{}, {},
@@ -236,5 +218,3 @@ local tag_list = function(s)
wibox.layout.fixed.horizontal() wibox.layout.fixed.horizontal()
) )
end end
return tag_list

View File

@@ -1,3 +1,8 @@
---------------------------------
-- This is the tasklist widget --
---------------------------------
-- Awesome Libs
local awful = require('awful') local awful = require('awful')
local wibox = require('wibox') local wibox = require('wibox')
local dpi = require('beautiful').xresources.apply_dpi local dpi = require('beautiful').xresources.apply_dpi
@@ -83,7 +88,7 @@ local list_update = function(widget, buttons, label, data, objects)
task_widget:buttons(create_buttons(buttons, object)) task_widget:buttons(create_buttons(buttons, object))
local text, bg, bg_image, icon, args = label(object, task_widget.container.layout_it.title) local text, _ = label(object, task_widget.container.layout_it.title)
if object == client.focus then if object == client.focus then
if text == nil or text == '' then if text == nil or text == '' then
task_widget.container.layout_it.title:set_margins(0) task_widget.container.layout_it.title:set_margins(0)
@@ -112,61 +117,64 @@ local list_update = function(widget, buttons, label, data, objects)
widget:add(task_widget) widget:add(task_widget)
widget:set_spacing(dpi(6)) widget:set_spacing(dpi(6))
--#region Hover_signal
local old_wibox, old_cursor, old_bg local old_wibox, old_cursor, old_bg
task_widget:connect_signal( task_widget:connect_signal(
"mouse::enter", "mouse::enter",
function() function()
old_bg = task_widget.bg old_bg = task_widget.bg
if object == client.focus then if object == client.focus then
task_widget.bg = '#dddddddd' task_widget.bg = '#dddddddd'
else else
task_widget.bg = '#3A475Cdd' task_widget.bg = '#3A475Cdd'
end
local w = mouse.current_wibox
if w then
old_cursor, old_wibox = w.cursor, w
w.cursor = "hand1"
end
end end
local w = mouse.current_wibox
if w then
old_cursor, old_wibox = w.cursor, w
w.cursor = "hand1"
end
end
) )
task_widget:connect_signal( task_widget:connect_signal(
"button::press", "button::press",
function() function()
if object == client.focus then if object == client.focus then
task_widget.bg = "#ffffffaa" task_widget.bg = "#ffffffaa"
else else
task_widget.bg = '#3A475Caa' task_widget.bg = '#3A475Caa'
end
end end
end
) )
task_widget:connect_signal( task_widget:connect_signal(
"button::release", "button::release",
function() function()
if object == client.focus then if object == client.focus then
task_widget.bg = "#ffffffdd" task_widget.bg = "#ffffffdd"
else else
task_widget.bg = '#3A475Cdd' task_widget.bg = '#3A475Cdd'
end
end end
end
) )
task_widget:connect_signal( task_widget:connect_signal(
"mouse::leave", "mouse::leave",
function() function()
task_widget.bg = old_bg task_widget.bg = old_bg
if old_wibox then if old_wibox then
old_wibox.cursor = old_cursor old_wibox.cursor = old_cursor
old_wibox = nil old_wibox = nil
end
end end
end
) )
--#endregion
end end
return widget return widget
end end
local tasklist = function(s) return function(s)
return awful.widget.tasklist( return awful.widget.tasklist(
s, s,
awful.widget.tasklist.filter.currenttags, awful.widget.tasklist.filter.currenttags,
@@ -175,24 +183,24 @@ local tasklist = function(s)
{}, {},
1, 1,
function(c) function(c)
if c == client.focus then if c == client.focus then
c.minimized = true c.minimized = true
else else
c.minimized = false c.minimized = false
if not c:isvisible() and c.first_tag then if not c:isvisible() and c.first_tag then
c.first_tag:view_only() c.first_tag:view_only()
end
c:emit_signal('request::activate')
c:raise()
end end
c:emit_signal('request::activate')
c:raise()
end end
end
), ),
awful.button( awful.button(
{}, {},
3, 3,
function(c) function(c)
c:kill() c:kill()
end end
) )
), ),
{}, {},
@@ -200,5 +208,3 @@ local tasklist = function(s)
wibox.layout.fixed.horizontal() wibox.layout.fixed.horizontal()
) )
end end
return tasklist

View File

@@ -1,156 +1,412 @@
# ░█▀█░▀█▀░█▀▀░█▀█░█▄█░░░░█▀▀░█▀█░█▀█░█▀▀ #################################
# ░█▀▀░░█░░█░░░█░█░█░█░░░░█░░░█░█░█░█░█▀▀ # Shadows #
# ░▀░░░▀▀▀░▀▀▀░▀▀▀░▀░▀░▀░░▀▀▀░▀▀▀░▀░▀░▀░░ #################################
# Enabled client-side shadows on windows. Note desktop windows
# (windows with '_NET_WM_WINDOW_TYPE_DESKTOP') never get shadow,
# unless explicitly requested using the wintypes option.
# #
# X compositor configuration # shadow = false
# ░█▀▀░█░█░█▀█░█▀▄░█▀█░█░█
# ░▀▀█░█▀█░█▀█░█░█░█░█░█▄█
# ░▀▀▀░▀░▀░▀░▀░▀▀░░▀▀▀░▀░▀
shadow = true; shadow = true;
# The blur radius for shadows, in pixels. (defaults to 12)
# shadow-radius = 12
shadow-radius = 12; shadow-radius = 12;
shadow-opacity = 0.65;
shadow-offset-x = -5;
shadow-offset-y = -6;
# The opacity of shadows. (0.0 - 1.0, defaults to 0.75)
# shadow-opacity = .75
# The left offset for shadows, in pixels. (defaults to -15)
# shadow-offset-x = -15
shadow-offset-x = -7;
# The top offset for shadows, in pixels. (defaults to -15)
# shadow-offset-y = -15
shadow-offset-y = -7;
# Red color value of shadow (0.0 - 1.0, defaults to 0).
# shadow-red = 0 # shadow-red = 0
# Green color value of shadow (0.0 - 1.0, defaults to 0).
# shadow-green = 0 # shadow-green = 0
# Blue color value of shadow (0.0 - 1.0, defaults to 0).
# shadow-blue = 0 # shadow-blue = 0
shadow-color = "#000000";
# Hex string color value of shadow (#000000 - #FFFFFF, defaults to #000000). This option will override options set shadow-(red/green/blue)
shadow-color = "#000000"
# Specify a list of conditions of windows that should have no shadow.
#
# examples:
# shadow-exclude = "n:e:Notification";
#
# shadow-exclude = []
shadow-exclude = [ shadow-exclude = [
#"name = 'Notification'", "name = 'Notification'",
"class_g = 'Conky'", "class_g = 'Conky'",
#"class_g ?= 'Notify-osd'", "class_g ?= 'Notify-osd'",
"class_g = 'Cairo-clock'", "class_g = 'Cairo-clock'",
#"class_g = 'slop'", "_GTK_FRAME_EXTENTS@:c"
#"name = 'Dunst'",
#"name = 'dmenu'",
#"class_g = 'Rofi'",
"_GTK_FRAME_EXTENTS@:c",
"_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'"
]; ];
# shadow-exclude-reg = "x10+0+0"; # Specify a list of conditions of windows that should have no shadow painted over, such as a dock window.
# xinerama-shadow-crop = true; # clip-shadow-above = []
# ░█▀▀░█▀█░█▀▄░▀█▀░█▀█░█▀▀ # Specify a X geometry that describes the region in which shadow should not
# ░█▀▀░█▀█░█░█░░█░░█░█░█░█ # be painted in, such as a dock window region. Use
# ░▀░░░▀░▀░▀▀░░▀▀▀░▀░▀░▀▀▀ # shadow-exclude-reg = "x10+0+0"
# for example, if the 10 pixels on the bottom of the screen should not have shadows painted on.
#
# shadow-exclude-reg = ""
# Crop shadow of a window fully on a particular Xinerama screen to the screen.
# xinerama-shadow-crop = false
#################################
# Fading #
#################################
# Fade windows in/out when opening/closing and when opacity changes,
# unless no-fading-openclose is used.
# fading = false
fading = true; fading = true;
# Opacity change between steps while fading in. (0.01 - 1.0, defaults to 0.028)
# fade-in-step = 0.028
fade-in-step = 0.03; fade-in-step = 0.03;
# Opacity change between steps while fading out. (0.01 - 1.0, defaults to 0.03)
# fade-out-step = 0.03
fade-out-step = 0.03; fade-out-step = 0.03;
fade-delta = 4;
fade-exclude = [ # The time between steps in fade step, in milliseconds. (> 0, defaults to 10)
"name *= 'polybar'" fade-delta = 6
];
no-fading-openclose = false; # Specify a list of conditions of windows that should not be faded.
no-fading-destroyed-argb = true; # fade-exclude = []
# ░█▀█░█▀█░█▀█░█▀▀░▀█▀░▀█▀░█░█ # Do not fade on window open/close.
# ░█░█░█▀▀░█▀█░█░░░░█░░░█░░░█░ # no-fading-openclose = false
# ░▀▀▀░▀░░░▀░▀░▀▀▀░▀▀▀░░▀░░░▀░
# Do not fade destroyed ARGB windows with WM frame. Workaround of bugs in Openbox, Fluxbox, etc.
# no-fading-destroyed-argb = false
#################################
# Transparency / Opacity #
#################################
# Opacity of inactive windows. (0.1 - 1.0, defaults to 1.0)
# inactive-opacity = 1
inactive-opacity = 1; inactive-opacity = 1;
# Opacity of window titlebars and borders. (0.1 - 1.0, disabled by default)
# frame-opacity = 1.0
frame-opacity = 1; frame-opacity = 1;
# Let inactive opacity set by -i override the '_NET_WM_WINDOW_OPACITY' values of windows.
# inactive-opacity-override = true
inactive-opacity-override = false; inactive-opacity-override = false;
active-opacity = 1.0;
inactive-dim = 0.0;
focus-exclude = [ # Default opacity for active windows. (0.0 - 1.0, defaults to 1.0)
"class_g = 'Cairo-clock'", # active-opacity = 1.0
"class_g ?= 'rofi'",
"class_g ?= 'slop'",
"class_g ?= 'Steam'"
];
# inactive-dim-fixed = 1.0; # Dim inactive windows. (0.0 - 1.0, defaults to 0.0)
# inactive-dim = 0.0
opacity-rule = [ # Specify a list of conditions of windows that should never be considered focused.
"80:class_g = 'URxvt'", # focus-exclude = []
"80:class_g = 'UXTerm'", focus-exclude = [ "class_g = 'Cairo-clock'" ];
"80:class_g = 'XTerm'"
]
# ░█▀▄░█░░░█░█░█▀▄░█▀▄░▀█▀░█▀█░█▀▀ # Use fixed inactive dim value, instead of adjusting according to window opacity.
# ░█▀▄░█░░░█░█░█▀▄░█▀▄░░█░░█░█░█░█ # inactive-dim-fixed = 1.0
# ░▀▀░░▀▀▀░▀▀▀░▀░▀░▀░▀░▀▀▀░▀░▀░▀▀▀
blur: { # Specify a list of opacity rules, in the format `PERCENT:PATTERN`,
method = "dual_kawase"; # like `50:name *= "Firefox"`. picom-trans is recommended over this.
strength = 5.0; # Note we don't make any guarantee about possible conflicts with other
deviation = 1.0; # programs that set '_NET_WM_WINDOW_OPACITY' on frame or client windows.
kernel = "11x11gaussian"; # example:
} # opacity-rule = [ "80:class_g = 'URxvt'" ];
#
# opacity-rule = []
blur-background = false;
blur-background-frame = true;
blur-background-fixed = true;
# blur-kern = "3x3box";
blur-background-exclude = [ #################################
#"name *= 'polybar'", # Corners #
"window_type = 'dock'", #################################
"_GTK_FRAME_EXTENTS@:c"
];
# ░█▀▀░█▀▀░█▀█░█▀▀░█▀▄░█▀█░█░░░░░█▀▀░█▀▀░▀█▀░▀█▀░▀█▀░█▀█░█▀▀░█▀▀ # Sets the radius of rounded window corners. When > 0, the compositor will
# ░█░█░█▀▀░█░█░█▀▀░█▀▄░█▀█░█░░░░░▀▀█░█▀▀░░█░░░█░░░█░░█░█░█░█░▀▀█ # round the corners of windows. Does not interact well with
# ░▀▀▀░▀▀▀░▀░▀░▀▀▀░▀░▀░▀░▀░▀▀▀░░░▀▀▀░▀▀▀░░▀░░░▀░░▀▀▀░▀░▀░▀▀▀░▀▀▀ # `transparent-clipping`.
#corner-radius = 10
#corner-radius = 10.0 # Exclude conditions for rounded corners.
rounded-corners-exclude = [ rounded-corners-exclude = [
"name *= 'Awesome drawin'", "window_type = 'dock'",
"name *= 'polybar'", "window_type = 'desktop'"
"name *= 'rofi'", ];
"name *= 'Dunst'",
"name *= 'dmenu'",
"_GTK_FRAME_EXTENTS@:c" #################################
] # Background-Blurring #
round-borders = 1 #################################
daemon = false;
# Parameters for background blurring, see the *BLUR* section for more information.
blur-method = "dual_kawase"
blur-size = 12
#
# blur-deviation = false
#
blur-strength = 5
# Blur background of semi-transparent / ARGB windows.
# Bad in performance, with driver-dependent behavior.
# The name of the switch may change without prior notifications.
#
blur-background = false
# Blur background of windows when the window frame is not opaque.
# Implies:
# blur-background
# Bad in performance, with driver-dependent behavior. The name may change.
#
blur-background-frame = true
# Use fixed blur strength rather than adjusting according to window opacity.
blur-background-fixed = true
# Specify the blur convolution kernel, with the following format:
# example:
# blur-kern = "5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1";
#
# blur-kern = ""
blur-kern = "11x11gaussian";
# Exclude conditions for background blur.
# blur-background-exclude = []
blur-background-exclude = [
"window_type = 'dock'",
"window_type = 'desktop'",
"_GTK_FRAME_EXTENTS@:c"
];
#################################
# General Settings #
#################################
# Daemonize process. Fork to background after initialization. Causes issues with certain (badly-written) drivers.
# daemon = false
# Specify the backend to use: `xrender`, `glx`, or `xr_glx_hybrid`.
# `xrender` is the default one.
#
# backend = "glx"
backend = "glx"; backend = "glx";
# Enable/disable VSync.
# vsync = false
vsync = true; vsync = true;
dbus = false;
# Enable remote control via D-Bus. See the *D-BUS API* section below for more details.
# dbus = false
# Try to detect WM windows (a non-override-redirect window with no
# child that has 'WM_STATE') and mark them as active.
#
# mark-wmwin-focused = false
mark-wmwin-focused = true; mark-wmwin-focused = true;
# Mark override-redirect windows that doesn't have a child window with 'WM_STATE' focused.
# mark-ovredir-focused = false
mark-ovredir-focused = true; mark-ovredir-focused = true;
# Try to detect windows with rounded corners and don't consider them
# shaped windows. The accuracy is not very high, unfortunately.
#
# detect-rounded-corners = false
detect-rounded-corners = true; detect-rounded-corners = true;
# Detect '_NET_WM_WINDOW_OPACITY' on client windows, useful for window managers
# not passing '_NET_WM_WINDOW_OPACITY' of client windows to frame windows.
#
# detect-client-opacity = false
detect-client-opacity = true; detect-client-opacity = true;
refresh-rate = 0;
# use-ewmh-active-win = true;
# unredir-if-possible = false;
# unredir-if-possible-delay = 0;
unredir-if-possible-exclude = []; # Use EWMH '_NET_ACTIVE_WINDOW' to determine currently focused window,
# rather than listening to 'FocusIn'/'FocusOut' event. Might have more accuracy,
# provided that the WM supports it.
#
# use-ewmh-active-win = false
# Unredirect all windows if a full-screen opaque window is detected,
# to maximize performance for full-screen windows. Known to cause flickering
# when redirecting/unredirecting windows.
#
# unredir-if-possible = false
# Delay before unredirecting the window, in milliseconds. Defaults to 0.
# unredir-if-possible-delay = 0
# Conditions of windows that shouldn't be considered full-screen for unredirecting screen.
# unredir-if-possible-exclude = []
# Use 'WM_TRANSIENT_FOR' to group windows, and consider windows
# in the same group focused at the same time.
#
# detect-transient = false
detect-transient = true; detect-transient = true;
detect-client-leader = true;
resize-damage = 1;
invert-color-include = []; # Use 'WM_CLIENT_LEADER' to group windows, and consider windows in the same
# group focused at the same time. This usually means windows from the same application
# will be considered focused or unfocused at the same time.
# 'WM_TRANSIENT_FOR' has higher priority if detect-transient is enabled, too.
#
# detect-client-leader = false
glx-no-stencil = true; # Resize damaged region by a specific number of pixels.
# glx-no-rebind-pixmap = false; # A positive value enlarges it while a negative one shrinks it.
# If the value is positive, those additional pixels will not be actually painted
# to screen, only used in blur calculation, and such. (Due to technical limitations,
# with use-damage, those pixels will still be incorrectly painted to screen.)
# Primarily used to fix the line corruption issues of blur,
# in which case you should use the blur radius value here
# (e.g. with a 3x3 kernel, you should use `--resize-damage 1`,
# with a 5x5 one you use `--resize-damage 2`, and so on).
# May or may not work with *--glx-no-stencil*. Shrinking doesn't function correctly.
#
# resize-damage = 1
# Specify a list of conditions of windows that should be painted with inverted color.
# Resource-hogging, and is not well tested.
#
# invert-color-include = []
# GLX backend: Avoid using stencil buffer, useful if you don't have a stencil buffer.
# Might cause incorrect opacity when rendering transparent content (but never
# practically happened) and may not work with blur-background.
# My tests show a 15% performance boost. Recommended.
#
glx-no-stencil = true
# GLX backend: Avoid rebinding pixmap on window damage.
# Probably could improve performance on rapid window content changes,
# but is known to break things on some drivers (LLVMpipe, xf86-video-intel, etc.).
# Recommended if it works.
#
# glx-no-rebind-pixmap = false
# Disable the use of damage information.
# This cause the whole screen to be redrawn everytime, instead of the part of the screen
# has actually changed. Potentially degrades the performance, but might fix some artifacts.
# The opposing option is use-damage
#
# no-use-damage = false
use-damage = true; use-damage = true;
# xrender-sync-fence = true;
# glx-fshader-win = ""; # Use X Sync fence to sync clients' draw calls, to make sure all draw
# force-win-blend = false; # calls are finished before picom starts drawing. Needed on nvidia-drivers
# with GLX backend for some users.
#
# xrender-sync-fence = false
# no-ewmh-fullscreen = false; # GLX backend: Use specified GLSL fragment shader for rendering window contents.
# max-brightness = 1.0; # See `compton-default-fshader-win.glsl` and `compton-fake-transparency-fshader-win.glsl`
# in the source tree for examples.
#
# glx-fshader-win = ""
transparent-clipping = false; # Force all windows to be painted with blending. Useful if you
# have a glx-fshader-win that could turn opaque pixels transparent.
#
# force-win-blend = false
show-all-xerrors = true; # Do not use EWMH to detect fullscreen windows.
# Reverts to checking if a window is fullscreen based only on its size and coordinates.
#
# no-ewmh-fullscreen = false
wintypes: { # Dimming bright windows so their brightness doesn't exceed this set value.
tooltip = { fade = true; focus = false; }; # Brightness of a window is estimated by averaging all pixels in the window,
normal = { shadow = true; blur-background = false; }; # so this could comes with a performance hit.
dock = { shadow = true; blur-background = false;}; # Setting this to 1.0 disables this behaviour. Requires --use-damage to be disabled. (default: 1.0)
desktop = { shadow = true; blur-background = false; }; #
# max-brightness = 1.0
# Make transparent windows clip other windows like non-transparent windows do,
# instead of blending on top of them.
#
# transparent-clipping = false
# Set the log level. Possible values are:
# "trace", "debug", "info", "warn", "error"
# in increasing level of importance. Case doesn't matter.
# If using the "TRACE" log level, it's better to log into a file
# using *--log-file*, since it can generate a huge stream of logs.
#
# log-level = "debug"
log-level = "warn";
# Set the log file.
# If *--log-file* is never specified, logs will be written to stderr.
# Otherwise, logs will to written to the given file, though some of the early
# logs might still be written to the stderr.
# When setting this option from the config file, it is recommended to use an absolute path.
#
# log-file = "/path/to/your/log/file"
# Show all X errors (for debugging)
# show-all-xerrors = false
# Write process ID to a file.
# write-pid-path = "/path/to/your/log/file"
# Window type settings
#
# 'WINDOW_TYPE' is one of the 15 window types defined in EWMH standard:
# "unknown", "desktop", "dock", "toolbar", "menu", "utility",
# "splash", "dialog", "normal", "dropdown_menu", "popup_menu",
# "tooltip", "notification", "combo", and "dnd".
#
# Following per window-type options are available: ::
#
# fade, shadow:::
# Controls window-type-specific shadow and fade settings.
#
# opacity:::
# Controls default opacity of the window type.
#
# focus:::
# Controls whether the window of this type is to be always considered focused.
# (By default, all window types except "normal" and "dialog" has this on.)
#
# full-shadow:::
# Controls whether shadow is drawn under the parts of the window that you
# normally won't be able to see. Useful when the window has parts of it
# transparent, and you want shadows in those areas.
#
# clip-shadow-above:::
# Controls wether shadows that would have been drawn above the window should
# be clipped. Useful for dock windows that should have no shadow painted on top.
#
# redir-ignore:::
# Controls whether this type of windows should cause screen to become
# redirected again after been unredirected. If you have unredir-if-possible
# set, and doesn't want certain window to cause unnecessary screen redirection,
# you can set this to `true`.
#
wintypes:
{
tooltip = { fade = true; shadow = true; opacity = 0.75; focus = true; full-shadow = false; };
dock = { shadow = true; clip-shadow-above = false; }
dnd = { shadow = false; }
popup_menu = { opacity = 0.8; }
dropdown_menu = { opacity = 0.8; }
}; };