How to get popup window before empty gnome trash in Ubuntu

Sponsored Link
We have already discussed how to empty gnome trash from command line this will delete all the contents without prompt any warning this tutorial will explain how to get popup window before empty gnome trash.
Open terminal and run the following commands

First you need to create emptytrash file

gksudo gedit /usr/local/bin/emptytrash

Now you need to copy and paste the following lines

#!/bin/bash
zenity --question --text "Permanently remove all items from the trash?" && rm -rf ~/.Trash/*

Save and exit the file

Zenity is a tool that allows you to display Gtk+ dialog boxes from the command line and through shell scripts. It is similar to gdialog, but is intended to be saner. It comes from the same family as dialog, Xdialog, and cdialog, but it surpasses those projects by having a cooler name.

Now you need to give execute permissions for our script

sudo chmod +x /usr/local/bin/emptytrash

Now you need to open configuration editor using the following command  from your terminal

gconf-editor &

Once you get the configuration editor window go to navigate to Apps > Metacity > global_keybindings > run_command_1. Right-click the value and select Edit Key and put in the keyboard shortcut you want

<Control><Shift>e

go to Apps > Metacity > keybinding_commands > command_1. Right-click the value and select Edit Key and put in the command

emptytrash

Now, the keyboard shortcut Control-Shift-E should bring up the empty trash dialogue.

Credit goes here

Sponsored Link

Related posts

4 thoughts on “How to get popup window before empty gnome trash in Ubuntu

  1. I just ran this, it empties the trash and is much simpler.
    [you@yourbox ~]$ rm -rf ~/.local/share/Trash/files/*
    For some reason Gnome isn’t displaying an empty trash can, but the free space has just increased by more than 8 Gb. I’ve been through this previously and the can will empty on after a while, or after reloading X, I don’t recall. Fedora 10 mind you, but it would be the same thing in Ubuntu. Kurt

    [Reply]

Leave a comment

Your email address will not be published. Required fields are marked *