1

I am trying to set up a "terminal as desktop wallpaper" in Openbox, as described here

Openbox has the possibility to set <layer>below</layer>, so that window is running as desktop background, and won't be displayed by the statusbar and unaffected by "minimize windows". So instead of displaying a useless image as wallpaper, I actually have a terminal.

The actual terminal that I am running as background is terminator, I have just created a symlink terminator-wallpaper-1a and terminator-wallpaper-1b, which are just symlinks to the terminator binary. Only so that the names are different, and I can distinguish them.

I have dual monitor setup, and I want terminator wallpaper on each monitor.

The openbox window property is set by devilspie:

(if
(matches (application_name) "terminator-wallpaper")
(begin
(wintype "desktop")
)
)

And then, I have this in my openbox config, so that each wallpaper goes to corresponding monitor/desktop:

<application name="terminator-wallpaper-1a">
  <focus>yes</focus>
  <layer>below</layer>
  <desktop>1</desktop>
  <position>
    <y>0</y>
    <x>0</x>
    <monitor>1</monitor>
  </position>
  <skip_taskbar>yes</skip_taskbar>
  <maximized>true</maximized>
</application>

<application name="terminator-wallpaper-1b">
  <focus>yes</focus>
  <layer>below</layer>
  <desktop>1</desktop>
  <position>
    <y>0</y>
    <x>0</x>
    <monitor>2</monitor>
  </position>
  <skip_taskbar>yes</skip_taskbar>
  <maximized>true</maximized>
</application>

Lastly, this is how I start the whole thing:

devilspie &
terminator-wallpaper-1a -b &
terminator-wallpaper-1b -b &

xdotool set_desktop 0

xdotool search --class 'Terminator-wallpaper-1a' windowunmap --sync windowmap windowsize %1 1920 1180
xdotool search --class 'Terminator-wallpaper-1b' windowunmap --sync windowmap windowsize %1 1920 1180

Everything works nicely, and when I minimize all other windows, I actually see my terminator wallpapers. But only one of them is actually usable. ie, focused, or active. The other I cannot type into. Even when I click with the mouse, the cursors is still inactive, so that the window never becomes focused.

How can I fix this ?

SOLUTION:

after exhaustive troubleshooting with user @intika, we have identified the problem. Adding following snippet to section <mouse> in the openbox config file fixed the issue:

<context name="Desktop">
  <mousebind button="Left" action="Press">
    <action name="Focus"/>
    <action name="Raise"/>
  </mousebind>
</context>
1
  • I feel issue is (matches (application_name) "terminator-wallpaper") which was supposed to be (matches (application_name) "terminator") assuming you did not rename binary to terminator-wallpaper. can you confirm ?
    – Devidas
    Dec 13 '19 at 8:09
3
+500

Only one window/application can have the focus at a time.

In your openbox config both applications/wallpaper have the focus but technically this not possible, so openbox mitigate your configuration by giving focus to only one application (it can not do otherwise).

<application name="terminator-wallpaper-1a">
  <focus>yes</focus>
...
<application name="terminator-wallpaper-1b">
  <focus>yes</focus>

There are many possibilities to fix this issue, they evolve around implementing a way to switch the focus to the first or second screen desktop/application/wallpaper

Possible solution 1:

You may try to set focus value to no or remove the focus line all together, then test switching the focus by a mouse click

Possible solution 2:

Use the mouse location to set the focus, here is the openbox wiki for the matter, first remove the focus entry for both of your wallpaper app then add the following to your openbox config under the main section <focus></focus> like described on the linked documentation

<followMouse>yes</followMouse>
<!-- move focus to a window when you move the mouse into it -->

Note that this will impact your other windows as well...

You can also try to use followMouse under the application section but i don't think this is handled by openbox

Possible solution 2:

Use xdotool with a keyboard shortcut or else to switch the focus, in fact you can assign a keyboard shortcut a command like the one bellow, also this solution also require you to fix your config by removing/editing the dual <focus>yes</focus>

xdotool search --class 'Terminator-wallpaper-1b' windowactivate

Same as xdotool, wmctrl can be used for the matter as well:

#Lists currently open windows 
wmctrl -l 

#Set focus to windows with title containing STRING
wmctrl -a STRING

Note:

<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

Note 2:

There are many other possible solutions, you can comment the answer and i will edit it accordingly ;)

7
  • removing <focus>yes</focus>, or setting to no does not have any effect. I can make inactive window active with the xdotool command, but then still only one window is "accesible". Dec 29 '19 at 7:57
  • what about the mouse focus solution ? also does a command line linked to a keyboard shortcut suit your needs ?
    – intika
    Dec 29 '19 at 8:25
  • the problem here is that the desktop is considered one single layer even if you have 2 screens and thus only one application can have focus on that layer... openbox with <focus>yes</focus> is not meant for a dynamic focus on a single layer
    – intika
    Dec 29 '19 at 8:29
  • also an other solution could be a python/or/else script that will watch the mouse location + desktop window and set the focus to the proper window... it would require some work but doable in 1 or 2h programming... let me know i'll see what i can do ;)
    – intika
    Dec 29 '19 at 8:31
  • also, I should point out, that everything worked fine in earlier versions of openbox (3.5.0). It stopped working with version 3.6.1 Dec 29 '19 at 9:03

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.