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

@@ -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 --
-------------------------------
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
@@ -14,7 +13,6 @@ local wibox = require("wibox")
local icondir = awful.util.getdir("config") .. "src/assets/icons/notifications/"
-- TODO: Figure out how to use hover effects without messing up the actions
naughty.config.defaults.ontop = true
naughty.config.defaults.icon_size = dpi(80)
naughty.config.defaults.timeout = 3
@@ -31,334 +29,383 @@ naughty.config.defaults.spacing = dpi(10)
naughty.connect_signal(
'request::icon',
function(n, context, hints)
if context ~= 'app_icon' then return end
local path = menubar.utils.lookup_icon(hints.app_icon) or
menubar.utils.lookup_icon(hints.app_icon:lower())
if path then
n.icon = path
if context ~= 'app_icon' then
return
end
local path = menubar.utils.lookup_icon(hints.app_icon) or menubar.utils.lookup_icon(hints.app_icon:lower())
if path then
n.icon = path
end
end
end
)
naughty.connect_signal(
"request::display",
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
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
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",
id = "skip-prev",
icon = gears.color.recolor_image(icondir .. "skip-prev.svg", color["Cyan200"]),
},
naughty.action {
icon = gears.color.recolor_image(icondir .. "skip-prev.svg", color["Cyan200"])
}, naughty.action {
program = "Spotify",
id = "play-pause",
icon = gears.color.recolor_image(icondir .. "play-pause.svg", color["Cyan200"]),
},
naughty.action {
icon = gears.color.recolor_image(icondir .. "play-pause.svg", color["Cyan200"])
}, naughty.action {
program = "Spotify",
id = "skip-next",
icon = gears.color.recolor_image(icondir .. "skip-next.svg", color["Cyan200"]),
},
}
use_image = true
end
icon = gears.color.recolor_image(icondir .. "skip-next.svg", color["Cyan200"])
} }
use_image = true
end
local action_template_widget = {}
local action_template_widget = {}
if use_image then
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 {
{
{
if use_image then
action_template_widget = {
{
{
{
{
{
{
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
id = "icon_role",
widget = wibox.widget.imagebox
},
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",
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"
layout = wibox.layout.fixed.horizontal
},
fg = color["Teal200"],
widget = wibox.container.background
},
margins = dpi(10),
widget = wibox.container.margin
},
nil,
{
{
{
text = os.date("%H:%M"),
widget = wibox.widget.textbox
},
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"
{
{
{
{
{
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),
widget = wibox.container.margin,
id = "arc_margin"
id = "arc_app_layout",
layout = wibox.layout.align.horizontal
},
id = "arc_app_layout",
layout = wibox.layout.align.horizontal
id = "arc_app_bg",
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,
widget = wibox.widget.imagebox,
clip_shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 10)
end,
{
image = n.icon,
resize = true,
widget = wibox.widget.imagebox,
clip_shape = function(cr, width, height)
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,
height = naughty.config.defaults.icon_size,
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,
halign = "center",
valign = "top",
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 = wibox.container.margin
{
{
{
widget = naughty.widget.title,
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",
layout = wibox.layout.fixed.vertical
id = "min_size",
strategy = "min",
width = dpi(100),
widget = wibox.container.constraint
},
id = "min_size",
strategy = "min",
width = dpi(100),
id = "max_size",
strategy = "max",
width = Theme.notification_max_width or dpi(500),
widget = wibox.container.constraint
},
id = "max_size",
strategy = "max",
width = Theme.notification_max_width or dpi(500),
widget = wibox.container.constraint,
},
id = "background",
bg = color["Grey900"],
border_color = color["Grey800"],
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
id = "background",
bg = color["Grey900"],
border_color = color["Grey800"],
border_width = dpi(4),
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4)
end,
widget = wibox.container.background
}
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(
"button::press",
function()
n:destroy()
end
)
local timeout = n.timeout
local remove_time = timeout
w_template:connect_signal(
"button::press",
function(c, d, e, key)
if key == 3 then
n:destroy()
if timeout ~= 0 then
arc.value = 360
local arc_timer = 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
}
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
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
)
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(
"destroyed",
function()
end
end
)
-- Test notification
--[[ naughty.notification {
naughty.notification {
app_name = "System Notification",
title = "A notification 2",
message = "This is very informative and overflowing",
@@ -376,21 +423,21 @@ end
name = "Ignore",
},
}
} ]]
}
naughty.connect_signal(
"invoked",
function(_, action)
if action.program == "Spotify" then
if action.id == "skip-prev" then
awful.spawn("playerctl previous")
end
if action.id == "play-pause" then
awful.spawn("playerctl play-pause")
end
if action.id == "skip-next" then
awful.spawn("playerctl next")
if action.program == "Spotify" then
if action.id == "skip-prev" then
awful.spawn("playerctl previous")
end
if action.id == "play-pause" then
awful.spawn("playerctl play-pause")
end
if action.id == "skip-next" then
awful.spawn("playerctl next")
end
end
end
end
)

View File

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

View File

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

View File

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

View File

@@ -7,6 +7,7 @@ local awful = require("awful")
local color = require("src.theme.colors")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local naughty = require("naughty")
local wibox = require("wibox")
require("src.core.signals")
@@ -16,6 +17,7 @@ local icondir = awful.util.getdir("config") .. "src/assets/icons/audio/"
-- Returns the volume controller
return function(s)
-- Function to create source/sink devices
local function create_device(name, node, sink)
local device = wibox.widget {
{
@@ -53,10 +55,10 @@ return function(s)
device:connect_signal(
"button::press",
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)
end
awesome.emit_signal("update::background:vol", node)
end
)
--#region Signal Functions
@@ -146,47 +148,47 @@ return function(s)
awesome.connect_signal(
"update::background:vol",
function(new_node)
if node == new_node then
old_bg = color["Purple200"]
old_fg = color["Grey900"]
bg = color["Purple200"]
fg = color["Grey900"]
device.background:set_bg(color["Purple200"])
device.background:set_fg(color["Grey900"])
else
fg = color["Purple200"]
bg = color["Grey700"]
device.background:set_fg(color["Purple200"])
device.background:set_bg(color["Grey700"])
if node == new_node then
old_bg = color["Purple200"]
old_fg = color["Grey900"]
bg = color["Purple200"]
fg = color["Grey900"]
device.background:set_bg(color["Purple200"])
device.background:set_fg(color["Grey900"])
else
fg = color["Purple200"]
bg = color["Grey700"]
device.background:set_fg(color["Purple200"])
device.background:set_bg(color["Grey700"])
end
end
end
)
awful.spawn.easy_async_with_shell(
[[ pactl get-default-sink ]],
function(stdout)
local node_active = stdout:gsub("\n", "")
if node == node_active then
bg = color["Purple200"]
fg = color["Grey900"]
device.background:set_bg(color["Purple200"])
device.background:set_fg(color["Grey900"])
else
fg = color["Purple200"]
bg = color["Grey700"]
device.background:set_fg(color["Purple200"])
device.background:set_bg(color["Grey700"])
local node_active = stdout:gsub("\n", "")
if node == node_active then
bg = color["Purple200"]
fg = color["Grey900"]
device.background:set_bg(color["Purple200"])
device.background:set_fg(color["Grey900"])
else
fg = color["Purple200"]
bg = color["Grey700"]
device.background:set_fg(color["Purple200"])
device.background:set_bg(color["Grey700"])
end
end
end
)
else
device:connect_signal(
"button::press",
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)
end
awesome.emit_signal("update::background:mic", node)
end
)
--#region Signal Functions
@@ -276,42 +278,43 @@ return function(s)
awesome.connect_signal(
"update::background:mic",
function(new_node)
if node == new_node then
old_bg = color["Blue200"]
old_fg = color["Grey900"]
bg = color["Blue200"]
fg = color["Grey900"]
device.background:set_bg(color["Blue200"])
device.background:set_fg(color["Grey900"])
else
fg = color["Blue200"]
bg = color["Grey700"]
device.background:set_fg(color["Blue200"])
device.background:set_bg(color["Grey700"])
if node == new_node then
old_bg = color["Blue200"]
old_fg = color["Grey900"]
bg = color["Blue200"]
fg = color["Grey900"]
device.background:set_bg(color["Blue200"])
device.background:set_fg(color["Grey900"])
else
fg = color["Blue200"]
bg = color["Grey700"]
device.background:set_fg(color["Blue200"])
device.background:set_bg(color["Grey700"])
end
end
end
)
awful.spawn.easy_async_with_shell(
[[ pactl get-default-source ]],
function(stdout)
local node_active = stdout:gsub("\n", "")
if node == node_active then
bg = color["Blue200"]
fg = color["Grey900"]
device.background:set_bg(color["Blue200"])
device.background:set_fg(color["Grey900"])
else
fg = color["Blue200"]
bg = color["Grey700"]
device.background:set_fg(color["Blue200"])
device.background:set_bg(color["Grey700"])
local node_active = stdout:gsub("\n", "")
if node == node_active then
bg = color["Blue200"]
fg = color["Grey900"]
device.background:set_bg(color["Blue200"])
device.background:set_fg(color["Grey900"])
else
fg = color["Blue200"]
bg = color["Grey700"]
device.background:set_fg(color["Blue200"])
device.background:set_bg(color["Grey700"])
end
end
end
)
end
return device
end
-- Container for the source devices
local dropdown_list_volume = wibox.widget {
{
{
@@ -330,6 +333,7 @@ return function(s)
widget = wibox.container.margin
}
-- Container for the sink devices
local dropdown_list_microphone = wibox.widget {
{
{
@@ -550,19 +554,19 @@ return function(s)
audio_selector_margin:connect_signal(
"button::press",
function()
volume_list.visible = not volume_list.visible
if volume_list.visible then
audio_bg.shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 4)
volume_list.visible = not volume_list.visible
if volume_list.visible then
audio_bg.shape = function(cr, width, height)
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
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
)
-- Variables for easier access and better readability
@@ -575,19 +579,19 @@ return function(s)
mic_selector_margin:connect_signal(
"button::press",
function()
mic_list.visible = not mic_list.visible
if mic_list.visible then
mic_selector_margin.mic_bg.shape = function(cr, width, height)
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 4)
mic_list.visible = not mic_list.visible
if mic_list.visible then
mic_selector_margin.mic_bg.shape = function(cr, width, height)
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
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
)
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(
"property::value",
function()
local volume = audio_slider_margin.value
awful.spawn("pactl set-sink-volume @DEFAULT_SINK@ " .. tonumber(volume) .. "%")
end
local volume = audio_slider_margin.value
awful.spawn("pactl set-sink-volume @DEFAULT_SINK@ " .. tonumber(volume) .. "%")
end
)
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(
"property::value",
function()
local volume = mic_slider_margin.value
awful.spawn("pactl set-source-volume @DEFAULT_SOURCE@ " .. tonumber(volume) .. "%")
awesome.emit_signal("get::mic_volume", volume)
end
local volume = mic_slider_margin.value
awful.spawn("pactl set-source-volume @DEFAULT_SOURCE@ " .. tonumber(volume) .. "%")
awesome.emit_signal("get::mic_volume", volume)
end
)
-- Main container
@@ -627,87 +631,98 @@ return function(s)
end
}
-- Get all audio devices from all sinks
local function get_devices()
-- Get all source devices
local function get_source_devices()
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}' ]],
function(stdout)
local i, j = 1, 1
local device_list = { layout = wibox.layout.fixed.vertical }
local i, j = 1, 1
local device_list = { layout = wibox.layout.fixed.vertical }
local node_names, alsa_names = {}, {}
for node_name in stdout:gmatch("[^\n]+") do
if (i % 2) == 0 then
table.insert(node_names, node_name)
local node_names, alsa_names = {}, {}
for node_name in stdout:gmatch("[^\n]+") do
if (i % 2) == 0 then
table.insert(node_names, node_name)
end
i = i + 1
end
i = i + 1
end
for alsa_name in stdout:gmatch("[^\n]+") do
if (j % 2) == 1 then
table.insert(alsa_names, alsa_name)
for alsa_name in stdout:gmatch("[^\n]+") do
if (j % 2) == 1 then
table.insert(alsa_names, alsa_name)
end
j = j + 1
end
j = j + 1
end
for k = 1, #alsa_names, 1 do
device_list[#device_list + 1] = create_device(alsa_names[k], node_names[k], true)
for k = 1, #alsa_names, 1 do
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
dropdown_list_volume.volume_device_background.volume_device_list.children = device_list
end
)
end
get_devices()
get_source_devices()
-- Get all input devices from all sources
-- Get all input devices
local function get_input_devices()
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}' ]],
function(stdout)
local i, j = 1, 1
local device_list = { layout = wibox.layout.fixed.vertical }
local i, j = 1, 1
local device_list = { layout = wibox.layout.fixed.vertical }
local node_names, alsa_names = {}, {}
for node_name in stdout:gmatch("[^\n]+") do
if (i % 2) == 0 then
table.insert(node_names, node_name)
local node_names, alsa_names = {}, {}
for node_name in stdout:gmatch("[^\n]+") do
if (i % 2) == 0 then
table.insert(node_names, node_name)
end
i = i + 1
end
i = i + 1
end
for alsa_name in stdout:gmatch("[^\n]+") do
if (j % 2) == 1 then
table.insert(alsa_names, alsa_name)
for alsa_name in stdout:gmatch("[^\n]+") do
if (j % 2) == 1 then
table.insert(alsa_names, alsa_name)
end
j = j + 1
end
j = j + 1
end
for k = 1, #alsa_names, 1 do
device_list[#device_list + 1] = create_device(alsa_names[k], node_names[k], false)
for k = 1, #alsa_names, 1 do
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
dropdown_list_microphone.volume_device_background.volume_device_list.children = device_list
end
)
end
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
local function get_mic_volume()
awful.spawn.easy_async_with_shell(
"./.config/awesome/src/scripts/mic.sh volume",
function(stdout)
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))
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"]))
else
volume_controller:get_children_by_id("mic_volume_margin")[1].icon:set_image(gears.color.recolor_image(icondir .. "microphone-off.svg", color["LightBlue200"]))
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))
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"]))
else
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
@@ -718,75 +733,122 @@ return function(s)
awful.spawn.easy_async_with_shell(
"./.config/awesome/src/scripts/mic.sh mute",
function(stdout)
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].icon:set_image(gears.color.recolor_image(icondir .. "microphone-off.svg", color["LightBlue200"]))
else
get_mic_volume()
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].icon:set_image(gears.color.recolor_image(icondir .. "microphone-off.svg", color["LightBlue200"]))
else
get_mic_volume()
end
end
end
)
end
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,
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(
"get::volume",
function(volume)
volume = tonumber(volume)
local icon = icondir .. "volume"
if volume < 1 then
icon = icon .. "-mute"
volume = tonumber(volume)
local icon = icondir .. "volume"
if volume < 1 then
icon = icon .. "-mute"
elseif volume >= 1 and volume < 34 then
icon = icon .. "-low"
elseif volume >= 34 and volume < 67 then
icon = icon .. "-medium"
elseif volume >= 67 then
icon = icon .. "-high"
elseif volume >= 1 and volume < 34 then
icon = icon .. "-low"
elseif volume >= 34 and volume < 67 then
icon = icon .. "-medium"
elseif volume >= 67 then
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
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(
"get::volume_mute",
function(mute)
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"]))
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"]))
end
end
end
)
-- Set the microphone volume
awesome.connect_signal(
"get::mic_volume",
function(volume)
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"]))
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"]))
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"]))
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"]))
end
end
end
)
-- Toggle container visibility
awesome.connect_signal(
"volume_controller::toggle",
function(scr)
if scr == s then
volume_controller_container.visible = not volume_controller_container.visible
end
if scr == s then
volume_controller_container.visible = not volume_controller_container.visible
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
for index, icon in ipairs(icon_cache) do
for _, icon in ipairs(icon_cache) do
if icon:match(clientName) then
return icon
end
end
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 ioStream = io.open(iconDir .. clientName, "r")
if ioStream ~= nil then

View File

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

View File

@@ -1,7 +1,6 @@
--------------------------------
-- This is the battery widget --
--------------------------------
-- Awesome Libs
local awful = require("awful")
local color = require("src.theme.colors")
@@ -71,23 +70,23 @@ return function()
awful.spawn.easy_async_with_shell(
[[ upower -i $(upower -e | grep BAT) | grep "time to " ]],
function(stdout)
if stdout == nil or stdout == '' then
battery_tooltip:set_text('No Battery Found')
return
if stdout == nil or stdout == '' then
battery_tooltip:set_text('No Battery Found')
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
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
get_battery_info()
@@ -109,92 +108,96 @@ return function()
awful.spawn.easy_async_with_shell(
[[sh -c "upower -i $(upower -e | grep BAT) | grep percentage | awk '{print \$2}' |tr -d '\n%'"]],
function(stdout)
local battery_percentage = tonumber(stdout)
local battery_percentage = tonumber(stdout)
if not battery_percentage then
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()
if not battery_percentage then
return
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
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
Hover_signal(battery_widget, color["Purple200"])
Hover_signal(battery_widget, color["Purple200"], color["Grey900"])
battery_widget:connect_signal(
'button::press',
function()
awful.spawn("xfce4-power-manager-settings")
end
awful.spawn("xfce4-power-manager-settings")
end
)
battery_widget:connect_signal(
"mouse::enter",
function()
get_battery_info()
end
get_battery_info()
end
)
watch(
[[sh -c "upower -i $(upower -e | grep BAT) | grep state | awk '{print \$2}' | tr -d '\n'"]],
5,
function(widget, stdout)
local status = stdout:gsub('%\n', '')
if status == nil or status == '' then
battery_widget.container.battery_layout.spacing = dpi(0)
battery_widget.container.battery_layout.label.visible = false
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")))
local status = stdout:gsub('%\n', '')
if status == nil or status == '' then
battery_widget.container.battery_layout.spacing = dpi(0)
battery_widget.container.battery_layout.label.visible = false
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")))
end
update_battery(status)
end
update_battery(status)
end
)
return battery_widget

View File

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

View File

@@ -39,7 +39,8 @@ return function()
id = "label",
align = "center",
valign = "center",
widget = wibox.widget.textbox
format = "%H:%M",
widget = wibox.widget.textclock
},
id = "clock_layout",
layout = wibox.layout.fixed.horizontal
@@ -57,22 +58,7 @@ return function()
widget = wibox.container.background
}
local set_clock = function()
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"])
Hover_signal(clock_widget, color["Orange200"], color["Grey900"])
return clock_widget
end

View File

@@ -145,21 +145,21 @@ return function(widget, clock_mode)
[[ cat "/proc/stat" | grep '^cpu ' ]],
3,
function(_, stdout)
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")
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")
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_total = total - total_prev
local diff_usage = (1000 * (diff_total - diff_idle) / diff_total + 5) / 10
local diff_idle = idle - idle_prev
local diff_total = total - total_prev
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
idle_prev = idle
collectgarbage("collect")
end
total_prev = total
idle_prev = idle
collectgarbage("collect")
end
)
watch(
@@ -167,53 +167,53 @@ return function(widget, clock_mode)
3,
function(_, stdout)
local temp_icon
local temp_color
local temp_icon
local temp_color
local temp_num = tonumber(stdout:match("%d+"))
if temp_num < 50 then
temp_color = color["Green200"]
temp_icon = icon_dir .. "thermometer-low.svg"
elseif temp_num >= 50 and temp_num < 80 then
temp_color = color["Orange200"]
temp_icon = icon_dir .. "thermometer.svg"
elseif temp_num >= 80 then
temp_color = color["Red200"]
temp_icon = icon_dir .. "thermometer-high.svg"
local temp_num = tonumber(stdout:match("%d+"))
if temp_num < 50 then
temp_color = color["Green200"]
temp_icon = icon_dir .. "thermometer-low.svg"
elseif temp_num >= 50 and temp_num < 80 then
temp_color = color["Orange200"]
temp_icon = icon_dir .. "thermometer.svg"
elseif temp_num >= 80 then
temp_color = color["Red200"]
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
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(
[[ bash -c "cat /proc/cpuinfo | grep "MHz" | awk '{print int($4)}'" ]],
3,
function(_, stdout)
local cpu_freq = {}
local cpu_freq = {}
for value in stdout:gmatch("%d+") do
table.insert(cpu_freq, value)
end
local average = 0
if clock_mode == "average" then
for i = 1, #cpu_freq do
average = average + cpu_freq[i]
for value in stdout:gmatch("%d+") do
table.insert(cpu_freq, value)
end
local average = 0
if clock_mode == "average" then
for i = 1, #cpu_freq do
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
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
)
Hover_signal(cpu_usage_widget, color["Blue200"])
Hover_signal(cpu_clock, color["Purple200"])
Hover_signal(cpu_usage_widget, color["Blue200"], color["Grey900"])
Hover_signal(cpu_clock, color["Purple200"], color["Grey900"])
if widget == "usage" then
return cpu_usage_widget

View File

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

View File

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

View File

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

View File

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

View File

@@ -131,21 +131,21 @@ return function()
awful.spawn.easy_async_with_shell(
[[ iw dev ]] .. interfaces.wlan_interface .. [[ link ]],
function(stdout)
local essid = stdout:match("SSID: (.-)\n") 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 essid = stdout:match("SSID: (.-)\n") 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>"
if healthy then
update_tooltip(message)
else
update_tooltip("You are connected but have no internet" .. message)
end
if healthy then
update_tooltip(message)
else
update_tooltip("You are connected but have no internet" .. message)
end
if reconnect_startup or startup then
notify_connected(essid)
update_reconnect_startup(false)
if reconnect_startup or startup then
notify_connected(essid)
update_reconnect_startup(false)
end
end
end
)
end
@@ -153,20 +153,20 @@ return function()
awful.spawn.easy_async_with_shell(
check_for_internet,
function(stdout)
local icon = "wifi-strength"
if not stdout:match("Connected but no internet") then
if startup or reconnect_startup then
awesome.emit_signal("system::network_connected")
local icon = "wifi-strength"
if not stdout:match("Connected but no internet") then
if startup or reconnect_startup then
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
icon = icon .. '-' .. tostring(strength)
update_wireless_data(true)
else
icon = icon .. "-" .. tostring(strength)
update_wireless_data(false)
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
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
@@ -174,16 +174,16 @@ return function()
awful.spawn.easy_async_with_shell(
[[ awk 'NR==3 {printf "%3.0f", ($3/70)*100}' /proc/net/wireless ]],
function(stdout)
if not tonumber(stdout) then
return
if not tonumber(stdout) then
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
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
@@ -205,26 +205,26 @@ return function()
awful.spawn.easy_async_with_shell(
check_for_internet,
function(stdout)
local icon = "ethernet"
local icon = "ethernet"
if stdout:match("Connected but no internet") then
icon = "no-internet"
update_tooltip(
"No internet"
)
else
update_tooltip("You are connected to:\nEthernet Interface <b>" .. interfaces.lan_interface .. "</b>")
if startup or reconnect_startup then
awesome.emit_signal("system::network_connected")
notify_connected()
update_startup()
if stdout:match("Connected but no internet") then
icon = "no-internet"
update_tooltip(
"No internet"
)
else
update_tooltip("You are connected to:\nEthernet Interface <b>" .. interfaces.lan_interface .. "</b>")
if startup or reconnect_startup then
awesome.emit_signal("system::network_connected")
notify_connected()
update_startup()
end
update_reconnect_startup(false)
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
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
@@ -302,15 +302,15 @@ return function()
print_network_mode
]=],
function(stdout)
local mode = stdout:gsub("%\n", "")
if stdout:match("No internet connected") then
update_disconnected()
elseif stdout:match("wireless") then
update_wireless()
elseif stdout:match("wired") then
update_wired()
local mode = stdout:gsub("%\n", "")
if stdout:match("No internet connected") then
update_disconnected()
elseif stdout:match("wireless") then
update_wireless()
elseif stdout:match("wired") then
update_wired()
end
end
end
)
end
@@ -324,13 +324,13 @@ return function()
}
-- Signals
Hover_signal(network_widget, color["Red200"])
Hover_signal(network_widget, color["Red200"], color["Grey900"])
network_widget:connect_signal(
"button::press",
function()
awful.spawn("gnome-control-center wlan")
end
awful.spawn("gnome-control-center wlan")
end
)
return network_widget

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,3 +1,8 @@
---------------------------------
-- This is the tasklist widget --
---------------------------------
-- Awesome Libs
local awful = require('awful')
local wibox = require('wibox')
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))
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 text == nil or text == '' then
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:set_spacing(dpi(6))
--#region Hover_signal
local old_wibox, old_cursor, old_bg
task_widget:connect_signal(
"mouse::enter",
function()
old_bg = task_widget.bg
if object == client.focus then
task_widget.bg = '#dddddddd'
else
task_widget.bg = '#3A475Cdd'
old_bg = task_widget.bg
if object == client.focus then
task_widget.bg = '#dddddddd'
else
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
local w = mouse.current_wibox
if w then
old_cursor, old_wibox = w.cursor, w
w.cursor = "hand1"
end
end
)
task_widget:connect_signal(
"button::press",
function()
if object == client.focus then
task_widget.bg = "#ffffffaa"
else
task_widget.bg = '#3A475Caa'
if object == client.focus then
task_widget.bg = "#ffffffaa"
else
task_widget.bg = '#3A475Caa'
end
end
end
)
task_widget:connect_signal(
"button::release",
function()
if object == client.focus then
task_widget.bg = "#ffffffdd"
else
task_widget.bg = '#3A475Cdd'
if object == client.focus then
task_widget.bg = "#ffffffdd"
else
task_widget.bg = '#3A475Cdd'
end
end
end
)
task_widget:connect_signal(
"mouse::leave",
function()
task_widget.bg = old_bg
if old_wibox then
old_wibox.cursor = old_cursor
old_wibox = nil
task_widget.bg = old_bg
if old_wibox then
old_wibox.cursor = old_cursor
old_wibox = nil
end
end
end
)
--#endregion
end
return widget
end
local tasklist = function(s)
return function(s)
return awful.widget.tasklist(
s,
awful.widget.tasklist.filter.currenttags,
@@ -175,24 +183,24 @@ local tasklist = function(s)
{},
1,
function(c)
if c == client.focus then
c.minimized = true
else
c.minimized = false
if not c:isvisible() and c.first_tag then
c.first_tag:view_only()
if c == client.focus then
c.minimized = true
else
c.minimized = false
if not c:isvisible() and c.first_tag then
c.first_tag:view_only()
end
c:emit_signal('request::activate')
c:raise()
end
c:emit_signal('request::activate')
c:raise()
end
end
),
awful.button(
{},
3,
function(c)
c:kill()
end
c:kill()
end
)
),
{},
@@ -200,5 +208,3 @@ local tasklist = function(s)
wibox.layout.fixed.horizontal()
)
end
return tasklist