From 13df3ee87a2bdf93c1e5806bffd10ec703e299af Mon Sep 17 00:00:00 2001 From: elenapan Date: Fri, 27 Mar 2020 02:17:28 +0200 Subject: [PATCH] Add signal to automatically raise clients when focused --- config/awesome/elemental/window_switcher.lua | 8 ------- config/awesome/helpers.lua | 2 -- config/awesome/keys.lua | 23 ++------------------ config/awesome/noodle/desktop_control.lua | 1 - config/awesome/noodle/minimal_tasklist.lua | 1 - config/awesome/rc.lua | 4 +++- 6 files changed, 5 insertions(+), 34 deletions(-) diff --git a/config/awesome/elemental/window_switcher.lua b/config/awesome/elemental/window_switcher.lua index b104ce9..6ac9f4e 100644 --- a/config/awesome/elemental/window_switcher.lua +++ b/config/awesome/elemental/window_switcher.lua @@ -148,7 +148,6 @@ local function window_switcher_hide() -- Add currently focused client to history if client.focus then awful.client.focus.history.add(client.focus) - client.focus:raise() end -- Resume recording focus history awful.client.focus.history.enable_tracking() @@ -196,15 +195,11 @@ local unminimize = function() -- Focus restored client if c then client.focus = c - c:raise() end end local cycle = function(direction) awful.client.focus.byidx(direction) - if client.focus then - client.focus:raise() - end end -- Set up keybinds @@ -242,9 +237,6 @@ function window_switcher_show(s) -- Go to previously focused client (in the tag) awful.client.focus.history.previous() - if client.focus then - client.focus:raise() - end -- Stop recording focus history awful.client.focus.history.disable_tracking() diff --git a/config/awesome/helpers.lua b/config/awesome/helpers.lua index e3ac034..33a892e 100644 --- a/config/awesome/helpers.lua +++ b/config/awesome/helpers.lua @@ -127,7 +127,6 @@ function helpers.rofi_move_client_here(window) c.minimized = false c:move_to_tag(mouse.screen.selected_tag) client.focus = c - c:raise() end end @@ -393,7 +392,6 @@ function helpers.run_or_raise(match, move, spawn_cmd, spawn_args) if move then c:move_to_tag(mouse.screen.selected_tag) client.focus = c - c:raise() else c:jump_to() end diff --git a/config/awesome/keys.lua b/config/awesome/keys.lua index 9c6fee7..615483e 100644 --- a/config/awesome/keys.lua +++ b/config/awesome/keys.lua @@ -71,7 +71,6 @@ keys.desktopbuttons = gears.table.join( -- -- Focus restored client -- if c then -- client.focus = c - -- c:raise() -- end -- end) ) @@ -83,25 +82,21 @@ keys.globalkeys = gears.table.join( awful.key({ superkey }, "j", function() awful.client.focus.bydirection("down") - if client.focus then client.focus:raise() end end, {description = "focus down", group = "client"}), awful.key({ superkey }, "k", function() awful.client.focus.bydirection("up") - if client.focus then client.focus:raise() end end, {description = "focus up", group = "client"}), awful.key({ superkey }, "h", function() awful.client.focus.bydirection("left") - if client.focus then client.focus:raise() end end, {description = "focus left", group = "client"}), awful.key({ superkey }, "l", function() awful.client.focus.bydirection("right") - if client.focus then client.focus:raise() end end, {description = "focus right", group = "client"}), @@ -109,25 +104,21 @@ keys.globalkeys = gears.table.join( awful.key({ superkey }, "Down", function() awful.client.focus.bydirection("down") - if client.focus then client.focus:raise() end end, {description = "focus down", group = "client"}), awful.key({ superkey }, "Up", function() awful.client.focus.bydirection("up") - if client.focus then client.focus:raise() end end, {description = "focus up", group = "client"}), awful.key({ superkey }, "Left", function() awful.client.focus.bydirection("left") - if client.focus then client.focus:raise() end end, {description = "focus left", group = "client"}), awful.key({ superkey }, "Right", function() awful.client.focus.bydirection("right") - if client.focus then client.focus:raise() end end, {description = "focus right", group = "client"}), @@ -311,7 +302,6 @@ keys.globalkeys = gears.table.join( -- Focus restored client if c then client.focus = c - c:raise() end end, {description = "restore minimized", group = "client"}), @@ -694,7 +684,6 @@ keys.clientkeys = gears.table.join( if not layout_is_floating then awful.client.floating.toggle() end - --c:raise() end, {description = "toggle floating", group = "client"}), @@ -820,7 +809,7 @@ end -- Mouse buttons on the client (whole window, not just titlebar) keys.clientbuttons = gears.table.join( - awful.button({ }, 1, function (c) client.focus = c; c:raise() end), + awful.button({ }, 1, function (c) client.focus = c end), -- awful.button({ }, 2, function (c) -- if c.class == "mpv" then -- -- mpv_osd_toggle(c:geometry()) @@ -831,7 +820,6 @@ keys.clientbuttons = gears.table.join( awful.button({ superkey }, 2, function (c) c:kill() end), awful.button({ superkey }, 3, function(c) client.focus = c - c:raise() awful.mouse.client.resize(c) -- awful.mouse.resize(c, nil, {jump_to_corner=true}) end), @@ -861,7 +849,6 @@ keys.tasklist_buttons = gears.table.join( -- This will also un-minimize -- the client, if needed client.focus = c - c:raise() end end), -- Middle mouse button closes the window @@ -876,12 +863,10 @@ keys.tasklist_buttons = gears.table.join( -- Side button up - toggle floating awful.button({ }, 9, function(c) - -- c:raise() c.floating = not c.floating end), -- Side button down - toggle ontop - awful.button({ }, 8, function() - -- c:raise() + awful.button({ }, 8, function(c) c.ontop = not c.ontop end) ) @@ -920,7 +905,6 @@ keys.titlebar_buttons = gears.table.join( awful.button({ }, 1, function() local c = mouse.object_under_pointer() client.focus = c - c:raise() awful.mouse.client.move(c) -- local function single_tap() -- awful.mouse.client.move(c) @@ -942,7 +926,6 @@ keys.titlebar_buttons = gears.table.join( awful.button({ }, 3, function() local c = mouse.object_under_pointer() client.focus = c - c:raise() awful.mouse.client.resize(c) -- awful.mouse.resize(c, nil, {jump_to_corner=true}) end), @@ -950,7 +933,6 @@ keys.titlebar_buttons = gears.table.join( awful.button({ }, 9, function() local c = mouse.object_under_pointer() client.focus = c - c:raise() --awful.placement.centered(c,{honor_padding = true, honor_workarea=true}) c.floating = not c.floating end), @@ -958,7 +940,6 @@ keys.titlebar_buttons = gears.table.join( awful.button({ }, 8, function() local c = mouse.object_under_pointer() client.focus = c - c:raise() c.ontop = not c.ontop -- Double Tap - toggle sticky -- local function single_tap() diff --git a/config/awesome/noodle/desktop_control.lua b/config/awesome/noodle/desktop_control.lua index 078e8fb..dda12bc 100644 --- a/config/awesome/noodle/desktop_control.lua +++ b/config/awesome/noodle/desktop_control.lua @@ -43,7 +43,6 @@ desktop_control:buttons(gears.table.join( local c = awful.client.restore() if c then client.focus = c - c:raise() end end) )) diff --git a/config/awesome/noodle/minimal_tasklist.lua b/config/awesome/noodle/minimal_tasklist.lua index f815808..1a22a3f 100644 --- a/config/awesome/noodle/minimal_tasklist.lua +++ b/config/awesome/noodle/minimal_tasklist.lua @@ -24,7 +24,6 @@ minimal_tasklist:buttons(gears.table.join( local c = awful.client.restore() if c then client.focus = c - c:raise() end end), -- Close diff --git a/config/awesome/rc.lua b/config/awesome/rc.lua index ac26e55..80c1db7 100644 --- a/config/awesome/rc.lua +++ b/config/awesome/rc.lua @@ -996,11 +996,13 @@ awful.tag.attached_connect_signal(s, "property::selected", function () for c in awful.client.iterate(urgent_clients) do if c.first_tag == mouse.screen.selected_tag then client.focus = c - c:raise() end end end) +-- Raise focused clients automatically +client.connect_signal("focus", function(c) c:raise() end) + -- Focus urgent clients automatically -- client.connect_signal("property::urgent", function(c) -- if c.urgent then