1
# ARandR -- Another XRandR GUI
2
# Copyright (C) 2008 -- 2011 chrysn <chrysn@fsfe.org>
3
# 
4
# This program is free software: you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation, either version 3 of the License, or
7
# (at your option) any later version.
8
# 
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
# 
14
# You should have received a copy of the GNU General Public License
15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17
import xcb
18
import xcb.xproto
19
import xcb.randr
20
21
RRScreenChangeNotifyMask = 1 << 0 # from randr.h
22
23
def main():
24
    conn = xcb.connect()
25
    conn.randr = conn(xcb.randr.key)
26
27
    setup = conn.get_setup()
28
    root = setup.roots[0].root
29
30
    print "XRRSelectInput"
31
    conn.randr.SelectInput(root, RRScreenChangeNotifyMask) # as seen in http://www.mail-archive.com/sawfish-list@gnome.org/msg03630.html
32
33
    conn.flush()
34
35
    while True:
36
        e = conn.wait_for_event()
37
        print e, vars(e)
38
39
if __name__ == "__main__":
40
    main()