I am trying get a python script to run on startup using insserv or executing the script using /etc/rc.local. The python script enables keyboard shortcuts for snapping windows to the edges of the screen (https://github.com/paulswartz/gnome-shell-grid).
When I use rc.local I found that I get errors related to the display presumably because the screen isn't ready at the point that rc.local is executed. Here is the error log:
Code: Select all
/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:57: GtkWarning: could not open display
warnings.warn(str(e), _gtk.Warning)
Traceback (most recent call last):
File "/home/gareth/bin/gnome-shell-grid/gnome-shell-grid.py", line 192, in <module>
main()
File "/home/gareth/bin/gnome-shell-grid/gnome-shell-grid.py", line 147, in main
display = Xlib.display.Display()
File "/usr/lib/pymodules/python2.7/Xlib/display.py", line 83, in __init__
self.display = _BaseDisplay(display)
File "/usr/lib/pymodules/python2.7/Xlib/display.py", line 65, in __init__
apply(protocol.display.Display.__init__, (self, ) + args, keys)
File "/usr/lib/pymodules/python2.7/Xlib/protocol/display.py", line 44, in __init__
name, host, displayno, screenno = connect.get_display(display)
File "/usr/lib/pymodules/python2.7/Xlib/support/connect.py", line 65, in get_display
return mod.get_display(display)
File "/usr/lib/pymodules/python2.7/Xlib/support/unix_connect.py", line 59, in get_display
raise error.DisplayNameError(display)
Xlib.error.DisplayNameError: Bad display name ""
I would like to remove and reinstall but when I try to remove insserv I get a warning that I am about to do something dangerous and potentially harmful.
So I have 2 questions really:
1) Can I use insserv to get this script to run at startup after the display is ready?
and if so:
2) why can I not run insserv if it is apparently installed?
Thanks in advance,
Gareth