Awesome fixes

This commit is contained in:
Thomas Avé 2023-05-21 00:35:23 +02:00
parent 994f1f72ef
commit b848f94c8f
3 changed files with 45 additions and 23 deletions

View File

@ -202,10 +202,10 @@ keys.globalkeys = gears.table.join(
-- Brightness -- Brightness
awful.key({ }, "XF86MonBrightnessDown", function () awful.key({ }, "XF86MonBrightnessDown", function ()
awful.util.spawn("xbacklight -dec 15") end), awful.spawn("xbacklight -dec 15") end),
awful.key({ }, "XF86MonBrightnessUp", function () awful.key({ }, "XF86MonBrightnessUp", function ()
awful.util.spawn("xbacklight -inc 15") end), awful.spawn("xbacklight -inc 15") end),
-- ALSA volume control -- ALSA volume control
awful.key({}, "XF86AudioRaiseVolume", awful.key({}, "XF86AudioRaiseVolume",
@ -266,7 +266,7 @@ keys.globalkeys = gears.table.join(
-- Screenshot on prtscn using scrot -- Screenshot on prtscn using scrot
awful.key({}, "Print", awful.key({}, "Print",
function() function()
awful.util.spawn(apps.screenshot, false) awful.spawn(apps.screenshot, false)
end end
), ),
@ -284,7 +284,7 @@ keys.globalkeys = gears.table.join(
awful.key({modkey}, "Escape", awful.key({modkey}, "Escape",
function() function()
-- emit signal to show the exit screen -- emit signal to show the exit screen
awful.util.spawn("rofi -show power-menu -modi power-menu:" .. os.getenv("XDG_CONFIG_HOME") .. "/awesome/scripts/rofi-power-menu") awful.spawn("rofi -show power-menu -modi power-menu:" .. os.getenv("XDG_CONFIG_HOME") .. "/awesome/scripts/rofi-power-menu")
end, end,
{description = "toggle exit screen", group = "hotkeys"} {description = "toggle exit screen", group = "hotkeys"}
), ),
@ -292,14 +292,14 @@ keys.globalkeys = gears.table.join(
awful.key({}, "XF86PowerOff", awful.key({}, "XF86PowerOff",
function() function()
-- emit signal to show the exit screen -- emit signal to show the exit screen
awful.util.spawn("rofi -show power-menu -modi power-menu:~/.config/awesome/scripts/rofi-power-menu") awful.spawn("rofi -show power-menu -modi power-menu:~/.config/awesome/scripts/rofi-power-menu")
end, end,
{description = "toggle exit screen", group = "hotkeys"} {description = "toggle exit screen", group = "hotkeys"}
), ),
awful.key({}, "XF86Calculator", awful.key({}, "XF86Calculator",
function() function()
awful.util.spawn("rofi -show calc -modi calc -no-show-match -no-sort -calc-command \"echo -n '{result}' | xsel --clipboard\"") awful.spawn("rofi -show calc -modi calc -no-show-match -no-sort -calc-command \"echo -n '{result}' | xsel --clipboard\"")
end, end,
{description = "Launch the calculator", group = "hotkeys"} {description = "Launch the calculator", group = "hotkeys"}
), ),

View File

@ -79,21 +79,6 @@ awful.layout.layouts = {
awful.layout.suit.tile.top, awful.layout.suit.tile.top,
} }
-- Signal function to execute when a new client appears.
client.connect_signal("manage", function (c)
-- Set the window as a slave (put it at the end of others instead of setting it as master)
if not awesome.startup then
awful.client.setslave(c)
end
if awesome.startup and not c.size_hints.user_position and not c.size_hints.program_position then
-- Prevent clients from being unreachable after screen count changes.
awful.placement.no_offscreen(c)
end
gears.timer.delayed_call(function() awful.placement.centered(mouse, {parent=c}) end)
end)
-- =================================================================== -- ===================================================================
-- Client Focusing -- Client Focusing
-- =================================================================== -- ===================================================================
@ -107,6 +92,27 @@ client.connect_signal("mouse::enter", function(c)
c:emit_signal("request::activate", "mouse_enter", {raise = false}) c:emit_signal("request::activate", "mouse_enter", {raise = false})
end) end)
-- Signal function to execute when a new client appears.
client.connect_signal("manage", function (c)
-- Set the window as a slave (put it at the end of others instead of setting it as master)
if not awesome.startup then
awful.client.setslave(c)
end
if awesome.startup and not c.size_hints.user_position and not c.size_hints.program_position then
-- Prevent clients from being unreachable after screen count changes.
awful.placement.no_offscreen(c)
end
gears.timer.delayed_call(function()
local geometry = c:geometry()
local x = geometry.x + geometry.width/2
local y = geometry.y + geometry.height/2
mouse.coords({x = x, y = y}, true)
end)
end)
-- =================================================================== -- ===================================================================
-- Screen Change Functions (ie multi monitor) -- Screen Change Functions (ie multi monitor)
-- =================================================================== -- ===================================================================
@ -134,6 +140,17 @@ require("awesomewm-vim-tmux-navigator") {
experimental = true experimental = true
} }
local function move_mouse_onto_focused_client()
local c = client.focus
if c then
local geometry = c:geometry()
local x = geometry.x + geometry.width/2
local y = geometry.y + geometry.height/2
mouse.coords({x = x, y = y}, true)
end
end
client.connect_signal("property::maximized", function(focused) client.connect_signal("property::maximized", function(focused)
local hide = focused.maximized or focused.fullscreen local hide = focused.maximized or focused.fullscreen
for i, c in ipairs(client.get()) do for i, c in ipairs(client.get()) do
@ -162,3 +179,6 @@ end)
client.connect_signal("unfocus", function(c) client.connect_signal("unfocus", function(c)
c.border_color = beautiful.border_normal c.border_color = beautiful.border_normal
end) end)
client.connect_signal("focus", move_mouse_onto_focused_client)
client.connect_signal("swapped", move_mouse_onto_focused_client)

View File

@ -62,8 +62,10 @@ local function list_update(w, buttons, label, _, objects)
local static_length = 16 * count local static_length = 16 * count
local total_text_length = 0 local total_text_length = 0
for _, o in ipairs(objects) do for _, o in ipairs(objects) do
if o.name then
total_text_length = total_text_length + o.name:len() total_text_length = total_text_length + o.name:len()
end end
end
local truncate = (total_text_length + static_length) > 170 local truncate = (total_text_length + static_length) > 170
for i, o in ipairs(objects) do for i, o in ipairs(objects) do
@ -198,7 +200,7 @@ local filter = function(c, _)
if t.selected then if t.selected then
local ctags = c:tags() local ctags = c:tags()
for _, v in ipairs(ctags) do for _, v in ipairs(ctags) do
if v == t and c.screen == client.focus.screen then if v == t and client.focus and c.screen == client.focus.screen then
return true return true
end end
end end