Urxvt Terminal Revisited

Forum Forums General Tips and Tricks Urxvt Terminal Revisited

  • This topic has 7 replies, 5 voices, and was last updated May 18-5:51 am by oops.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #7476
    Member
    sleekmason

      Urxvt Revisited

      After years of using whatever terminal came with whichever distro, I decided to check out urxvt, (rxvt-unicode)
      which comes installed in antix full and base. (Screenshot below)

      My inspiration to see what urxvt could do came from the good people here at antiX, both in the old forum and new.

      rocking-urxvt-with-style/
      This excellent post by rokytnji provides several pre-set urxvt options to choose from, including colors, and I’m placing the link here for people who don’t really want to manually change parameters, but would like different themes and such. Check it out!

      My starter template came from discovering BitJam’s post in the antiX archive here: reasonable-urxvt-terminal-defaults-font-and-font-s-t4420.html Nicely ordered!


      Now, that being said, I wanted to dig a little deeper for myself. Learn a bit more, and create my own configuration. Might as well learn something while I’m here, right? This one now matches my other themes.

      Changing the colors for Urxvt is not difficult. You can too if you want. See below for more about changing colors individually.


      With the configuration below, Urxvt can:

      Change the default window size.
      Open links in firefox (or whatever) by mouse click.
      Make those same links bold by default.
      Change the font size on the fly.
      Be able to use mouse clickable tabs.
      control the psuedo transparency of the screen, to include fading, blur, shading, and tint color.
      Change the colors to suit individual needs.
      Change the scrolling behavior and whether or not to enable a scroll bar.
      Adjust the keybinds to make life easy for terminal users.
      Copy and paste is easy to do through the mouse. “Select” the text, and it is also copied. Use the middle mouse button to paste.
      Plenty more weird and obscure things for you to discover.


      A bunch of these options came with BitJams original template, with a bunch more I added on during my own search.
      Bundles of information online, URxvt is well documented, with all the configuration settings I used coming directly from the arch linux forums. Most of the existing examples could be found there as well. (links at bottom)

      Below is a working configuration from which to make changes.

      Working configuration to be copied into ~/.Xdefaults if you are so inclined. Piecemeal or whole!
      It will provide a template for most of the changes you might wish to make:

      !--- Window Settings
      Xcursor.size:10
      URxvt.buffered:             true
      URxvt.geometry:             90x30
      
      !--- Font Size and Controls
      URxvt*.font:  xft:DejaVu Sans Mono:autohint=true:pixelsize=12
      URxvt.perl-lib:                     ~/.urxvt/ext
      URxvt.keysym.C-Up:     font-size:increase
      URxvt.keysym.C-Down:   font-size:decrease
      URxvt.keysym.C-S-Up:   font-size:incglobal
      URxvt.keysym.C-S-Down: font-size:decglobal
      URxvt.keysym.C-equal:  font-size:reset
      URxvt.keysym.C-slash:  font-size:show
      !URxvt.perl-ext-common: font-size,tabbed,matcher
      URxvt.perl-ext-common: font-size,matcher
      
      !--- For Tabs
      URxvt.tabbed.reopen-on-close: yes
      URxvt.keysym.Control-Shift-Left: perl:tabbedex:move_tab_left
      URxvt.keysym.Control-Shift-Right: perl:tabbedex:move_tab_right
      URxvt.keysym.Control-Shift-R: perl:tabbedex:rename_tab
      
      !---Make url links clickable
      URxvt.url-launcher: /usr/bin/firefox-esr
      URxvt.matcher.button: 1
      URxvt.matcher.rend.0: Uline Bold fg5
      
      !--- Scrolling
      URxvt*.scrollTtyOutput:     false
      URxvt*.scrollWithBuffer:    false
      URxvt*.scrollTtyKeypress:   true
      URxvt.secondaryScroll:      true
      URxvt*scrollstyle:          plain
      URxvt*saveLines:            10000
      URxvt.scrollBar_right:      true
      URxvt.scrollBar:            false
      URxvt.mapAlert:             true
      
      !---Transparency and effect settings
      URxvt*inheritPixmap:        true
      URxvt*transparent:          true
      
      !---URxvt*shading: 0 to 99 darkens, 101 to 200 lightens
      URxvt*shading:              20
      URxvt.blurRadius:           5
      URxvt.fading:               0
      !####URxvt.tintColor:            #FF0000
      
      !--- Tabbing Menu colors
      
      URxvt.tabbed.tabbar-bg:     0
      URxvt.tabbed.tabbar-fg:     6
      URxvt.tabbed.tab-bg:        0
      URxvt.tabbed.tab-fg:        5
      
      !--- Colors
      
      URxvt.cursorColor:          #06D5FF
      URxvt.pointerColor:         #15ACCC
      URxvt.background:           #000000
      URxvt.foreground:           #85ECEA
      URxvt.underlineColor:       #DE9D00
      URxvt.throughColor:         #85ECEA
      URxvt.highlightColor:       #004755
      
      URxvt.color0:               #000000
      URxvt.color1:               #15ACCC
      URxvt.color2:               #15ACCC
      URxvt.color3:               #15ACCC
      URxvt.color4:               #06D5FF
      URxvt.color5:               #15ACCC
      URxvt.color6:               #15ACCC
      URxvt.color7:               #85ECEA
      URxvt.color8:               #15ACCC
      URxvt.color9:               #F5F500
      URxvt.color10:              #04BD04
      URxvt.color11:              #85ECEA
      URxvt.color12:              #85ECEA
      URxvt.color13:              #06D5FF
      URxvt.color14:              #85ECEA
      URxvt.color15:              #85ECEA


      URxvt Uses the settings found in ~/.xdefaults

      In order to see what settings are available, In a terminal:
      urxvt --help 2>&1| sed -n '/: /s/^ */! URxvt*/gp'

      Here is my example output:

      sleek@ai:~
      $ urxvt --help 2>&1| sed -n '/:  /s/^ */! URxvt*/gp'
      ! URxvt*termName:                       string
      ! URxvt*geometry:                       geometry
      ! URxvt*chdir:                          string
      ! URxvt*reverseVideo:                   boolean
      ! URxvt*loginShell:                     boolean
      ! URxvt*multiClickTime:                 number
      ! URxvt*jumpScroll:                     boolean
      ! URxvt*skipScroll:                     boolean
      ! URxvt*pastableTabs:                   boolean
      ! URxvt*scrollstyle:                    mode
      ! URxvt*scrollBar:                      boolean
      ! URxvt*scrollBar_right:                boolean
      ! URxvt*scrollBar_floating:             boolean
      ! URxvt*scrollBar_align:                mode
      ! URxvt*thickness:                      number
      ! URxvt*scrollTtyOutput:                boolean
      ! URxvt*scrollTtyKeypress:              boolean
      ! URxvt*scrollWithBuffer:               boolean
      ! URxvt*inheritPixmap:                  boolean
      ! URxvt*transparent:                    boolean
      ! URxvt*tintColor:                      color
      ! URxvt*shading:                        number
      ! URxvt*blurRadius:                     HxV
      ! URxvt*fading:                         number
      ! URxvt*fadeColor:                      color
      ! URxvt*utmpInhibit:                    boolean
      ! URxvt*urgentOnBell:                   boolean
      ! URxvt*visualBell:                     boolean
      ! URxvt*mapAlert:                       boolean
      ! URxvt*meta8:                          boolean
      ! URxvt*mouseWheelScrollPage:           boolean
      ! URxvt*tripleclickwords:               boolean
      ! URxvt*insecure:                       boolean
      ! URxvt*cursorUnderline:                boolean
      ! URxvt*cursorBlink:                    boolean
      ! URxvt*pointerBlank:                   boolean
      ! URxvt*background:                     color
      ! URxvt*foreground:                     color
      ! URxvt*color0:                         color
      ! URxvt*color1:                         color
      ! URxvt*color2:                         color
      ! URxvt*color3:                         color
      ! URxvt*color4:                         color
      ! URxvt*color5:                         color
      ! URxvt*color6:                         color
      ! URxvt*color7:                         color
      ! URxvt*color8:                         color
      ! URxvt*color9:                         color
      ! URxvt*color10:                        color
      ! URxvt*color11:                        color
      ! URxvt*color12:                        color
      ! URxvt*color13:                        color
      ! URxvt*color14:                        color
      ! URxvt*color15:                        color
      ! URxvt*colorBD:                        color
      ! URxvt*colorIT:                        color
      ! URxvt*colorUL:                        color
      ! URxvt*colorRV:                        color
      ! URxvt*underlineColor:                 color
      ! URxvt*scrollColor:                    color
      ! URxvt*troughColor:                    color
      ! URxvt*highlightColor:                 color
      ! URxvt*highlightTextColor:             color
      ! URxvt*cursorColor:                    color
      ! URxvt*cursorColor2:                   color
      ! URxvt*pointerColor:                   color
      ! URxvt*pointerColor2:                  color
      ! URxvt*borderColor:                    color
      ! URxvt*path:                           search path
      ! URxvt*backgroundPixmap:               file[;geom]
      ! URxvt*iconFile:                       file
      ! URxvt*font:                           fontname
      ! URxvt*boldFont:                       fontname
      ! URxvt*italicFont:                     fontname
      ! URxvt*boldItalicFont:                 fontname
      ! URxvt*intensityStyles:                boolean
      ! URxvt*inputMethod:                    name
      ! URxvt*preeditType:                    style
      ! URxvt*imLocale:                       string
      ! URxvt*imFont:                         fontname
      ! URxvt*title:                          string
      ! URxvt*iconName:                       string
      ! URxvt*saveLines:                      number
      ! URxvt*buffered:                       boolean
      ! URxvt*depth:                          number
      ! URxvt*visual:                         number
      ! URxvt*transient-for:                  windowid
      ! URxvt*override-redirect:              boolean
      ! URxvt*hold:                           boolean
      ! URxvt*externalBorder:                 number
      ! URxvt*internalBorder:                 number
      ! URxvt*borderLess:                     boolean
      ! URxvt*lineSpace:                      number
      ! URxvt*letterSpace:                    number
      ! URxvt*skipBuiltinGlyphs:              boolean
      ! URxvt*pointerBlankDelay:              number
      ! URxvt*backspacekey:                   string
      ! URxvt*deletekey:                      string
      ! URxvt*print-pipe:                     string
      ! URxvt*modifier:                       modifier
      ! URxvt*cutchars:                       string
      ! URxvt*answerbackString:               string
      ! URxvt*secondaryScreen:                boolean
      ! URxvt*secondaryScroll:                boolean
      ! URxvt*perl-lib:                       string
      ! URxvt*perl-eval:                      perl-eval
      ! URxvt*perl-ext-common:                string
      ! URxvt*perl-ext:                       string
      ! URxvt*iso14755:                       boolean
      ! URxvt*iso14755_52:                    boolean
      ! URxvt*xrm:                            string
      ! URxvt*keysym.sym:                     keysym
      ! URxvt*background.border:              boolean
      ! URxvt*background.expr:                string
      ! URxvt*background.interval:            seconds
      ! URxvt*bell-command:                   string
      ! URxvt*font-size.step:                 interger
      ! URxvt*kuake.hotkey:                   string
      ! URxvt*matcher.button:                 string
      ! URxvt*matcher.launcher:               string
      ! URxvt*matcher.launcher.*:             string
      ! URxvt*matcher.pattern.*:              string
      ! URxvt*matcher.rend.*:                 string
      ! URxvt*remote-clipboard.fetch:         string
      ! URxvt*remote-clipboard.store:         string
      ! URxvt*searchable-scrollback:          string
      ! URxvt*selection-autotransform.*:      string
      ! URxvt*selection-pastebin.cmd:         string
      ! URxvt*selection-pastebin.url:         string
      ! URxvt*selection.pattern-0:            string
      ! URxvt*tab-bg:                         colour
      ! URxvt*tab-fg:                         colour
      ! URxvt*tabbar-bg:                      colour
      ! URxvt*tabbar-fg:                      colour
      ! URxvt*url-launcher:                   string



      If you want to know what each item is/does:
      man -Pcat urxvt

      This will pretty much show everything you need to know. The output is way too large to post here, but may be useful in your configuration.


      As you can see, there are many many variables to play with.
      Change the size of the font manually by adjusting the number associated with Xcursor.size:10 in the configuration, or see below for use of perl extensions.


      You may wish to comment out the dimensions completely if you like the windows to be the same as when you last used them. An example would be calling a program
      from within the terminal you like to keep a certain size i.e. Newsboat. I want it to come onto the screen large and ready to rock. Setting the window size with the menu option is the way to go.

      Example menu entry for fluxbox:
      [exec] (Newsboat) {urxvt -g 102x44 -e newsboat}
      This opens Newsboat in a decent size window, while not affecting other instances of the terminal, or their dimensions.


      The colors are easy to change with tools you probably already have.

      IN order to edit the urxvt colors for your ~/.Xdefaults file using Geany, click on tools and open the color changer. Countless hours of fun/frustration can be had if your into that sort of thing.

      In order for changes to take place while editing, use:
      xrdb ~/.Xdefaults
      In a terminal to update the database, then type urxvt to open the changed version.
      Keeping an instance of urxvt or of another terminal to update the database helps timewise.

      If you have problems for some reason, you could comment out:

      ! urxvt colours 
      # include ".config/xresources.d/xcolours/antix.conf"


      This is located in ~/.Xresources


      If you would like to tint the window as well, you should disable shading, and vice versa.
      Just comment out:
      URxvt*shading: 90

      And un-comment:
      URxvt.tintColor: #FF0000

      The color FF0000 is a bright red. Left that to observe changes. Doesn’t come across bad though:)

      If you want to be able to change the font size on the fly, while inside the terminal, you will need perl extensions made for urxvt.
      These handy little guys set up the code to do the tabs, change the font size, and open urls from the terminal.

      Download the perl extension from here:
      https://github.com/majutsushi/urxvt-font-size

      The last commit was 2 Dec 2017 showing an active page. Six contributers, four releases, and a start on the project 4 years ago. Works for me.
      Could put a note here about not blindly downloading stuff from the internet. There, I did.


      unzip the file you downloaded into a New directory made specifically for the purpose of unzipping your downloaded file.
      You really don’t want random weird files just floating around in $home.


      Open the resultant folder and find the “font-size” file.
      This file should be placed in ~/.urxvt/ext

      Open a terminal and:
      mkdir -p ~/.urxvt/ext

      Place the “font-size” file inside ~/.urxvt/ext Done!
      The rest of what’s necessary to use the perl extension is already in the configuration file above.


      After this, you can control the font size with CTRL UP and CTRL DOWN
      For the other key bindings, choose your own or look in the config above.

      The support to use tabs has been commented out in the configuration because while perfectly usable, when changing the font size while tabs are enabled changes the layout of the screen.
      Possibly a crossed keybind of some sort? Bug?

      If you dont often resize your fonts and still want to use the tabs function, Comment:
      URxvt.perl-ext-common: font-size,matcher

      and un-comment:
      URxvt.perl-ext-common: font-size,tabbed,matcher

      This instructs urxvt to use the tab feature within the perl extension. When/if it goes wonky, just move the window a bit and it will readjust.

      I haven’t messed with Tabbing menu colors that came with my template, and some of the numbered colors don’t seem to do anything, code or no.
      I’m sure they will come out of the wood work when special situations arise. Numbers 5, 6, 8, 9, 10, 12, 13, 14, had direct changes that could be observed.

      Here’s a few ways to place urxvt in your personal menu using fluxbox:
      # simply opens a terminal window:
      [exec] (urxvt) {urxvt}
      # Opens another program:
      [exec] (Newsboat) {urxvt -g 102x44 -e newsboat}
      # Opens a terminal in root:
      [exec] (urxvt-root) {gksu urxvt}
      (Thank you skidoo) My line from 8 years ago was half a page wide;)

      These can also be combined with menu options. Check em out in a terminal first.
      #arch wiki example for mplayer
      urxvt -b 600 -geometry 20x1 -e sh -c 'mplayer -wid $WINDOWID file...'
      #arch wiki example to make it look like an application launcher
      $ urxvt -geometry 80x3 -name 'bashrun' -e sh -c "/bin/bash -i -t"


      *Note If the screen will not stay at the requested dimensions/font size upon reboot, use:
      xrdb ~/.Xdefaults &
      Put this in your startup file.


      That’s it! Hope all the info is useful to those that like to tinker.
      Here are a list of resources I used to get the above configuration. Good reading:


      Bitjams urxvt post:
      https://antixlinux.com/forum-archive/reasonable-urxvt-terminal-defaults-font-and-font-s-t4420.html
      #for URxvt options:
      http://pod.tst.eu/http://cvs.schmorp.de/rxvt-unicode/doc/rxvt.1.pod#OPTIONS
      #For reference
      http://pod.tst.eu/http://cvs.schmorp.de/rxvt-unicode/doc/rxvt.7.pod
      #frequently asked questions:
      http://pod.tst.eu/http://cvs.schmorp.de/rxvt-unicode/doc/rxvt.1.pod#FREQUENTLY_ASKED_QUESTIONS
      #This guy – good info here as well.
      https://www.askapache.com/linux/rxvt-xresources/

      #and this one I found after I was done (of course).
      Choose colors online, and display for preview:
      https://terminal.sexy/#AAAAhezqAAAAFazMFazMFazMBtX_FazMFazMhezqhezq9fUABNQEhezqhezqBtX_hezqhezqhttps://bbs.archlinux.org/img/smilies/tongue.png

      • This topic was modified 5 years, 2 months ago by sleekmason.
      • This topic was modified 5 years, 2 months ago by sleekmason.
      • This topic was modified 5 years, 2 months ago by sleekmason. Reason: Added Info. Now Complete
      Attachments:
      #21675
      Anonymous
        Helpful
        Up
        0
        ::

        bumping this valuable thread because terminal fonts + colors were recently discussed by noClue and Koo.
        https://www.antixforum.com/forums/topic/terminal-font-color/

        #21685
        Member
        ex_Koo
          Helpful
          Up
          0
          ::

          @ sleekmason & skidoo

          This excellence post is the reason I started using rxvt in the first place with antiX and still today. With fake transparency which is very light on resources compared to programs like Compton..
          Back then Debian used .Xdefaults and not .Xresources now testing Debian 10 running with .Xresources.

          At the moment testing st = (suckless) Simple Terminal the only downside to st is it needs Compton for transparency to work.
          st is not even compatible with transparency or .Xresources with out installing add on patches from suckless after you install a patch or editing config.h file you have to recompiled the program each time. A Build Your own terminal program super powerful an Fun to use..

          Thanks skidoo Great post

          #21688
          Member
          ex_Koo
            Helpful
            Up
            0
            ::

            A bit more on transparency rxvt. for .Xresources

            true transparency (instead of native) can be enabled with:
            URxvt.depth: 32
            URxvt.background: rgba:0000/0000/0000/bbbb
            This type uses a compositor and open windows behind the terminal will be seen, whereas the native kind steals the desktop image and windows behind the terminal can’t be seen.

            Lots of great tutorials here Use the drop down boxes along the top of the page..

            Also if you want to reload your .Xresources file after editing instead of rebooting or logging out run this command. xrdb ~/.Xresources

            • This reply was modified 3 years, 11 months ago by ex_Koo.
            #21699
            Member
            oops
              Helpful
              Up
              0
              ::

              Hello, … Excellence post, now the key way is to find a very easy way to do that.

              #21763
              Anonymous
                Helpful
                Up
                0
                ::

                Great post…
                I’ve used urxvt terminal alot but never really messed too much under the hood.
                I also use lily term now and then because I can set per user profile and
                keybindings on the right click menu in it. I.E. my users and root terminals
                look different so I can easily tell the difference

                #21766
                Anonymous
                  Helpful
                  Up
                  0
                  ::

                  now the key way is to find a very easy way to do that.

                  ? ? ?

                  sudo apt install xcompmgr (or compton instead of xcompmgr)
                  and
                  echo -e “URxvt.depth: 32\nURxvt.background: rgba:0000/0000/0000/bbbb” >> ~/.xdefaults

                  #21783
                  Member
                  oops
                    Helpful
                    Up
                    0
                    ::

                    now the key way is to find a very easy way to do that.

                    ? ? ?

                    sudo apt install xcompmgr (or compton instead of xcompmgr)
                    and
                    echo -e “URxvt.depth: 32\nURxvt.background: rgba:0000/0000/0000/bbbb” >> ~/.xdefaults

                    Yes, like this it’s pretty simple, but the man file is long … I have to learn 😉
                    man -Pcat urxvt

                  Viewing 8 posts - 1 through 8 (of 8 total)
                  • You must be logged in to reply to this topic.