To-Slalom

desktop updates

May 12th, 2021 (edited)
650
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2.  
  3. #########################################
  4. # small script to update desktop files  #
  5. # for linux Puppy Buster and Fossa64    #
  6. # so far the only 2 OS i have test it   #
  7. #########################################
  8.  
  9. ###################################
  10. # list of desktop files to change #
  11. ###################################
  12. DIRECTORY="/usr/share/applications"
  13. file_desktop=(
  14.         'palemoon'
  15.         'chromium'
  16.         'firefox-esr'
  17.         'pcmanfm'
  18.         'sublime_text'
  19.         'gimp'
  20.         'telegramdesktop'
  21.         'lxterminal'
  22.     )
  23. ###################################
  24. # list of categories to change    #
  25. ###################################
  26. list_categories=(
  27.         'WebBrowser'
  28.         'WebBrowser'
  29.         'WebBrowser'
  30.         'FileManager'
  31.         'TextEditor'
  32.         'VectorGraphics'
  33.         'IRCClient'
  34.         'TerminalEmulator'
  35.     )
  36. ###################################
  37. # list of command lines to change #
  38. ###################################
  39. Exec_List=(
  40.         'palemoon'
  41.         'chromium'
  42.         'firefox-esr'
  43.         'pcmanfm'
  44.         'subl'
  45.         'gimp-2.10'
  46.         'telegram-desktop'
  47.         'lxterminal'
  48.     )
  49. # this one im not doing nuthing yet since i just add it yesterday to have an idea
  50. icon_List=(
  51.         'palemoon'
  52.         'chromium'
  53.         'firefox-esr'
  54.         'pcmanfm'
  55.         'subl'
  56.         'gimp-2.10'
  57.         'telegram-desktop'
  58.         'lxterminal'
  59.     )
  60. count_apps=${#file_desktop[@]}
  61. for (( i = 0 ; i < ${count_apps} ; i++ )) ; do
  62.     # check first if path exist
  63.     if [[ -d "$DIRECTORY" ]] ; then
  64.         # check if file exist then do the nasty job
  65.         if [[ -f "${DIRECTORY}/${file_desktop[i]}.desktop" ]] ; then
  66.             sed -i -e "s/^Categories=*.*/Categories=${list_categories[i]}/g" ${DIRECTORY}/${file_desktop[i]}.desktop
  67.             sed -i -e "s/^Exec=*.*/Exec=${Exec_List[i]}/g"                   ${DIRECTORY}/${file_desktop[i]}.desktop
  68.         fi
  69.     fi
  70. done
  71. fixmenus     # fix menus
  72. jwm -restart # restart jwm
RAW Paste Data