I was using sudo. I googled for the answer and tried export display, after trying that I "No protocol specified kwrite: cannot connect to X server :0" It does work from su -. I was never able to find any documentation about that.