Skip to content

Commit

Permalink
Update freedesktop README and snappy.desktop.
Browse files Browse the repository at this point in the history
  • Loading branch information
culler committed Jan 2, 2025
1 parent f02130a commit 075253b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 41 deletions.
52 changes: 14 additions & 38 deletions freedesktop/README
Original file line number Diff line number Diff line change
@@ -1,46 +1,22 @@
To make the SnapPy application launchable from a Linux desktop, the
files in the share directory can be installed either in $HOME/.local/share
or in /usr/share.
files in the share directory can be installed either in $HOME/.local/share.
For example, you could do this by running the command:

cp -rp share/* ~/.local/share

You should then be able to search for and launch the snappy application
and pin the SnapPy application icon to your gnome Dock or KDE Application
launcher.

The files consist of a .desktop file and icon files of various sizes in
.png format. The .desktop file is used by the window manager uses to
recognize SnapPy as an application, and to know how to launch it.
Usually you have to logout and log back in before the application icon
will be recognized.

In the old days of setuptools, the snappy.desktop file needed to be
adjusted for different Linux distributions, according to where python
setuptools installs the SnapPy script. So far I have observed:

Ubuntu 13.04 /usr/local/bin
Mandriva 2010 /usr/bin
Fedora 18 /usr/bin

Now we should install python packages with pip instead of setuptools
(and the setup.py file in SnapPy supports this with the the target:
"python setup.py pip_install"). However, as of 2018 a number of
distros, e.g. Ubuntu 18.04, have implemented a new policy for
installing packages with pip. By default the system version of pip
assumes the --user option, which means that packages are installed in
$HOME/.local/lib/pythonX.Y/site-packages and executables such as the
SnapPy script will be installed in $HOME/.local/bin. This is a big
improvement in many ways, but there are two gotchas:

1) The application launcher (as far as I can tell by experiment since
none of this is documented) does not have $HOME/.local/bin in its path.
So when editing your .desktop file be sure to use full paths in both the
Exec and the TryExec lines. If either file is not found, your application
will be silently ignored by the application launcher. (It is not necessary
to use a full path for the Icon line.)

2) If you run pip install --upgrade pip, as you will be instructed to do,
you will no longer have a pip which assumes --user as a default option.
A good way to deal with this is to create a file $HOME/.config/pip/pip.conf
containing these lines:

[install]
user = yes

Then you can use a new version of pip without creating the conflicts with
the linux package manager that the default --user option was designed to
avoid.
Modern linux systems, such as Ubuntu 24.04, no longer support installing
python packages with pip unless they are being installed in a venv.
The .desktop file assumes that you are using $HOME/venv as the name
of the venv that you used to install the snappy package with pip.
If that is incorrect then you will need to edit the Exec line in
snappy.desktop appropriately.
5 changes: 2 additions & 3 deletions freedesktop/share/applications/snappy.desktop
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
[Desktop Entry]
Version=1.0
Version=3.1
Name=SnapPy
GenericName=Manifold browser
Comment=Study hyperbolic 3-manifolds.
MimeType=;
Exec=/usr/local/bin/SnapPy
TryExec=SnapPy
Exec=/home/culler/venv/bin/python3 -m snappy.app
Icon=SnapPy
Type=Application
Terminal=false
Expand Down

0 comments on commit 075253b

Please sign in to comment.