3

I have a HiDPI display so I often have to customize the Exec lines in /usr/share/applications/*.desktop files to add --force-device-scale-factor=1.8.

I'm finding that whenever Chrome or Spotify are upgraded by apt, this customization is lost.

Is there a persistent way I can do this that wont be lost on upgrade? Didn't apt used to ask whether you wanted to keep or replace files when you had modified them and they needed to be upgraded?

Is there a better place I should be putting these 'patches'?

3
  • 3
    I don't know about vanilla Ubuntu, but in Lubuntu one can put replacement desktop files in /home/[username]/.local/share/applications/. They override the ones in /usr/share/applications and aren't touched by updates. Dec 16, 2016 at 15:47
  • 1
    @OrganicMarble: It works in plain vanilla Ubuntu too.
    – AlexP
    Dec 16, 2016 at 16:49
  • It only prompts about files that are marked as configuration files by the package maintainer, which is probably not the case for .desktop files.
    – fkraiem
    Dec 16, 2016 at 17:35

2 Answers 2

7

One can put replacement desktop files in /home/[username]/.local/share/applications/. They override the ones in /usr/share/applications/ and aren't touched by updates.

(Thanks to AlexP for letting me know that this works in Ubuntu as well as Lubuntu)

3
  • A drawback is that possible changes of the package owned .desktop files will be overridden by the local ones. Dec 16, 2016 at 23:23
  • @GunnarHjalmarsson In this particular case, I don't see how that is a drawback.
    – mchid
    Oct 15, 2017 at 6:46
  • 1
    @mchid: I mean that possible updates of .desktop via package upgrades won't be effective, since the local .desktop file is used instead. Oct 15, 2017 at 10:02
1

One thought is to use wrapper scripts. Example:

$ cat ~/bin/google-chrome
#!/bin/sh
exec /usr/bin/google-chrome --force-device-scale-factor=1.8 "$@"

If you make it executable with

chmod +x ~/bin/google-chrome

it might do what you are after.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .