app-id: io.github.vikdevelop.SaveDesktop
desktop-file-name-suffix: ' (Master)'
runtime: org.gnome.Platform
runtime-version: '47'
sdk: org.gnome.Sdk
command: savedesktop
finish-args:
    - --share=ipc
    - --share=network
    - --socket=wayland
    - --socket=fallback-x11
    - --device=dri
    # for opening cloud folders properly
    - --filesystem=xdg-run/gvfs
    - --filesystem=xdg-run/gvfsd
    # load Desktop environment config files
    - --filesystem=~/.config
    # load Desktop environment data files (e.g. backgrounds, extensions, etc.)
    - --filesystem=~/.local/share
    # to be able to select destination for saving configuration in also these directories
    - --filesystem=xdg-download
    - --filesystem=xdg-music
    - --filesystem=xdg-videos
    - --filesystem=xdg-documents
    - --filesystem=xdg-public-share
    - --filesystem=xdg-pictures
    - --filesystem=xdg-desktop
    # save all themes installed in home folder
    - --filesystem=~/.themes:create
    # save all icons installed in home folder
    - --filesystem=~/.icons:create
    # save cinnamon config in home directory
    - --filesystem=~/.cinnamon:create
    # save xfce config in home directory
    - --filesystem=~/.xfce4:create
    # save all fonts installed in home directory
    - --filesystem=~/.fonts:create
    # save a list of installed flatpak apps
    - --filesystem=/var/lib/flatpak:ro
    - --filesystem=~/.local/share/flatpak/app:ro
    # save user data of installed flatpak apps
    - --filesystem=~/.var/app:ro
    # log out from session (GNOME-based environments) for changes to the desktop configuration to take effect
    - --talk-name=org.gnome.SessionManager
    # log out from session (Xfce) for changes to the Xfce desktop configuration to take effect
    - --talk-name=org.xfce.SessionManager
    # log out from session (KDE5) for changes to the KDE5 desktop configuration to take effect
    - --talk-name=org.kde.LogoutPrompt
    # log out from session (COSMIC Rust) for changes to the COSMIC Rust desktop configuration to take effect
    - --talk-name=com.system76.CosmicSession
    # ensuring to FileChooserNative will work correctly
    - --talk-name=org.freedesktop.FileManager1
    - --env=DCONF_USER_CONFIG_DIR=.config/dconf
    - --filesystem=xdg-run/dconf
    - --talk-name=ca.desrt.dconf
modules:
  - name: dconf-amd64
    only-arches: ['x86_64']
    buildsystem: simple
    build-commands:
      - cp -R * /app
    sources:
      - type: archive
        url: https://github.com/vikdevelop/SaveDesktop/releases/download/2.9.5n/dconf_build.tar.xz
        sha256: 164fc714f96ef4b348665fc3617f54cfa5acf12df5c039d7a9d21ba1d86a2f2d
  - name: dconf-aarch64
    only-arches: ['aarch64']
    buildsystem: meson
    config-opts:
    - "-Dsystemduserunitdir=/app/lib/systemd/user/"
    - "-Dbash_completion=false"
    - "-Dman=false"
    cleanup:
    - "/include"
    - "/lib/pkgconfig"
    - "/libexec"
    - "/share/dbus-1"
    sources:
    - type: archive
      url: https://download.gnome.org/sources/dconf/0.40/dconf-0.40.0.tar.xz
      sha256: cf7f22a4c9200421d8d3325c5c1b8b93a36843650c9f95d6451e20f0bcb24533
  - name: savedesktop
    buildsystem: simple
    build-commands:
       - install -Dm755 -t /app/bin savedesktop
       - cp -R src/* /app
       - install -D -t /app/share/applications flatpak/io.github.vikdevelop.SaveDesktop.desktop
       - install -D -t /app/share/icons/hicolor/scalable/apps flatpak/icons/io.github.vikdevelop.SaveDesktop.svg
       - install -D -t /app/share/icons/hicolor/scalable/apps flatpak/icons/io.github.vikdevelop.SaveDesktop.Devel.svg
       - install -D -t /app/share/icons/hicolor/symbolic/apps flatpak/icons/io.github.vikdevelop.SaveDesktop-symbolic.svg
       - install -D -t /app/share/icons/hicolor/128x128/apps flatpak/symbolic-icons/exclamation_mark.png
       - install -D -t /app/share/icons/hicolor/128x128/apps flatpak/symbolic-icons/desktop-symbolic.svg
       - install -D -t /app/share/icons/hicolor/128x128/apps flatpak/symbolic-icons/list-view.png
       - install -D -t /app/share/icons/hicolor/128x128/apps flatpak/symbolic-icons/done.svg
       - install -D -t /app/share/metainfo flatpak/io.github.vikdevelop.SaveDesktop.metainfo.xml
       - install -D -t /app/share/glib-2.0/schemas flatpak/io.github.vikdevelop.SaveDesktop.gschema.xml
       - glib-compile-schemas /app/share/glib-2.0/schemas
       - cp -R translations /app/
    sources:
          - type: dir
            path: .