2

I'm running Lubuntu 16.04. It's using openbox as its window manager. I wanted to configure the virtual desktops to be in a grid arrangement rather than a line, which I can do by running this command:

xprop -root -f _NET_DESKTOP_LAYOUT 32cccc -set _NET_DESKTOP_LAYOUT 0,3,2,0

This works fine when run manually. So I've put that command in my ~/.profile, hoping that it would be executed on every login.

But it's not. :( Lubuntu boots, I login and the pager is still setup in a line. I have to manually run that command to get the desktop layout back.

.profile is being executed when I log in. I can tell this because the PATHS adjustments made in it are having an effect.

  1. How come it works when run in a terminal but not from .profile? (I've even done source ~/.profile rather than typing/copying the command to ensure it's correct in the file)
  2. Where's the appropriate file to put such a command for it to be properly executed?

Looking for any subsequent 'xprop' commands that might be overriding it I ran

grep -r xprop  .

and found a reference to a xprop failure in the file run.log. The log appears to be generated in each log in:

pod@lubuntu-vm:~$ grep -C3 xprop  ~/.cache/lxsession/Lubuntu/run.log 
** Message: utils.vala:79: Config system location : /etc/xdg/lxsession/Lubuntu
** Message: utils.vala:85: System system path location : /etc/xdg/lxsession/Lubuntu/conffiles.conf
** Message: utils.vala:89: Final file used : /etc/xdg/lxsession/Lubuntu/conffiles.conf
xprop:  no such property "_NET_NUMBER_OF_DESKTOPS"
xprop:  no such property "_NET_DESKTOP_NAMES"
** Message: options.vala:164: Activate xsettings_manager build-in
** Message: utils.vala:68: User config used : /home/pod/.config/lxsession/Lubuntu/desktop.conf
** Message: utils.vala:89: Final file used : /home/pod/.config/lxsession/Lubuntu/desktop.conf

But that's the only reference, and it's not the same property I'm trying to adjust.

Jacob Vlijm
  • 83,767
Pod
  • 123
  • 1
    I can't post an answer atm, but it's a timing issue. Run the command on log in with a small break of 10 seconds. No clue where to set login commands on Lubuntu, but set a command to run on log in: /bin/bash -c "sleep 10 && commandtosetworkspaces" I will add it as an answer tomorrow, please mention if you manage. – Jacob Vlijm Jan 25 '17 at 21:25
  • 1
    ^ commandtosetworkspaces is your xprop command :) – Jacob Vlijm Jan 25 '17 at 21:27
  • I've tried it in ~/.config/openbox/autostart, ~/.config/lxsession/Lubuntu/autostart and ~/.config/autostart but it didn't work. I tried both the normal command and with the /bin/bash -c "sleep 10 &&. :( I'll try and find more ways to run something on login.. – Pod Jan 25 '17 at 22:29
  • Ha! If I do the command in ~/.profile and make sure to & run it in the background, it works! (If I don't background it then it takes 10 seconds to log in :) ). Thanks! Interestingly I saw this other answer by you when looking for start up locations. – Pod Jan 25 '17 at 22:35
  • 2 seconds seems to be the lowest it will reliably work with. – Pod Jan 25 '17 at 22:39
  • Hi Pod, since you mentioned the answer solved the issue, would you accept it? It makes clear the question is answered in a sufficient way :) – Jacob Vlijm Jan 26 '17 at 21:26
  • Do you know why this is required, other than a general timing issue? I.e. which specific thing isn't loaded yet and is causing the problem? It'd be nice if that thing had a post load hook of some kind. (Or even better, a proper config to put this setting in?) – Pod Jan 26 '17 at 22:48
  • Does it really matter if the break can be as short as 2 seconds? Anyway, I cannot find out, since I don't run Lubuntu :). – Jacob Vlijm Jan 27 '17 at 08:11

1 Answers1

4

The issue

As I already mentioned in comments, the issue is timing. (commands to-) Configuring desktops is typically something that will break if the desktop isn't ready for it, and your command simply misses target. This often happens when running commands on configuring monitors, keyboards and mouse for example.

To solve

To solve the issue, you need to add a little break before the command is run. I don't run Lubuntu, but according to this post, you should be able to add a command to startup (login actually) here: Start Menu → Preferences → Default applications for LXSession → AutoStart. The command to add a little break is then:

/bin/bash -c "sleep 5 && xprop -root -f _NET_DESKTOP_LAYOUT 32cccc -set _NET_DESKTOP_LAYOUT 0,3,2,0"

Alternatively, (tested by you :) ), you can add it to ~/.profile, and add a & to make sure it will run in the background and not hold the login process.

Jacob Vlijm
  • 83,767