3

While setting up a configuration for a live Lubuntu, I need to launch (after booting, on startup) a terminal (lxterminal preferred) window in the left half of the screen, and an editor (gedit preferred) window in the right half. After playing with xdpyinfo to get the screen size, and the geometry of some commands (like xterm), the parametrization seems puzzling (actually, I did not succeed). On the other hand xdotool would do it by emulating Super+Right/Left hotkeys, but that might interfere with the user clicking here or there.

Is there a simple way to launch these two applications in the two halves of the screen?

  • 2
  • Please mention if you manage. – Jacob Vlijm Oct 11 '16 at 17:30
  • @DKBose, if I understand it right, something like <x>0</x><y>0</y><maximized>Vertical</maximized> would place a window on the left half of the screen, is this right? On the other hand, how to identify the application with obxprop? – nightcod3r Oct 11 '16 at 18:28
  • @JacobVlijm, the answers provided in this question make use of xdotool or similar tools, something I would like to avoid, as it might interfere with the user. – nightcod3r Oct 11 '16 at 18:30
  • @nightcod3r not at all! xdotool is only used to resize the window, not to simulate keystrokes at all. No chance of interference whatsoever. xdotool is a versatile tool. – Jacob Vlijm Oct 11 '16 at 18:34
2

This question focuses on Lubuntu, which comes with openbox included in its latest version (14.04.5). As pointed out in the comments, by configuring the ~/.config/openbox/lubuntu-rc.xml file, you can affect the applications included in the ~/.config/autostart, that are run on startup. The following lines added to the <applications> section will place the lxterminal window on the left half, and the gedit window on the right half.

<!-- Allocate 'lxterminal' in the left half-->
<application name="x-terminal-emulator">
  <position>
    <x>0</x>
    <y>0</y>
  </position>
  <size>
    <width>50%</width>
  </size>
  <maximized>Vertical</maximized>
</application>

<!-- Allocate 'gedit' in the right half-->
<application name="gedit">
  <position>
    <x>-0</x>
    <y>0</y>
  </position>
  <size>
    <width>50%</width>
  </size>
  <maximized>Vertical</maximized>
</application>

To learn more follow this link.

Update: Regarding how to make it fit to exactly 50% of the screen, it's been posted in the comments (edited):

lxterminal, like some other terminals, uses characters (in width) and rows for height!

In the rc.xml (keybind section), you can Super+T for

sh -c "wmctrl -xa LXTerminal || lxterminal --geometry=84x44 2&gt;/dev/null"

Then, in the applications section, you write:

<application class="Lxterminal" name="lxterminal">
  <position force="yes">
    <x>-0</x> <y>0</y>
  </position>
  <decor>no</decor>
</application>.

But you have to get the values for lxterminal by trial and error for the screen with the particular chosen font type and font size.

  • @DKBose That's also helpful, to be sure of the application's name. What is tricky is that I couldn't resize them to precisely fit each window a half of the screen. Tried also <size><width>50%</width></size>, but the Lxterminal always shows wider than 50%. – nightcod3r Oct 17 '16 at 10:02
  • @DKBose This would make it system-dependent, something I'm trying to avoid. Funny enough, just by adding the no-decor feature (something I was also targeting) -without the sh command-, the windows seem to get the right size (half each), but I can't see why. – nightcod3r Oct 17 '16 at 10:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.