• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

URxvt: messed prompt.

lebarondemerde

Aspiring Daemon

Thanks: 372
Messages: 984

#1
Hi,

This is a problem I am experiencing since I started using x11/rxvt-unicode in Gentoo/Linux, and I still experience it in FreeBSD, unfortunately.

Randomly, but very often, the prompt get very MESSED. The example in the picture is not the worse it can get.

It seem to just happen when the shell is tcsh/csh. I do not remember to be experiencing this problem while still using shells/bash as default shell, in Linux.

This "mess" usually happen when urxvt start, and after it is minimized or hidden in some way.

clear or ctrl+l workaround the problem temporarily.

Code:
!!! Xft.Font Tweaks !!!
Xft.rgba:   rgb
Xft.hintstyle:   hintslight
Xft.lcdfilter:   lcddefault
Xft.dpi:   91
Xft.antialias:   1
Xft.hinting:   1
Xft.autohint:   0


!!! Set Fonts !!!
*font:               -*-ohsnapu-medium-r-normal-*-14-*-*-*-*-*-*-*
*boldfont:           -*-ohsnapu-bold-r-normal-*-14-*-*-*-*-*-*-*


!!! X Cursor Theme !!!
Xcursor.theme:            LCDBlue


!!! XTerm Tweaks !!!
XTerm.termName:        xterm-256color
XTerm.vt100.locale:        1


!!! URxvt.Tweaks !!!
URxvt.termName:                 rxvt-unicode-256color

URxvt.depth:           32
URxvt.background:       [90]#000000
URxvt.cursorBlink:       1
URxvt.skipBuiltinGlyphs:       1
URxvt.saveLines:       2048

URxvt.iso14755:        0
URxvt.iso14755_52:        0

