ANSI Colors in Intellij Terminal - intellij-idea

Context:
I am trying to set up Powerline on WSL
On my Windows Machine
Which I have set up to be the terminal in Intellij which is running on windows
The colors were displayed in a very odd way. I came across the question How to change the output color of echo in Linux which suggested the use of the following command to test the color outputs.
for code in {0..255}; do echo -e "\033[48;5;${code}m $code "; done | paste - - - - - - - -
Which gave the following result.
I had similar results when trying to make use of the WSL bash terminal.
Edit: This only happens when in intellij. bash.exe and the ubuntu terminal do not have this issue.
What is the correct way to make use of 8-bit and/or 24-bit color in intellij/WSL?

As of Intellij Idea version 2021.3, the terminal now supports 24-bit color thanks to ConPTY support on Windows.

Related

Linux Screen tab misbehaves on WSL environment

I use Ubuntu 18.04 on a WSL system and usually log on a Linux server through ssh to get some work done. When I activate 'screen' and use the tab key to autocomplete commands, my cursor goes to the end of line, and the formatting of my entire terminal breaks from then on.
When using vim in that condition on a screen terminal, if I go to the end of file and press down on more time, it erases the last line from the terminal.
It seems a kind of misinterpretation of some terminal signal. When using Putty or any other ssh client under the same circumstances, everything works fine, so I am pretty sure it is a problem with WSL environment, specifically.
Any ideas about what is the main issue and how to solve it?
I just came across this same exact issue and it appears to be a possible bug with Windows Console and certain $TERM values.
I have this problem when $TERM is set to screen-256color. The problem went away after setting $TERM to xterm-256color in .screenrc
$ cat ~/.screenrc
term xterm-256color

Embedded terminal sending ESC on OS X

