SNAP Tutorial 03. Start snap application from a graphic environment

snap

Greetings to all on the continuation of the topic of self-contained snap packages.
In today's part, we will discuss how to configure the application so that it can be launched not only in the console, but also in the graphical environment (KDE, GNOME, XFCE, and so on).

There are 2 options:

Option 1

This setup will require 2 files, managetime.desktop and managetime.png. We add these files to the snap / gui directory. That is, you just need to put these files in the correct directory, that's all.

The previous article showed the tree structure of directories and files based on my application.

Consider what is the managetime.desktop file.

[Desktop Entry]
Encoding=UTF-8
Categories=Application for time management
Comment=Applique for those who want to control their time
Exec=managetime
GenericName=Application for time management2
Icon=${SNAP}/meta/gui/managetime.png
Name=TimerProject_desktop
Type=Application
Terminal=false

The most basic is 5 and 7 lines. Line 5 is the name of the application itself.

apps:
    managetime:

7 the same line indicates the path inside the snap package where the icon is located.
Also in this file there is a description of the application itself, whether to open it in the console or not.

Option 2

This option already works through the setting in the file snapcraft.yaml
We indicate among the other settings of the application, where we have the files.

name: managetime
version: "0.1.0"
summary: timer
description: |
    Application for time management
confinement: strict
grade: stable
architectures: [amd64]

base: core18

icon: snap/gui/managetime.png

apps:
    managetime:
        desktop: share/applications/managetime.desktop
        command: bin/projecttimer
        plugs: 
            - home

As you can see, we have added 2 points:

  • the first is the icon where the file remains in the same place.
  • But the app.desktop file has migrated to another directory and we have already through the desktop: we specify its location.

How it works you can look at my finished application. snap

Thanks to all.
To be continued)

We recommend hosting TIMEWEB
We recommend hosting TIMEWEB
Stable hosting, on which the social network EVILEG is located. For projects on Django we recommend VDS hosting.

Comments

Only authorized users can post comments.
Please, Log in or Sign up
Donate

Hello, Dear Users of EVILEG!!!

If the site helped you, then support the development of the site financially, please.

You can do it by following ways:

Thank you, Evgenii Legotckoi

AS
Dec. 13, 2019, 6:05 a.m.
Aruzhan Seraliyeva

C++ - Тест 003. Условия и циклы

  • Result:50points,
  • Rating points-4
AS
Dec. 13, 2019, 5:47 a.m.
Aruzhan Seraliyeva

C++ - Test 001. The first program and data types

  • Result:40points,
  • Rating points-8
T
Dec. 11, 2019, 4:56 p.m.
Toma

C++ - Тест 003. Условия и циклы

  • Result:50points,
  • Rating points-4
Last comments
Dec. 9, 2019, 3:41 a.m.
Evgenij Legotskoj

Эта ошибка invalid use of incomplete type ‘class Ui::AnotherWindow’ обычно говорит о том, что не найдено определение класса или структуры. Типичная проблема - не подключён заголовочны…
NB
Dec. 9, 2019, 3:36 a.m.
Nikolaj Batmanov

Ну, не настолько со мной всё полхо...))) Вроде бы. Я ж кнопки отрисовываю.
Dec. 9, 2019, 3:14 a.m.
Evgenij Legotskoj

Добрый день. У вас ui файлов по ходу нет. UI файлы используются для вёрстки в графическом дизайнере.
NB
Dec. 9, 2019, 3:05 a.m.
Nikolaj Batmanov

Здравствуйте! Полностью скопировал ваш пример к себе, чтобы разобраться. А он не хочет запускаться, дает ошибку: invalid use of incomplete type ‘class Ui::AnotherWindow’ ui(new Ui…
Dec. 8, 2019, 7:23 a.m.
Evgenij Legotskoj

У меня здесь есть одна старая статья с примером векторного редактора. Там есть ответы на ваши вопросы. Поизучайте Qt/C++ - Урок 072. Пример векторного редактора на Qt QGraphicsItem, QG…
Now discuss on the forum
Dec. 13, 2019, 10:16 a.m.
Ruslan Volshebnik

Да, я посмотрел, вы абсолютно правы. Единственное, если я правильно понял, если срабатывает условие if (aggregates["max_id"] - aggregates["min_id"]) + 1 == aggregates["count"]: return sel…
t
Dec. 13, 2019, 9:53 a.m.
tantrido

Ответ >>
Dec. 13, 2019, 8:39 a.m.
Aleksandr Panjushkin

Вроде да. Только там начинаются вопросы с тем, чтобы виджет бы в фокусе, чтобы до виджета это событие долетало.
DK
Dec. 13, 2019, 7:48 a.m.
Dzhon Kofi

Привет. Есть класс "ждун", который используется на разных виджетах: class WaiterDialog;#define WAITER_DIALOG Singleton<WaiterDialog>::instance()class WaiterDialog : public QObject, …
EVILEG
About
Services
© EVILEG 2015-2019
Recommend hosting TIMEWEB