How Do I Give My Usb Stick/mem Card Its Own Icon?


The current ones look to be stored within usr/share/icons/elementary/devices/48 but I've no idea how to point to a new one or use ones of your own design.
 
what about replacing the above mentioned graphics with your own?
 
that would work but that would affect all usb drives/mem cards and im looking for a way to modify on an individual basis.
 
does the pandora follow the normal way of doing it? (just google for it in ubuntu, it's the way involving an icon, and some form of autorun ini/etc, it's been so long since i needed to do it i can't remember :p )
 
u can right click on the current icon (on the desktop) in ubuntu and then there is an option to change the icon, howver that option doesnt exist for pandora.
 
I believe there is an free desktop spec for the mounting of removable drives and what can exist in the autorun.inf files. In the old days you would set a specific icon for the ident of the card and place it in the afore mentioned directory. Im sure its easier now-a-days.
 
doesnt work :( boo any other suggestions?

Isn't this sort of easily scriptable?


The below instructions expect that you know how to automate a program (like with cron) to make it run periodically. If I get a chance to think harder (and if I get a Pandora so I can actually play around), I can probably just make an easily installable package that will magically make this all happen.


Make a file called Card.desktop on the root of the card with the following contents:



Code:
[Desktop Entry]

Name=SomeFancyNameOfYourChoosing Spaces Are Okay

Terminal=false

Type=Application

Categories=Other



Also, make a file called "icon.png" on the root of the card. This should be the icon you want to represent the card.





Now, using a text editor, make a script like so and save it to the home directory with the name "autocard" (or some other appropriate path and name).





Code:
#!/usr/bin/env bash


slot="/media/mmcblk0p1"; icon="~/Desktop/Card1.desktop"

if [[ -e "${slot}/Card.desktop" ]];  then 

 cp ${slot}/Card.desktop" "${icon}"; 

 echo "Exec=thunar ${slot}" >> ${icon}

 echo "Icon=${slot}/icon.png" >> ${icon}

else 

 rm ${icon};

 fi


slot="/media/mmcblk0p2"; icon="~/Desktop/Card2.desktop"

if [[ -e "${slot}/Card.desktop" ]];  then 

 cp ${slot}/Card.desktop" "${icon}"; 

 echo "Exec=thunar ${slot}" >> ${icon}

 echo "Icon=${slot}/icon.png" >> ${icon}

else 

 rm ${icon};

 fi



(note: "/media/mmcblk0p1" and soforth may or may not be correct -- it should refers to the card slot paths when mounted)





Afterward, make it executable by either typing "chmod a+x ~/autocard" in a terminal or browsing to the file's location, right clicking on the file, clicking "Properties", clicking "Permissions" and selecting "Allow this file to run as a program" (hopefully, the checkbox for this exists):



Now, you just have to automate it. There are two ways. One involves slightly editing the script then putting it in a special place called "/etc/init.d". That's a better way, but I'll do it the simpler way for now. As I don't have a Pandora, I'm making a lot of assumptions here:



Open up a terminal and type the following:



Code:
EDITOR=mousepad crontab -e



I'm assuming that mousepad is the Pandora's built-in text editor. The above line (and capitalization matters there!) will open up the editor, and it will probably be blank. Add a line at the bottom like so:





Code:
* * * * * ~/autocard


It is important to hit Enter at the end of the line -- it will fail to work if the last line isn't a blank line! Anyway, save and close. The terminal will say "installing new crontab" if you typed it in correctly or "errors in crontab file" if something went wrong. Now, if everything went well (especially making it executable, as mentioned above!), it will run autocard once a minute, so it will take as much as 60 seconds for the card to appear. The "/etc/init.d" thing I mentioned can be used to make it check more frequently (like every second or five), but I'd need to have a Pandora and know its particulars to be sure about how to get it working right, since different operating systems treat init.d differently.


The above instructions assume that the Pandora desktop environment (xfce, right?) automatically refreshes the desktop when there is a change. The Web tells me that it does or doesn't, depending on how it's set up (whether or not the "gamin" library is installed). So this may or may not have been an exercise in futility.


Also.... I can safely assume that the Pandora has bash, right?


Note: Sorry the response took so long. I kept erasing and recreating the script and .desktop file, because I'm not 100% sure about the particulars of the Pandora and because I tried to cut corners initially (read: at each step).
 
Back
Top