Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12
I'm writing utility to rebuild a users desktop should they accidentally delete shortcuts....I would like to recreate Computer and Trash shortcuts on the desktop. No luck on google so far ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2013
    Posts
    13

    Physicalocation of Trash/Computer Icons on Red hat 6.3 Gnome Desktop??


    I'm writing utility to rebuild a users desktop should they accidentally delete shortcuts....I would like to recreate Computer and Trash shortcuts on the desktop.

    No luck on google so far and I looked all through /usr/share/icons and for life of me cannot find the Computer and Trash icon imagery anywhere in the file system.....

    Of course i could always download it form the web but I'm more curious out of spite as to where they're at

    Thank you in advanced....
    Last edited by ruberked; 09-13-2013 at 02:31 PM.

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    hi,

    Try this command to find how your system might be doing that already:

    Code:
    grep Icon=computer /usr/share/applications/*.desktop
    that doesn't necessarily point you to the Icon, but it points you to the icon name (i.e., "computer") that GNOME uses to select an icon (of the right size, theme, etc.) for you. so you could just use the same convention (or just use the whole *.desktop file, for that matter).

  3. #3
    Just Joined!
    Join Date
    Sep 2013
    Posts
    13
    Quote Originally Posted by atreyu View Post
    hi,

    Try this command to find how your system might be doing that already:

    Code:
    grep Icon=computer /usr/share/applications/*.desktop
    that doesn't necessarily point you to the Icon, but it points you to the icon name (i.e., "computer") that GNOME uses to select an icon (of the right size, theme, etc.) for you. so you could just use the same convention (or just use the whole *.desktop file, for that matter).
    Thanx for the reply and I'm had done that actually. Pretty sure the file is gnome-nautilus-computer.desktop. And as you suggested it has "Icon=computer"....but I don't see anything that tells me where the icon actually is?

  4. #4
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Quote Originally Posted by ruberked View Post
    Thanx for the reply and I'm had done that actually. Pretty sure the file is gnome-nautilus-computer.desktop. And as you suggested it has "Icon=computer"....but I don't see anything that tells me where the icon actually is?
    yeah, i know it doesn't. what i was hoping was that you could use the same Icon=whatever syntax in your desktop file and GNOME would do the work behind the scenes to pick the right icon for you. that basically entails selecting an icon from the right theme, and size for your desktop, e.g.:

    Code:
    # rpm -ql nautilus|grep icon
    /usr/share/icons/hicolor/16x16/apps/nautilus.png
    /usr/share/icons/hicolor/22x22/apps/nautilus.png
    /usr/share/icons/hicolor/24x24/apps/nautilus.png
    /usr/share/icons/hicolor/32x32/apps/nautilus.png
    see this GNOME document for a better explanation than I could ever give.

  5. #5
    Just Joined!
    Join Date
    Sep 2013
    Posts
    13
    Thank you again....looks like an interesting read.

  6. #6
    Just Joined!
    Join Date
    Sep 2013
    Posts
    13
    Thanx atreyu...

    I was cctually able to find them with after reading that link.

    Now perhaps I can hit you up with another semi-related question......You don't happen to know where the .desktop files for the three default shortcuts(computer, home dir, trash) reside do you?

    I thought they would be in /user/share/applications directory but it doesn't seem as though that is the case....

    I'm running RHEL 6.3 if that helps at all....

    Thanks in advance!

  7. #7
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Quote Originally Posted by ruberked View Post
    Now perhaps I can hit you up with another semi-related question......You don't happen to know where the .desktop files for the three default shortcuts(computer, home dir, trash) reside do you?

    I thought they would be in /user/share/applications directory but it doesn't seem as though that is the case....

    I'm running RHEL 6.3 if that helps at all....
    well, i suppose you could created desktop links for those guys, but they're actually special shortcuts (tightly integrated with Nautilus), so the best thing to do for them would probably be to use gconftool-2 to adjust the proper settings for the given user in GConf. It is a command line tool that is ideal for scripting. I think it is still gconftool-2 in RHEL6, not sure.

  8. #8
    Just Joined!
    Join Date
    Sep 2013
    Posts
    13
    Quote Originally Posted by atreyu View Post
    well, i suppose you could created desktop links for those guys, but they're actually special shortcuts (tightly integrated with Nautilus), so the best thing to do for them would probably be to use gconftool-2 to adjust the proper settings for the given user in GConf. It is a command line tool that is ideal for scripting. I think it is still gconftool-2 in RHEL6, not sure.
    Ha...I'm a bone head. All this, while educational, was for kind of for nothing. I've assumed all this time that a user could delete the "computer", "home dir", "trash" folders. Well, being the genius I am, I just happened to right click on them and whaddaya know?? You can't delete them.....Problem solved....

    One last question and I will stop bugging you and finally go write my stupid tool. Do you happen to know how to lock down other/regular launchers so that a user can not delete them? I tried a bunch of different stuff. A quick test case was to change ownership/group of the .desktop files to....say root for example....but it still seemed as though a regular user could delete them....

    Thanks again!

  9. #9
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Quote Originally Posted by ruberked View Post
    Ha...I'm a bone head. All this, while educational, was for kind of for nothing. I've assumed all this time that a user could delete the "computer", "home dir", "trash" folders. Well, being the genius I am, I just happened to right click on them and whaddaya know?? You can't delete them.....Problem solved....
    ah, if only they were all that easy!

    One last question and I will stop bugging you and finally go write my stupid tool. Do you happen to know how to lock down other/regular launchers so that a user can not delete them? I tried a bunch of different stuff. A quick test case was to change ownership/group of the .desktop files to....say root for example....but it still seemed as though a regular user could delete them....
    you say you've changed the ownership of a *.desktop file to root and a regular user could still delete it? That surprises me. check the output of this, to be sure:
    Code:
    ls -l ~/Desktop/*.desktop
    what i've found is that if the user running the Desktop session is NOT the owner of the .desktop file, then the icon will be somehow be changed to reflect this and the executable won't even launch when double-clicked.

    anyway, one sure way to protect a file from deletion is by setting the immutable flag on it, using the chattr command. Only root can set it though. so su to root and do:

    Code:
    chattr +i /home/user/Desktop/foo.desktop
    you can check for the flag using the companion lsattr util:

    Code:
    # lsattr foo.desktop
    ----i-------- foo.desktop
    with that set, not even root can delete (or change) the file. you can remove the immutable flag, returning the file to normal, with:

    Code:
    chattr -i foo.desktop

  10. #10
    Just Joined!
    Join Date
    Sep 2013
    Posts
    13
    yeah....I changed a *.desktop file ownership/group to root and I could still rename it and delete it. It did act funny tho when I renamed it (via right click). Like it I think it lost the desktop extsion if I remember correcting

    Very interesting about the imuutable siggestion....We use some immutable flags in other parts of the system actually. I didn't personally set them up but I've had to change them before using a procedure a little procedure we have on hand.

    Really appreciate the help! I'll letcha know how it goes!

    Great idea...I will be sure to try this out!

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •