Fvwm-menu-desktop duplicates and pyxdg

Hi everyone. Gee, stay away for a while, and everything’s different. :slight_smile:

Yeah, I know this is a bit of a duplicate, but I figured the specific title might help others find it better. Plus, I hope more info.

I’m on Ubuntu 20, so Fvwm 2.6.8 and more importantly, pyxdg 0.26. The pyxdg bug has already been mentioned, but the short version is the fvwm-menu-desktop duplication problem is in the pyxdg library, and it’s been fixed.

That’s all nice, but Ubuntu hasn’t made a newer pyxdg available in updates. (No, I’m not going to do a dist-upgrade - I have my reasons. :crazy_face:)

So, I’m hoping to figure out a fix. I’m hesitant to try to just overwrite the system pyxdg with a newer version from git or wherever, but before I try that, I wonder whether I can do a local install of it, and have Fvwm use it. It’d be something like what I remember from years ago, using $LD_LIBRARY_PATH to run beta software for testing. I’m certainly not a Python coder, but I think it has something similar. (IIRC, so does Perl.) If I could stick pyxdg in $HOME/local/python3 (or wherever) and use an ENV to use it for fvwm-menu-desktop somehow, might that be an option? If so, I’d appreciate some details.

ETA: I messed with this some, and this, so far, seems to work. Comments appreciated.

pip install --user --upgrade pyxdg
PYTHON_PATH=~/.local/lib/python3.8/site-packages/xdg/ fvwm-menu-desktop > foo.menu

It threw a lot of errors, but seemed to work OK.

Maybe, if I export the PYTHON_PATH in my .bashrc, it’ll stick for invocations of FvwmForm-XDGMenu-Config. Would it be better to just do SetEnv?

The fvwm-menu-desktop from fvwm2 is a bit dated and some fixes have been included in fvwm3. Since this is just a python script (and the menu syntax has not changed in fvwm3), you could just download the script from the fvwm3 github repo and use that instead. That may fix some of the errors you are seeing. Just put a copy of the script in your $PATH such as $HOME/bin or /usr/local/bin/, and that script will run instead of the one from the Ubuntu package.

Once you have a copy of the script just modify it to use your local pyxdg library (though personally in this case, I wouldn’t worry about installing it system wide with pip). But basically right be fore the test for python-xdg at the top of the fvwm-menu-directory script just add the following line (note use the full path and not ~):

sys.path.insert(1, '/home/user/.local/lib/python3.8/site-packages/xdg')

This is a bit of a hack, but it will force the script to look for packages in that directory first.

Some notes, if you use the fvwm3 script, you’ll have to remove the prefix .in, add the shebang #!/usr/bin/python3 as the first line, and make the script executable, chmod +x.

I’ll give the updated menu script a shot sometime. The errors apparently didn’t affect the output, that I can tell, so I’m not too concerned. (I see lots of mindless “bit spew” messages either in terminals or .xsession-errors, none of which seem to matter, so I’m used to it now.)

But I think I’ll keep the PYTHON_PATH env, rather than editing the script.