Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- #/home/cpcmonster/bin/unity2dsnapsetup.py
- # Released under a GPLv3 Licence by Clockwork PC 2011
- # www.clockworkpc.com.au
- # You are entitled to the following four freedoms:
- # Freedom 0: To run this program for any purpose
- # Freedom 1: To study how this program works and change it to make it do what you wish
- # Freedom 2: To redistribute copies so you can help your neighbour
- # Freedom 3: To distribute copies of your modified version to others
- import os
- binFolder = os.getenv("HOME")+"/bin/"
- snapLeftText = "wmctrl -r :ACTIVE: -e 0,0,0,840,1000"
- snapRightText = "wmctrl -r :ACTIVE: -e 0,840,0,840,1000"
- snapLeftName = "unity2dsnapleft.sh"
- snapRightName = "unity2dsnapright.sh"
- snapLeftFile = binFolder + "unity2dsnapleft.sh"
- snapRightFile = binFolder + "unity2dsnapright.sh"
- print binFolder
- print snapLeftFile
- print snapRightFile
- os.system("touch " + snapLeftFile)
- os.system("touch " + snapRightFile)
- f = open(snapLeftFile, "a")
- f.write("""#!/bin/bash
- #~/bin/unity2dsnapleft.sh
- """ + snapLeftText)
- f.close
- g = open(snapRightFile, "a")
- g.write("""#!/bin/bash
- #~/bin/unity2dsnapright.sh
- """ + snapRightText)
- g.close
- os.system("chmod +x " + snapLeftFile)
- os.system("chmod +x " + snapRightFile)
- os.system("sudo ln -sv " + snapLeftFile + " " + "/usr/local/bin/"+snapLeftName)
- os.system("sudo ln -sv " + snapRightFile + " " + "/usr/local/bin/"+snapRightName)
- #Then you have to assign the keyboard shortcuts accordingly.
- #ALT+SHIFT+LEFT = snap left
- #ALT+SHIFT+RIGHT = snap right
- os.sytem("sudo apt-get install wmctrl")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement