Skip to content

Instantly share code, notes, and snippets.

@hoyang
Created April 9, 2017 21:13
Show Gist options
  • Save hoyang/c4eb7c210c5de056e7b1d5fb837c5bc3 to your computer and use it in GitHub Desktop.
Save hoyang/c4eb7c210c5de056e7b1d5fb837c5bc3 to your computer and use it in GitHub Desktop.
Python script to create GNOME 3 App Folder
#!/usr/bin/python3
import sys, os, json
class AppFolderMgr:
dconf_prefix = 'gsettings set org.gnome.desktop.app-folders.folder:/org/gnome/desktop/app-folders/folders/'
def __init__(self):
self.folder_tree = {
"Utilities": ['catfish.desktop',
'baobab.desktop',
'brasero.desktop',
'org.gnome.clocks.desktop',
'gtkhash.desktop',
'agave.desktop',
'file-roller.desktop',
'diodon.desktop',
'basexgui.desktop',
'activity-log-manager.desktop',
'gcolor2.desktop',
'gnome-nettool.desktop',
'shutter.desktop',
'Windows7.desktop',
'easystroke.desktop',
'screenruler.desktop',
'gnome-calculator.desktop',
'gnome-split.desktop',
'gpick.desktop',
'synapse.desktop',
'gitg.desktop',
'remote-viewer.desktop',
'gnome-translate.desktop',
'indicator-multiload.desktop',
'poedit.desktop',
'tracker-needle.desktop'],
"Accessories": ['onboard.desktop',
'onboard-settings.desktop',
'gnome-system-log.desktop',
'org.gnome.SoundRecorder.desktop',
'wine-notepad.desktop',
'gnome-system-monitor.desktop',
'mugshot.desktop',
'gedit.desktop',
'nautilus.desktop',
'vim.desktop',
'bijiben.desktop',
'nact.desktop',
'org.gnome.Logs.desktop',
'nautilus-pastebin-configurator.desktop',
'gnome-dictionary.desktop',
'gnome-user-share-properties.desktop',
'org.gnome.Weather.Application.desktop',
'org.gnome.Maps.desktop',
'gnome-pomodoro.desktop',
'ebook-viewer.desktop',
'org.gnome.font-viewer.desktop',
'org.gnome.Documents.desktop',
'org.gnome.Dictionary.desktop',
'org.gnome.Contacts.desktop',
'org.gnome.baobab.desktop',
'org.gnome.gedit.desktop',
'org.gnome.Books.desktop',
'org.gnome.GPaste.Settings.desktop',
'gnome-schedule.desktop',
'org.gnome.Screenshot.desktop',
'gpk-application.desktop',
'gnome-power-statistics.desktop',
'gnome-terminal.desktop',
'gnome-search-tool.desktop',
'gnome-contacts.desktop',
'yelp.desktop',
'gucharmap.desktop',
'orca.desktop'],
"System-Tools": ['alacarte.desktop',
'zeitgeist-explorer.desktop',
'software-properties-drivers.desktop',
'org.gnome.Boxes.desktop',
'software-properties-gnome.desktop',
'gnome-power-panel.desktop',
'gnome-session-properties.desktop',
'software-properties-gtk.desktop',
'gpk-update-viewer.desktop',
'network.desktop',
'landscape-client-settings.desktop',
'gdebi.desktop',
'nm-connection-editor.desktop',
'deja-dup-preferences.desktop',
'users.desktop',
'virt-manager.desktop',
'update-manager.desktop',
'flash-player-properties.desktop',
'usb-creator-gtk.desktop',
'qtconfig-qt4.desktop',
'arandr.desktop',
'virtualbox.desktop',
'vmware-netcfg.desktop',
'vmware-player.desktop',
'vmware-workstation.desktop',
'synaptic.desktop',
'gconf-editor.desktop',
'time.desktop',
'deja-dup.desktop',
'gnome-deja-dup-panel.desktop',
'gigolo.desktop',
'htop.desktop',
'ca.desrt.dconf-editor.desktop',
'nvidia-settings.desktop',
'gnome-tweak-tool.desktop',
'gnome-control-center.desktop',
'gufw.desktop',
'menulibre.desktop',
'wine-browsedrive.desktop',
'wine.desktop',
'winetricks.desktop',
'pavucontrol.desktop',
'wine-uninstaller.desktop',
'wine-winecfg.desktop',
'tracker-preferences.desktop',
'gparted.desktop',
'gnome-activity-journal.desktop',
'seahorse.desktop',
'gnome-disks.desktop'],
"Network": ['transmission-gtk.desktop',
'uget-gtk.desktop',
'wireshark.desktop',
'opera.desktop',
'org.baedert.corebird.desktop',
'teamviewer.desktop',
'Google-googleearth.desktop',
'xchat.desktop',
'dropbox.desktop',
'iptux.desktop',
'filezilla.desktop',
'viber.desktop',
'firefox.desktop',
'qthid-2.2.desktop',
'qthid.desktop',
'birdie.desktop',
'pidgin.desktop',
'opera-browser.desktop',
'gnome-blog.desktop',
'skype.desktop',
'smart_qq.desktop',
'nutstore-menu.desktop',
'gnuradio-grc.desktop',
'remmina.desktop',
'empathy.desktop',
'google-chrome.desktop'],
"Office": ['calibre-gui.desktop',
'goldendict.desktop',
'cherrytree.desktop',
'dia.desktop',
'youdao-dict.desktop',
'gnome-genius.desktop',
'gtg.desktop',
'www.octave.org-octave.desktop',
'evince.desktop',
'evolution.desktop',
'gnucash.desktop',
'gnote.desktop',
'libreoffice-base.desktop',
'libreoffice-calc.desktop',
'libreoffice-draw.desktop',
'libreoffice-impress.desktop',
'libreoffice-math.desktop',
'libreoffice-writer.desktop',
'libreoffice-startcenter.desktop',
'pencil.desktop',
'anki.desktop',
'wiznote.desktop',
'zim.desktop',
'lrfviewer.desktop',
'keepassx.desktop',
'zotero.desktop',
'thunderbird.desktop',
'xmind.desktop',
'wiznote.desktop',
'simple-scan.desktop',
'gelemental.desktop'],
"AudioVideo": ['smplayer.desktop',
'rhythmbox.desktop',
'bitwig-studio.desktop',
'lightworks.desktop',
'pitivi.desktop',
'puddletag.desktop',
'osdlyrics.desktop',
'mkvmergeGUI.desktop',
'mkvinfo.desktop',
'gnome-sound-recorder.desktop',
'gnome-music.desktop',
'cheese.desktop',
'audacity.desktop',
'gnome-dvb-control.desktop',
'gnome-dvb-setup.desktop',
'easytag.desktop',
'oggconvert.desktop',
'winff.desktop',
'vlc.desktop'],
"Game": ['teeworlds.desktop',
'steam.desktop',
'Counter-Strike Global Offensive.desktop',
'Dota 2.desktop',
'Team Fortress 2.desktop',
'No More Room in Hell.desktop',
'War Thunder.desktop',
'supertuxkart.desktop',
'sol.desktop',
'gmchess.desktop',
'gnome-klotski.desktop',
'gnome-mahjongg.desktop',
'gnome-hearts.desktop',
'lightsoff.desktop',
'gnome-sudoku.desktop',
'openttd.desktop',
'gnome-mines.desktop',
'iagno.desktop',
'gnome-nibbles.desktop',
'gnome-mastermind.desktop',
'sweethome3d.desktop',
'stellarium.desktop',
'four-in-a-row.desktop',
'flare.desktop',
'gnome-chess.desktop',
'five-or-more.desktop',
'swell-foop.desktop',
'tali.desktop',
'gnome-tetravex.desktop',
'gnome-robots.desktop',
'quadrapassel.desktop'],
"Graphics": ['gimp.desktop',
'gthumb.desktop',
'inkscape.desktop',
'org.gnome.Photos.desktop',
'rawtherapee.desktop',
'eog.desktop',
'display.im6.desktop'],
"GoogleChromeApps": ['chrome-gbchcmhmhahfdphkhkmpfmihenigjmpp-Default.desktop',
'chrome-app-list.desktop',
'chrome-hfgjlgjnpkpmnpojkkpfkogapiclopop-Default.desktop',
'chrome-hfhhnacclhffhdffklopdkcgdhifgngh-Default.desktop',
'chrome-hmjkmjkepdijhoojdojkdfohbdgmmhki-Default.desktop',
'chrome-joodangkbfjnajiiifokapkpmhfnpleo-Default.desktop',
'chrome-pnoffddplpippgcfjdhbmhkofpnaalpg-Default.desktop',
'chrome-knipolnnllmklapflnccelgolnpehhpl-Default.desktop',
'chrome-ohmmkhmmmpcnpikjeljgnaoabkaalbgc-Default.desktop'],
"Development": ['android-developer-tools.desktop',
'bluefish.desktop',
'kiki.desktop',
'anjuta.desktop',
'zeal.desktop',
'aurora.desktop',
'smartgit.desktop',
'QtProject-qtcreator.desktop',
'atom.desktop',
'DigiaQtOpenSource-qtcreator.desktop',
'chrome-fhbjgbiflinjbdggehcddcbncdddomop-Default.desktop',
'ghex.desktop',
'nemiver.desktop',
'bpython.desktop',
'codeblocks.desktop',
'jdev.desktop',
'devhelp.desktop',
'netbeans-8.0.desktop',
'drracket.desktop',
'SenchaArchitect.desktop',
'wxformbuilder.desktop',
'eclipse.desktop',
'jedit.desktop',
'komodo-ide-8.desktop',
'meld.desktop',
'mysql-workbench.desktop',
'pgadmin3.desktop',
'rapidsvn.desktop',
'R.desktop',
'sqldeveloper.desktop',
'glade.desktop',
'retext.desktop',
'sqliteman.desktop',
'google-webdesigner.desktop',
'sublime_text.desktop',
'brackets.desktop',
'emacs.desktop',
'jetbrains-phpstorm.desktop',
'jetbrains-clion.desktop',
'HeidiSQL.desktop',
'Notepad++.desktop',
'jetbrains-pycharm.desktop',
'jetbrains-rubymine.desktop',
'tiled.desktop',
'webstorm.desktop',
'vscode.desktop',
'blender.desktop',
'idea.desktop']
}
def _gsettings(self, category, key, value):
shell_command = self.dconf_prefix + category + "/" + " " + key + " " + value
print(shell_command)
os.system( shell_command )
def enableCategory(self, categories):
shell_command = 'gsettings set org.gnome.desktop.app-folders folder-children ' + categories
print(shell_command)
os.system(shell_command)
def setCategory(self, category):
self._gsettings(category, 'name', category + ".directory")
self._gsettings(category, 'translate', 'true')
def setCategoryApplications(self, category, apps):
self.setCategory(category)
self._gsettings(category, 'apps', '"' + str(apps) + '"')
if __name__ == "__main__":
appFolderMgr = AppFolderMgr()
categories = []
for folder, apps in appFolderMgr.folder_tree.items():
appFolderMgr.setCategoryApplications(folder, apps)
categories.append(folder)
enableCategories = '"' + str(categories) + '"'
appFolderMgr.enableCategory(enableCategories)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment