diff --git a/data/flatpak/org.flameshot.flameshot.yml b/data/flatpak/org.flameshot.flameshot.yml index 0adef6bd..bc9df9a9 100644 --- a/data/flatpak/org.flameshot.flameshot.yml +++ b/data/flatpak/org.flameshot.flameshot.yml @@ -1,6 +1,6 @@ -app-id: org.flameshot.app +app-id: org.flameshot.flameshot runtime: org.kde.Platform -runtime-version: '5.14' +runtime-version: '5.15' sdk: org.kde.Sdk command: flameshot finish-args: @@ -15,5 +15,5 @@ modules: - -DCMAKE_BUILD_TYPE=RelWithDebInfo sources: - type: git - url: https://github.com/borgmanJeremy/flameshot/ + url: https://github.com/flameshot-org/flameshot branch: master diff --git a/data/snap/local/launchers/README.md b/data/snap/local/launchers/README.md new file mode 100644 index 00000000..3c070409 --- /dev/null +++ b/data/snap/local/launchers/README.md @@ -0,0 +1,16 @@ +# /snap/local/launchers + +Here are the launchers, or wrapper programs to deal with some runtime-fixable +problems for the snapped applications, like setting proper environmental +variables in snap. + +In convention launchers are named _something_-launch, for dealing certain +problem with _something_, and usually can be called in a stacked manner to +consolidate their modifications. + +```yaml +apps: + _app_name_: + command: foo-launch bar-launch _app_command_ +``` + diff --git a/data/snap/local/launchers/flameshot-launch b/data/snap/local/launchers/flameshot-launch new file mode 100644 index 00000000..3045d0e9 --- /dev/null +++ b/data/snap/local/launchers/flameshot-launch @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +# This is the maintainence launcher for the snap, make necessary runtime +# environment changes to make the snap work here. You may also insert security +# confinement/deprecation/obsoletion notice of the snap here. + +set \ + -o errexit \ + -o errtrace \ + -o nounset \ + -o pipefail + +# gtk-common-themes support +export QT_QPA_PLATFORMTHEME=gtk3 +# Correct the TMPDIR path for Chromium Framework/Electron to +# ensure libappindicator has readable resources +export TMPDIR=$XDG_RUNTIME_DIR +# Coerce XDG_CURRENT_DESKTOP to Unity so that App Indicators +# are used and do not fall back to Notification Area applets +# or disappear completely. +export XDG_CURRENT_DESKTOP=Unity + +# Finally run the next part of the command chain +exec "${@}" diff --git a/data/snap/snapcraft.yaml b/data/snap/snapcraft.yaml new file mode 100644 index 00000000..d4ff2b66 --- /dev/null +++ b/data/snap/snapcraft.yaml @@ -0,0 +1,148 @@ +--- + +name: flameshot +adopt-info: flameshot +base: core20 +summary: Powerful yet simple to use screenshot software +description: | + A powerful open source screenshot and annotation tool for Linux, Flameshot + has a varied set of markup tools available, which include Freehand drawing, + Lines, Arrows, Boxes, Circles, Highlighting, Blur. Additionally, you can + customise the color, size and/or thickness of many of these image annotation + tools. +grade: stable # must be 'stable' to release into candidate/stable channels +confinement: strict # use 'strict' once you have the right plugs and slots +architectures: + - build-on: amd64 + - build-on: i386 + + +apps: + flameshot: + adapter: full + command: usr/bin/flameshot + desktop: usr/share/applications/flameshot.desktop + environment: + DISABLE_WAYLAND: 1 + XDG_DATA_DIRS: $SNAP/share:$XDG_DATA_DIRS + slots: [dbus-flameshot] + plugs: + - desktop + - desktop-legacy + - gsettings + - home + - network + - network-bind + - opengl + - pulseaudio + - unity7 + - wayland + - x11 + + +plugs: + # Gtk Common Themes support + # https://forum.snapcraft.io/t/how-to-use-the-system-gtk-theme-via-the-gtk-common-themes-snap/6235 + gsettings: + 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 + + +parts: + desktop-qt5: + source: https://github.com/ubuntu/snapcraft-desktop-helpers.git + source-subdir: qt + plugin: make + make-parameters: ["FLAVOR=qt5"] + build-packages: + - qtbase5-dev + - dpkg-dev + stage-packages: + - libxkbcommon0 + - ttf-ubuntu-font-family + - dmz-cursor-theme + - light-themes + - adwaita-icon-theme + - gnome-themes-standard + - shared-mime-info + - libqt5gui5 + - libgdk-pixbuf2.0-0 + - libgtk2.0-0 + - libqt5svg5 + - try: + - appmenu-qt5 + - locales-all + - xdg-user-dirs + - fcitx-frontend-qt5 + + libappindicator: + plugin: nil + stage-packages: + - libappindicator3-1 + after: [desktop-qt5] + prime: + - usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libdbusmenu*.so* + - usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libappindicator*.so* + - usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libindicator*.so* + + launchers: # custom launcher to set QT_QPA_PLATFORMTHEME=gtk3 correctly + source: . + source-subdir: snap/local/launchers + plugin: dump + organize: + '*': bin/ + stage: + - -bin/README.* + + flameshot: + after: + - desktop-qt5 + plugin: cmake + cmake-parameters: + - '-DCMAKE_BUILD_TYPE=RelWithDebInfo' + - '-DCMAKE_INSTALL_PREFIX=/usr' + source: https://github.com/flameshot-org/flameshot.git + source-type: git + override-pull: | + snapcraftctl pull + last_committed_tag="$(git tag -l --sort=-v:refname | head -1)" + git_revno="$(git rev-list $(git describe --tags --abbrev=0)..HEAD --count)" + git_hash="$(git rev-parse --short HEAD)" + snapcraftctl set-version "${last_committed_tag}+git${git_revno}.${git_hash}" + override-build: | + snapcraftctl build + # Correct the Icon path + sed -i 's|^Exec=flameshot|Exec=/snap/bin/flameshot.flameshot|' ${SNAPCRAFT_PART_INSTALL}/usr/share/applications/flameshot.desktop + sed -i 's|^Icon=.*|Icon=${SNAP}/usr/share/icons/hicolor/scalable/apps/flameshot.svg|' ${SNAPCRAFT_PART_INSTALL}/usr/share/applications/flameshot.desktop + sed -i 's/^\(Name\(\[.\+\]\)\?=.*\)$/\1 (Snappy Edition)/g' ${SNAPCRAFT_PART_INSTALL}/usr/share/applications/flameshot.desktop + build-packages: + - qt5-default + - qttools5-dev-tools + - qttools5-dev + - libqt5svg5-dev + stage-packages: + - dbus-x11 + - libgtk2.0-0 + - openssl + - ca-certificates + - qtwayland5 + - qt5-gtk-platformtheme # for theming, font settings, cursor and to use gtk3 file chooser + +slots: + # Depending on in which environment we're running we either need + # to use the system or session DBus so we also need to have one + # slot for each. + dbus-flameshot: + interface: dbus + bus: session + name: org.flameshot.Flameshot