systray, dock, icon_handler some major revision
This commit is contained in:
@@ -11,6 +11,7 @@ local wibox = require("wibox")
|
||||
return function (s, widget)
|
||||
|
||||
local top_center = awful.popup{
|
||||
screen = s,
|
||||
widget = wibox.container.background,
|
||||
ontop = false,
|
||||
bg = colors.color["Grey900"],
|
||||
@@ -21,7 +22,7 @@ return function (s, widget)
|
||||
gears.shape.rounded_rect(cr, width, height, 10)
|
||||
end
|
||||
}
|
||||
|
||||
local naught = require("naughty")
|
||||
top_center:setup{
|
||||
nil,
|
||||
{
|
||||
@@ -34,10 +35,48 @@ return function (s, widget)
|
||||
layout = wibox.layout.align.horizontal
|
||||
}
|
||||
|
||||
awesome.connect_signal(
|
||||
"hide_centerbar",
|
||||
function (hide)
|
||||
top_center.visible = hide
|
||||
client.connect_signal(
|
||||
"manage",
|
||||
function (c)
|
||||
if #s:get_clients() < 1 then
|
||||
top_center.visible = false
|
||||
else
|
||||
top_center.visible = true
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
client.connect_signal(
|
||||
"unmanage",
|
||||
function (c)
|
||||
if #s:get_clients() < 1 then
|
||||
top_center.visible = false
|
||||
else
|
||||
top_center.visible = true
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
client.connect_signal(
|
||||
"tag::switched",
|
||||
function (c)
|
||||
if #s:get_clients() < 1 then
|
||||
top_center.visible = false
|
||||
else
|
||||
top_center.visible = true
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
"refresh",
|
||||
function (c)
|
||||
if #s:get_clients() < 1 then
|
||||
top_center.visible = false
|
||||
else
|
||||
top_center.visible = true
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
end
|
||||
|
||||
@@ -10,41 +10,8 @@ local wibox = require("wibox")
|
||||
|
||||
return function(s, programs)
|
||||
|
||||
local function create_dock_element (program, name, size)
|
||||
|
||||
local function create_indicator()
|
||||
local color = ""
|
||||
local indicators = {layout = wibox.layout.flex.horizontal}
|
||||
local t = 2
|
||||
local naughty = require("naughty")
|
||||
for i, indicator_screen in ipairs(screen) do
|
||||
for j, indicator_client in ipairs(indicator_screen.clients) do
|
||||
if indicator_client.class == program then
|
||||
if indicator_client.maximized then
|
||||
color = colors.color["Green200"]
|
||||
elseif indicator_client.fullscreen then
|
||||
color = colors.color["Red200"]
|
||||
elseif indicator_client.focus then
|
||||
color = colors.color["Blue200"]
|
||||
elseif indicator_client.minimised then
|
||||
color = colors.color["Pink200"]
|
||||
else
|
||||
color = colors.color["White"]
|
||||
end
|
||||
|
||||
local indicator = wibox.widget{
|
||||
widget = wibox.container.background,
|
||||
shape = gears.shape.circle,
|
||||
forced_height = dpi(5),
|
||||
bg = color
|
||||
}
|
||||
indicators[t] = indicator
|
||||
t = t + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
return indicators
|
||||
end
|
||||
local function create_dock_element (program, name, is_steam, size)
|
||||
is_steam = is_steam or false
|
||||
|
||||
local dock_element = wibox.widget{
|
||||
{
|
||||
@@ -54,10 +21,14 @@ return function(s, programs)
|
||||
resize = true,
|
||||
forced_width = size,
|
||||
forced_height = size,
|
||||
image = Get_icon_by_class_name("Papirus-Dark",program),
|
||||
image = Get_icon("Papirus-Dark",program, is_steam),
|
||||
widget = wibox.widget.imagebox
|
||||
},
|
||||
create_indicator(),
|
||||
{
|
||||
widget = nil,
|
||||
layout = wibox.layout.align.horizontal,
|
||||
id = "indicator"
|
||||
},
|
||||
layout = wibox.layout.align.vertical,
|
||||
id = "dock_layout"
|
||||
},
|
||||
@@ -81,17 +52,57 @@ return function(s, programs)
|
||||
dock_element:connect_signal(
|
||||
"button::press",
|
||||
function ()
|
||||
awful.spawn(program)
|
||||
if is_steam then
|
||||
awful.spawn("steam steam://rungameid/" .. program)
|
||||
else
|
||||
awful.spawn(program)
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
local dock_tooltip = awful.tooltip{
|
||||
awful.tooltip {
|
||||
objects = {dock_element},
|
||||
text = name,
|
||||
mode = "outside",
|
||||
preferred_alignments = "middle",
|
||||
margins = dpi(10)
|
||||
}
|
||||
|
||||
local function create_indicator()
|
||||
local color = ""
|
||||
local indicators
|
||||
local t = 1
|
||||
for indicator_screen in screen do
|
||||
for j,indicator_client in ipairs(indicator_screen.get_clients()) do
|
||||
if indicator_client.class == program then
|
||||
if indicator_client.maximized then
|
||||
color = colors.color["Green200"]
|
||||
elseif indicator_client.fullscreen then
|
||||
color = colors.color["Red200"]
|
||||
elseif indicator_client.focus then
|
||||
color = colors.color["Blue200"]
|
||||
elseif indicator_client.minimised then
|
||||
color = colors.color["Pink200"]
|
||||
else
|
||||
color = colors.color["White"]
|
||||
end
|
||||
|
||||
local indicator = wibox.widget{
|
||||
widget = wibox.container.background,
|
||||
shape = gears.shape.circle,
|
||||
forced_height = dpi(50),
|
||||
bg = color
|
||||
}
|
||||
indicators.add(indicator)
|
||||
t = t + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
return indicators
|
||||
end
|
||||
|
||||
dock_element.background.margin.dock_layout.indicator = create_indicator()
|
||||
|
||||
return dock_element
|
||||
end
|
||||
|
||||
@@ -113,7 +124,7 @@ return function(s, programs)
|
||||
local dock_elements = {layout = wibox.layout.fixed.horizontal}
|
||||
|
||||
for i, p in ipairs(pr) do
|
||||
dock_elements[i] = create_dock_element(p[1], p[2], user_vars.vars.dock_icon_size)
|
||||
dock_elements[i] = create_dock_element(p[1], p[2], p[3], user_vars.vars.dock_icon_size)
|
||||
end
|
||||
|
||||
return dock_elements
|
||||
@@ -123,21 +134,21 @@ return function(s, programs)
|
||||
get_dock_elements(programs),
|
||||
layout = wibox.layout.fixed.vertical
|
||||
}
|
||||
|
||||
-- TODO: This function runs only every second, it can be optimized by
|
||||
-- calling it every time the mouse is over the dock, a client changes it states ...
|
||||
-- but im too lazy rn
|
||||
local naughty = require("naughty")
|
||||
--[[ TODO: This function runs every 0.1 second, it can be optimized by
|
||||
calling it every time the mouse is over the dock, a client changes it states ...
|
||||
but im too lazy rn ]]
|
||||
local function check_for_dock_hide()
|
||||
for i, screen in ipairs(screen) do
|
||||
local mx, my = mouse.coords().x * 100 / screen.geometry.width, mouse.coords().y * 100 / screen.geometry.height
|
||||
if ((mx > 30) and (mx < 70)) and (my > 95) then
|
||||
for s in screen do
|
||||
local mx, my = mouse.coords().x * 100 / s.geometry.width, mouse.coords().y * 100 / s.geometry.height
|
||||
if ((mx > 30) and (mx < 70)) and (my > 99) then
|
||||
dock.visible = true
|
||||
break;
|
||||
end
|
||||
for j, c in ipairs(screen.clients) do
|
||||
for j,c in ipairs(s.get_clients()) do
|
||||
local y = c:geometry().y
|
||||
local h = c.height
|
||||
if (y + h) >= screen.geometry.height - user_vars.vars.dock_icon_size - 35 then
|
||||
if (y + h) >= s.geometry.height - user_vars.vars.dock_icon_size - 35 then
|
||||
dock.visible = false
|
||||
break;
|
||||
else
|
||||
@@ -146,11 +157,11 @@ return function(s, programs)
|
||||
end
|
||||
end
|
||||
end
|
||||
local naughty = require("naughty")
|
||||
awesome.connect_signal(
|
||||
|
||||
client.connect_signal(
|
||||
"manage",
|
||||
function ()
|
||||
naughty.notify({title = "hi"})
|
||||
check_for_dock_hide()
|
||||
end
|
||||
)
|
||||
|
||||
@@ -162,4 +173,18 @@ return function(s, programs)
|
||||
check_for_dock_hide()
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
dock:connect_signal(
|
||||
"mouse::enter",
|
||||
function ()
|
||||
dock_intelligent_hide:stop()
|
||||
end
|
||||
)
|
||||
|
||||
dock:connect_signal(
|
||||
"mouse::leave",
|
||||
function ()
|
||||
dock_intelligent_hide:again()
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
@@ -5,10 +5,14 @@
|
||||
local awful = require("awful")
|
||||
|
||||
awful.screen.connect_for_each_screen(
|
||||
-- For each screen this function is called once
|
||||
-- If you want to change the modules per screen use the indices
|
||||
-- e.g. 1 would be the primary screen and 2 the secondary screen.
|
||||
function (s)
|
||||
-- Modules
|
||||
|
||||
require("theme.crylia.modules.powermenu")(s)
|
||||
require("theme.crylia.modules.calendar_osd")(s)
|
||||
-- TODO: rewrite calendar osd, maybe write an own inplementation
|
||||
-- require("theme.crylia.modules.calendar_osd")(s)
|
||||
require("theme.crylia.modules.volume_osd")(s)
|
||||
require("theme.crylia.modules.brightness_osd")(s)
|
||||
require("theme.crylia.modules.titlebar")
|
||||
@@ -22,15 +26,31 @@ awful.screen.connect_for_each_screen(
|
||||
s.bluetooth = require("theme.crylia.widgets.bluetooth")()
|
||||
s.layoutlist = require("theme.crylia.widgets.layout_list")()
|
||||
s.powerbutton = require("theme.crylia.widgets.power")()
|
||||
s.kblayout = require("theme.crylia.widgets.kblayout")()
|
||||
s.kblayout = require("theme.crylia.widgets.kblayout")(s)
|
||||
s.taglist = require("theme.crylia.widgets.taglist")(s)
|
||||
s.tasklist = require("theme.crylia.widgets.tasklist")(s)
|
||||
s.systray = require("theme.crylia.widgets.systray")(s)
|
||||
|
||||
-- Add more of these if statements if you want to change
|
||||
-- the modules/widgets per screen.
|
||||
-- uncomment this example and dont forget to remove/comment the other code below
|
||||
--[[ if s.index == 1 then
|
||||
require("crylia_bar.left_bar")(s, {s.layoutlist, s.systray, s.taglist})
|
||||
require("crylia_bar.center_bar")(s, s.tasklist)
|
||||
require("crylia_bar.right_bar")(s, {s.date, s.clock,s.powerbutton})
|
||||
require("crylia_bar.dock")(s, user_vars.vars.dock_programs)
|
||||
end ]]
|
||||
|
||||
--[[ if s.index == 2 then
|
||||
require("crylia_bar.left_bar")(s, {s.layoutlist, s.systray, s.taglist})
|
||||
require("crylia_bar.center_bar")(s, s.tasklist)
|
||||
require("crylia_bar.right_bar")(s, {s.battery, s.network, s.bluetooth, s.audio, s.kblayout, s.date, s.clock,s.powerbutton})
|
||||
end ]]
|
||||
-- Bars
|
||||
require("crylia_bar.left_bar")(s, {s.layoutlist, s.systray, s.taglist})
|
||||
require("crylia_bar.center_bar")(s, s.tasklist)
|
||||
require("crylia_bar.right_bar")(s, {s.battery, s.network, s.bluetooth, s.audio, s.kblayout, s.date, s.clock,s.powerbutton})
|
||||
require("crylia_bar.dock")(s, user_vars.vars.dock_programs)
|
||||
|
||||
end
|
||||
)
|
||||
|
||||
@@ -11,6 +11,7 @@ local wibox = require("wibox")
|
||||
return function (s, widgets)
|
||||
|
||||
local top_left = awful.popup{
|
||||
screen = s,
|
||||
widget = wibox.container.background,
|
||||
ontop = false,
|
||||
bg = colors.color["Grey900"],
|
||||
@@ -50,4 +51,4 @@ return function (s, widgets)
|
||||
nil,
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user