Skip to content

Instantly share code, notes, and snippets.

@olivierlemoal
Last active February 17, 2021 19:48
Show Gist options
  • Save olivierlemoal/bff45ab69925e702691d0797fd303fcb to your computer and use it in GitHub Desktop.
Save olivierlemoal/bff45ab69925e702691d0797fd303fcb to your computer and use it in GitHub Desktop.
i3 script to toggle between last windows
Moved to https://github.com/olivierlemoal/i3-swap-focus
@daankata
Copy link

I can't seem to make this work. I have an installed and working i3ipc from pip, I have ncat (nmap), event-listener.py is executable (755) and is in /usr/local/bin/, I added the needed lines in my i3 config file and restarted my system multiple times with no success whatsoever. Running event-listener.py from the terminal returns no output or error. Is there anything else I should install? What am I missing here?

@olivierlemoal
Copy link
Author

olivierlemoal commented Jan 30, 2021

It looks like last ncat version has segfaults issues when using Unix sockets (nmap/nmap#2154 still unpatched in arch). Try using openbsd-netcat like this instead :

bindsym $mod+Tab exec echo "swap_focus" | nc -w0 -U "$XDG_RUNTIME_DIR/i3/event-listener.sock"

Alternatively, you can use this ncat static build from ERNW.

@daankata
Copy link

Yes, it works now! Thank you for the fast reply and the script, I appreciate it.

@stahlnow
Copy link

Great script, I could need help to adapt it to only switch the focus of windows, which are on the same workspace. Thank you!

@olivierlemoal
Copy link
Author

This gist seems to draw some attention, so I put it on a repo so you can open issues / PR :
https://github.com/olivierlemoal/i3-swap-focus

@olivierlemoal
Copy link
Author

@stahlnow I updated the script so you can stay on workspace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment