systray, dock, icon_handler some major revision

This commit is contained in:
Rene Kievits
2022-03-06 20:56:06 +01:00
parent 39179f06b7
commit dae28d55eb
29 changed files with 422 additions and 255 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1008 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 930 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 292 KiB

After

Width:  |  Height:  |  Size: 245 KiB

View File

@@ -120,6 +120,7 @@ return function (s)
}
local calendar_osd_container = awful.popup{
screen = s,
widget = wibox.container.background,
ontop = true,
bg = color.color["Grey900"],
@@ -178,4 +179,4 @@ return function (s)
end
end
)
end
end

View File

@@ -324,4 +324,4 @@ client.connect_signal(
awful.titlebar.hide(c, 'bottom')
end
end
)
)

View File

@@ -14,8 +14,8 @@ Theme = { }
dofile(Theme_path .. "theme_variables.lua")
dofile(Theme_path .. "layouts.lua")
Theme.wallpaper = Theme_path .. "assets/wallpaper.png"
--Theme.wallpaper = Theme_path .. "assets/space.jpg"
Theme.awesome_icon = Theme_path .. "assets/icons/icon.png"
Theme.awesome_subicon = Theme_path .. "assets/icons/icon.png"
return Theme
return Theme

View File

@@ -1,13 +1,23 @@
------------------------------
-- This is the audio widget --
------------------------------
local naughty = require("naughty")
local awful = require("awful")
-----------------------------------------------------
-- Helper to get icons from a program/program name --
-----------------------------------------------------
function Get_icon(theme, c)
-- tries to find a matching file name in /usr/share/icons/THEME/RESOLUTION/apps/ and if not found tried with first letter
-- as uppercase, this should get almost all icons to work with the papirus theme atleast
-- TODO: try with more icon themes
function Get_icon(theme, c, is_steam)
if theme and c then
local clientName
clientName = string.lower(c.class) .. ".svg"
-- TODO: Access steamdb api to fetch the clienticon if there is no icon found in this theme
if is_steam then
clientName = "steam_icon_" .. tostring(c) .. ".svg"
else
if type(c) == type("") then
clientName = string.lower(c) .. ".svg"
else
clientName = string.lower(c.class) .. ".svg"
end
end
local resolutions = {"128x128", "96x96", "64x64", "48x48", "42x42", "32x32", "24x24", "16x16"}
for i, res in ipairs(resolutions) do
local iconDir = "/usr/share/icons/" .. theme .. "/" .. res .."/apps/"
@@ -15,27 +25,29 @@ function Get_icon(theme, c)
if ioStream ~= nil then
return iconDir .. clientName
else
return c.icon
clientName = clientName:gsub("^%l", string.upper)
iconDir = "/usr/share/icons/" .. theme .. "/" .. res .."/apps/"
ioStream = io.open(iconDir .. clientName, "r")
if ioStream ~= nil then
return iconDir .. clientName
elseif type(c) ~= type("") then
local naughty = require("naughty")
if pcall(
function ()
if c:Get_icon(1) then
error("icon error")
else
return c:Get_icon(1)
end
end
) then
return nil
end
return "/usr/share/icons/Papirus-Dark/128x128/apps/Zoom.svg"
end
end
end
end
return c:Get_icon(1)
return nil
end
function Get_icon_by_class_name(theme, c)
if theme and c then
local c_name = string.lower(c) .. ".svg"
local resolutions = {"128x128", "96x96", "64x64", "48x48", "42x42", "32x32", "24x24", "16x16"}
for i, res in ipairs(resolutions) do
local iconDir = "/usr/share/icons/" .. theme .. "/" .. res .."/apps/"
local ioStream = io.open(iconDir .. c_name, "r")
if ioStream ~= nil then
return iconDir .. c_name
end
end
end
end
function Get_icon_by_desktop(theme, c)
end

View File

@@ -53,7 +53,7 @@ return function ()
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end,
widget = wibox.widget.background
widget = wibox.container.background
}
local get_volume = function ()
@@ -120,4 +120,4 @@ return function ()
check_muted()
return audio_widget
end
end

View File

@@ -56,7 +56,7 @@ return function ()
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end,
widget = wibox.widget.background
widget = wibox.container.background
}
local battery_tooltip = awful.tooltip{
@@ -198,4 +198,4 @@ return function ()
)
return battery_widget
end
end

View File

