roosta / i3wsr

Change i3-wm workspace names based on content
MIT License
178 stars 14 forks source link

Added tagging for swap to previous focused window #7

Closed eamondo2 closed 4 years ago

eamondo2 commented 4 years ago

This might be a bit of a dirty hack, but I added a small sub-function that fires on window focus change. It uses i3's default behavior of only allowing a tag to exist once across all windows, and ensures that the current focused window is tagged as _current and the previous focused window is tagged as _last.

This can be used with a keybind in i3's config to jump focus to the last focused window.

Ex: bindsym $mod+Shift+y exec i3-msg [con_mark=_last] focus

This works across workspaces as well as in the current view.

eamondo2 commented 4 years ago

Just as a follow up, I really dig this program. Been using it since I found it a couple of days ago, convinced me to learn Rust again.

roosta commented 4 years ago

I might be misunderstanding but isn't the same thing achieved with

# move to last workspace
bindsym $mod+Shift+y workspace back_and_forth

Glad your liking i3wsr and rust! and thank you for taking an interest :)

eamondo2 commented 4 years ago

I had thought so as well, but this tabs between marked containers rather than just workspaces. Workspace back_and_forth is useful as well, but this will let you direct focus between multiple windows in the same workspace, as well as across workspaces if the last focused window is there.

As an addendum, I find this useful when I need to tab between open windows while typing and don't want to have to drag my hand over to the mouse to direct focus, or use the directional keys.

(I double checked my config, I actually have a duplicate keybind there. I use $mod+Tab for quick swapping, $mod+Shift+y for workspace back_and_forth)

roosta commented 4 years ago

I see, that is useful. But maybe better suited for a separate script than in i3wsr, seeing as the main goal of i3wsr is to rename workspaces. I like to adhere of the unix philosophy

Make each program do one thing well. To do a new job, build afresh rather than complicate old programs by adding new "features".