Go Back   openSUSE Forums > Archives > SF Archives > ARCHIVES - Tips, Tricks & Tweaks
Forums FAQ Members List Search Today's Posts Mark Forums Read


ARCHIVES - Tips, Tricks & Tweaks Tips and Solutions for SUSE Linux
(Please do not post questions here)

 
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-Nov-2007, 12:01
andy123
Guest
 
Posts: n/a
Default

I have been playing with nautilus scripts for gnome and although i think most of them are a bit lame and not useful or just don't work I was wondering how easy it would be to make some useful ones for my own.

So I had an idea to make a simple one that would just change whether a file was executable or not- it would make it (slightly) easier than either opening up a terminal and chmod'ing it or to right click and go into node properties. So the script for this would be really easy, but i thought it might be better to give the user some idea of whether the script was executable or not.

I thought id try to programatically alter the icon by adding an emblem.so the emblem would be shown you made the file executable or removed if you ran the script again to remove its execution privilige.

I only noticed emblems a couple of weeks ago: by pressing the down arrow next to "Places" in the nautilus sidebar you can change the sidebar to the emblems menu and just drag the emblems onto folders and files to place an emblem or use the "Erase" icon to remove emblems from files.

I had no idea of how this information was stored untill some googling and i found this page, which said that the information is stored in xml files in .nautilus/metafiles- one file for each directory.

Inside each xml file their is an entry for each file and directory. This contains lots of information on each file/folder such as where they should be drawn and how to display a directories contents if you were to click it.
It also stores the information of what emblem should be drawn with it. for instance in this case:
<file name="Firefox_wallpaper.png" timestamp="1194715959"><keyword name="important"/></file>
the keyword=important states that this file should be displayed with the important emblem.

to change the keyword entry in this file is very easy to do in a script with regular expressions.

This is as far as I have got now& it does work except that to get nautilus to update howto display an icons emblem- you need to run nautilus -q. This stops nautilus and when you restart it then its icons will be updated. This is quite lame but it is possible to restart nautilus in the correct location easily enough, it is still very hacky.

I am still researching as to how you can add or remove emblems programmatically and i will post any findings and my script later.

Andy
  #2 (permalink)  
Old 01-Dec-2007, 00:17
devilsmaster
Guest
 
Posts: n/a
Default

I will wait for you findings andy.
 

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




 

Search Engine Friendly URLs by vBSEO 3.3.0 RC2