xterm

How do you read the arrow keys?

我怕爱的太早我们不能终老 提交于 2020-01-02 16:08:07
问题 Extensive searching on the use of raw mode with termios and xterm leads to numerous references to a "timing trick" required to distinguish between an escape-sequence and a lone appearance of the escape character. So how do you do it? I don't want to use curses because I don't want to clear the screen. This is for a calculator-style program, so it's important to retain the "ticker-tape" interface. 回答1: finally found a nice detailed description in an old usenet thread. I quote the relevant

Color ouput with Swift command line tool

淺唱寂寞╮ 提交于 2019-12-31 10:36:33
问题 I'm writing a command line tool with Swift and I'm having trouble displaying colors in my shell. I'm using the following code: println("\033[31;32mhey\033[39;39m") or even NSFileHandle.fileHandleWithStandardOutput().writeData("\033[31;32mhey\033[39;39m".dataUsingEncoding(NSASCIIStringEncoding, allowLossyConversion: true)!) It works when I use a simple echo in php (the text is displayed in green) but is there a reason it doesn't work in a Swift command line tool? Thanks! 回答1: Swift has built

Color ouput with Swift command line tool

好久不见. 提交于 2019-12-31 10:36:04
问题 I'm writing a command line tool with Swift and I'm having trouble displaying colors in my shell. I'm using the following code: println("\033[31;32mhey\033[39;39m") or even NSFileHandle.fileHandleWithStandardOutput().writeData("\033[31;32mhey\033[39;39m".dataUsingEncoding(NSASCIIStringEncoding, allowLossyConversion: true)!) It works when I use a simple echo in php (the text is displayed in green) but is there a reason it doesn't work in a Swift command line tool? Thanks! 回答1: Swift has built

run xterm -e without terminating

耗尽温柔 提交于 2019-12-30 08:00:48
问题 I want to run xterm -e file.sh without terminating. In the file, I'm sending commands to the background and when the script is done, they are still not finished. What I'm doing currently is: (cd /myfolder; /xterm -ls -geometry 115x65 -sb -sl 1000) and then after the window pops up sh file.sh exit What I want to do is something like: (cd /myfolder; /xterm -ls -geometry 115x65 -sb -sl 1000 -e sh file.sh) without terminating and wait until the commands in the background finish. Anyone know how

Xlib test window names

最后都变了- 提交于 2019-12-30 07:49:15
问题 I'm trying to get control of the the Xterm with Xlib. For that i'm making a Xterm with a strange title. After I list all window and check they names. But something is bugged the nammes of my Xterm does not appear when they are listed. Here is the code for list all window : void CMD::getWindowTerminal() { Atom a = XInternAtom(m_display, "_NET_CLIENT_LIST", true); Atom actualType; int format; unsigned long numItems, bytesAfter; unsigned char *data = 0; int status = XGetWindowProperty(m_display,

Reading the Device Status Report ANSI escape sequence reply

拟墨画扇 提交于 2019-12-29 07:35:15
问题 I'm trying to retrieve the coordinates of cursor in a VT100 terminal using the following code: void getCursor(int* x, int* y) { printf("\033[6n"); scanf("\033[%d;%dR", x, y); } I'm using the following ANSI escape sequence: Device Status Report - ESC[6n Reports the cursor position to the application as (as though typed at the keyboard) ESC[n;mR, where n is the row and m is the column. The code compiles and the ANSI sequence is sent, but, upon receiving it, the terminal prints the ^[[x;yR

How do I get the exit code of command and not xterm?

孤人 提交于 2019-12-29 00:07:26
问题 If I call a command (in my case another script) with xterm like so: xterm -e sh second.sh The value in $? after xterm returns is the exit status code of xterm (usually for me 0) and not my script. Is there anyway to get the exit status code of my script? 回答1: You could do something like this: statusfile=$(mktemp) xterm -e sh -c 'yourcommand; echo $? > '$statusfile status=$(cat $statusfile) rm $statusfile The exit status of yourcommand is now in variable status . 来源: https://stackoverflow.com

How to disable line buffering of input in xterm from program?

谁说我不能喝 提交于 2019-12-25 03:12:16
问题 Ie, how to get keystrokes send directly to my program without waiting for the user to press enter. Basicly I'm trying get something like curses's cbreak() call. (But I can't use curses due a couple of bugs/misfeatures that I haven't been able to work around.) This seems like something that should just be a trival escape sequence, but I haven't been able find anything. 回答1: Lookup termios and the tcsetattr function. 回答2: Isn't this called the "raw mode"? If so, this might help you. 来源: https:/

How to create a shell script to launch 3 terminals and execute a set of commands in each?

守給你的承諾、 提交于 2019-12-24 11:35:46
问题 Currently, I open 3 terminals ('openocd session','telnet session' & 'gdb session') and execute 'a set of commands' in each terminal every time I flash my image on target. Is is possible to put this in one shell script file and run at once? (Commands on each terminal are NOT dependent on others; except that the terminals should be opened in the order mentioned above) Thanks in advance ! 回答1: Which terminal are you using? A terminal like xterm can start a program instead of a shell. Simply run

gnome 3.12 cannot be launched + locale does not help out

佐手、 提交于 2019-12-24 03:48:12
问题 I have recently installed debian "testing" jessie RC betta. I wanted to personalized system-wide the gnome-terminal by changing the custom default terminal size in the file /usr/share/vte/termcap/xterm . In fact, I just changed with gedit the the col and li numbers in the following line :co#80:it#8:li#24:\ . After I did that, I was not able to launch any more the gnome terminal 3.12.3. I got the following output: ~$ gnome-terminal (process:2879): Gtk-WARNING **: Locale not supported by C