@@ -37,7 +37,7 @@ return function ()
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end,
widget = wibox.widget.background
widget = wibox.container.background
}
local bluetooth_tooltip = awful.tooltip{
@@ -123,4 +123,4 @@ return function ()
get_bluetooth_information()
return bluetooth_widget
end
end

View File

@@ -54,7 +54,7 @@ return function ()
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end,
widget = wibox.widget.background
widget = wibox.container.background
}
local set_clock = function ()
@@ -75,4 +75,4 @@ return function ()
hover_signal(clock_widget, color.color["Orange200"])
return clock_widget
end
end

View File

@@ -54,7 +54,7 @@ return function ()
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end,
widget = wibox.widget.background
widget = wibox.container.background
}
local set_date = function ()
@@ -89,4 +89,4 @@ return function ()
)
return date_widget
end
end

View File

@@ -13,7 +13,7 @@ require("main.signals")
-- Icon directory path
local icondir = awful.util.getdir("config") .. "theme/crylia/assets/icons/kblayout/"
return function ()
return function (s)
local kblayout_widget = wibox.widget{
{
{
@@ -52,7 +52,7 @@ return function ()
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end,
widget = wibox.widget.background
widget = wibox.container.background
}
local layout = "";
@@ -246,6 +246,7 @@ return function ()
end
local kb_menu_widget = awful.popup{
screen = s,
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end,
@@ -335,4 +336,4 @@ return function ()
get_kblayout()
kb_menu_widget.visible = false
return kblayout_widget
end
end

View File

@@ -66,7 +66,7 @@ return function ()
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end,
widget = wibox.widget.background
widget = wibox.container.background
}
local network_tooltip = awful.tooltip{
@@ -334,4 +334,4 @@ return function ()
)
return network_widget
end
end

View File

@@ -47,7 +47,7 @@ return function ()
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, height, width, 5)
end,
widget = wibox.widget.background
widget = wibox.container.background
}
-- Signals
@@ -61,4 +61,4 @@ return function ()
)
return power_widget
end
end

View File

@@ -16,14 +16,14 @@ return function (s)
local systray = wibox.widget{
{
{
wibox.widget.systray,
wibox.widget.systray(),
top = dpi(6),
bottom = dpi(6),
left = dpi(6),
right = dpi(6),
widget = wibox.container.margin
widget = wibox.container.margin,
id = 'st'
},
width = dpi(100),
strategy = "exact",
layout = wibox.container.constraint,
id = "container"
@@ -36,6 +36,6 @@ return function (s)
}
-- Signals
hover_signal(systray.container, color.color["Red200"])
systray.container.st.widget:set_base_size(dpi(20))
return systray
end
end

View File

@@ -60,7 +60,7 @@ local list_update = function (widget, buttons, label, data, objects)
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end,
widget = wibox.widget.background
widget = wibox.container.background
}
local function create_buttons(buttons, object)
@@ -235,12 +235,11 @@ local tag_list = function (s)
awful.tag.viewprev(t.screen)
end
)
)
,
),
{},
list_update,
wibox.layout.fixed.horizontal()
)
end
return tag_list
return tag_list

View File

@@ -6,7 +6,9 @@ local color = require('theme.crylia.colors')
local list_update = function (widget, buttons, label, data, objects)
widget:reset()
local count
for i, object in ipairs(objects) do
count = i
local task_widget = wibox.widget{
{
{
@@ -48,7 +50,7 @@ local list_update = function (widget, buttons, label, data, objects)
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end,
widget = wibox.widget.background
widget = wibox.container.background
}
local task_tool_tip = awful.tooltip{
@@ -81,11 +83,9 @@ local list_update = function (widget, buttons, label, data, objects)
return btns
end
end
task_widget:buttons(create_buttons(buttons, object))
local text, bg, bg_image, icon, args = 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)
@@ -109,7 +109,6 @@ local list_update = function (widget, buttons, label, data, objects)
task_widget.container.layout_it.margin.layout_icon.icon:set_image(Get_icon("Papirus-Dark", object))
widget:add(task_widget)
widget:set_spacing(dpi(6))
local old_wibox, old_cursor, old_bg
task_widget:connect_signal(
"mouse::enter",
@@ -161,16 +160,10 @@ local list_update = function (widget, buttons, label, data, objects)
end
)
end
if (widget.children and #widget.children or 0) == 0 then
awesome.emit_signal("hide_centerbar", false)
else
awesome.emit_signal("hide_centerbar", true)
end
return widget
end
return function(s)
local tasklist = function(s)
return awful.widget.tasklist(
s,
awful.widget.tasklist.filter.currenttags,
@@ -203,4 +196,6 @@ return function(s)
list_update,
wibox.layout.fixed.horizontal()
)
end
end
return tasklist