| jaapz  
 
 
 
 
 Group: Members
 Posts: 129
 Joined: May 2007
 | 
|  | Posted: April 09 2008,21:45 |  |  hiya,
 
 i figured it would be quite cool when DSL got the ability to switch to a different icon theme. although i do not yet have any different icon theme i could use, i made a script in lua which does what i want.
 would someone plz test it on their pc? i tested it here and it works fine for me. dont think some could go wrong anyway, but still it would be nice to be sure...
 its not for versions < 4.0 cos this script uses the DFM dir (though the icon dir can be changed in the script itself)
 also would be nice when some people made some nice iconthemes xD
 
 heres the code:
 
 | Code Sample |  | #!/bin/lua -- Written by Jaap Broekhuizen aka Jaapz
 -- This script is released under the terms of the GPL2 License
 
 --iconthemeswitch.lua
 ---Switch to a different icon theme!
 
 --Variables
 home = os.getenv("HOME").."/"
 backup = 1
 icondir = "/usr/share/dfm/icons/"
 
 --Main
 w = fltk:Fl_Window(250,125,"Icon Theme Switcher")
 w:callback(
 function(w)
 os.exit(0)
 end)
 
 text = fltk:Fl_Box(110,0,30,30,[[Click browse to select the tar.gz file
 where the icons are located.]])
 text:labelfont(1)
 text:labelsize(11)
 
 output = fltk:Fl_Output(5,35,170,25)
 
 browseBtn = fltk:Fl_Button(180,35,65,25,"Browse")
 browseBtn:callback(
 function(browseBtn)
 icontarball = fltk.fl_file_chooser("Select tarball", "Types (*.tar.gz)",home)
 output:value(icontarball)
 end)
 
 deleteOrig = fltk:Fl_Round_Button(5,70,20,20,"Delete old icons")
 deleteOrig:type(fltk.FL_RADIO_BUTTON)
 deleteOrig:selection_color(fltk.FL_BLUE)
 deleteOrig:labelfont(1)
 deleteOrig:labelsize(13)
 deleteOrig:callback(
 function(deleteOrig)
 backup = 0
 end)
 
 backupOrig = fltk:Fl_Round_Button(125,70,20,20,"Backup old icons")
 backupOrig:type(fltk.FL_RADIO_BUTTON)
 backupOrig:selection_color(fltk.FL_BLUE)
 backupOrig:labelfont(1)
 backupOrig:labelsize(13)
 backupOrig:callback(
 function(keepOrig)
 backup = 1
 end)
 
 okBtn = fltk:Fl_Return_Button(5,95,50,25,"OK")
 okBtn:callback(
 function(okBtn)
 if icontarball == nil then
 fltk:fl_message("No filename is given, terminating!")
 os.exit(1)
 end
 
 if backup == 1 then
 os.execute("sudo tar -zcvf ~/iconbackup.tar.gz " ..icondir.. "*")
 end
 
 os.execute("sudo tar -zxvf " ..icontarball.. " -C " ..icondir)
 fltk:fl_message("All icons in " ..icontarball.. " are added/copied to " ..icondir.. "!")
 os.exit(0)
 end)
 
 cancelBtn = fltk:Fl_Button(60,95,60,25,"Cancel")
 cancelBtn:callback(
 function(cancelBtn)
 os.exit(0)
 end)
 
 helpBtn = fltk:Fl_Button(195,95,50,25,"Help")
 helpBtn:callback(
 function(helpBtn)
 fltk:fl_message([[You can change your icon theme by using this tool.
 Just select the tarball (.tar.gz) where you have your icons located,
 and click the ok-button.
 Then restart your window manager.]])
 end)
 
 backupOrig:value(1)
 w:show()
 Fl:run()
 | 
 |