Elementary OS. Keep clean and tidy in Applications

Hello!

When I first went to the Habr, I realized that I was at home. Home, Sweet Home. ...
Everything did not dare to write. Here, I decided! Writing. Good il bad, but I write.



I was always depressed by the mess in [... everywhere, I don’t like the mess ...] in the applications menu of Mandriva, Suse, Ubuntu, Elementary OS (I decided to list them in the order of use. I am writing and nostalgic). Of course, the situation is the same for the vast majority of distributions, since the information on how and where to display the program is written by the creators of these programs in * .desktop files. And many of them do not seem to care about the mess that comes from such a negligent attitude towards the logic of building navigation.

I decided to fix it. A long time ago a long time ago, scary a long time ago And after a while, a long time ago ... Taki fixed it. And I decided and was going to show you just now.

Task: to remove all superfluous from Applications. At the same time, not only not to lose in the convenience of work, but also to win many times.

I figured out how to achieve what I need in the simplest way. And I need order in the menu and at the same time the performance of all programs. Different * .desktop files had different structure and line order. In a word - no order. Someone in the forest, some for firewood. Changing them yourself and perfecting an ungrateful task. Yes, I once did this, I was still on Ubuntu then. Threw) Although the achievements are still and probably should be laid out as is. Perhaps I will get user support in my endeavor, or maybe they will criticize me to the smithereens so that I forget about this long-standing idealistic venture as a nightmare. What to do, we must try.

Experimentally, I realized that you need to add two lines to the very beginning of each * .desktop file:
[Desktop Entry]
NoDisplay=true


What are * .desktop files? - Something like shortcuts in Windows. Located in / usr / share / applications /

I wrote a simple bash file. Visually broke it into three parts:

  • What I run from the console. I don’t want people to see specific applications. And they themselves would not be embarrassed and did not embarrass me what would b.
  • What essentially is nothing to do in the program menu. Archivers, players, viewers and others. This is the staff, whose work should be elegant, fast and hateful.
  • Text editors. Took out a separate unit for convenience. As in the previous paragraph, I probably clicked on the editor’s icon several times, the first of out of curiosity. If we still need an editor at hand, then no one forbids docking it. It will not be in the application menu, but in the dock.


Here it is, for example:



Note:
My native Scratch as an editor did not take root, but I did not find anything better than Scratch for organizing TODO lists and all kinds of notes. She was once in love with Tomboy notes, console wyrd, then with Wunderlist. I tried a lot of things and stopped now on a bunch of responsive and simple test editor with fixing the folder tree (Scratch) and the cloud service (Dropbox). The folders in the picture in the left sidebar are fixed and do not disappear when you open / close the editor. Conveniently. I discovered such functionality by chance and fell in love with it.

The bash code of the script to clean up the application menu
#!/bin/bash
# Just not needed for others to know that i have this in my system. # I always can run them from cli. Вот
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/synaptic.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/synaptic.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/teamviewer-teamviewer9.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/teamviewer-teamviewer9.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/bleachbit.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/bleachbit.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/bleachbit-root.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/bleachbit-root.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/virtualbox.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/virtualbox.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/wireshark.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/wireshark.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/umit.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/umit.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/bum.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/bum.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/gparted.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/gparted.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/guake.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/guake.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/luakit.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/luakit.desktop
# Rubbish. То, что не запускаем отдельно, # а открывается автоматически при открытии соответствующего файла,# основываясь на file associations 
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/dropbox.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/dropbox.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/AdobeAIR.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/AdobeAIR.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/file-roller.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/file-roller.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/caffeine-preferences.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/caffeine-preferences.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/evince.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/evince.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/gdebi.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/gdebi.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/gthumb.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/gthumb.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/update-manager.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/update-manager.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/vlc.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/vlc.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/pantheon-terminal.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/pantheon-terminal.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/noise.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/noise.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/libreoffice4.3-base.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/libreoffice4.3-base.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/libreoffice4.3-calc.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/libreoffice4.3-calc.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/libreoffice4.3-math.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/libreoffice4.3-math.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/libreoffice4.3-draw.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/libreoffice4.3-draw.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/libreoffice4.3-impress.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/libreoffice4.3-impress.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/libreoffice4.3-writer.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/libreoffice4.3-writer.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/ibus-setup.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/ibus-setup.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/empathy.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/empathy.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/totem.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/totem.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/gxneur.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/gxneur.desktop
# Скрыла, потому что эти приложения доступны из контекстного меню. # Посчитала излишним дублировать их в меню. Время покажет права ли я.
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/scratch-text-editor.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/scratch-text-editor.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/scribes.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/scribes.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/sublime_text.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/sublime_text.desktop
sudo sed -i '1iNoDisplay=true'  /usr/share/applications/atom.desktop
sudo sed -i '1i[Desktop Entry]' /usr/share/applications/atom.desktop
#Пример как удалить ошибочную строку после batch edit. Экранируем спецсимволы и ставим параметр 'd'#sudo sed -i '/\[Desktop Entry\] NoDisplay=true/d' /usr/share/applications/synaptic.desktop



Of all the icons of the liberophis, she left only one - the central one.

Save and run.

chmod u+x Beautify_menu
sh Beautify_menu

Just one inconvenience. The script must be restarted after program updates. Since they erase the old and write a new * .desktop file. As a result, our edits are lost and you need to repeat the script. But what about when one program is updated, while others are not. What then? Don’t worry, multiple lines below do not affect anything:

[Desktop Entry]
NoDisplay=true
[Desktop Entry]
NoDisplay=true
[Desktop Entry]
NoDisplay=true
[Desktop Entry]
NoDisplay=true


Because the script can be run endlessly many times.

How optimally the script is written, I leave for your judgment. It seems to me personally that the code can be simplified at least twice. But how exactly, I do not know. I was tortured to experiment and laid out as is.

Do not run this script blindly. Think about whether you want what I wanted. Perhaps everything suits you.

If you are in solidarity with my point of view about the order in the menu, do not forget to fix the script “for yourself”. I wish you all good luck.

In a future article, I would like to introduce you to my console and its aliases. A lot more of what lies in the daddy marked “In dev”. My thoughts are inconsistent, I know.


Also popular now: