fix dock autohide, fix titlebar beeing empty, added toggle floating(stays after reboot)

This commit is contained in:
Kievits Rene
2022-04-20 21:12:23 +02:00
parent b11fa86729
commit 21519a9460
8 changed files with 128 additions and 27 deletions

View File

@@ -181,33 +181,61 @@ return function(screen, programs)
}
local function check_for_dock_hide(s)
if #s:get_clients() < 1 then
local naughty = require("naughty")
if #s.selected_tag:clients() < 1 then
dock.visible = true
return
end
if s == mouse.screen then
if mouse.current_widget then
--[[ if mouse.current_widget then
if tostring(mouse.current_widget):match("fake") then
dock.visible = true
return
end
end ]]
local visible = false
for j, c in ipairs(s.selected_tag:clients()) do
--naughty.notify({ title = tostring(c.class) })
if c.maximized or c.fullscreen then
dock.visible = false
return
end
for j, c in ipairs(screen.selected_tag:clients()) do
local y = c:geometry().y
local h = c.height
if (y + h) >= screen.geometry.height - user_vars.dock_icon_size - 35 then
if (y + h) >= s.geometry.height - user_vars.dock_icon_size - 35 then
dock.visible = false
return
else
dock.visible = true
return
end
--[[ if visible then
dock.visible = visible
return
end ]]
end
else
dock.visible = false
end
end
local dock_intelligent_hide = gears.timer {
timeout = 1,
autostart = true,
call_now = true,
callback = function()
check_for_dock_hide(screen)
end
}
fakedock:connect_signal(
"mouse::enter",
function()
dock_intelligent_hide:stop()
dock.visible = true
end
)
client.connect_signal(
"manage",
function()
@@ -244,15 +272,6 @@ return function(screen, programs)
end
)
local dock_intelligent_hide = gears.timer {
timeout = 1,
autostart = true,
call_now = true,
callback = function()
check_for_dock_hide(screen)
end
}
dock:connect_signal(
"mouse::enter",
function()

View File

@@ -2,6 +2,7 @@
local gears = require("gears")
local awful = require("awful")
local hotkeys_popup = require("awful.hotkeys_popup")
local ruled = require("ruled")
local modkey = user_vars.modkey
@@ -309,5 +310,75 @@ return gears.table.join(
awesome.emit_signal("kblayout::toggle")
end,
{ description = "Toggle keyboard layout", group = "System" }
),
awful.key(
{ modkey },
"#22",
function()
awful.spawn.easy_async_with_shell(
[[xprop | grep WM_CLASS | awk '{gsub(/"/, "", $4); print $4}']],
function(stdout)
if stdout then
ruled.client.append_rule {
rule = { class = stdout:gsub("\n", "") },
properties = {
floating = true
},
}
awful.spawn.easy_async_with_shell(
"cat ~/.config/awesome/src/assets/rules.txt",
function(stdout2)
for class in stdout2:gmatch("%a+") do
if class:match(stdout:gsub("\n", "")) then
return
end
end
awful.spawn.with_shell("echo -n '" .. stdout:gsub("\n", "") .. ";' >> ~/.config/awesome/src/assets/rules.txt")
local c = mouse.screen.selected_tag:clients()
for j, client in ipairs(c) do
if client.class:match(stdout:gsub("\n", "")) then
client.floating = true
end
end
end
)
end
end
)
end
),
awful.key(
{ modkey, "Shift" },
"#22",
function()
awful.spawn.easy_async_with_shell(
[[xprop | grep WM_CLASS | awk '{gsub(/"/, "", $4); print $4}']],
function(stdout)
if stdout then
ruled.client.append_rule {
rule = { class = stdout:gsub("\n", "") },
properties = {
floating = false
},
}
awful.spawn.easy_async_with_shell(
[[
REMOVE="]] .. stdout:gsub("\n", "") .. [[;"
STR=$(cat ~/.config/awesome/src/assets/rules.txt)
echo -n ${STR//$REMOVE/} > ~/.config/awesome/src/assets/rules.txt
]],
function(stdout2)
local c = mouse.screen.selected_tag:clients()
for j, client in ipairs(c) do
if client.class:match(stdout:gsub("\n", "")) then
client.floating = false
end
end
end
)
end
end
)
end
)
)

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 245 KiB

After

Width:  |  Height:  |  Size: 292 KiB

View File

@@ -5,6 +5,7 @@
-- Awesome Libs
local awful = require("awful")
local beautiful = require("beautiful")
local ruled = require("ruled")
awful.rules.rules = {
{
@@ -48,3 +49,17 @@ awful.rules.rules = {
properties = { titlebars_enabled = true }
}
}
awful.spawn.easy_async_with_shell(
"cat ~/.config/awesome/src/assets/rules.txt",
function(stdout)
for class in stdout:gmatch("%a+") do
ruled.client.append_rule {
rule = { class = class },
properties = {
floating = true
},
}
end
end
)

View File

@@ -236,15 +236,11 @@ client.connect_signal(
client.connect_signal(
'property::floating',
function(c)
if c.floating and not c.maximized then
if c.class == "Steam" then
awful.titlebar.hide(c, 'left')
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.show(c, 'left')
end
else
awful.titlebar.hide(c, 'left')
awful.titlebar.hide(c, 'right')

View File

@@ -83,8 +83,8 @@ user_vars = {
{ "Thunderbird", "thunderbird", "Thunderbird" },
{ "Mattermost", "mattermost-desktop", "Mattermost" },
{ "Blender", "blender", "Blender" },
{ "Steam", "steam", "Steams" },
{ "FreeCAD", "freecad", "Freecad" },
{ "Steam", "steam", "Steam" },
{ "FreeCAD", "freecad", "FreeCAD" },
{ "Nemo", "nemo", "Dateien" },
{ "Paradox Launcher", "394360", "Hearts of Iron 4", true }
}

View File

@@ -151,6 +151,6 @@ show-all-xerrors = true;
wintypes: {
tooltip = { fade = true; focus = false; };
normal = { shadow = true; blur-background = false; };
dock = { shadow = false; blur-background = false;};
dock = { shadow = true; blur-background = false;};
desktop = { shadow = true; blur-background = false; };
};