I've made a fresh install of intellij after switching to v2016.1 and I noticed that I could not write the pipe character | anymore in the embedded terminal.
So I ran cat to see exactly what was going on, and it turns out that when using the alt key, the ESC character is prepended:
$ cat # type alt+shift+l
^[|
So I wonder if there is a (new?) option somewhere I might not be aware of?
It seems to be a known issue of 2016.1 versions: https://youtrack.jetbrains.com/issue/IDEA-152291

Why there are only 75 visible characters in Intellij Idea's embedded terminal?

When I use Idea's embedded command prompt in the tools window I can only see 75 characters. The chars are there but they are not visible:
C:>echo "This is the sentence I want to show you but I get only 75 characters h
"This is the sentence I want to show you but I get only 75 characters here"
Neither have I found any setting for this, nor have I found someone with the same problem by googling
Idea version is 13.1.13 on Windows 7 with jdk 1.7x
Outside idea, cmd.exe's (Version 6.1.7601) configuration is not limiting anything to 75
Notice: since IDEA 2016.3.2 this breaks the terminal and is not required anymore. So just delete it when you update to a version it cannot create the Terminal.
For windows change the terminal shell path (File->Settings->Tools->Terminal) from cmd.exe to:
cmd.exe "/K mode con:cols=500 lines=9999&cmd.exe"
or if using the bash for windows subsystem:
cmd.exe "/K set LINES=9999&C:\windows\system32\bash.exe"
as described in the bug description (https://youtrack.jetbrains.com/issue/IDEA-117552)
Edit: wrap /K in quotes as well!
This is a known bug: IDEA-117552 Terminal output truncated to 80 symbols
Happens on my system, too (JDK 1.7, Windows 7, 32bit).
If line length matters (not for me), you can set the terminal floating and reduce its horizontal size. Then it works.

xwd/java.awt.Robot captures black windows (everything except unity2d shell is black)

Today, I ran into weird issue: java.awt.Robot captures black areas, instead of image content. I'm using Ubuntu 12.04 and OpenJDK6/7.
java.awt.Robot on Unix is supported by the sun.awt.X11.XRobotPeer,
which, following the corresponding OpenJDK sources, uses image grabbing functions similar to those, used by xwd utililty (lines 92-162).
So, I ran the following command:
xwd -root -out test.screen.root.xwd
and then opened this file with gimp. Here's what I get:
Then I tried:
xwd -root | xwdtopnm | pnmtopng > Screenshot.root.png
And I got the following result:
Console output:
xwdtopnm: writing PPM file
libpng warning: Invalid sBIT depth specified
And the image itself:
What can cause this? How can I fix it?
Seems like the only way to fix this is to use your own native implementation of screen shotting.
Here's the detailed description of the problem at the launchpad from unity devs: launchpad conversation.
The problem is in the way unity-2d draws itself and in the use of XShaping.
I had the same error message. Apparently, it is linked to xwdtopnm not handling well the color depth of your screen - causing the resulting png file to be corrupted.
An alternative solution is to use the import command from the imagemagick package to take the screenshot.
So you can just replace:
xwd -root | xwdtopnm | pnmtopng > Screenshot.root.png
with:
import -window root Screenshot.root.png
NB: if it is not installed, you can get imagemagick on Ubuntu with the following command:
sudo apt install imagemagick

Trying to make a Webkit Kiosk on Debian with Raspberry Pi

I'm trying to build a Webkit Kiosk on a Raspberry Pi.
I found a good start at: https://github.com/pschultz/kiosk-browser
The things I want to do:
1) Start the kiosk without logging in (with inittab?)
Peter Schultz pointed out adding the following line:
1:2345:respawn:/usr/bin/startx -e /usr/bin/browser http://10.0.0.5/zfs/monitor tty1 /dev/tty1 2>&1
But he did not explain the steps to make this work (for noobs).
What I did is add his code to a personal git repository and cloned this repo to /usr/bin/kiosk and sudo apt-get install libwebkit-dev and sudo make.
The line to add to inittab will be:
1:2345:respawn:/usr/bin/startx -e /usr/bin/kiosk/browser http://my-kiosk-domain.com tty1 /dev/tty1 2>&1
If I do this, I generate a loop or some kind...
If you want to automatically load a browser full screen in kiosk mode every time you turn on the rpi you can add one of these two lines to the file /etc/xdg/lxsession/LXDE/autostart
#chromium --kiosk --incognito www.google.it
#midori -i 120 -e Fullscreen -a www.google.it -p
The first is for chromium and the latter is for midori, the rpi default lightweight browser.
Hint : Since we will use the rpi as a kiosk we want to prevent the screen from going black and disable the screensaver. Edit the autostart file:
sudo pico /etc/xdg/lxsession/LXDE/autostart
find the following line and comment it using a # (it should be located at the bottom)
##xscreensaver -no-splash
and append the following lines
#xset s off
#xset -dpms
#xset s noblank
Save, reboot.
More info on
http://pikiosk.tumblr.com/post/38721623944/setup-raspberry-ssh-overclock-sta
The upvoted answer suggest to run LXDE for it. You could also do it without such a heaver desktop enviorment. You could just start midori or chromium in an X session:
xinit /usr/bin/midori -e Fullscreen -a http://www.examples.com/
xinit chromium --kiosk http://www.examples.com/
Sometimes Fullscreen mode of midori is not working as expected and midori is not using whole screen. In these cases you could map it inside a very simple window manager like MatchBox to get real fullscreen. Due to xinit you have to wrap everything in a shell script.
#!/bin/sh
matchbox-window-manager &
midori -e Fullscreen -a http://dev.mobilitylab.org/TransitScreen/screen/index/11
Autostart could be done simply be using /etc/rc.local.
More information concerning screensaver issues and an automated restart could be found here: https://github.com/MobilityLab/TransitScreen/wiki/Raspberry-Pi#running-without-a-desktop
Chromium has a dependency problem on some debian derivate for arm architecture. For Cubian you find the bug report here. I am not sure if you could install chromium on latest Raspbian without problem.
But I really could recommend midori. It's very fast and support for modern web technologies is very good. As Chromium it is using webkit as rendering engine. If you miss some html5 / css3 features consider an update of libwebkitgtk (for example by using package of debian testing).
It's possible you haven't set the DISPLAY environment variable.
Try:
export DISPLAY=:0
/usr/bin/startx /usr/bin/browser
Or, browser can also take a display argument (so you don't need the environment variable):
/usr/bin/startx /usr/bin/browser :0
This works for me on Raspbian from a standard terminal shell (I'm logged in over SSH).
Updated for the current version of Raspbian (with Pixel desktop) install with noop 2.0.
I found you need to edit in two different places to get it to work.
/etc/xdg/lxsession/LXDE/autostart
/home/pi/.config/lxsession/LXDE-pi/autostart
So my configure file is:
# #xscreensaver -no-splash
#xset s off
#xset -dpms
#xset s noblank
#chromium-browser --kiosk --incognito http://localhost
And that's it.
You should probably start with checking if /usr/bin/kiosk/browser is working at all. You should start normal X session (graphical environment) on your RaspberryPi, launch terminal, try running this command:
/usr/bin/kiosk/browser http://my-kiosk-domain.com
and see what it prints on the terminal. Is this working? Do you see any error messages?
I'm trying to build a Webkit Kiosk on a Raspberry Pi.
I think Instant WebKiosk for Raspberry Pi could be useful for you.
See: http://www.binaryemotions.com/raspberry-digital-signage/