Snap package ignoring cursor theme

System info:

Distribution: Ubuntu 23.10
DE: GNOME 45.2
WM: Mutter
Windowing System: Wayland
snap:    2.61.1
snapd:   2.61.1
kernel:  6.5.0-15-generic

I have cursor theme at $HOME/.icons. Snap apps does not respect that location. It looks a bit weird. Is there a solution ? I know it’s due to sandboxing but how can we allow $HOME/.icons access?

Icon themes also need to be installed in the snap. As it’s not possible… move the cursor theme to the snap’s .icons folder. i.e $HOME/snap/<snap-name>/current/.local/share/icons

This is a lot of work… but you may try some auto mating commands…

I moved the icons to $HOME/snap/<snap-name>/current/.local/share/icons still no change. Am I missing something?

You’d have to do this for each of those snaps. Try logging-out and logging in also.

Today I finally found a real solution to this problem and just thought I’d share it with the internet. Hopefully some people find this useful and are able to apply this advice to whatever cursor theme they are using.

So currently I am using a cursor theme called “Bibata-Modern-Ice” which has no snap package in the store and my solution here basically goes over how to compile it into a snap, install on your system and configure your snap applications to actually use it.

For this example I’m using this git repo like a template. https://github.com/stoefelz/arcaurora-cursors-snap

  1. I cloned the repo with this command git clone https://github.com/stoefelz/arcaurora-cursors-snap

  2. I went here and downloaded “Bibata-Modern-Ice.tar.xz”

  3. Extracted the archive containing my cursor theme and verified that it’s directory structure is like so:

Bibata-Modern-Ice
├── cursors
│   ├── [...] (Lots of files with numbers & stuff)
├── cursor.theme
└── index.theme

  1. Recompressed the archive which was downloaded in step 2 into a zip archive. (I think this may be unnecessary)

  2. Moved into the repository directory in my terminal (cd arcaurora-cursors-snap) and also moved the zip file I made in the previous step to this same directory.

  3. Edited the file snap/snapcraft.yaml like so:

---
name: bibata-modern-ice-cursors
version: '1.0'
base: core22
license: GPL-3.0
grade: stable
confinement: strict
summary: Bibata Cursor Theme
description: |
  This snap contains the Bibata-Modern-Ice cursor theme
slots:
  icon-themes:
    interface: content
    source:
      read:
        - $SNAP/share/icons/Bibata-Modern-Ice
parts:
  cursors:
    plugin: dump
    source: ./Bibata-Modern-Ice.zip
    override-build: |
      snapcraftctl build
      mkdir -p $SNAPCRAFT_PART_INSTALL/share/icons
      mv -f $SNAPCRAFT_PART_INSTALL/Bibata-Modern-Ice $SNAPCRAFT_PART_INSTALL/share/icons/
    stage:
      - share/icons/Bibata-Modern-Ice
  1. Installed snapcraft using the command sudo snap install snapcraft

  2. Ran the command snapcraft inside the git repo directory

  3. I was prompted to allow the automatic installation of a snap called lxd during the process. I had to manually add my user to the lxd group which I did using sudo usermod -a -G lxd (your linux user here)

  4. After logging out of GNOME and then logging back in I moved back into the repo directory and reran the snapcraft command

  5. Finally, the snapcraft command exited successfully and I then found a file in my repo directory called bibata-modern-ice-cursors_1.0_amd64.snap which I installed using the command sudo snap install bibata-modern-ice-cursors_1.0_amd64.snap --dangerous

  6. I ran snap connections firefox command and noted the plug and slot for firefox:gtk-3-themes and firefox:icon-themes which had extra entries for me (from previous theme installation attempts).

  7. I disconnected the firefox:gtk-3-themes & firefox:icon-themes plugs using commands sudo snap disconnect firefox:gtk-3-themes and sudo snap disconnect firefox:icon-themes

  8. Reconnected the firefox gtk 3 themes plug using sudo snap connect firefox:gtk-3-themes gtk-common-themes:gtk-3-themes

  9. Connected the icon themes plug to my newly installed snap package with the command sudo snap connect firefox:icon-themes bibata-modern-ice-cursors:icon-themes

  10. Restarted the firefox snap app and observed that the Bibata modern ice cursor theme is actually being used after all this work.

To apply this theme to my other apps I basically repeated steps 12 - 16 but with the package name of the other app I wanted to change like discord for example. If you want to see a list of your packages in the terminal you can run snap list

Disclaimers: I’m not really much of a programmer and I don’t really know what I’m doing on a deep technical level. I think this solution won’t work if your theme for other like normal gtk apps isn’t set to exactly the same thing as what’s being used in the theme snap. For example my cursor theme in gnome-tweaks is set to “Bibata-Modern-Ice” and I installed the same exact files in the archive from step 2 into ~/.icons /usr/share/icons and .local/share/icons so if your doing this with a different cursor theme you might need to make sure you have it installed in those locations also and that everything lines up in the snapcraft.yaml file where I basically replaced all the references to arc aurora with the theme I wanted (Bibata modern ice).

2 Likes

To allow snap to connect to locate and access hte $HOME/ .icons. You need to connect to home to access the snap package. After this you allow to access the specific directories in your home directory include iocn folder. For this run command:

sudo snap connect <snap_name>:home

That’s not at all true. Snaps have separate home folders of their own.

Yea I tried the sudo snap connect discord:home just now like how johntk005 stated and it doesn’t seem to allow the current gtk cursor theme to work - for me… I wish it were that simple though. I’ve tried many other solutions and such from several online forums and only the solution I’ve outlined earlier worked for me personally.

The home interface does not allow access to any hidden files or directories (i.e. anything starting wirh a dot) … so it wouldn’t help with accessing ~/.icons at all

Packaging the theme as a content provider snap (best done by the theme upstream themselves indeed) is the correct solution to provide themes to snaps

1 Like

That’s the correct solution may be from the POV of snap and snap community, but not at all from the POV of an user. An user can use any arbitrary cursor. The package format should support it. I really think, that as a community we should look into theming heavily now, specifically for KDE, as there is nothing called default in KDE like in Gnome.

There is automation and all, but a snap of the theme must exist, see the video attached to the announcement about automatic snap theme handling:

1 Like

If you would look at the description of the arcaurora-cursors snap that you took as base for creating your own snap you would see this:

  **Applying the theme**
  
  To apply the theme to a single application, perform the following:
  
  `sudo snap connect [snap-you-want-to-theme]:icon-themes
  arcaurora-cursors:icon-themes`
  
  To apply to all applications run the following command. Thanks to
  @flexiondotorg for the handy loop.
  
  ` for plug in $(snap connections | grep gtk-common-themes:icon-themes | awk
  '{print $2}'); do sudo snap connect ${plug} arcaurora-cursors:icon-themes;
  done`
  
  _NOTE:_ Some apps like the Ubuntu Snap Store may require logging out, and
  back in to load the changes.

So you could apply the theme to all your currently installed snaps with that one command. I used that previously, but for the themes and icons snaps. Pretty much any snap of that kind has that handy commands in it’s description.

1 Like

Also thank you @NoMoreWindows for this topic.

I packaged two snap cursor themes thanks to your findings. And I will probably make more in the future.

Also thanks for the Bibata cursors. I didn’t knew about those before, and the guy that made them has several other nice cursor themes.

1 Like