-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwmiirc_local.py
154 lines (124 loc) · 4.07 KB
/
wmiirc_local.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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
import os
import dbus
from pygmi import fs, _
import wmiirc
from wmiirc import *
from plugins import dbus_instance
from plugins import notice
from plugins import spotify
# Theme
wmiirc.background = '#333333'
wmiirc.floatbackground='#222222'
wmii['font'] = '-*-terminus-medium-*-*-*-12-*-*-*-*-*-*-*'
wmii['normcolors'] = '#dddddd', '#474747', '#727272'
wmii['focuscolors'] = '#a7d8fe', '#232323', '#474747'
wmii.cache['urgentcolors'] = '#dddddd', '#bb6050', '#dd8070'
wmii['border'] = 1
tags.focuscol = '#a7d8fe', '#232323', '#232323'
tags.reset()
# Behavior / rules
keys.defs['mod'] = 'Mod1'
wmiirc.terminal = 'wmiir', 'setsid', 'urxvt'
wmii['grabmod'] = keys.defs['mod']
wmii['colmode'] = 'default'
wmii.colrules = (
(ur'gimp', '17+83+41'),
(ur'comm', '20+80'),
(ur'dev', '40+60'),
(ur'vpn', '40+60'),
(ur'.*', '50+50'),
)
wmii.rules = (
(ur':MPlayer:', dict(floating=True)),
(ur'^Pidgin:', dict(tags='comm')),
(ur':Firefox:', dict(tags='www')),
(ur':Thunderbird:', dict(tags='mail')),
(ur'^libreoffice:', dict(tags='docs', group=0)),
(ur'^spotify:', dict(tags='music', floating=False)),
)
# Right bar status plugins
fs.indexed_bar.add('right') # Make them stay in the order they are created
notice.Notice()
# Misc functions
def setbackground(color='black'):
bg_file = '%s/background' % os.path.dirname(__file__)
if os.path.isfile(bg_file):
call('feh', '--no-fehbg', '--bg-fill', bg_file)
else:
call('xsetroot', '-solid', color)
wmiirc.setbackground = setbackground
def lock(blank=False):
cmd = ['securezone']
if blank:
cmd.append('-b')
return call(*cmd, background=True)
def system_ctl(action):
logind = dbus_instance.get_system_bus('org.freedesktop.login1',
'/org/freedesktop/login1')
manager = logind.get_interface('org.freedesktop.login1.Manager')
getattr(manager, action)(True)
# Actions
class Actions(wmiirc.Actions):
def __init__(self):
super(Actions, self).__init__(show_scripts=False)
def lock(self, args=''):
lock()
def suspend(self, args=''):
lock()
system_ctl('Suspend')
def reboot(self, args=''):
system_ctl('Reboot')
self.quit()
def poweroff(self, args=''):
system_ctl('PowerOff')
self.quit()
wmiirc.actions = Actions()
# Key bindings
keys.unbind([
'%(mod)s-y',
'%(mod)s-i', '%(mod)s-Shift-i',
'%(mod)s-o', '%(mod)s-Shift-o',
'%(mod)s-b', '%(mod)s-Shift-b',
'%(mod)s-n', '%(mod)s-Shift-n',
])
keys.bind('main', (
"Security",
('Control-%(mod)s-l', "Lock screens",
lambda k: lock(True)),
"Tag actions",
('%(mod)s-b', "Create a temporary tag for selected client",
lambda k: wmiirc.temp_tag()),
('%(mod)s-i', "Move to the last tag",
lambda k: tags.select(tags.LAST)),
('%(mod)s-Shift-i', "Move to the last tag, take along current client",
lambda k: tags.select(tags.LAST, take_client=Client('sel'))),
('%(mod)s-q', "Move to the view to the left",
lambda k: tags.select(tags.next(True))),
('%(mod)s-w', "Move to the view to the right",
lambda k: tags.select(tags.next())),
('%(mod)s-Shift-q', "Move to the view to the left, take along current client",
lambda k: tags.select(tags.next(True), take_client=Client('sel'))),
('%(mod)s-Shift-w', "Move to the view to the right, take along current client",
lambda k: tags.select(tags.next(), take_client=Client('sel'))),
"Spotify control",
('%(mod)s-Up', "Show song meta information",
lambda k: spotify.toggle_meta_info()),
('%(mod)s-Down', "Toggle play/pause",
lambda k: spotify.play_pause()),
('%(mod)s-Left', "Play previous song",
lambda k: spotify.prev()),
('%(mod)s-Right', "Play next song",
lambda k: spotify.next()),
('XF86AudioStop', "Quit spotify",
lambda k: spotify.quit()),
))
# Events
events.unbind([
'AreaFocus',
Match('LeftBarMouseDown', 3),
Match('ClientClick', _, 4),
Match('ClientClick', _, 5),
])
# Load any local adaptations
import local
# vim:se sts=4 sw=4 et: