File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env python3
2+ #
3+ # provides alt+tab functionality between windows, switching
4+ # between n windows; example i3 conf to use:
5+ # exec_always --no-startup-id i3-cycle-focus.py --history 2
6+ # bindsym $mod1+Tab exec --no-startup-id i3-cycle-focus.py --switch
27
38import os
49import socket
712from argparse import ArgumentParser
813import i3ipc
914
10- SOCKET_FILE = '/tmp/i3-cycle-focus'
15+ SOCKET_FILE = '/tmp/. i3-cycle-focus.sock '
1116MAX_WIN_HISTORY = 16
1217UPDATE_DELAY = 2.0
1318
1419
20+ def on_shutdown (i3_conn , e ):
21+ os ._exit (0 )
22+
1523class FocusWatcher :
1624 def __init__ (self ):
1725 self .i3 = i3ipc .Connection ()
1826 self .i3 .on ('window::focus' , self .on_window_focus )
27+ self .i3 .on ('shutdown' , on_shutdown )
1928 self .listening_socket = socket .socket (socket .AF_UNIX , socket .SOCK_STREAM )
2029 if os .path .exists (SOCKET_FILE ):
2130 os .remove (SOCKET_FILE )
You can’t perform that action at this time.
0 commit comments