You are not logged in.

#1 2012-02-09 15:42:43

myrlin
Member
Registered: 2010-06-11
Posts: 300

[SOLVED] Protecting Desktop Files in /usr/share/applications

I am using Openbox/fbpanel, and I have a very irritating problem.

Fbpanel uses the desktop files in /usr/share/applications to create its launcher menu. I have edited several of these to my own requirements (hiding some applications, changing the names of some. etc). This all works fine until I carry out an update, when new versions of packages overwrite these modified files. I then have to do the modifications all over again. Very time-consuming and VERY annoying.

Does anyone have any ideas on how I can prevent this from happening?

Last edited by myrlin (2012-02-11 10:34:39)

Offline

#2 2012-02-09 15:46:06

Gusar
Member
Registered: 2009-08-25
Posts: 3,607

Re: [SOLVED] Protecting Desktop Files in /usr/share/applications

Copy the files you've changed into ~/.local/share/applications

Offline

#3 2012-02-09 16:11:27

myrlin
Member
Registered: 2010-06-11
Posts: 300

Re: [SOLVED] Protecting Desktop Files in /usr/share/applications

Thank you so much for your fast reply, Gusar.

So, does fpanel look in ~/.local/share/applications first, then ignore any duplicates found in /usr/share/applications?

Offline

#4 2012-02-09 16:32:09

Gusar
Member
Registered: 2009-08-25
Posts: 3,607

Re: [SOLVED] Protecting Desktop Files in /usr/share/applications

That's how this stuff is supposed to work, if a file with the same name is present in both /usr/share/applications and ~/.local/share/applicantions, the the file in ~/.local will be used. Works with lxpanel, no idea about fbpanel.

Offline

#5 2012-02-09 19:18:52

myrlin
Member
Registered: 2010-06-11
Posts: 300

Re: [SOLVED] Protecting Desktop Files in /usr/share/applications

Hmm...seems not!

I've just done some experiments, and  I just get two entries in the menu. Looks like an fbpanel issue then?

Thanks again for your help, Gusar.

Offline

#6 2012-02-09 19:24:49

Awebb
Member
Registered: 2010-05-06
Posts: 6,688

Re: [SOLVED] Protecting Desktop Files in /usr/share/applications

For some paranoia reasons, I prefer /usr/local/* over of ~/.local/*. Pure preferencial aestetics, of course.

Offline

#7 2012-02-09 20:11:33

myrlin
Member
Registered: 2010-06-11
Posts: 300

Re: [SOLVED] Protecting Desktop Files in /usr/share/applications

Same result - duplicate entires.

I guess a workaround would be to transfer EVERYTHING from /usr/share/applications into  a local file, delete everything from /usr/sahre/applications, then keep it empty. Seems a bit of a dirty hack, so I would be interested in anyone's views.

Thanks again to everyone for their help.

Offline

#8 2012-02-09 20:40:23

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,019

Re: [SOLVED] Protecting Desktop Files in /usr/share/applications

On ext filesystems, you can use "chattr +i filename" to stop the file from being modified.

Offline

#9 2012-02-10 01:21:56

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,360

Re: [SOLVED] Protecting Desktop Files in /usr/share/applications

I doubt fbpanel can edit the files in /usr/share/applications without requesting root permissions?

In any case, you could just use NoUpgrade on each file in pacman.conf


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#10 2012-02-11 07:45:20

swanson
Member
From: Sweden
Registered: 2011-02-05
Posts: 759

Re: [SOLVED] Protecting Desktop Files in /usr/share/applications

Preventing installation scripts from writing files seems a bit scary, I mean, it might error out? So I made this little script;

 EDIT: removed my stupid script! Much better to backup your .desktop files 
and then restore them, as suggested in this thread. 
Sometimes my scripting curiousity overshadows my logic.

I think you can restart fbpanel with; killall -USR1 fbpanel. I made it since I seem to have the same problem with .local/share/applications and /usr/share/applications, or sometimes some apps don't look in .local/share/ ... , like obmenugen.

Last edited by swanson (2012-02-13 08:31:21)

Offline

#11 2012-02-11 08:49:27

desm0tes
Member
From: 127.0.0.1
Registered: 2012-02-04
Posts: 233
Website

Re: [SOLVED] Protecting Desktop Files in /usr/share/applications

myrlin wrote:

I am using Openbox/fbpanel, and I have a very irritating problem.

Fbpanel uses the desktop files in /usr/share/applications to create its launcher menu. I have edited several of these to my own requirements (hiding some applications, changing the names of some. etc). This all works fine until I carry out an update, when new versions of packages overwrite these modified files. I then have to do the modifications all over again. Very time-consuming and VERY annoying.

Does anyone have any ideas on how I can prevent this from happening?

I don't know how to prevent this from happening, but how to prevent you from having to do all the modifications all over again: It's actually that simple, I can't believe nobody suggested it, yet^^
Backup the modified .desktops in .backup or whereever you want them and after an upgrade, simply

cp .backup/*.desktop /usr/share/applications

Offline

#12 2012-02-11 10:33:02

myrlin
Member
Registered: 2010-06-11
Posts: 300

Re: [SOLVED] Protecting Desktop Files in /usr/share/applications

Very many thanks to everyone for all your advice.

@lucke: This looks like a great solution. I tried it on a single package, and, although I got some warnings from pacman, it didn't error out, so maybe it will be OK. I'll try it with a "pacman -Syu". If it works, it will mean that the upgrade process continues to be automatic, without need for further  manual intervention, which is my aim smile
@swanson: Thank you for this script, and your help.
@desm0tes: This is so elegant:) Many thanks.

One (or several) of the suggestions you have all so kindly provided will deal with the problem, so I will mark this thread as "Solved".

Once again, thank you to everyone.

Offline

#13 2012-02-11 10:52:29

Awebb
Member
Registered: 2010-05-06
Posts: 6,688

Re: [SOLVED] Protecting Desktop Files in /usr/share/applications

How about an incron job, writing back your backups, whenever the files change?

Offline

#14 2012-02-11 10:52:32

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,019

Re: [SOLVED] Protecting Desktop Files in /usr/share/applications

I use that chattr trick for chromium.desktop - there should be no problems, only warnings when updating.

Offline

Board footer

Powered by FluxBB