qubes-trigger-desktop-file-install 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #!/bin/bash -e
  2. # vim: set ts=4 sw=4 sts=4 et :
  3. #
  4. # qubes-trigger-desktop-file-install
  5. #
  6. # This trigger script calls qubes-desktop-file-install to installation and edit
  7. # desktop file overrides, leaving the original desktop file in-place and
  8. # untouched.
  9. #
  10. # 'qubes-desktop-file-install' options:
  11. # --dir DIR Install desktop files to the DIR directory (default: <FILE>)
  12. # --force Force overwrite of existing desktop files (default: False)
  13. # --remove-show-in Remove the "OnlyShowIn" and "NotShowIn" entries from the desktop file (default: False)
  14. # --remove-key KEY Remove the KEY key from the desktop files, if present
  15. # --set-key (KEY VALUE) Set the KEY key to VALUE
  16. # --remove-only-show-in ENVIRONMENT Remove ENVIRONMENT from the list of desktop environment where the desktop files should be displayed
  17. # --add-only-show-in ENVIRONMENT Add ENVIRONMENT to the list of desktop environment where the desktop files should be displayed
  18. # --remove-not-show-in ENVIRONMENT Remove ENVIRONMENT from the list of desktop environment where the desktop files should not be displayed
  19. # --add-not-show-in ENVIRONMENT Add ENVIRONMENT to the list of desktop environment where the desktop files should not be displayed
  20. QUBES_DESKTOP_FILE_INSTALL='/usr/bin/qubes-desktop-file-install'
  21. QUBES_XDG_CONFIG_DIR=/usr/share/qubes/xdg/autostart
  22. XDG_CONFIG_DIR=/etc/xdg/autostart
  23. INSTALL_CMD=""${QUBES_DESKTOP_FILE_INSTALL}" --force --dir "${QUBES_XDG_CONFIG_DIR}""
  24. # Remove all current Qubes desktop entry files
  25. if [ "${1}" == "clean" ]; then
  26. rm -f "${QUBES_XDG_CONFIG_DIR}"/*
  27. fi
  28. generatePath () {
  29. echo "${XDG_CONFIG_DIR}/${1}.desktop"
  30. }
  31. generateFileList () {
  32. for key in "${!FILES[@]}"; do
  33. FILES[${key}]="$(generatePath ${FILES[key]})"
  34. done
  35. }
  36. install () {
  37. local options="${@}"
  38. # Install an edited version of desktop file in $QUBES_XDG_CONFIG_DIR
  39. generateFileList
  40. $INSTALL_CMD "${@}" "${FILES[@]}" || true
  41. }
  42. # Desktop Entry Modification - NotShowIn=QUBES
  43. FILES=(
  44. 'pulseaudio'
  45. 'deja-dup-monitor'
  46. 'imsettings-start'
  47. 'krb5-auth-dialog'
  48. 'restorecond'
  49. 'sealertauto'
  50. 'gnome-power-manager'
  51. 'gnome-sound-applet'
  52. 'gnome-screensaver'
  53. 'orca-autostart'
  54. 'notify-osd'
  55. ); install --remove-show-in --add-not-show-in X-QUBES
  56. # Desktop Entry Modification - NotShowIn=DisposableVM
  57. FILES=('gcm-apply')
  58. install --remove-show-in --add-not-show-in X-DisposableVM
  59. # Desktop Entry Modification - OnlyShowIn=GNOME;AppVM;
  60. FILES=(
  61. 'gnome-keyring-gpg'
  62. 'gnome-keyring-pkcs11'
  63. 'gnome-keyring-secrets'
  64. 'gnome-keyring-ssh'
  65. 'gnome-settings-daemon'
  66. 'user-dirs-update-gtk'
  67. 'gsettings-data-convert'
  68. ); install --remove-show-in --add-only-show-in 'GNOME;X-AppVM'
  69. # Desktop Entry Modification - OnlyShowIn=GNOME;UpdateableVM
  70. FILES=('gpk-update-icon')
  71. install --remove-show-in --add-only-show-in 'GNOME;X-UpdateableVM'
  72. # Desktop Entry Modification - OnlyShowIn=GNOME;QUBES
  73. FILES=('nm-applet')
  74. install --remove-show-in --add-only-show-in 'GNOME;X-QUBES'
  75. # Desktop Entry Modification - Remove existing rules
  76. FILES=(
  77. 'abrt-applet'
  78. ); install --remove-show-in