-
Notifications
You must be signed in to change notification settings - Fork 0
/
layouts.py
135 lines (120 loc) · 3.75 KB
/
layouts.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
from libqtile import layout
from colors import kanagawa
class Columns(layout.Columns):
def cmd_shuffle_left(self):
cur = self.cc
client = cur.cw
if client is None:
return
if self.current <= 0 and len(cur) <= 1:
# Move to left screen
screen_idx = client.qtile.current_screen.index - 1
if screen_idx < 0:
return
try:
client.cmd_toscreen(screen_idx)
client.qtile.focus_screen(screen_idx, False)
except IndexError:
return
return
super().cmd_shuffle_left()
def cmd_shuffle_right(self):
cur = self.cc
client = cur.cw
if client is None:
return
if self.current + 1 >= len(self.columns) and len(cur) <= 1:
# Move to right screen
screen_idx = client.qtile.current_screen.index + 1
try:
client.cmd_toscreen(screen_idx)
client.qtile.focus_screen(screen_idx, False)
except IndexError:
return
return
super().cmd_shuffle_right()
def cmd_left(self):
if self.current > 0:
self.current = self.current - 1
self.group.focus(self.cc.cw, True)
else:
# Focus left screen
screen_idx = self.group.qtile.current_screen.index - 1
if screen_idx < 0:
return
try:
self.group.qtile.focus_screen(screen_idx, False)
except IndexError:
return
return
def cmd_right(self):
if len(self.columns) - 1 > self.current:
self.current = self.current + 1
self.group.focus(self.cc.cw, True)
else:
# Focus right screen
screen_idx = self.group.qtile.current_screen.index + 1
try:
self.group.qtile.focus_screen(screen_idx, False)
except IndexError:
return
return
class Max(layout.Max):
def cmd_shuffle_left(self):
client = self.group.qtile.current_window
# Move to left screen
screen_idx = self.group.qtile.current_screen.index - 1
if screen_idx < 0:
return
try:
client.cmd_toscreen(screen_idx)
client.qtile.focus_screen(screen_idx, False)
except IndexError:
return
return
def cmd_shuffle_right(self):
client = self.group.qtile.current_window
# Move to right screen
screen_idx = self.group.qtile.current_screen.index + 1
try:
client.cmd_toscreen(screen_idx)
client.qtile.focus_screen(screen_idx, False)
except IndexError:
return
return
def cmd_left(self):
screen_idx = self.group.qtile.current_screen.index - 1
if screen_idx < 0:
return
try:
self.group.qtile.focus_screen(screen_idx, False)
except IndexError:
return
def cmd_right(self):
screen_idx = self.group.qtile.current_screen.index + 1
if screen_idx < 0:
return
try:
self.group.qtile.focus_screen(screen_idx, False)
except IndexError:
return
BORDER_WIDTH = 2
layouts = [
Columns(
border_focus=kanagawa.base09,
border_normal=kanagawa.base0D,
border_width=BORDER_WIDTH,
border_on_single=True,
margin=3,
margin_on_single=5,
wrap_focus_columns=False,
wrap_focus_rows=False,
wrap_focus_stacks=False,
),
Max(
border_focus=kanagawa.base09,
border_normal=kanagawa.base0D,
border_width=BORDER_WIDTH,
margin=5,
),
]