BlinCT
Dec. 17, 2018, 12:33 p.m.

SNAP Tutorial 03. Start snap application from a graphic environment

Content

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.

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

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

  1. apps:
  2. 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.

  1. name: managetime
  2. version: "0.1.0"
  3. summary: timer
  4. description: |
  5. Application for time management
  6. confinement: strict
  7. grade: stable
  8. architectures: [amd64]
  9.  
  10. base: core18
  11.  
  12. icon: snap/gui/managetime.png
  13.  
  14. apps:
  15. managetime:
  16. desktop: share/applications/managetime.desktop
  17. command: bin/projecttimer
  18. plugs:
  19. - 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)

By article asked0question(s)

2

Comments

Only authorized users can post comments.
Please, Log in or Sign up
  • Last comments
  • Evgenii Legotckoi
    March 9, 2025, 9:02 p.m.
    К сожалению, я этого подсказать не могу, поскольку у меня нет необходимости в обходе блокировок и т.д. Поэтому я и не задавался решением этой проблемы. Ну выглядит так, что вам действитель…
  • VP
    March 9, 2025, 4:14 p.m.
    Здравствуйте! Я устанавливал Qt6 из исходников а также Qt Creator по отдельности. Все компоненты, связанные с разработкой для Android, установлены. Кроме одного... Когда пытаюсь скомпилиров…
  • ИМ
    Nov. 22, 2024, 9:51 p.m.
    Добрый вечер Евгений! Я сделал себе авторизацию аналогичную вашей, все работает, кроме возврата к предидущей странице. Редеректит всегда на главную, хотя в логах сервера вижу запросы на правильн…
  • Evgenii Legotckoi
    Oct. 31, 2024, 11:37 p.m.
    Добрый день. Да, можно. Либо через такие же плагины, либо с постобработкой через python библиотеку Beautiful Soup
  • A
    Oct. 19, 2024, 5:19 p.m.
    Подскажите как это запустить? Я не шарю в программировании и кодинге. Скачал и установаил Qt, но куча ошибок выдается и не запустить. А очень надо fb3 переконвертировать в html