URxvt.keysym.Control-Up:   \033[1;5A
URxvt.keysym.Control-Down:   \033[1;5B
URxvt.keysym.Control-Left:   \033[1;5D
URxvt.keysym.Control-Right:   \033[1;5C

URxvt.scrollBar:        0
URxvt.scrollTtyOutput:        0
URxvt.scrollWithBuffer:    1
URxvt.scrollTtyKeypress:    1
URxvt.secondaryScroll:       0

! URxvt.Perls
URxvt.perl-ext-common:        default,clipboard,matcher,

URxvt.keysym.C-C:        perl:clipboard:copy
URxvt.keysym.C-V:        perl:clipboard:paste
URxvt.keysym.C-A-V:        perl:clipboard:paste_escaped
URxvt.url-launcher:       /usr/local/bin/xdg-open
URxvt.colorUL:            #00C6C6
URxvt.matcher.button:       1


!!! Terminal Colors !!!
*background:   #000000
*foreground:   #FFFFFF
*cursorColor:   #F2F2F2

! black
*color0:   #000000
! dark grey
*color8:   #8B8B8B

! red
*color1:   #C30000
! bright red
*color9:   #DC0000

! green
*color2:   #00C300
! bright green
*color10:   #00DC00

! yellow
*color3:   #C6C600
! bright yellow
*color11:   #DCDC00

! blue
*color4:   #0000C3
! bright blue
*color12:   #0000DC

! magenta
*color5:   #6100C3
! bright magenta
*color13:   #6E00DC

! cyan
*color6:   #44C1C1
! bright cyan
*color14:   #19CBCB

! light grey
*color7:   #B9B9B9
! white
*color15:   #F2F2F2
Disabling perls-scripts, transparency, or anything does not helped in any way, neither using different fonts, or even Xft fonts. However, it seem, when using Xft fonts the things seem to degrade even more.

Thanks!
 

lebarondemerde

Aspiring Daemon

Thanks: 372
Messages: 984

#3
fulano Hi!

I already disabled Xft completely, but in fact urxvt is not using Xft fonts but bitmap ones.

I will try without .Xresources.

Thanks!

EDIT: same problem without .Xresources at all.
 

Minbari

Active Member

Thanks: 72
Messages: 167

#4
Here it's how's mine looks and it's working perfectly.



Code:
! Author Minbari
!
! URXVT NAME
! !------------------------------------------------
 
  URxvt*termName: rxvt-unicode-256color

! URXVT GEOMETRY
! !------------------------------------------------
 
  URxvt*geometry:  240x84


! URXVT FONTS
! !------------------------------------------------

  URxvt.font: xft:monospace:size=10
  URxvt*boldFont:xft:monospace:bold:size=10
  URxvt*italicFont:xft:monospace:italic:size=10
  URxvt*boldItalicFont:xft:monospace:bold:italic:size=10
  URxvt*allow_bold: true

! URXVT SCROLLBAR, CURSOR STYLE, BORDER
! !------------------------------------------------
 
  URxvt*saveLines:                        300000
  URxvt.scrollBar:                        false
  URxvt*scrollstyle:                      plain
  URxvt.scrollBar_right:                  false
  URxvt*scrollWithBuffer:                 true
  URxvt*scrollTtyKeypress:                true
  URxvt*scrollTtyOutput:                  false
  URxvt*cursorBlink:                      true
  URxvt*cursorUnderline:                  true
  URxvt*cursorColor:                      #F1F014
  URxvt*pointerColor2:                    #002B36
  URxvt*fading:                           20
  URxvt*borderColor:                  [68]#131520
  URxvt*borderLess:                       false
  URxvt*letterSpace:                      0
  URxvt.lineSpace:                        1
  URxvt.intensityStyles:                  false

 
! URXVT ENABLE LINK SUPPORT
! !------------------------------------------------

  URxvt*colorUL:                          #1a8cff
  URxvt*underlineColor:                   #F1F014
  URxvt.url-launcher: /usr/bin/firefox

! URXVT PERL EXTENSION
! !------------------------------------------------
 
  URxvt.perl-ext-common: default,matcher,tabbed,selection-to-clipboard
  URxvt.matcher.button: 1

! URXVT COPY PASTE SHORTCUTS
! !------------------------------------------------

  URxvt.iso14755: False
  URxvt.keysym.Shift-Control-C: perl:clipboard:copy
  URxvt.keysym.Shift-Control-V: perl:clipboard:paste
 
! URXVT KEY BINDS
! !------------------------------------------------

  URxvt.keysym.Home: \033[1~
  URxvt.keysym.End: \033[4~
  URxvt.keysym.KP_Home: \033[1~
  URxvt.keysym.KP_End:  \033[4~

! disable the bell
! !------------------------------------------------

  URxvt.insecure:                         false

! URXVT TABS
! !------------------------------------------------

  URxvt.tabbed.autohide:        yes
  URxvt.tabbed.tabbar-fg:       10
  URxvt.tabbed.tabbar-bg:       8
  URxvt.tabbed.tab-fg:          6
  URxvt.tabbed.tab-bg:          16
  URxvt.tabbed.title:           no
  URxvt.tabbed.new-button:      true


! URXVT COLORS
! !------------------------------------------------

 URxvt.colorIT:                                  #87af5f
 URxvt.colorBD:                                  #d7d7d7
 URxvt.depth: 32
 URxvt.background:                           [68]#131520
 URxvt*foreground:                               #ffffff
! !black
 *color0:                                        #101010
 *color8:                                        #070707
! !red
 *color1:                                        #FF0000
 *color9:                                        #B80000
! !green
 *color2:                                        #33CC33
 *color10:                                       #384d23
! !yellow
 *color3:                                        #FFFF00
 *color11:                                       #E6E600
! !blue
 *color4:                                        #3366FF
 *color12:                                       #1919FF
! !magenta
 *color5:                                        #D119D1
 *color13:                                       #A319A3
! !cyan
 *color6:                                        #33D6FF
 *color14:                                       #29A3A3
! !white
 *color7:                                        #FAFAFA
 *color15:                                       #D1D1D1
feel free to modify it to your needs.
 
Last edited:

lebarondemerde

Aspiring Daemon

Thanks: 372
Messages: 984

#5
Minbari

The URxvt*geometry: 240x84 called my attention. I do not set geometry and I am using i3, what the size change all the time, maybe setting it fix something.

Other than that, you have a nice urxvt configuration. :)

Thanks!
 

lebarondemerde

Aspiring Daemon

Thanks: 372
Messages: 984

#6
Minbari

Yes, it seems setting geometry solved the issue. It still need more testing time, but for now I could not reproduce it anymore.

Thanks! :beer:
 

lebarondemerde

Aspiring Daemon

Thanks: 372
Messages: 984

#7
Well, the issue is still present but does not happen often anymore. I will keep investigating.
 

Minbari

Active Member

Thanks: 72
Messages: 167

#8
It might not be related to rxvt-unicode and the problem could be from the prompt itself. Does this happen when you are using other terminal emulators like Xterm, Xfce4-terminal, etc.?
 

lebarondemerde

Aspiring Daemon

Thanks: 372
Messages: 984

#9
Minbari

No, just with urxvt, and as far I remember just when the shell is {t}csh.

Another thing, after setting geometry the terminal is faster too.
 

Minbari

Active Member

Thanks: 72
Messages: 167

#10
As a normal user I'm using zsh but for root I have csh and I don't have any issues in rxvt-unicode or xterm, that's why I think the problem it's a prompt design.

00.png
 

lebarondemerde

Aspiring Daemon

Thanks: 372
Messages: 984

#11
This is my current prompt, but I experienced that with a very simple one:

Code:
   set grey    = "%{\033[1;30m%}"
   set red    = "%{\033[1;31m%}"
   set green    = "%{\033[1;32m%}"
   set yellow    = "%{\033[1;33m%}"
   set blue    = "%{\033[1;34m%}"
   set magenta    = "%{\033[1;35m%}"
   set cyan    = "%{\033[1;36m%}"
   set white    = "%{\033[1;37m%}"

   set end    = "%{\033[0m%}"

       if ($tty =~ ttyv*) then

           if ( $USER == root ) then
               set prompt = "\n${blue}%~ ${red}%N@%m: \n>>>${end} "
           else
               set prompt = "\n${red}%~ ${blue}%m: \n>>>${end} "
           endif

       else

           if ( $USER == root ) then
               set prompt = "\n${blue}%~ ${red}%N@%m: \n❱❱❱${end} "
           else
               set prompt = "\n${red}%~ ${blue}%m: \n❱❱❱${end} "
           endif

       endif

   unset grey red green yellow blue magenta cyan white end
My prompt while still using Gentoo was basically the default one but blue.

Thanks!
 

Minbari

Active Member

Thanks: 72
Messages: 167

#12
I've tested your prompt on my machine and on a Debian in vbox and it's working OK with my Xresources.

01.png
 

lebarondemerde

Aspiring Daemon

Thanks: 372
Messages: 984

#13
Minbari thank you for your efforts to help me.

Nice to see it is properly working in there. I should now dig to know what exactly could be causing it here, or what is lacking.

I had posted about this problem in the x11/rxvt-unicode mailing list and just today I had a reply. Also, it indeed that reply confirmed some of my suspicious.

I am posting it here since the mailing list is public:

Hi, Baron d'Merde :)

Keep in mind that urxvt faithfully executes commands sent to it, so this
prompt is likely correct, in the sense of displaying what the application
printing the prompt told it to display.

One thing to look into is whether the program you use to generate those
commands uses the correct terminal database - most programs use terminfo
these days, but some distributions force programs back to termcap (e.g.
redhat did that for bash), which uses a different database (/etc/termcap).

If that isn't the issue, then you have to find what generates your prompt
and fix it, which might not be aneasy task.

> It seem to just happen when the shell is {t}csh.

I don't think tcsh prints coloured prompts, so likely whatever generates
the prompt is something else, and this would explain the difference
between bash and tcsh - they simply execute different prompt-generating
commands.

> This "mess" usually happen when urxvt start, and after it is minimized or
> hidden in some way.

Minimization (or hiding) shouldn't really do anything to urxvt or the
program running inside, so you might want to find out what your window
manager does instead when you want it to minimize.

For example, maybe your window manager resizes urxvt to some tiny size
which isn't long enough for the prompt. This could cause this problem.

While programs can adapt to size changes, it's quite possible that
whatever generates the prompt isn't so intelligent and simply gets
confused. It's also quite hard to get right in programs that aren't
full-screen, as resizes are asynchronous.

If that's the case, telling your window manager not to do unnecessary
resizes might be a workaround for your problem as well.

> Disabling perls, transparency, or anything does not helped in any way,

Yes, this is unlikely to be an issue in urxvt, it's almost certainly
simply interpreting the commands it gets.
Two things I have in mind now:

  1. after geometry be set the issue does not happen often. More like rarely indeed (I think I saw it two times).
  2. The unknown capabilities problem: Thread 61533
The geometry was set using the numbers you use. I will try to set it matching with a fraction of my screen resolution.
 

ILUXA

Well-Known Member

Thanks: 220
Messages: 397

#15
Here is my urxvt configuration, never had any issues while using tcsh or zsh.

Code:
! URxvt ------------------------------------------------
URxvt.termName:				rxvt-unicode-256color
URxvt.loginShell:			false
URxvt.font:				xft:DejaVu\ Sans\ Mono:size=9
URxvt.background: 			#0D0D0D
URxvt.foreground:			#ffffff
URxvt.borderColor:			#000000
URxvt.cursorColor:			#215D9C
URxvt.cursorBlink:			true
URxvt.visualBell:			true
URxvt.geometry:				82x23
URxvt.saveLines:			15000
URxvt.internalBorder:			1
URxvt.fading:				0
URxvt.letterSpace:			-2
URxvt.cutchars:				'"'()<>[]{}|=,;:&?*@^"'"
URxvt.tripleclickwords:			false
URxvt.skipBuiltinGlyphs:		false
URxvt.scrollTtyOutput:			false
URxvt.jumpScroll:			true
URxvt.scrollTtyKeypress:		true
URxvt.scrollWithBuffer:			true
URxvt.scrollBar:			true
URxvt.scrollBar_right:			true
URxvt.scrollBar_floating:		false
URxvt.scrollstyle:			next
URxvt.scrollColor:			#ADADAD
! disable ctrl+shift key binding
URxvt.iso14755:				false
! URxvt perls
URxvt.perl-lib:				/usr/local/lib/urxvt/perl/
URxvt.perl-ext-common:			matcher,eval,selection-popup,option-popup
URxvt.url-launcher:			/usr/local/bin/luakit
URxvt.colorUL:				#4682B4
URxvt.matcher.button:			1
! map ctrl+shift+c/ctrl+shift+v to copy/paste
URxvt.keysym.Shift-Control-V:		eval:paste_clipboard
URxvt.keysym.Shift-Control-C:		eval:selection_to_clipboard
! emulate some XTerm key sequences
URxvt.keysym.M-Up:			\033[1;3A
URxvt.keysym.M-Down:			\033[1;3B
URxvt.keysym.M-Left:			\033[1;3D
URxvt.keysym.M-Right:			\033[1;3C
URxvt.keysym.C-Up:			\033[1;5A
URxvt.keysym.C-Down:			\033[1;5B
URxvt.keysym.C-Left:			\033[1;5D
URxvt.keysym.C-Right:			\033[1;5C
URxvt.keysym.S-Up:			\033[1;2A
URxvt.keysym.S-Down:			\033[1;2B
URxvt.keysym.S-Left:			\033[1;2D
URxvt.keysym.S-Right:			\033[1;2C
URxvt.keysym.C-S-Up:			\033[1;6A
URxvt.keysym.C-S-Down:			\033[1;6B
URxvt.keysym.C-S-Left:			\033[1;6D
URxvt.keysym.C-S-Right:			\033[1;6C
URxvt.keysym.S-M-Up:			\033[1;4A
URxvt.keysym.S-M-Down:			\033[1;4B
URxvt.keysym.S-M-Left:			\033[1;4D
URxvt.keysym.S-M-Right:			\033[1;4C
URxvt.keysym.C-M-Up:			\033[1;7A
URxvt.keysym.C-M-Down:			\033[1;7B
URxvt.keysym.C-M-Left:			\033[1;7D
URxvt.keysym.C-M-Right:			\033[1;7C
But now I use xterm, I decided to stick with it, cause it has better tmux integration, is available on every *nix and is a part of xorg.
Here is my xterm configuration.
Code:
! XTerm ------------------------------------------------
XTerm*termName:				xterm
XTerm*loginShell:			false
XTerm*activeIcon:			false
XTerm*faceName:				xft:Dejavu\ Sans\ Mono
XTerm*faceSize:				9
XTerm*Foreground:			#ffffff
XTerm*Background:			#0D0D0D
XTerm*cursorColor:			#215D9C
XTerm*vt100*geometry:			80x22
XTerm*saveLines:			10000
XTerm*visualBell:			true
XTerm*cursorBlink:			true
XTerm*scrollBar:			true
XTerm*rightScrollBar:			true
XTerm*scrollbar.width:			17
XTerm*scrollBarBorder:			2
XTerm*Scrollbar*background:		#ADADAD
XTerm*scrollKey:			true
XTerm*multiScroll:			true
XTerm*scrollTtyOutput:			false
XTerm*BorderWidth:			1
XTerm*borderColor:			black
XTerm*metaSendsEscape:			true
XTerm*disallowedWindowOps:		20,21,SetXprop
XTerm*charClass:			33:48,35:48,37:48,42:48,45-47:48,64:48,95:48,126:48
! keybindings
XTerm*VT100*translations:    #override \
	<KeyPress> F11: fullscreen(toggle) \n\
	Ctrl Shift <KeyPress> c: copy-selection(CLIPBOARD) \n\
	Ctrl Shift <KeyPress> v: insert-selection(CLIPBOARD)


Transparency can be used with any terminal emulator, just install x11-wm/devilspie, a window manipulation tool, and create ~/.devilspie/main.ds:
Code:
( if 
( is (window_class) "XTerm" )
( opacity 80 )
)

( if
( is (window_class) "URxvt" )
( opacity 80 )
)
Then start % devilspie & and add "devilspie &" to your startup file.
 

Minbari

Active Member

Thanks: 72
Messages: 167

#16
THIS seem to be the same issue.
I have this "bug" too but I "solved" the issue with the help of tabs. So instead of using two/three/etc., containers in the same workspace (i3) I'm using urxvt tabs. Same goes with vim where I'm using Fx keys to switch/move/close tabs.

image.gif
 

Minbari

Active Member

Thanks: 72
Messages: 167

#18
There is no need in terminal tabs, if you use sysutils/tmux, what is pretty useful.
I'm that kind of person who want to use as fewer dependency as possible. So why should I use an external program to do that task when I can simply use the built in utility? It make no sense to me! Sure if I use xterm then I've been forced to use tmux or gnu screen, but since this thread is about rxvt-unicode I wont do that (using tmux). :)
 

ILUXA

Well-Known Member

Thanks: 220
Messages: 397

#19
I'm that kind of person who want to use as fewer dependency as possible. So why should I use an external program to do that task when I can simply use the built in utility?
With tmux, you can make things, that you cannot do without it,
for example, you can run app in background, and it won't be closed,
when you close terminal window, or even if your ssh session will be closed,
it is really very usefull, when you're able to attach to sessions, that was started before.

It is a screenshot of xterm :) you can do the same with rxvt, or any other terminal emulator.
It is really almost no difference, what terminal emulator you're using, when you use tmux.
tmux is my favourite cli app, together with zsh.

To configure tmux, read this topic — https://forums.freebsd.org/threads/40045/,
you can find there my tmux configuration.
 

sidetone

Aspiring Daemon

Thanks: 220
Messages: 779

#20
With tmux, you can "make things", that you cannot do without it,
for example, you can run app in background, and it won't be closed,
when you close terminal window. it is really very usefull.
Start a command from that terminal with &bg (background) after it, before pressing enter, and that application won't close when the terminal closes. If the command wasn't started this way, you can use the bg to bring it back, if it was the last user process started. I forgot how to specify a process to choose which process to put into the background, After running jobs to show it, bg %# can also select the process. If you forgot to put a & after a command, you can press Crtl-z then type bg to run the process in the background.
 

ILUXA

Well-Known Member

Thanks: 220
Messages: 397

#21
Of course I know it....
I use jobs¸ bg¸ fg and disown every day, even in tmux.
But it won't help when yours ssh connection will be closed,
or if you close your terminal, when you're trying to build word... for example.

And I don't want to argue. Who use tmux understand why it is very useful,
who don't — don't understand, but it is only until you'll start using sysutils/tmux ;)
 

Minbari

Active Member

Thanks: 72
Messages: 167

#22
I don't want to dethrone the thread discussions and go to offtopic but I'm never closing my terminal emulator, he has his designated workspace and always something is running there (e.g. pyradio). zsh is my $hell too.;)
 

sidetone

Aspiring Daemon

Thanks: 220
Messages: 779

#23
I was mistaken, thinking that tmux was Linux tux. It has an ISC license. Its dependencies aren't bad either.
 

ILUXA

Well-Known Member

Thanks: 220
Messages: 397

#24
No. As far as I remember, tmux came from OpenBSD.

In OpenBSD, tmux is included in base system.
screen, tmux alternative, using GPL license,
and it is not very usable IMHO, especially for every day usage.

And yes, tmux is really lightweight, it is even possible to build static tmux,
so tmux won't use any packages, as a dependencies.
 

lebarondemerde

Aspiring Daemon

Thanks: 372
Messages: 984

#25
Hi!

I thought about using sysutils/tmux already, but I currently do not need its features and it would just increase the dependency list. I am using x11/bspwm and I almost never need to close a terminal.

I current think this is a upstream "won't fix" thing and I am availing to switch to another terminal, but I didn't any decision yet.

The two options I have in mind are: x11/sterm and x11/mlterm.

I have x11/sterm installed already but didn't test it yet.

The problems I see with it that are two: the configurations should be made in its source code, before it is compiled, what is fine but may be annoying if it is updated to often; the another one is the fact it uses x11-fonts/fontconfig and I prefer to use the bitmap fonts in the old fashion (they look far better for my eyes). It may eventually work with fonts in the way I like but I actually didn't looked for that yet.

Thanks!