gitee.com/mysnapcore/mysnapd@v0.1.0/interfaces/builtin/desktop_launch.go (about)

     1  // -*- Mode: Go; indent-tabs-mode: t -*-
     2  
     3  /*
     4   * Copyright (C) 2019 Canonical Ltd
     5   *
     6   * This program is free software: you can redistribute it and/or modify
     7   * it under the terms of the GNU General Public License version 3 as
     8   * published by the Free Software Foundation.
     9   *
    10   * This program is distributed in the hope that it will be useful,
    11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
    12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13   * GNU General Public License for more details.
    14   *
    15   * You should have received a copy of the GNU General Public License
    16   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    17   *
    18   */
    19  
    20  package builtin
    21  
    22  const desktopLaunchSummary = `allows snaps to identify and launch desktop applications in (or from) other snaps`
    23  
    24  const desktopLaunchBaseDeclarationPlugs = `
    25    desktop-launch:
    26      allow-installation: false
    27      deny-auto-connection: true
    28  `
    29  
    30  const desktopLaunchBaseDeclarationSlots = `
    31    desktop-launch:
    32      allow-installation:
    33        slot-snap-type:
    34          - core
    35      deny-auto-connection: true
    36  `
    37  
    38  const desktopLaunchConnectedPlugAppArmor = `
    39  # Description: Can identify and launch other snaps.
    40  
    41  # Access to the desktop and icon files installed by snaps
    42  /var/lib/snapd/desktop/applications/{,*} r,
    43  /var/lib/snapd/desktop/icons/{,**} r,
    44  
    45  #include <abstractions/dbus-session-strict>
    46  
    47  dbus (send)
    48      bus=session
    49      path=/io/snapcraft/PrivilegedDesktopLauncher
    50      interface=io.snapcraft.PrivilegedDesktopLauncher
    51      member=OpenDesktopEntry
    52      peer=(label=unconfined),
    53  `
    54  
    55  // Only implicitOnClassic since userd isn't yet usable on core
    56  func init() {
    57  	registerIface(&commonInterface{
    58  		name:                  "desktop-launch",
    59  		summary:               desktopLaunchSummary,
    60  		implicitOnClassic:     true,
    61  		baseDeclarationPlugs:  desktopLaunchBaseDeclarationPlugs,
    62  		baseDeclarationSlots:  desktopLaunchBaseDeclarationSlots,
    63  		connectedPlugAppArmor: desktopLaunchConnectedPlugAppArmor,
    64  	})
    65  }