Nautilus script to convert GDM theme to MDM

Write tutorials and howtos in here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Do not start a support topic here please. Before you post please read this

Nautilus script to convert GDM theme to MDM

Postby esteban1uy on Sun May 27, 2012 10:43 am

I made a little script for Nautilus to convert some GDM themes to MDM (original theme packs can be found here http://browse.deviantart.com/?q=gdm or here http://gnome-look.org/index.php?xcontentmode=150)

Copy the following code, open gedit and paste it, save it to /home/YOUR_PERSONAL_FOLDER/.gnome2/nautilus-scripts/ with the name Convert GDM theme to MDM.
Then open nautilus, navigate to that folder, right-click the script file, select "Properties" and under "Permissions" tick "Allow executing file as program".
Now you can download any GDM theme pack, right-click and select "Convert..." from the scripts sub-menu.
The converted MDM theme pack can be installed via Menu > Administration > Login Window > Local > Style > " Themed with Face Browser" and clicking "Add".

Code: Select all
#!/usr/bin/env python

# Convert GDM theme to MDM by esteban1uy
import pygtk
import tarfile
import os
import sys
import tempfile
import gtk

pygtk.require('2.0')

if gtk.pygtk_version < (2,3,90):
   raise SystemExit
def look_in_directory(directory):
    for f in os.listdir(directory):
        if os.path.isfile(os.path.join(directory, f)):
            if f == "GdmGreeterTheme.desktop":
                return os.path.join(directory, f)
        if os.path.isdir(os.path.join(directory, f)):
            if look_in_directory(os.path.join(directory, f)) != "":
                return os.path.join(directory, f)

dialog = gtk.FileChooserDialog("Select theme file",
                               None,
                               gtk.FILE_CHOOSER_ACTION_OPEN,
                               (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                                gtk.STOCK_OPEN, gtk.RESPONSE_OK))
dialog.set_default_response(gtk.RESPONSE_OK)

filter = gtk.FileFilter()
filter.set_name("All files")
filter.add_pattern("*.tar.gz")
dialog.add_filter(filter)

response = dialog.run()
if response == gtk.RESPONSE_OK:
    fullpathToTar = dialog.get_filename()
    fullpath = os.path.dirname(fullpathToTar)
    tar = tarfile.open(fullpathToTar, "r:gz")
    destinationPath = tempfile.mkdtemp() + "/"
    tar.extractall(destinationPath)
    GdmFile = look_in_directory(destinationPath)
    if GdmFile != "":
        o = open(GdmFile+"/MdmGreeterTheme.desktop","a")
        for line in open(GdmFile+"/GdmGreeterTheme.desktop"):
             line = line.replace("GdmGreeterTheme","MdmGreeterTheme")
             o.write(line)
        o.close()
        innerfolder = os.path.split(os.path.dirname(GdmFile+"/"))[1]
        newtar = tarfile.open(fullpath + "/"+innerfolder+"_for_MDM.tar.gz", "w:gz")
        newtar.add(GdmFile+"/",innerfolder+"/")         
        newtar.close()
elif response == gtk.RESPONSE_CANCEL:
    exit()
dialog.destroy()
Last edited by esteban1uy on Sun May 27, 2012 11:59 pm, edited 1 time in total.
Sorry, I only speak Spanish
User avatar
esteban1uy
Level 5
Level 5
 
Posts: 734
Joined: Sat Nov 12, 2011 6:20 am

Linux Mint is funded by ads and donations.
 

Re: Nautilus script to convert GDM theme to MDM

Postby esteban1uy on Sun May 27, 2012 11:56 pm

Forgot to mention: in case you're using MATE desktop, the script must be saved to /home/YOUR_PERSONAL_FOLDER/.config/caja/scripts (thanks therobertsonz).
And remember to enable "Show hidden files" in order to be able to see those files and folders with a name starting with "."
Sorry, I only speak Spanish
User avatar
esteban1uy
Level 5
Level 5
 
Posts: 734
Joined: Sat Nov 12, 2011 6:20 am

Re: Nautilus script to convert GDM theme to MDM

Postby Platypus on Thu Jun 21, 2012 4:58 am

Sorry, but I can't get it to work in Mate. I put the script into /.config/caja/scripts and sorted the permissions but still no converstion taking place. I'll go back to doing it by manually.

Regards
Platypus
Platypus
Level 1
Level 1
 
Posts: 5
Joined: Tue Jun 19, 2012 2:11 am
Location: OZ

Re: Nautilus script to convert GDM theme to MDM

Postby esteban1uy on Thu Jun 21, 2012 8:11 am

Platypus wrote:Sorry, but I can't get it to work in Mate. I put the script into /.config/caja/scripts and sorted the permissions but still no converstion taking place. I'll go back to doing it by manually.

Regards
Platypus


Yeap, if the script doesn't work for you, then you can always do it manually. It's really very simple.

Cheers.
Sorry, I only speak Spanish
User avatar
esteban1uy
Level 5
Level 5
 
Posts: 734
Joined: Sat Nov 12, 2011 6:20 am

Re: Nautilus script to convert GDM theme to MDM

Postby twodogs on Tue Aug 07, 2012 4:47 pm

Thank you very much. Works great on Linux Mint 13 Maya :)
User avatar
twodogs
Level 4
Level 4
 
Posts: 244
Joined: Sat Jun 09, 2007 9:18 pm

Re: Nautilus script to convert GDM theme to MDM

Postby madwoollything on Tue Oct 09, 2012 1:20 pm

Brilliant!
madwoollything
Level 3
Level 3
 
Posts: 156
Joined: Sun Jul 20, 2008 8:46 am


Return to Tutorials / Howtos

Who is online

Users browsing this forum: No registered users and 12 guests