How to make openbox display window in certain area only

5,938

Try

<application name="emacs*" class="Emacs*" type="normal">
    <position force="yes">
        <x>0</x>
        <y>0</y>
    </position>
    <size>
        <height>600</height>
        <width>1024</width>
    </size>
    <decor>no</decor>
    <maximized>no</maximized>
</application>

The <height> and <width> need to be in the <size> tag.

From the example configuration of Openbox

<position force="no">
  # the position is only used if both an x and y coordinate are provided
  # (and not set to 'default')
  # when force is "yes", then the window will be placed here even if it
  # says you want it placed elsewhere.  this is to override buggy
  # applications who refuse to behave
  <x>center</x>
  # a number like 50, or 'center' to center on screen. use a negative number
  # to start from the right (or bottom for <y>), ie -50 is 50 pixels from
  # the right edge (or bottom). use 'default' to specify using value
  # provided by the application, or chosen by openbox, instead.
  <y>200</y>
  <monitor>1</monitor>
  # specifies the monitor in a xinerama setup.
  # 1 is the first head, or 'mouse' for wherever the mouse is
</position>

<size>
  # the size to make the window.
  <width>20</width>
  # a number like 20, or 'default' to use the size given by the application.
  # you can use fractions such as 1/2 or percentages such as 75% in which
  # case the value is relative to the size of the monitor that the window
  # appears on.
  <height>30%</height>
</size>
Share:
5,938

Related videos on Youtube

godblessfq
Author by

godblessfq

Updated on September 18, 2022

Comments

  • godblessfq
    godblessfq over 1 year

    I have a display with a native resolution of 1024X600. I set it to 1024X724, because some window can't be display in the native resolution. I have to use the mouse to do the panning. But for the majority of windows, the native resolution is enough.

    1 Is there a way to set all windows be displayed in the upper 1024X600 region of the display?

    2 For some applications, I want to specify the exact position and size. I tried this for emacs, both position and size don't work. Any ideas?

    <application name="emacs24" class="Emacs" type="normal">
    <position force="yes">
        <x>0</x>
        <y>0</y>
    </position>
        <height>600</height>
        <width>1024</width>
    <decor>no</decor>
    <maximized>no</maximized>
    </application>
    

    The output of obxprop is:

    _OB_APP_TYPE(UTF8_STRING) = "normal"
    _OB_APP_CLASS(UTF8_STRING) = "Emacs"
    _OB_APP_NAME(UTF8_STRING) = "emacs24"
    
  • godblessfq
    godblessfq over 8 years
    No, the position and size don't work unless I set application name="*". I have tried lxterminal too. Maybe this is a bug. I am using openbox 3.5.2.
  • godblessfq
    godblessfq over 8 years
    No, it doesn't work for me. If it works for you, I will accept this as an answer. Thank you!
  • Raphael Ahrens
    Raphael Ahrens over 8 years
    @godblessfq Could you please add the output of running obxprop | grep "^_OB_APP" and then clicking on an open emacs window, to your original question?
  • godblessfq
    godblessfq over 8 years
    I have read the tutorial, maybe the encoding of the window name string is causing the problem.
  • Raphael Ahrens
    Raphael Ahrens over 8 years
    @godblessfq I don't think that this is an encoding problem. But if name="*" is working then maybe name="emacs*" class="Emacs*" could work. I edited the answer. The behaviour you describe is very unusual. (btw I'm also using 3.5.2)
  • godblessfq
    godblessfq over 8 years
    It works today. I put the rule for all application <application class="*"> behind the one for emacs.