{"id":8101,"date":"2018-08-30T16:52:44","date_gmt":"2018-08-30T16:52:44","guid":{"rendered":"http:\/\/ubuntuhandbook.org\/?p=8101"},"modified":"2018-08-30T16:52:44","modified_gmt":"2018-08-30T16:52:44","slug":"add-trash-icon-dock-launcher-ubuntu-18-04","status":"publish","type":"post","link":"https:\/\/ubuntuhandbook.org\/index.php\/2018\/08\/add-trash-icon-dock-launcher-ubuntu-18-04\/","title":{"rendered":"Add Trash Can to Left Panel (Dock Launcher) in Ubuntu 18.04"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2016\/03\/classic-gnome-icon.png\" alt=\"gnome shell\" width=\"245\" height=\"250\" class=\"aligncenter size-full wp-image-5741\" \/><\/p>\n<p>While the trash icon does not have &#8216;<b>Add to Favorites<\/b>&#8216; context menu option, here&#8217;s how to manually add a trash can icon to the left launcher in Ubuntu 18.04 Gnome Shell.<\/p>\n<p>First see the result effect (in the picture, the left panel was replaced by Dash to Dock extension):<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2018\/08\/trash-in-dock-600x280.jpg\" alt=\"\" width=\"600\" height=\"280\" class=\"aligncenter size-large wp-image-8102\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2018\/08\/trash-in-dock.jpg 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2018\/08\/trash-in-dock-450x210.jpg 450w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p><b>1.<\/b> Open terminal either via <b>Ctrl+Alt+T<\/b> shortcut key, or by searching for &#8216;terminal&#8217; from app launcher.<\/p>\n<p><b>2.<\/b> Run command to create and edit an empty file called <code>trash.sh<\/code>:<\/p>\n<pre style=\"border:none;\">gedit ~\/Documents\/trash.sh<\/pre>\n<p>When the file opens, paste following lines and save it.<\/p>\n<pre style=\"background:none;\">#!\/bin\/bash\r\nicon=$HOME\/.local\/share\/applications\/trash.desktop\r\n\r\nwhile getopts \"red\" opt; do\r\n\tcase $opt in\r\n    r)\r\n\tif [ \"$(gio list trash:\/\/)\" ]; then\r\n\t\techo -e '[Desktop Entry]\\nType=Application\\nName=Trash\\nComment=Trash\\nIcon=user-trash-full\\nExec=nautilus trash:\/\/\\nCategories=Utility;\\nActions=trash;\\n\\n[Desktop Action trash]\\nName=Empty Trash\\nExec='$HOME\/Documents\/trash.sh -e'\\n' > $icon\r\n\tfi\r\n\t;;\r\n    e)\r\n\tgio trash --empty && echo -e '[Desktop Entry]\\nType=Application\\nName=Trash\\nComment=Trash\\nIcon=user-trash\\nExec=nautilus trash:\/\/\\nCategories=Utility;\\nActions=trash;\\n\\n[Desktop Action trash]\\nName=Empty Trash\\nExec='$HOME\/Documents\/trash.sh -e'\\n' > $icon\r\n\t;;\r\n    d)\r\n\twhile sleep 5; do ($HOME\/Documents\/trash.sh -r &) ; done\r\n\t;;\r\n  esac\r\ndone<\/pre>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2018\/08\/trash-script.jpg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2018\/08\/trash-script-600x407.jpg\" alt=\"\" width=\"600\" height=\"407\" class=\"aligncenter size-large wp-image-8103\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2018\/08\/trash-script-600x407.jpg 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2018\/08\/trash-script-450x305.jpg 450w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2018\/08\/trash-script-768x521.jpg 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2018\/08\/trash-script.jpg 819w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p><b>3.<\/b> Make the script file executable and run it via the 2 commands:<\/p>\n<pre style=\"border:none;\">chmod +x ~\/Documents\/trash.sh\r\n\r\n.\/Documents\/trash.sh -e<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2018\/08\/run-trash-script-600x102.jpg\" alt=\"\" width=\"600\" height=\"102\" class=\"aligncenter size-large wp-image-8104\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2018\/08\/run-trash-script-600x102.jpg 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2018\/08\/run-trash-script-450x77.jpg 450w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2018\/08\/run-trash-script.jpg 747w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p><b>4.<\/b> Search for &#8216;trash&#8217; in software launcher and select &#8216;Add to Favorites&#8217; in its context menu.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2018\/08\/add-trash-favorites-450x214.jpg\" alt=\"\" width=\"450\" height=\"214\" class=\"aligncenter size-medium wp-image-8105\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2018\/08\/add-trash-favorites-450x214.jpg 450w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2018\/08\/add-trash-favorites.jpg 515w\" sizes=\"auto, (max-width: 450px) 100vw, 450px\" \/><\/p>\n<p><b>5.<\/b> Finally open <b>Startup Applications<\/b>, click <b>Add<\/b> to add a new startup app:<\/p>\n<ul>\n<li>Type a name for the trash script.<\/li>\n<li>Type command <b>\/home\/YOUR_USER_NAME\/Documents\/trash.sh -d<\/b><\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2018\/08\/trash-autostart-600x410.jpg\" alt=\"\" width=\"600\" height=\"410\" class=\"aligncenter size-large wp-image-8106\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2018\/08\/trash-autostart-600x410.jpg 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2018\/08\/trash-autostart-450x308.jpg 450w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2018\/08\/trash-autostart.jpg 687w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>Reboot Ubuntu, and the trash can icon will change when it&#8217;s empty or not empty.<\/p>\n<p style=\"text-align:right;\">via: <a href=\"https:\/\/ubuntuforums.org\/showthread.php?t=2391367\" target=\"_blank\">ubuntuforums<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>While the trash icon does not have &#8216;Add to Favorites&#8216; context menu option, here&#8217;s how to manually add a trash can icon to the left launcher in Ubuntu 18.04 Gnome Shell. First see the result effect (in the picture, the left panel was replaced by Dash to Dock extension): 1. Open terminal either via Ctrl+Alt+T [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[1533,1527],"class_list":["post-8101","post","type-post","status-publish","format-standard","hentry","category-howtos","tag-trash-can","tag-ubuntu-18-04"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/8101","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/comments?post=8101"}],"version-history":[{"count":0,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/8101\/revisions"}],"wp:attachment":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media?parent=8101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/categories?post=8101"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/tags?post=8101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}