Posted by iggykoopa on Tue 27th Jan 21:35 (modification of post by view diff)
download | new post
- #!/usr/bin/env python
- import os,commands
- home = os.getenv("HOME")
- rcPath = home + "/.config/openbox/rc.xml"
- menuPath = home + "/.config/openbox/menu.xml"
- menuInstalled = commands.getoutput("aptitude show menu | grep State")
- if not ": installed" in menuInstalled:
- os.system("sudo apt-get install menu")
- rc = open(rcPath).read()
- if not "<!-- system menu files on Debian systems -->" in rc:
- rc = rc.replace("<!-- system menu files on Debian systems", "<!-- system menu files on Debian systems -->")
- if "<file>debian-menu.xml</file> -->" in rc:
- rc = rc.replace("<file>debian-menu.xml</file> -->", "<file>debian-menu.xml</file>")
- newrc = open(rcPath, "w")
- newrc.write(rc)
- menu = open(menuPath).read()
- if not '<menu id="Debian" />' in menu:
- menu = menu.replace('<menu id="preferences" label="Preferences">', '<menu id="Debian" />\n<menu id="preferences" label="Preferences">')
- newMenu = open(menuPath, "w")
- newMenu.write(menu)
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.