qubes-trigger-desktop-file-install 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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=/var/lib/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. 'pulseaudio-kde'
  46. 'deja-dup-monitor'
  47. 'imsettings-start'
  48. 'krb5-auth-dialog'
  49. 'restorecond'
  50. 'sealertauto'
  51. 'spice-vdagent'
  52. 'gnome-power-manager'
  53. 'gnome-sound-applet'
  54. 'gnome-screensaver'
  55. 'orca-autostart'
  56. 'notify-osd'
  57. ); install --remove-show-in --add-not-show-in X-QUBES
  58. # Desktop Entry Modification - NotShowIn=DisposableVM
  59. FILES=('gcm-apply')
  60. install --remove-show-in --add-not-show-in X-DisposableVM
  61. # Desktop Entry Modification - OnlyShowIn=GNOME;AppVM;
  62. FILES=(
  63. 'gnome-keyring-gpg'
  64. 'gnome-keyring-pkcs11'
  65. 'gnome-keyring-secrets'
  66. 'gnome-keyring-ssh'
  67. 'gnome-settings-daemon'
  68. 'user-dirs-update-gtk'
  69. 'gsettings-data-convert'
  70. ); install --remove-show-in --add-only-show-in 'GNOME;X-AppVM'
  71. # Desktop Entry Modification - OnlyShowIn=GNOME;UpdateableVM
  72. FILES=('gpk-update-icon')
  73. install --remove-show-in --add-only-show-in 'GNOME;X-UpdateableVM'
  74. # Desktop Entry Modification - OnlyShowIn=GNOME;QUBES
  75. FILES=('nm-applet')
  76. install --remove-show-in --add-only-show-in 'GNOME;X-QUBES'
  77. # Desktop Entry Modification - Remove existing rules
  78. FILES=(
  79. 'abrt-applet'
  80. ); install --remove-show-in