File tree 1 file changed +10
-1
lines changed
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 1
1
#!/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
2
7
3
8
import os
4
9
import socket
7
12
from argparse import ArgumentParser
8
13
import i3ipc
9
14
10
- SOCKET_FILE = '/tmp/i3-cycle-focus'
15
+ SOCKET_FILE = '/tmp/. i3-cycle-focus.sock '
11
16
MAX_WIN_HISTORY = 16
12
17
UPDATE_DELAY = 2.0
13
18
14
19
20
+ def on_shutdown (i3_conn , e ):
21
+ os ._exit (0 )
22
+
15
23
class FocusWatcher :
16
24
def __init__ (self ):
17
25
self .i3 = i3ipc .Connection ()
18
26
self .i3 .on ('window::focus' , self .on_window_focus )
27
+ self .i3 .on ('shutdown' , on_shutdown )
19
28
self .listening_socket = socket .socket (socket .AF_UNIX , socket .SOCK_STREAM )
20
29
if os .path .exists (SOCKET_FILE ):
21
30
os .remove (SOCKET_FILE )
You can’t perform that action at this time.
0 commit comments