Hi! Guys, I’m trying to build project hamster in snap, since it’s the best time tracking software I’ve erver used , and the sad truth is that there have been no deb packages since 18.04.
I’m able to launch it, but I’m not very experience in snap and dbus. I’m seeking for advice on how to make ergonomics better.
Here’s the snap
name: hamster-snap # you probably want to 'snapcraft register <name>'
base: core18 # the base snap is the execution environment for this snap
version: "0.1" # just for humans, typically '1.2+git' or '1.3.2'
summary: snap for project hamster # 79 char long summary
description: |
First attempt for creating a snap for project hamster.
grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots
slots:
dbus-hamster:
interface: dbus
bus: session
name: org.gnome.Hamster
plugs:
gnome-3-28-1804:
interface: content
target: $SNAP/gnome-platform
default-provider: gnome-3-28-1804
gtk-3-themes:
interface: content
target: $SNAP/data-dir/themes
default-provider: gtk-common-themes
icon-themes:
interface: content
target: $SNAP/data-dir/icons
default-provider: gtk-common-themes
sound-themes:
interface: content
target: $SNAP/data-dir/sounds
default-provider: gtk-common-themes
apps:
hamster-service:
command: desktop-launch ${SNAP}/usr/lib/hamster-time-tracker/hamster-service
plugs:
- desktop
- desktop-legacy
- gsettings
- home
environment:
PYTHONPATH: $SNAP/usr/lib/python2.7/dist-packages
hamster-windows-service:
command: desktop-launch ${SNAP}/usr/lib/hamster-time-tracker/hamster-windows-service
plugs:
- desktop
- desktop-legacy
- gsettings
- home
environment:
PYTHONPATH: $SNAP/usr/lib/python2.7/dist-packages
hamster:
command: desktop-launch ${SNAP}/usr/bin/hamster
desktop: usr/share/applications/hamster-time-tracker.desktop
plugs:
- desktop
- desktop-legacy
- gsettings
- home
- unity7
environment:
PYTHONPATH: $SNAP/usr/lib/python2.7/dist-packages
LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP/usr/share/hamster-time-tracker
parts:
desktop-gnome-platform:
source: https://github.com/ubuntu/snapcraft-desktop-helpers.git
source-subdir: gtk
plugin: make
make-parameters: ["FLAVOR=gtk3"]
build-packages:
- build-essential
- libgtk-3-dev
override-build: |
snapcraftctl build
mkdir -pv $SNAPCRAFT_PART_INSTALL/gnome-platform
hamster:
# See 'snapcraft plugins'
after: [desktop-gnome-platform]
build-packages:
- gettext
- intltool
- python-gconf
- gconf2
stage-packages:
- gir1.2-gconf-2.0
- python3-gi-cairo
- python3-dbus
- python3-gi
- python3-xdg
source: snap/src
plugin: waf
configflags:
- --prefix=/usr
My biggest problem is that, in order to launch the GUI desktop file, one have to start the two process that would register on the specific dbus name.
I believe there are ways for automatic waking up service using dbus. But I’m not able to achieve this via snaps.
So currently I have to start the two service using desktop-launch(since it won’t find gtk related files if I just launch it with python)
Is there anyway I can bind a dbus slot and invoke the service anytime the name is called? Thx, any help would be welcomed.