How can I stop windows re-positioning after waking up monitors?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












I have a laptop with multi-monitor setup, one is HDMI and the other is VGA. I have the energy saving setting set to dim screen after 5 min and switch screen off after 10 min, with suspends set to never. I lock my PC and after 10 had passed, when I re-login all open windows will moved to the laptop screen! I would like to keep all windows in place without having to reorder them each time. Is there a solution to this?



System Information:



  • List item


  • OS: Kubuntu 18.04 64-bit


  • KDE Plasma Version: 5.12.6

  • Graphics Card: Intel Corporation Skylake GT2 [HD Graphics 520] (rev 07)









share|improve this question

























    up vote
    2
    down vote

    favorite












    I have a laptop with multi-monitor setup, one is HDMI and the other is VGA. I have the energy saving setting set to dim screen after 5 min and switch screen off after 10 min, with suspends set to never. I lock my PC and after 10 had passed, when I re-login all open windows will moved to the laptop screen! I would like to keep all windows in place without having to reorder them each time. Is there a solution to this?



    System Information:



    • List item


    • OS: Kubuntu 18.04 64-bit


    • KDE Plasma Version: 5.12.6

    • Graphics Card: Intel Corporation Skylake GT2 [HD Graphics 520] (rev 07)









    share|improve this question























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      I have a laptop with multi-monitor setup, one is HDMI and the other is VGA. I have the energy saving setting set to dim screen after 5 min and switch screen off after 10 min, with suspends set to never. I lock my PC and after 10 had passed, when I re-login all open windows will moved to the laptop screen! I would like to keep all windows in place without having to reorder them each time. Is there a solution to this?



      System Information:



      • List item


      • OS: Kubuntu 18.04 64-bit


      • KDE Plasma Version: 5.12.6

      • Graphics Card: Intel Corporation Skylake GT2 [HD Graphics 520] (rev 07)









      share|improve this question













      I have a laptop with multi-monitor setup, one is HDMI and the other is VGA. I have the energy saving setting set to dim screen after 5 min and switch screen off after 10 min, with suspends set to never. I lock my PC and after 10 had passed, when I re-login all open windows will moved to the laptop screen! I would like to keep all windows in place without having to reorder them each time. Is there a solution to this?



      System Information:



      • List item


      • OS: Kubuntu 18.04 64-bit


      • KDE Plasma Version: 5.12.6

      • Graphics Card: Intel Corporation Skylake GT2 [HD Graphics 520] (rev 07)






      kde multi-monitor kubuntu plasma5






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Sep 3 at 11:22









      Waqleh

      156117




      156117




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote













          Use this simple shellscript before and after suspend:



          #!/bin/bash
          # Get the coordinates of the active window's
          # top-left corner, and the window's size.
          # This can be saved & loaded

          getpos()
          wmctrl -l -G > /dev/shm/winposs

          setpos()
          while read -r id g x y w h host app;do
          IFS=" ," read ta tb a b c d <<<$(xprop -id "$id" _NET_FRAME_EXTENTS 2>/dev/null)
          [ -z $d ] && continue
          wmctrl -i -r $id -e "$g,$((x-$d)),$((y-$c)),$((w+$d+$b)),$((h+$c+$a))" 2>/dev/null
          done < /dev/shm/winposs


          case $1 in
          get) echo getting window positions
          getpos
          ;;
          set) echo setting window positions
          setpos
          ;;
          run) getpos
          shift
          $@
          setpos
          ;;
          *) echo "Usage: $0##*/"' [get|set|run <command>]'
          ;;
          esac





          share|improve this answer






















          • i think this script has a syntax error on line 11, but i cant figure out how ti fix it!
            – Waqleh
            Sep 18 at 8:22






          • 1




            Replace first sh to bash.
            – Ipor Sircer
            Sep 18 at 8:33










          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',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          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%2f466551%2fhow-can-i-stop-windows-re-positioning-after-waking-up-monitors%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          2
          down vote













          Use this simple shellscript before and after suspend:



          #!/bin/bash
          # Get the coordinates of the active window's
          # top-left corner, and the window's size.
          # This can be saved & loaded

          getpos()
          wmctrl -l -G > /dev/shm/winposs

          setpos()
          while read -r id g x y w h host app;do
          IFS=" ," read ta tb a b c d <<<$(xprop -id "$id" _NET_FRAME_EXTENTS 2>/dev/null)
          [ -z $d ] && continue
          wmctrl -i -r $id -e "$g,$((x-$d)),$((y-$c)),$((w+$d+$b)),$((h+$c+$a))" 2>/dev/null
          done < /dev/shm/winposs


          case $1 in
          get) echo getting window positions
          getpos
          ;;
          set) echo setting window positions
          setpos
          ;;
          run) getpos
          shift
          $@
          setpos
          ;;
          *) echo "Usage: $0##*/"' [get|set|run <command>]'
          ;;
          esac





          share|improve this answer






















          • i think this script has a syntax error on line 11, but i cant figure out how ti fix it!
            – Waqleh
            Sep 18 at 8:22






          • 1




            Replace first sh to bash.
            – Ipor Sircer
            Sep 18 at 8:33














          up vote
          2
          down vote













          Use this simple shellscript before and after suspend:



          #!/bin/bash
          # Get the coordinates of the active window's
          # top-left corner, and the window's size.
          # This can be saved & loaded

          getpos()
          wmctrl -l -G > /dev/shm/winposs

          setpos()
          while read -r id g x y w h host app;do
          IFS=" ," read ta tb a b c d <<<$(xprop -id "$id" _NET_FRAME_EXTENTS 2>/dev/null)
          [ -z $d ] && continue
          wmctrl -i -r $id -e "$g,$((x-$d)),$((y-$c)),$((w+$d+$b)),$((h+$c+$a))" 2>/dev/null
          done < /dev/shm/winposs


          case $1 in
          get) echo getting window positions
          getpos
          ;;
          set) echo setting window positions
          setpos
          ;;
          run) getpos
          shift
          $@
          setpos
          ;;
          *) echo "Usage: $0##*/"' [get|set|run <command>]'
          ;;
          esac





          share|improve this answer






















          • i think this script has a syntax error on line 11, but i cant figure out how ti fix it!
            – Waqleh
            Sep 18 at 8:22






          • 1




            Replace first sh to bash.
            – Ipor Sircer
            Sep 18 at 8:33












          up vote
          2
          down vote










          up vote
          2
          down vote









          Use this simple shellscript before and after suspend:



          #!/bin/bash
          # Get the coordinates of the active window's
          # top-left corner, and the window's size.
          # This can be saved & loaded

          getpos()
          wmctrl -l -G > /dev/shm/winposs

          setpos()
          while read -r id g x y w h host app;do
          IFS=" ," read ta tb a b c d <<<$(xprop -id "$id" _NET_FRAME_EXTENTS 2>/dev/null)
          [ -z $d ] && continue
          wmctrl -i -r $id -e "$g,$((x-$d)),$((y-$c)),$((w+$d+$b)),$((h+$c+$a))" 2>/dev/null
          done < /dev/shm/winposs


          case $1 in
          get) echo getting window positions
          getpos
          ;;
          set) echo setting window positions
          setpos
          ;;
          run) getpos
          shift
          $@
          setpos
          ;;
          *) echo "Usage: $0##*/"' [get|set|run <command>]'
          ;;
          esac





          share|improve this answer














          Use this simple shellscript before and after suspend:



          #!/bin/bash
          # Get the coordinates of the active window's
          # top-left corner, and the window's size.
          # This can be saved & loaded

          getpos()
          wmctrl -l -G > /dev/shm/winposs

          setpos()
          while read -r id g x y w h host app;do
          IFS=" ," read ta tb a b c d <<<$(xprop -id "$id" _NET_FRAME_EXTENTS 2>/dev/null)
          [ -z $d ] && continue
          wmctrl -i -r $id -e "$g,$((x-$d)),$((y-$c)),$((w+$d+$b)),$((h+$c+$a))" 2>/dev/null
          done < /dev/shm/winposs


          case $1 in
          get) echo getting window positions
          getpos
          ;;
          set) echo setting window positions
          setpos
          ;;
          run) getpos
          shift
          $@
          setpos
          ;;
          *) echo "Usage: $0##*/"' [get|set|run <command>]'
          ;;
          esac






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Sep 18 at 8:33

























          answered Sep 3 at 12:30









          Ipor Sircer

          9,3511920




          9,3511920











          • i think this script has a syntax error on line 11, but i cant figure out how ti fix it!
            – Waqleh
            Sep 18 at 8:22






          • 1




            Replace first sh to bash.
            – Ipor Sircer
            Sep 18 at 8:33
















          • i think this script has a syntax error on line 11, but i cant figure out how ti fix it!
            – Waqleh
            Sep 18 at 8:22






          • 1




            Replace first sh to bash.
            – Ipor Sircer
            Sep 18 at 8:33















          i think this script has a syntax error on line 11, but i cant figure out how ti fix it!
          – Waqleh
          Sep 18 at 8:22




          i think this script has a syntax error on line 11, but i cant figure out how ti fix it!
          – Waqleh
          Sep 18 at 8:22




          1




          1




          Replace first sh to bash.
          – Ipor Sircer
          Sep 18 at 8:33




          Replace first sh to bash.
          – Ipor Sircer
          Sep 18 at 8:33

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f466551%2fhow-can-i-stop-windows-re-positioning-after-waking-up-monitors%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Bahrain

          Postfix configuration issue with fips on centos 7; mailgun relay