Openbox

openbox:在特定位置打開新視窗

  • July 5, 2021

是否可以配置 openbox 在某些區域打開特定應用程序的新視窗?例如,應用 A 應在螢幕的左上象限打開,應用 B 在左下象限打開,應用 C 在螢幕的右半部分打開。或者至少設置應該打開視窗的座標。

我想有一些東西要寫進去,rc.xml但我不知道是什麼。

如果有幫助,我正在使用 lightdm 和 openbox 執行 raspbian。

只要去你的applications部分rc.xml。對於您可以做什麼,有一個完整的評論部分,這裡有一個副本:

<!--
 # this is an example with comments through out. use these to make your
 # own rules, but without the comments of course.
 # you may use one or more of the name/class/role/title/type rules to specify
 # windows to match

 <application name="the window's _OB_APP_NAME property (see obxprop)"
             class="the window's _OB_APP_CLASS property (see obxprop)"
         groupname="the window's _OB_APP_GROUP_NAME property (see obxprop)"
        groupclass="the window's _OB_APP_GROUP_CLASS property (see obxprop)"
              role="the window's _OB_APP_ROLE property (see obxprop)"
             title="the window's _OB_APP_TITLE property (see obxprop)"
              type="the window's _OB_APP_TYPE property (see obxprob)..
                     (if unspecified, then it is 'dialog' for child windows)">
 # you may set only one of name/class/role/title/type, or you may use more
 # than one together to restrict your matches.

 # the name, class, role, and title use simple wildcard matching such as those
 # used by a shell. you can use * to match any characters and ? to match
 # any single character.

 # the type is one of: normal, dialog, splash, utility, menu, toolbar, dock,
 #    or desktop

 # when multiple rules match a window, they will all be applied, in the
 # order that they appear in this list


   # each rule element can be left out or set to 'default' to specify to not
   # change that attribute of the window

   <decor>yes</decor>
   # enable or disable window decorations

   <shade>no</shade>
   # make the window shaded when it appears, or not

   <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>

   <focus>yes</focus>
   # if the window should try be given focus when it appears. if this is set
   # to yes it doesn't guarantee the window will be given focus. some
   # restrictions may apply, but Openbox will try to

   <desktop>1</desktop>
   # 1 is the first desktop, 'all' for all desktops

   <layer>normal</layer>
   # 'above', 'normal', or 'below'

   <iconic>no</iconic>
   # make the window iconified when it appears, or not

   <skip_pager>no</skip_pager>
   # asks to not be shown in pagers

   <skip_taskbar>no</skip_taskbar>
   # asks to not be shown in taskbars. window cycling actions will also
   # skip past such windows

   <fullscreen>yes</fullscreen>
   # make the window in fullscreen mode when it appears

   <maximized>true</maximized>
   # 'Horizontal', 'Vertical' or boolean (yes/no)
 </application>

 # end of the example
-->

對於此特定範例,結果將是:

 <!-- A -->
 <application name="A">
   <decor>yes</decor>
   <shade>no</shade>
   <position force="no">
     <!-- start pos at (0,0), top-left corner -->
     <x>0</x>
     <y>0</y>
     <monitor>1</monitor>
   </position>
   <size>
     <!-- go in height & width only 50%, one quarter of the screen -->
     <width>50%</width>
     <height>50%</height>
   </size>
   <focus>yes</focus>
   <desktop>1</desktop>
   <layer>normal</layer>
   <iconic>no</iconic>
 </application>

 <!-- B -->
 <application name="B">
   <decor>yes</decor>
   <shade>no</shade>
   <position force="no">
     <!-- start pos at (0,mid of screen), middle-left of screen -->
     <x>0</x>
     <y>50%</y>
     <monitor>1</monitor>
   </position>
   <size>
     <!-- go in height & width only 50%, one quarter of the screen -->
     <width>50%</width>
     <height>50%</height>
   </size>
   <focus>yes</focus>
   <desktop>1</desktop>
   <layer>normal</layer>
   <iconic>no</iconic>
 </application>
 
 <!-- C -->
 <application name="C">
   <decor>yes</decor>
   <shade>no</shade>
   <position force="no">
     <!-- start pos at (mid of screen, 0), top-mid of screen -->
     <x>50%</x>
     <y>0</y>
     <monitor>1</monitor>
   </position>
   <size>
     <!-- take up half the screen width, but all the height -->
     <width>50%</width>
     <height>100%</height>
   </size>
   <focus>yes</focus>
   <desktop>1</desktop>
   <layer>normal</layer>
   <iconic>no</iconic>
 </application>

找到_OB_APP_*您可以執行的屬性obxprop | grep _OB_APP,然後點擊您想要其屬性的視窗。

引用自:https://unix.stackexchange.com/questions/656277