Reply
Thread Tools
Posts: 3,664 | Thanked: 1,530 times | Joined on Sep 2009 @ Hamilton, New Zealand
#11
#!/usr/bin/python

import gtk
import gobject
import hildondesktop
import os
import sys
import stat

class Swappiness(hildondesktop.StatusMenuItem):
def __init__(self):

hildondesktop.StatusMenuItem.__init__(self)

#os.system('echo /usr/lib/hildon-desktop/Swappiness.py | root')
os.system('sudo chmod +x /usr/lib/hildon-desktop/Swappiness.py')

os.system('echo 30> /proc/sys/vm/swappiness')
#os.system('sudo chmod -R echo 30 > /proc/sys/vm/swappiness')
#swap_file = open('/proc/sys/vm/swappiness', 'w').write('30')
icon_theme = gtk.icon_theme_get_default()
pixbuf = icon_theme.load_icon("Swappiness", 22, gtk.ICON_LOOKUP_NO_SVG)
# hide icon after 1 sec
#gobject.timeout_add(1000, self.set_status_area_icon, None)
self.set_status_area_icon(pixbuf)

#label = gtk.Label("Show Me")
#self.add(label)
#self.show_all()



hd_plugin_type = Swappiness

This is my little simple script but nothing worked since I can't gain root access from the command os.system

Last edited by maxximuscool; 2010-09-04 at 15:04.
 

The Following User Says Thank You to maxximuscool For This Useful Post:
Posts: 3,664 | Thanked: 1,530 times | Joined on Sep 2009 @ Hamilton, New Zealand
#12
I want to make this work at reboot. And also place an Icon as well.
 

The Following User Says Thank You to maxximuscool For This Useful Post:
Posts: 842 | Thanked: 1,197 times | Joined on May 2010
#13
As said before, you can't gain root access inside the script. The script has to be run as root!
 
Posts: 3,664 | Thanked: 1,530 times | Joined on Sep 2009 @ Hamilton, New Zealand
#14
Originally Posted by RobbieThe1st View Post
As said before, you can't gain root access inside the script. The script has to be run as root!
Show me how to do that? from shell batch or something automatically without going through the xterminal and run it manually
 

The Following User Says Thank You to maxximuscool For This Useful Post:
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 22:19.