12

I just installed Ubuntu 18.04 and don't like having the trash icon on the desktop rather that in the launcher (Ubuntu dock).

How can I move it back to the launcher? Can other icons be moved from the desktop to the launcher?

pomsky
  • 68,507
user607003
  • 121
  • 1
  • 1
  • 4

1 Answers1

16

Removing the Trash icon from desktop

Up to Ubuntu 18.10

Launch Terminal and run

gsettings set org.gnome.nautilus.desktop trash-icon-visible false

You may alternatively use GUI tools like dconf-Editor or (GNOME) Tweaks (see this for reference).

Ubuntu 19.04 and later

Disable the trash icon option from Extensions > Desktop Icon in Tweaks:
enter image description here Alternatively, run the following command (note that this does not work from 21.04 onwards)

gsettings set org.gnome.shell.extensions.desktop-icons show-trash false

Adding a Trash icon to the Ubuntu dock

Up to Ubuntu 19.04

Follow the steps below.

  1. First install the trash-cli package by running

    sudo apt install trash-cli
    
  2. Create a .desktop file (say trash-in-dock.desktop) in your ~/.local/share/applications/ directory.

  3. Open the file with a text editor and add the following lines

    [Desktop Entry]
    Comment=Trash icon for Ubuntu dock
    Terminal=false
    Name=Trash for Dock
    Exec=nautilus trash:///
    Type=Application
    Icon=user-trash
    NoDisplay=false
    Actions=empty-trash;
    

    [Desktop Action empty-trash] Name=Empty Trash Exec=trash-empty

  4. Save the file and re-login if needed.

  5. Click "Activities" or press Super and search for Trash for Dock. It should appear in the results.

  6. Right click the icon and select "Add to Favourites".

What you will get

  1. A Trash icon in your dock, clicking which will open the Trash folder.

  2. Right clicking the Trash icon in the dock will show an "Empty Trash" option which should work as intended.
    enter image description here

What you won't get

  1. The Trash icon in the dock would be like other app icons, it won't be conveniently placed at the bottom like in Unity Launcher.

  2. The Trash icon in the dock would be a 'static' one, i.e. won't show two different icons depending on whether the Trash is empty or not.

Ubuntu 19.10 and later

Simply run the following command

gsettings set org.gnome.shell.extensions.dash-to-dock show-trash true
RomanSt
  • 103
  • 4
pomsky
  • 68,507
  • Thanks for the info. I will give it a try. I don't know why they took it out of the launcher/dock to begin with or why the nomenclature has to be changed just to confuse things. – user607003 Aug 21 '18 at 14:24
  • @user607003 It's not just the nomenclature, it goes deeper than that. Ubuntu 18.04 uses GNOME instead of Unity (after 6 years or so). The changeover is massive. – pomsky Aug 21 '18 at 14:26
  • About the step Save the file and re-login if needed.: Is not necessary, not even to reset (alt+f2 r). – Pablo Bianchi Mar 04 '19 at 18:23
  • @pablo Are you absolutely sure that's not required? I, for one, a few times experienced the issue of a newly created custom launcher not appearing in 'Show Applications' immediately after creation (and at least restarting GNOME shell was required). – pomsky Mar 04 '19 at 18:35
  • Only Chuck Norris can be absolutely sure about something. I just did it and it wasn't necessary. Gnome 3.28.3 @ 18.04.2. Maybe you could leave it at the end as a note if it doesn't work. – Pablo Bianchi Mar 04 '19 at 20:00
  • I don't understand the desktop file thing how do i type it? – Adnan Hossain Mar 07 '20 at 17:24
  • @AdnanHossain As stated in step 3, open with a text editor. – pomsky Mar 08 '20 at 08:46
  • i get this error No such schema “org.gnome.nautilus.desktop” – gccallie Apr 27 '20 at 16:50
  • @gccallie Are you sure you are using Ubuntu 18.04? – pomsky Apr 27 '20 at 16:55
  • @pomsky my mistake, I am on ubuntu 20.04. I solved by going to the extension management page (https://extensions.gnome.org/local/) then opening dash to dock configuration. Inside "Launchers" panel I found the "Show trash can" toggle option. – gccallie Apr 28 '20 at 13:13
  • Yes, this (question and) answer is not very useful for newer releases as they come with a trash on the dock feature by default. – pomsky Apr 28 '20 at 15:08
  • On Fedora 37 with Gnome 43, the setting is in "Extensions -> Dash to Dock -> Launchers -> 5th switch says "Show trash can". org.gnome.shell.extensions.dash-to-dock says not found – undefined Feb 09 '23 at 06:30