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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
#!/usr/bin/env python3
from libqtile.config import Key
from libqtile.command import lazy
from libqtile.config import Click, Drag
class MyKeys():
"""
Emacs-like keybindings for qtile
I prefer having my keys seperated so I won't mess anything up,
especially if you are running the same config in different machines
"""
def __init__(self):
"""
Default customization
"""
self.mod = "mod4"
self.browser = "firefox"
self.term = "emacsclient -c"
self.editor = "emacsclient -c -a 'emacs'"
def init_keys(self):
"""
Keyboard keybindings | Emacs-like | Set them and forget them.
I'm used to having the superkey to control my window manager,
and control for my emacs.
"""
my_keys = [
Key([self.mod], "Return",
lazy.spawn(self.term),
),
Key([self.mod, "shift"], "a",
lazy.spawn('anki'),
),
Key([self.mod, "shift"], "m",
lazy.spawn("spotify"),
),
Key([self.mod], "Tab",
lazy.spawn("rofi -show drun"),
),
Key([self.mod], "r",
lazy.spawn("rofi -show run"),
),
Key([self.mod], "w",
lazy.spawn("rofi -show window"),
),
Key([self.mod], "p",
lazy.spawn("passmenu -p 'Password for: '"),
),
Key([self.mod], "b",
lazy.spawn(self.browser),
),
Key([self.mod, "shift"], "c",
lazy.next_layout(),
),
Key([self.mod], "q",
lazy.window.kill(),
),
Key([self.mod, "shift"], "r",
lazy.restart(),
),
Key([self.mod, "shift"], "0",
lazy.shutdown(),
),
Key([self.mod, "shift"], "e",
lazy.spawn(self.editor),
),
# Switch focus of monitors
Key([self.mod], "period",
lazy.next_screen(),
),
# Treetab controls
Key([self.mod, "shift"], "h",
lazy.layout.move_left(),
),
Key([self.mod, "shift"], "l",
lazy.layout.move_right(),
),
# Window controls
Key([self.mod], "n",
lazy.layout.down(),
),
Key([self.mod], "p",
lazy.layout.up(),
),
Key([self.mod, "shift"], "n",
lazy.layout.shuffle_down(),
lazy.layout.section_down(),
),
Key([self.mod, "shift"], "p",
lazy.layout.shuffle_up(),
lazy.layout.section_up(),
),
Key([self.mod], "s",
lazy.layout.shrink(),
lazy.layout.decrease_nmaster(),
),
Key([self.mod], "l",
lazy.layout.grow(),
lazy.layout.increase_nmaster(),
),
Key([self.mod], "o",
lazy.layout.normalize(),
),
Key([self.mod], "m",
lazy.layout.maximize(),
),
Key([self.mod, "shift"], "f",
lazy.window.toggle_floating(),
),
Key([self.mod], "f",
lazy.window.toggle_fullscreen(),
),
# Stack controls
Key([self.mod, "shift"], "Tab",
lazy.layout.rotate(),
lazy.layout.flip(),
),
Key([self.mod, "shift"], "space",
lazy.layout.toggle_split(),
),
# Volume controls
Key([], "XF86AudioLowerVolume",
lazy.spawn('amixer sset Master 5%-'),
),
Key([], "XF86AudioRaiseVolume",
lazy.spawn('amixer sset Master 5%+'),
),
# I use mod+F[key] to change volume in my thinkpad,
# as I dislike using "fn" key in laptops
Key([self.mod], "F11",
lazy.spawn('amixer sset Master 5%-'),
),
Key([self.mod], "F12",
lazy.spawn('amixer sset Master 5%+'),
),
# Music controls | MOC
Key([self.mod], "u",
lazy.spawn("mocp -G "),
),
Key([self.mod], "o",
lazy.spawn("mocp -f"),
),
Key([self.mod], "i",
lazy.spawn("mocp -r"),
),
# Change languages
Key([self.mod], "F1",
lazy.spawn("setxkbmap us -option ctrl:swapcaps"),
),
Key([self.mod], "g",
lazy.spawn("setxkbmap gr"),
),
]
return my_keys
def init_mouse(self):
"""Mouse keys | cause sometimes we have to use the mouse."""
mouse_keys = [
Drag([self.mod], "Button1", lazy.window.set_position_floating(),
start=lazy.window.get_position()),
Drag([self.mod], "Button3", lazy.window.set_size_floating(),
start=lazy.window.get_size()),
Click([self.mod], "Button2",
lazy.window.bring_to_front()),
]
return mouse_keys
|