LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Command Line for creating shortcut icons (https://www.linuxquestions.org/questions/linux-general-1/command-line-for-creating-shortcut-icons-442663/)

indraveni 05-08-2006 12:53 AM

Command Line for creating shortcut icons
 
Hi Friends,

I want to know whether there is any way for adding the Applcaition shortcut to the panel through command line.

for example : I want to add the mozilla browser icon or shorcut ( what ever it may be ) to the panel through commad line. Is it possible . If so HOW ???


Regards
Indraveni.K

zulfilee 05-08-2006 01:38 AM

One way is to create the panel icon file through command line interface and restart gui.
Just check the similar panel shortcut files available in the users home directory.
In redhat
~user/.gnome/panel.d/
This dir may be different in different distros.

indraveni 05-08-2006 01:49 AM

I am using debian distro. and I checked in /usr/share/gnome/ but i dint find any such file. can any one tell me where is such file in debian distro

zulfilee 05-08-2006 01:53 AM

Dont check in /usr/share/gnome dir.
That dir will have files shared across users.

If you have logged in as user guest then check in
/home/guest/.gnome/ [it will be a hidden dir ]

Or if u have logged in as root check in
/root/.gnome dir

Cheers
Zulfi

indraveni 05-08-2006 02:00 AM

Yes it is there in /root/.gnome2 but panel2.d folder is having all the shortcut icons present in it. But what is the file which is effecting this folder, that is from where the information is beeing passed to add the shortcut icon to this panel.

Thankyou

zulfilee 05-08-2006 02:05 AM

Cool
So you have the dir there.

Now you try to create shortcut in the panel normally.[Right-clink on the panel and create a shortcut with your name]

See if a new file is ccreated into panel2.d dir.
Take this file as a reference and try creating a similar file in command line interface.[Copy,paste,modify]
Hope that should work.

indraveni 05-08-2006 02:10 AM

I have done i and checked it already and I have seen its creating an icon in the panel2.d.

But what copy,paste and modify work I can do here through command line. How can I map an application and create an icon on panel though command line.

Need some more help please

zulfilee 05-08-2006 02:18 AM

Write a small script that will create the file based on user input.

The final file created should be placed in the panel2.d dir.

indraveni 05-08-2006 02:26 AM

The dir panel2.d is having only the icons present in it. How can I get access to the application shortcut. can u give me a sample to the script please.

Thankyou

zulfilee 05-08-2006 02:35 AM

Can u find any dir with name launchers.
Go into launchers directory and you will see the files like these

bar-001c87e536.desktop foo-007ed6fd00.desktop hammer-006ed869da.desktop larry-0034d9a609.desktop

You will have to create a similar file like this.
Also you will have to put an entry in the confif file .
In my system the config file is
/home/user/.gnome/panel.d/default/Applet_Config

And the launcher dir is in
/home/user/.gnome/panel.d/default/launchers

Just create and delete a shortcut or two , observe the dir and config file and u will get the idea.

As for the script you will have to work it out.

indraveni 05-08-2006 02:48 AM

Ya I found the Launchers dir and this is the place where all my shortcut icons are present. I dint find any file as you told in this directory. /root/.gnome2/panel2.d/default/launchers -- Here i have the shorcut icons only..

Still I will search for the file. If u have idea about Debian system where it is exactly locating then please tell me...

Thankyou,

Indraveni

zulfilee 05-08-2006 03:00 AM

Easy

cd /root/.gnome2/panel2.d/default/launchers
ls

Get one file name from this dir
ex: bar005.desktop
[I have assumed this filename , you take the filename of the file available in the above dir ]

cd /root/.gnome2/panel2.d/default/
grep 'bar005.desktop' *

This will tell you the name of the config file where the shortcut is mentioned.

or try grep in /root/.gnome2/panel2.d/

grep -r 'bar005.desktop' /root/.gnome2/panel2.d/

indraveni 05-08-2006 03:16 AM

Thankyou very much for your support. I will continue now.

indraveni 05-08-2006 07:00 AM

I am not able to trace where the config file present about which u specified in the above post.

and one more thing, if I am going to add a new file then how can I select which filename I need to specify, for that particular application shotcut...

Thankyou

zulfilee 05-08-2006 07:15 AM

Ok have you tried copying a shortcut file and changing the contents to see if a new shortcut is created.

Paste one shortcut files content if possible.

If gnome has got information about the position of shortcut in some binary file then it will a tough time trying to do it from command line.

indraveni 05-08-2006 07:29 AM

Yes I have done the exercise. Its not Working. I think the conflict is coming for the name of the file. When I am creating a shortcut from the menu through launcher panel then its cerating with one name and I used the other name. How will I know which name I should have to use.
Else as you said I may need to add this new file name in that config file.

This is the sample file i am having for k3b shortcut

curly-00b7a0a19d.desktop


[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=k3b
Comment=
Exec=/usr/bin/k3b
Terminal=false
Icon=/usr/share/pixmaps/k3b.xpm
Type=Application

zulfilee 05-08-2006 08:01 AM

Ok this is goin to be a long post

Try this

grep -ir 'curly-00b7a0a19d.desktop' /home/user/.gnome/
grep -ir 'curly-00b7a0a19d.desktop' /home/user/.gnome2/

Note: I assume that curly-00b7a0a19d.desktop is a proper shortcut that is getting displayed in panel.

If the above step doesnt work out then try this out.

Create a shortcut normally through GUI.
Now open a console and move in from ./gnome dir.

For each dir see the last modified file [ls -lart shoudl do]

Or
find /home/user -cmin -2

This should list the files that were changed in the last 2 minutes.
This will tell the last accessed files and hopefully u should see your config file and the new shortcut file there.

indraveni 05-08-2006 08:20 AM

I got the output for last modifed files as the following

/root/.gaim/accels
/root/.gconf/apps/panel/profiles/default/general
/root/.gconf/apps/panel/profiles/default/general/%gconf.xml
/root/.gconf/apps/panel/profiles/default/objects
/root/.gconf/apps/panel/profiles/default/objects/object_6
/root/.gconf/apps/panel/profiles/default/objects/object_6/%gconf.xml

So I checked these two xml files after and before adding a shortcut to panel. I dint find any diffrence.

zulfilee 05-08-2006 08:44 AM

:confused:

Cool. I have been wastin your time then.
Try to poke in and find out if any file is getting modified,etc..

Also your prev mail indicates /root dir.
So i hope you have logged in as root user.

But while u create a new shortcut [ in gnome gui] 'find' command must atleast find the new shortcut file that has been created.

So ensure that you are checking in the correct "users home" directory.

Post back if u get any pointers.

indraveni 05-08-2006 09:06 AM

No our time is not gone vail. I restarted my system and did the same steps again. and I used the find command. I added totem movie player to panel and deleted.

the output after adding and after removing is as follows respectively:

After I added Totem to panel:

find /root/ -cmin -2
/root/
/root/.gnome2/panel2.d/default/launchers
/root/.gnome2/panel2.d/default/launchers/gegl-003df2b6e8.desktop
/root/.recently-used
/root/.gconfd
/root/.gconfd/saved_state
/root/.bluefish
/root/.bluefish/highlighting
/root/.xsession-errors
/root/.gnome2_private

After I removed the totem

find /root/ -cmin -2
/root/
/root/.viminfo
/root/.gnome2/panel2.d/default/launchers
/root/.gconfd
/root/.gconfd/saved_state
/root/.gconf/apps/panel/profiles/default/general
/root/.gconf/apps/panel/profiles/default/general/%gconf.xml
/root/.gconf/apps/panel/profiles/default/objects
/root/.gconf/apps/panel/profiles/default/objects/object_6
/root/.gconf/apps/panel/profiles/default/objects/object_6/%gconf.xml
/root/.xsession-errors
/root/.gnome2_private

But I am not understanding anything in these xml files..

zulfilee 05-08-2006 11:46 PM

Cool but the xml files were formed only after removing the shortcut. So that doesnt seem to be the file u are looking for.But one cannot be sure.

Also when u create a shortcut you logout and check for any new files.Maybe gnome doesnt write anything to the conf file till you log out.
So can u try that too [just add a shortcut and logout of GUI.now see if any new files are created.]

Cheers
Zulfi


All times are GMT -5. The time now is 10:37 PM.