Adding an enviromental variable in .desktop icon fails the icon

Forum Forums General Software Adding an enviromental variable in .desktop icon fails the icon

Tagged: 

  • This topic has 5 replies, 3 voices, and was last updated Mar 29-5:59 am by symbol.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #103320
    Member
    symbol

      I am editing the .desktop file for microsoft edge, originally the icon file works:

      Comment[zh_CN]=访问互联网
      Comment[zh_HK]=連線到網際網路
      Comment[zh_TW]=連線到網際網路
      Exec=/usr/bin/microsoft-edge-stable %U
      StartupNotify=true
      Terminal=false
      Icon=microsoft-edge
      Type=Application
      Categories=Network;WebBrowser;

      While after adding an environmental variable in the Exec the program won’t start.

      Comment[vi]=Truy cập Internet
      Comment[zh_CN]=访问互联网
      Comment[zh_HK]=連線到網際網路
      Comment[zh_TW]=連線到網際網路
      # Exec=/usr/bin/microsoft-edge-stable %U
      Exec=env GTK_IM_MODULE=xim /usr/bin/microsoft-edge-stable %U
      StartupNotify=true
      Terminal=false
      Icon=microsoft-edge
      Type=Application
      Categories=Network;WebBrowser;

      Anyone knows how to correct this? (GTK_IM_MODULE is for ibus)

      #103346
      Member
      RJP
        Helpful
        Up
        0
        ::

        Have you installed ibus?

        apt-cache policy ibus

        #103353
        Member
        PPC
          Helpful
          Up
          0
          ::

          Also, to be on the safe side, when executing complex commands on the Exec= field of a .desktop file, try using:

          Exec= sh -c “Command1 ; Command2”

          #103379
          Member
          symbol
            Helpful
            Up
            0
            ::

            apt-cache policy ibus

            Yes, I am using ibus, it works for most of the apps including firefox and geany, however it does not work for microsoft-edge.

            $ apt-cache policy ibus
            ibus:
              Installed: 1.5.23-2
              Candidate: 1.5.23-2
              Version table:
             *** 1.5.23-2 500
                    500 http://ftp.de.debian.org/debian bullseye/main amd64 Packages
                    100 /var/lib/dpkg/status
            #103380
            Member
            symbol
              Helpful
              Up
              0
              ::

              Also, to be on the safe side, when executing complex commands on the Exec= field of a .desktop file, try using:

              Exec= sh -c “Command1 ; Command2”

              This one does not work, clicking on the icon has not effect at all:
              Exec=bash -c 'export GTK_IM_MODULE=xim;/usr/bin/geany'
              While without export it works:
              Exec=bash -c '/usr/bin/geany'
              I need to import new environment variable though.

              • This reply was modified 1 month, 1 week ago by symbol.
              #103512
              Member
              symbol
                Helpful
                Up
                0
                ::

                I exported GTK_IM_MODULE and XMODIFIERS in the script /usr/bin/microsoft-edge-stable and fixed the problem.

                #!/bin/bash
                #
                # Copyright 2011 The Chromium Authors
                # Use of this source code is governed by a BSD-style license that can be
                # found in the LICENSE file.
                #ibus
                export GTK_IM_MODULE=xim #Fix for Chrome and Brave, when I start either of them from command lines
                export XMODIFIERS=@im=ibus
                # Let the wrapped binary know that it has been run through the wrapper.
                export CHROME_WRAPPER="<code>readlink -f &quot;$0&quot;</code>"
                • This reply was modified 1 month, 1 week ago by symbol.
                • This reply was modified 1 month, 1 week ago by symbol. Reason: highlight keywords in solution
              Viewing 6 posts - 1 through 6 (of 6 total)
              • You must be logged in to reply to this topic.