Change terminal emulator icon based on running program












0















I have started using more "ncurses" style applications, like vim and ipython that run directly from the terminal emulator. As a result, I frequently have multiple terminal applications open, but the problem is that each one has the same icon, so when I try to Alt+Tab between windows to pull up the one I want, all terminal applications look the same. For the moment I've been using gvim rather than vim specifically for this reason, as you can see it shows up nicely with its own icon:



Alt tab view with two terminals, Firefox and gvim



This seems like overkill. Ideally, running vim or nvim or ipython or gdb or some other long-running program that runs in the terminal would change the terminal icon to match some icon specified for the application.



I am using Cinnamon on Arch Linux. I'm OK with switching away from using GNOME terminal if there's a similar terminal emulator that has this functionality.










share|improve this question



























    0















    I have started using more "ncurses" style applications, like vim and ipython that run directly from the terminal emulator. As a result, I frequently have multiple terminal applications open, but the problem is that each one has the same icon, so when I try to Alt+Tab between windows to pull up the one I want, all terminal applications look the same. For the moment I've been using gvim rather than vim specifically for this reason, as you can see it shows up nicely with its own icon:



    Alt tab view with two terminals, Firefox and gvim



    This seems like overkill. Ideally, running vim or nvim or ipython or gdb or some other long-running program that runs in the terminal would change the terminal icon to match some icon specified for the application.



    I am using Cinnamon on Arch Linux. I'm OK with switching away from using GNOME terminal if there's a similar terminal emulator that has this functionality.










    share|improve this question

























      0












      0








      0








      I have started using more "ncurses" style applications, like vim and ipython that run directly from the terminal emulator. As a result, I frequently have multiple terminal applications open, but the problem is that each one has the same icon, so when I try to Alt+Tab between windows to pull up the one I want, all terminal applications look the same. For the moment I've been using gvim rather than vim specifically for this reason, as you can see it shows up nicely with its own icon:



      Alt tab view with two terminals, Firefox and gvim



      This seems like overkill. Ideally, running vim or nvim or ipython or gdb or some other long-running program that runs in the terminal would change the terminal icon to match some icon specified for the application.



      I am using Cinnamon on Arch Linux. I'm OK with switching away from using GNOME terminal if there's a similar terminal emulator that has this functionality.










      share|improve this question














      I have started using more "ncurses" style applications, like vim and ipython that run directly from the terminal emulator. As a result, I frequently have multiple terminal applications open, but the problem is that each one has the same icon, so when I try to Alt+Tab between windows to pull up the one I want, all terminal applications look the same. For the moment I've been using gvim rather than vim specifically for this reason, as you can see it shows up nicely with its own icon:



      Alt tab view with two terminals, Firefox and gvim



      This seems like overkill. Ideally, running vim or nvim or ipython or gdb or some other long-running program that runs in the terminal would change the terminal icon to match some icon specified for the application.



      I am using Cinnamon on Arch Linux. I'm OK with switching away from using GNOME terminal if there's a similar terminal emulator that has this functionality.







      cinnamon gui gnome-terminal






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 22 '18 at 17:10









      PaulPaul

      1566




      1566






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Success! Thanks google and SO for directing me to xseticon.



          First install xseticon



          Add this script somewhere in your PATH:



          # setWinIcon.sh
          #!/bin/sh

          # Usage: setWinIcon [title] [icon]
          # - title: a string to match within the title of the window
          # - icon: path to the icon file. Use png for best results.

          title="$1"
          ICONPATH="$2"

          known_windows=$(wmctrl -l |grep $title|awk '{ print $1 }')

          for id in ${known_windows}
          do
          xseticon -id "$id" "$ICONPATH"
          done


          Then add this function in your .vimrc, replacing path as required:



          system("setWinIcon.sh", "$WINDOWID [path/to/vimicon.png]")


          Note that this will not revert the icon. You could trigger a vimLeave autocmd to refresh it to the icon of your terminal like this:



          au vimLeave system("setWinIcon.sh", "$WINDOWID [path/to/termicon.png]")



          For the other programs, just configure them as an alias like alias ipython="setWinIcon.sh $WINDOWID [path/to/ipyicon.png] && ipython && setWinIcon.sh $WINDOWID [path/to/termicon.png]"






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "106"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f439317%2fchange-terminal-emulator-icon-based-on-running-program%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Success! Thanks google and SO for directing me to xseticon.



            First install xseticon



            Add this script somewhere in your PATH:



            # setWinIcon.sh
            #!/bin/sh

            # Usage: setWinIcon [title] [icon]
            # - title: a string to match within the title of the window
            # - icon: path to the icon file. Use png for best results.

            title="$1"
            ICONPATH="$2"

            known_windows=$(wmctrl -l |grep $title|awk '{ print $1 }')

            for id in ${known_windows}
            do
            xseticon -id "$id" "$ICONPATH"
            done


            Then add this function in your .vimrc, replacing path as required:



            system("setWinIcon.sh", "$WINDOWID [path/to/vimicon.png]")


            Note that this will not revert the icon. You could trigger a vimLeave autocmd to refresh it to the icon of your terminal like this:



            au vimLeave system("setWinIcon.sh", "$WINDOWID [path/to/termicon.png]")



            For the other programs, just configure them as an alias like alias ipython="setWinIcon.sh $WINDOWID [path/to/ipyicon.png] && ipython && setWinIcon.sh $WINDOWID [path/to/termicon.png]"






            share|improve this answer




























              0














              Success! Thanks google and SO for directing me to xseticon.



              First install xseticon



              Add this script somewhere in your PATH:



              # setWinIcon.sh
              #!/bin/sh

              # Usage: setWinIcon [title] [icon]
              # - title: a string to match within the title of the window
              # - icon: path to the icon file. Use png for best results.

              title="$1"
              ICONPATH="$2"

              known_windows=$(wmctrl -l |grep $title|awk '{ print $1 }')

              for id in ${known_windows}
              do
              xseticon -id "$id" "$ICONPATH"
              done


              Then add this function in your .vimrc, replacing path as required:



              system("setWinIcon.sh", "$WINDOWID [path/to/vimicon.png]")


              Note that this will not revert the icon. You could trigger a vimLeave autocmd to refresh it to the icon of your terminal like this:



              au vimLeave system("setWinIcon.sh", "$WINDOWID [path/to/termicon.png]")



              For the other programs, just configure them as an alias like alias ipython="setWinIcon.sh $WINDOWID [path/to/ipyicon.png] && ipython && setWinIcon.sh $WINDOWID [path/to/termicon.png]"






              share|improve this answer


























                0












                0








                0







                Success! Thanks google and SO for directing me to xseticon.



                First install xseticon



                Add this script somewhere in your PATH:



                # setWinIcon.sh
                #!/bin/sh

                # Usage: setWinIcon [title] [icon]
                # - title: a string to match within the title of the window
                # - icon: path to the icon file. Use png for best results.

                title="$1"
                ICONPATH="$2"

                known_windows=$(wmctrl -l |grep $title|awk '{ print $1 }')

                for id in ${known_windows}
                do
                xseticon -id "$id" "$ICONPATH"
                done


                Then add this function in your .vimrc, replacing path as required:



                system("setWinIcon.sh", "$WINDOWID [path/to/vimicon.png]")


                Note that this will not revert the icon. You could trigger a vimLeave autocmd to refresh it to the icon of your terminal like this:



                au vimLeave system("setWinIcon.sh", "$WINDOWID [path/to/termicon.png]")



                For the other programs, just configure them as an alias like alias ipython="setWinIcon.sh $WINDOWID [path/to/ipyicon.png] && ipython && setWinIcon.sh $WINDOWID [path/to/termicon.png]"






                share|improve this answer













                Success! Thanks google and SO for directing me to xseticon.



                First install xseticon



                Add this script somewhere in your PATH:



                # setWinIcon.sh
                #!/bin/sh

                # Usage: setWinIcon [title] [icon]
                # - title: a string to match within the title of the window
                # - icon: path to the icon file. Use png for best results.

                title="$1"
                ICONPATH="$2"

                known_windows=$(wmctrl -l |grep $title|awk '{ print $1 }')

                for id in ${known_windows}
                do
                xseticon -id "$id" "$ICONPATH"
                done


                Then add this function in your .vimrc, replacing path as required:



                system("setWinIcon.sh", "$WINDOWID [path/to/vimicon.png]")


                Note that this will not revert the icon. You could trigger a vimLeave autocmd to refresh it to the icon of your terminal like this:



                au vimLeave system("setWinIcon.sh", "$WINDOWID [path/to/termicon.png]")



                For the other programs, just configure them as an alias like alias ipython="setWinIcon.sh $WINDOWID [path/to/ipyicon.png] && ipython && setWinIcon.sh $WINDOWID [path/to/termicon.png]"







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 23 at 8:31









                BlueDrink9BlueDrink9

                1




                1






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Unix & Linux Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f439317%2fchange-terminal-emulator-icon-based-on-running-program%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

                    is 'sed' thread safe

                    How to make a Squid Proxy server?