public
Description: Gedit Plugins, Colorschemes and GtkSourceview Improvements to Gedit
Homepage: http://blog.siverti.com.br/gmate/
Clone URL: git://github.com/lexrupy/gmate.git
gmate / gmate.py
100755 34 lines (29 sloc) 0.998 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python
# This program is part of GMATE package
# Gmate script
# Author: Alexandre da Silva
# This scripts whants to allow users to use the gmate command (instead of gedit)
# command from a terminal and pass a directory as the first param.
# passign the directory as a parameter, gedit will open with filebrowser root
# directory pointing that
import gconf
import sys
import urllib
import os
#from optparse import OptionParser
 
# GConf directory for filebrowser
base = '/apps/gedit-2/plugins/filebrowser/on_load'
config = gconf.client_get_default()
config.add_dir(base, gconf.CLIENT_PRELOAD_NONE)
 
# Get the last option as file
path = os.path.abspath(sys.argv[-1:][0])
 
if len(sys.argv) > 1:
    parameters = ' '.join(sys.argv[1:-1])
    if os.path.isdir(path):
        url = "file://%s" % urllib.quote(path)
        config.set_string(os.path.join(base,'virtual_root'), url)
    else:
        parameters += ' '+ path
    os.system('gedit ' + parameters)
else:
    os.system('gedit')