Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP fixes the problem of losing focus after changing the workspace #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,25 @@ client.connect_signal("property::minimized", backham)

client.connect_signal("unmanage", backham)
--+ attach to closed state

local function focus_after_tag_change()
local current_tag = awful.tag.selected(1)
if current_tag == nil then
return nil
end

local table_of_clients = current_tag:clients()
local last_client = table_of_clients[#table_of_clients]
local first_client = table_of_clients[0] or table_of_clients[1]

local c = last_client ~= nil and last_client or first_client

if c == nil then
return nil
end

client.focus = c
c:raise()
end

tag.connect_signal("property::selected", focus_after_tag_change)