Remove Trashcan Icon from Raspberry Pi Desktop

Posted by ads' corner on Sunday, 2020-03-15
Posted in [Raspberry-Pi][Software]

Our home automation got a nice 7" Raspberry display in the kitchen, showing the most relevant information (like temperature, weather, washing machine, dryer ect) on a dedicated screen. Quite handy, especially the temperature, and the one-click stop to the weather forecast.

While installing the Pi and setting everything up, I stumbled over the Icons which LXDE by default shows on the desktop. Not necessary, I want them removed. All I want on the desktop is the browser icon which directly goes to the HABpanel.

The reason is simple: if the Pi starts up, but the browser for unknown reasons doesn’t come up, I don’t want anyone to be confused by additional icons on the desktop. After all, usually the LXDE desktop is not seen by default.

That’s easily done, especially the Trashcan icon is just one config setting away.

In my Ansible Playbook, all I have to do is:

- name: Remove Trashcan icon from Desktop
    dest: /home/pi/.config/pcmanfm/LXDE-pi/desktop-items-0.conf
    regexp: "{{ item.regexp }}"
    line: "{{ item.line }}"
    state: "{{ item.state }}"
    - { regexp: '^show_trash', line: 'show_trash=0', state: present }

This assumes that the default “pi” user is used. The config file is changed, but this requires the user to logout and login again, or reboot the Pi. Which in my case happens regularly - but that’s another story.

Categories: [Raspberry-Pi] [Software]