How can I setup an X Server to run in the background on Windows?

0

I have grown tired of the (visual) problems I get when using the combination of not-so-great terminal emulation+CygWin on Windows. Now I just run a forwarded gnome-terminal from my server when working in the terminal. The setup is quite simply using the Xserver I get through cygwin, which I start from the command line by issuing ´startx -- -multiwindows -clipboard´. The parameters means each program gets its own window. On a local network the performance is good enough for my needs.

I have three problems with my current setup

  1. I need to manually issue startx from a console. I wish it could just start up in the background when I log in.
  2. It seems startx, or rather the ~/.xinitrc needs to issue ´exec some-program´. Currently some xterm is started, which I have no use of. I would like this program to be non-visible.
  3. I need to start up a console (or use the xterm window that xinit starts for me) and then manually issue ´ssh -Y myuser@myserver gnome-terminal´ to get things going. If I issue the command from another cygwin console then I also have to manually set ´DISPLAY´ to whatever it is at the moment.

How can I automate/improve this setup?

oligofren

Posted 2014-05-01T18:14:05.153

Reputation: 842

Answers

0

These are my findings so far: I have got everything working except #3.

  1. Found out that the shortcut in the start meny did what I wanted. It starts up an Xserver on DISPLAY=:0 by running C:\cygwin\bin\run.exe /usr/bin/bash.exe -l -c /usr/bin/startxwin.exe and uses multiwindows as the default. So simply by copying this shortcut (or creating my own with the same content) to the "Startup" folder in the start meny the X server is started on login.
  2. I read the man file on startxwin. It seems that it will start xterm if it cannot find a ~/.startxwinrc file. Simply by creating an empty file with this name I get what I want: nothing started and the X server is running.
  3. Not quite there. I created a shortcut that runs the following command bash.exe -l -c "DISPLAY=:0 ssh -Y myuser@myserver gnome-terminal". This creates a console window that logs into my server and then starts up the gnome-terminal. This is almost there, except for the "dummy" console. I tried prepending "C:\cygwin\bin\run.exe" to the command, but it just silently executes without anything happening.

oligofren

Posted 2014-05-01T18:14:05.153

Reputation: 842

Wouldn't it need a command separator like: bash.exe -l -c "DISPLAY=:0; ssh -Y myuser@myserver gnome-terminal" ? – caffeine – 2017-07-09T07:20:07.083

1@caffeine no, it is not a command. you can prefix any command with environment variables like FOO=foo BAR=bar echo $FOO $BAR and they will only be available for that command. It means they will not affect the environment the command is started from. – oligofren – 2017-07-11T12:17:55.037