How to determine if window is maximised or minimised from bash scriptHow to close, minimize, and maximize a specified window from Terminal?Problem with using wmctrl to arrange windows in compizHow to determine status of upstart job in bash script?Bash escape from scriptHow do I use wmctrl to detect if a window is present?How do I permanently change window titles?Executing wmctrl from bashsleep X - won't actually make bash script loop waitSet window size and positionObtain last active time of window from IDFrom a bash script, send commands to a terminal window

What does "enim et" mean?

When blogging recipes, how can I support both readers who want the narrative/journey and ones who want the printer-friendly recipe?

How do I create uniquely male characters?

Is it possible to make sharp wind that can cut stuff from afar?

Patience, young "Padovan"

Simulate Bitwise Cyclic Tag

What are these boxed doors outside store fronts in New York?

Accidentally leaked the solution to an assignment, what to do now? (I'm the prof)

XeLaTeX and pdfLaTeX ignore hyphenation

Infinite past with a beginning?

How does one intimidate enemies without having the capacity for violence?

Could a US political party gain complete control over the government by removing checks & balances?

I see my dog run

Example of a relative pronoun

Closed subgroups of abelian groups

Can a German sentence have two subjects?

How to determine if window is maximised or minimised from bash script

The use of multiple foreign keys on same column in SQL Server

How do you conduct xenoanthropology after first contact?

Copenhagen passport control - US citizen

How do we improve the relationship with a client software team that performs poorly and is becoming less collaborative?

Modification to Chariots for Heavy Cavalry Analogue for 4-armed race

cryptic clue: mammal sounds like relative consumer (8)

What is the offset in a seaplane's hull?



How to determine if window is maximised or minimised from bash script


How to close, minimize, and maximize a specified window from Terminal?Problem with using wmctrl to arrange windows in compizHow to determine status of upstart job in bash script?Bash escape from scriptHow do I use wmctrl to detect if a window is present?How do I permanently change window titles?Executing wmctrl from bashsleep X - won't actually make bash script loop waitSet window size and positionObtain last active time of window from IDFrom a bash script, send commands to a terminal window






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








4















I have a bash script that moves my windows from the left screen to right screen in dual-screen setup. Currently the way it works is cycling through the window ids that are given by xdotool search --onlyvisible --maxdepth 2 --class "" and then moves them to the right by the screen width. It already works... unless the window in question is maximises or minimised.



So what is needed is a way to check the current status of the window. I have found an answer that provides the way to add and remove those bits, but where is the way to check if they are set already?



If it is not possible to do via xdotool, it should be possible to reuse the window id provided by the command mentioned above.










share|improve this question




























    4















    I have a bash script that moves my windows from the left screen to right screen in dual-screen setup. Currently the way it works is cycling through the window ids that are given by xdotool search --onlyvisible --maxdepth 2 --class "" and then moves them to the right by the screen width. It already works... unless the window in question is maximises or minimised.



    So what is needed is a way to check the current status of the window. I have found an answer that provides the way to add and remove those bits, but where is the way to check if they are set already?



    If it is not possible to do via xdotool, it should be possible to reuse the window id provided by the command mentioned above.










    share|improve this question
























      4












      4








      4








      I have a bash script that moves my windows from the left screen to right screen in dual-screen setup. Currently the way it works is cycling through the window ids that are given by xdotool search --onlyvisible --maxdepth 2 --class "" and then moves them to the right by the screen width. It already works... unless the window in question is maximises or minimised.



      So what is needed is a way to check the current status of the window. I have found an answer that provides the way to add and remove those bits, but where is the way to check if they are set already?



      If it is not possible to do via xdotool, it should be possible to reuse the window id provided by the command mentioned above.










      share|improve this question














      I have a bash script that moves my windows from the left screen to right screen in dual-screen setup. Currently the way it works is cycling through the window ids that are given by xdotool search --onlyvisible --maxdepth 2 --class "" and then moves them to the right by the screen width. It already works... unless the window in question is maximises or minimised.



      So what is needed is a way to check the current status of the window. I have found an answer that provides the way to add and remove those bits, but where is the way to check if they are set already?



      If it is not possible to do via xdotool, it should be possible to reuse the window id provided by the command mentioned above.







      bash xdotool wmctrl






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 2 hours ago









      v010dyav010dya

      5872728




      5872728




















          1 Answer
          1






          active

          oldest

          votes


















          4














          Retrieve info on the window state



          You can get the info (and a lot more) from the command:



          xprop -id <window_id>


          To get what you are specifically looking for:



          xprop -id 0x04c00010 | grep "_NET_WM_STATE(ATOM)"


          The output will look like:



          _NET_WM_STATE(ATOM) = _NET_WM_STATE_MAXIMIZED_HORZ, _NET_WM_STATE_MAXIMIZED_VERT, _NET_WM_STATE_HIDDEN


          on a window that is maximized (h + v) and minimized at the same time, or just



          _NET_WM_STATE(ATOM) =


          (or no output at all) if none of those is the case.






          share|improve this answer

























          • Excellent suggestion +1. As a comment, I tried it (under Linux, X11) and got slightly different results. When a window is neither hidden nor maximized, _NET_WM_STATE(ATOM) does not, as shown in the answer, appear with an empty value. Instead, it is not in the output at all.

            – John1024
            1 hour ago











          • @John1024 Ah, thanks! will add it to the answer.

            – Jacob Vlijm
            1 hour ago











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "89"
          ;
          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: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          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%2faskubuntu.com%2fquestions%2f1132023%2fhow-to-determine-if-window-is-maximised-or-minimised-from-bash-script%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









          4














          Retrieve info on the window state



          You can get the info (and a lot more) from the command:



          xprop -id <window_id>


          To get what you are specifically looking for:



          xprop -id 0x04c00010 | grep "_NET_WM_STATE(ATOM)"


          The output will look like:



          _NET_WM_STATE(ATOM) = _NET_WM_STATE_MAXIMIZED_HORZ, _NET_WM_STATE_MAXIMIZED_VERT, _NET_WM_STATE_HIDDEN


          on a window that is maximized (h + v) and minimized at the same time, or just



          _NET_WM_STATE(ATOM) =


          (or no output at all) if none of those is the case.






          share|improve this answer

























          • Excellent suggestion +1. As a comment, I tried it (under Linux, X11) and got slightly different results. When a window is neither hidden nor maximized, _NET_WM_STATE(ATOM) does not, as shown in the answer, appear with an empty value. Instead, it is not in the output at all.

            – John1024
            1 hour ago











          • @John1024 Ah, thanks! will add it to the answer.

            – Jacob Vlijm
            1 hour ago















          4














          Retrieve info on the window state



          You can get the info (and a lot more) from the command:



          xprop -id <window_id>


          To get what you are specifically looking for:



          xprop -id 0x04c00010 | grep "_NET_WM_STATE(ATOM)"


          The output will look like:



          _NET_WM_STATE(ATOM) = _NET_WM_STATE_MAXIMIZED_HORZ, _NET_WM_STATE_MAXIMIZED_VERT, _NET_WM_STATE_HIDDEN


          on a window that is maximized (h + v) and minimized at the same time, or just



          _NET_WM_STATE(ATOM) =


          (or no output at all) if none of those is the case.






          share|improve this answer

























          • Excellent suggestion +1. As a comment, I tried it (under Linux, X11) and got slightly different results. When a window is neither hidden nor maximized, _NET_WM_STATE(ATOM) does not, as shown in the answer, appear with an empty value. Instead, it is not in the output at all.

            – John1024
            1 hour ago











          • @John1024 Ah, thanks! will add it to the answer.

            – Jacob Vlijm
            1 hour ago













          4












          4








          4







          Retrieve info on the window state



          You can get the info (and a lot more) from the command:



          xprop -id <window_id>


          To get what you are specifically looking for:



          xprop -id 0x04c00010 | grep "_NET_WM_STATE(ATOM)"


          The output will look like:



          _NET_WM_STATE(ATOM) = _NET_WM_STATE_MAXIMIZED_HORZ, _NET_WM_STATE_MAXIMIZED_VERT, _NET_WM_STATE_HIDDEN


          on a window that is maximized (h + v) and minimized at the same time, or just



          _NET_WM_STATE(ATOM) =


          (or no output at all) if none of those is the case.






          share|improve this answer















          Retrieve info on the window state



          You can get the info (and a lot more) from the command:



          xprop -id <window_id>


          To get what you are specifically looking for:



          xprop -id 0x04c00010 | grep "_NET_WM_STATE(ATOM)"


          The output will look like:



          _NET_WM_STATE(ATOM) = _NET_WM_STATE_MAXIMIZED_HORZ, _NET_WM_STATE_MAXIMIZED_VERT, _NET_WM_STATE_HIDDEN


          on a window that is maximized (h + v) and minimized at the same time, or just



          _NET_WM_STATE(ATOM) =


          (or no output at all) if none of those is the case.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 32 mins ago

























          answered 1 hour ago









          Jacob VlijmJacob Vlijm

          66.2k9131230




          66.2k9131230












          • Excellent suggestion +1. As a comment, I tried it (under Linux, X11) and got slightly different results. When a window is neither hidden nor maximized, _NET_WM_STATE(ATOM) does not, as shown in the answer, appear with an empty value. Instead, it is not in the output at all.

            – John1024
            1 hour ago











          • @John1024 Ah, thanks! will add it to the answer.

            – Jacob Vlijm
            1 hour ago

















          • Excellent suggestion +1. As a comment, I tried it (under Linux, X11) and got slightly different results. When a window is neither hidden nor maximized, _NET_WM_STATE(ATOM) does not, as shown in the answer, appear with an empty value. Instead, it is not in the output at all.

            – John1024
            1 hour ago











          • @John1024 Ah, thanks! will add it to the answer.

            – Jacob Vlijm
            1 hour ago
















          Excellent suggestion +1. As a comment, I tried it (under Linux, X11) and got slightly different results. When a window is neither hidden nor maximized, _NET_WM_STATE(ATOM) does not, as shown in the answer, appear with an empty value. Instead, it is not in the output at all.

          – John1024
          1 hour ago





          Excellent suggestion +1. As a comment, I tried it (under Linux, X11) and got slightly different results. When a window is neither hidden nor maximized, _NET_WM_STATE(ATOM) does not, as shown in the answer, appear with an empty value. Instead, it is not in the output at all.

          – John1024
          1 hour ago













          @John1024 Ah, thanks! will add it to the answer.

          – Jacob Vlijm
          1 hour ago





          @John1024 Ah, thanks! will add it to the answer.

          – Jacob Vlijm
          1 hour ago

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Ask Ubuntu!


          • 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%2faskubuntu.com%2fquestions%2f1132023%2fhow-to-determine-if-window-is-maximised-or-minimised-from-bash-script%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

          Are there any AGPL-style licences that require source code modifications to be public? Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Force derivative works to be publicAre there any GPL like licenses for Apple App Store?Do you violate the GPL if you provide source code that cannot be compiled?GPL - is it distribution to use libraries in an appliance loaned to customers?Distributing App for free which uses GPL'ed codeModifications of server software under GPL, with web/CLI interfaceDoes using an AGPLv3-licensed library prevent me from dual-licensing my own source code?Can I publish only select code under GPLv3 from a private project?Is there published precedent regarding the scope of covered work that uses AGPL software?If MIT licensed code links to GPL licensed code what should be the license of the resulting binary program?If I use a public API endpoint that has its source code licensed under AGPL in my app, do I need to disclose my source?

          2013 GY136 Descoberta | Órbita | Referências Menu de navegação«List Of Centaurs and Scattered-Disk Objects»«List of Known Trans-Neptunian Objects»

          Button changing it's text & action. Good or terrible? The 2019 Stack Overflow Developer Survey Results Are Inchanging text on user mouseoverShould certain functions be “hard to find” for powerusers to discover?Custom liking function - do I need user login?Using different checkbox style for different checkbox behaviorBest Practices: Save and Exit in Software UIInteraction with remote validated formMore efficient UI to progress the user through a complicated process?Designing a popup notice for a gameShould bulk-editing functions be hidden until a table row is selected, or is there a better solution?Is it bad practice to disable (replace) the context menu?