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

@@ -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