Giter Club home page Giter Club logo

tabbedalt's Introduction

Tabbedalt

This is modified, alternative tabbed extension for well known urxvt-unicode terminal emulator

Features

  • Possibility to add named tabs, through the X resources, which run specified command or another shell (zsh/fish/ash/csh/ksh…). Without any configuration only default shell is available under default (Shift+Down) shortcut.

    Named tabs
  • Fast navigation to first ten tabs (if available) with shortcut Ctrl+[num], where num can be 0 to 9. CTRL+0 will switch to tenth tab.

  • Numbers in tabs can be switched off in by setting resource:URxvt.tabbedalt.tab-numbers: false

  • Integrated activity indicator with additional features like colors and different characters instead of simply asterisk depending on time.

    Indicator activity
  • Integrated tab renaming from stepb. Default under Shift+UP, then type some text and press RETURN for accept or ESC for cancel.

  • Added ability to configure own shortcuts using standard keysym urxvt option. See below for examples.

  • Autohide tab when there is only one tab at the moment.

  • Ability to assign hotkey to jump to last tab.

  • Configurable confirm dialog for closing urxvt window, when there is more than one tab opened or there is an process still running.

Installation

Copy tabbedalt into ~/.urxvt/ext directory.

Add these to your ~/.Xdefaults:

! Perl extension config
URxvt.perl-ext: tabbedalt

And that's it. On some systems, there might be a need to reload X resources:

$ xrdb ~/.Xdefaults

For quickinstall and run urxvt, tabbedalt can be installed using following command:

$ curl --create-dirs https://raw.githubusercontent.com/gryf/tabbedalt/master/tabbedalt -o ~/.urxvt/ext/tabbedalt
$ urxvt -pe tabbedalt

or even without "installing" at all:

$ curl https://raw.githubusercontent.com/gryf/tabbedalt/master/tabbedalt -o /tmp/tabbedalt
$ URXVT_PERL_LIB=/tmp urxvt -pe tabbedalt

Configure

There are several additional things you can set contrary to the original tabbed extension.

New button

You can disable [NEW] button, just to save the space. Just add following line to yours ~/.Xdefaults file:

URxvt.tabbedalt.new-button: false

Colors

You can change all of the colors regarding tabs appearance. Here are defaults:

URxvt.tabbedalt.tabbar-fg: 15
URxvt.tabbedalt.tabbar-bg: 8
URxvt.tabbedalt.tab-fg: 8
URxvt.tabbedalt.tab-bg: 0
URxvt.tabbedalt.active-fg: 1
URxvt.tabbedalt.actives-fg: 5
URxvt.tabbedalt.actived-fg: 4

Tab activity

Tabs can change colors depending on the activity of terminal under certain tab. Colors can be defined as described in section above. You can change the time for either group of activity:

URxvt.tabbedalt.tabbar-timeouts: 16:.:8:::4:+

The value can should be read as colon separated fields. In this case it would be read as:

  • 16 with symbol .
  • 8 with symbol :
  • 4 with symbol +

Numeric values means amount of seconds, on which three group of activity will be triggered. Those group are:

  • Inactive for at least 16 seconds
  • Inactive for at least 8 seconds
  • Inactive for at least 4 seconds

Activity of the tab is always represented by asterisk sign (*).

You can change those values but bear in mind, that first group should have timeout in seconds set higher, than middle one. You can also change symbols for those groups.

Tab activity can be disabled by setting:

URxvt.tabbedalt.disable-activity: true

Flickering

If you happen to see fonts flickering on the terminal, you might want to set this resource to true:

URxvt.tabbedalt.stop-flickering: true

It is false by default, and it will affect how refreshing of the tabs and windows is done. I was experienced it mostly on Intel graphics, with bitmap fonts, but your mileage may vary.

Tab numbers

You can turn off tab numbers and leave only name of the tab. Handy to save the space:

URxvt.tabbedalt.tab-numbers: false

Autohide

By default tab bar would be visible even with only one tab. To hide tab bar, when there is a single tab, the following resource need to be set to true:

URxvt.tabbedalt.autohide: true

Actions

There are several actions, which tabbedalt supports:

  • new_tab - for tab creation
  • rename_tab - for tab title renaming
  • prev_tab - for jumping to previous tab
  • next_tab - for jumping to next tab
  • move_tab_left - for moving tab to the left
  • move_tab_right - for moving tab to the right
  • jump_to_tab - for quickly jump into specific tab

See next sections for examples. This feature was adapted from tabbedex.

Disable default keystrokes

By setting:

URxvt.tabbedalt.disable-default-keys: true

you can completely remove default keystrokes for creating and navigating tabs. In fact, if this resource is set to false (default), than tabbedalt will create several keysyms mapped to the actions:

  • Shift-Down: new_tab - create tab
  • Shift-Up: rename_tab - for tab title renaming
  • Shift-Left: prev_tab - for jumping to previous tab
  • Shift-Right: next_tab - for jumping to next tab
  • Shift-Left: move_tab_left - for moving tab to the left
  • Control-Right: move_tab_right - for moving tab to the right
  • Control-1..0: jump_to_tab - for quickly jumping into first tenth tabs

It might be wise to define own shortcuts before disabling default keys.

  1. new_tab

    This action can have up to two arguments separated by colon, in a form:

    URxvt.keysym.desired-keys: tabbedalt:new_tab:tab-title:tab-command
    

    In this case for desired-keys shortcut there would be new tab created with title set to tab-title, and command which tab run as tab-command, for example:

    URxvt.keysym.Control-t: tabbedalt:new_tab:htop:htop
    

    where pressing control+t it will run new tab with title htop and command htop.

    Both title and command may be omitted. If so, default title shell will be used in absence of title, and default shell will be run on missing command.

  2. jump_to_tab

    In this action, there is only one argument expected - number of the tab, i.e.:

    URxvt.keysym.Control-1: tabbedalt:jump_to_tab:1
    URxvt.keysym.Control-2: tabbedalt:jump_to_tab:2
    …
    URxvt.keysym.Control-0: tabbedalt:jump_to_tab:0
    

    Note, that tabs are indexed from 1, and tab 10th is numbered as 0.

  3. The rest

    Al the rest of the actions (moving, jumping and renaming) are without argument. For example renaming will look like this:

    URxvt.keysym.Control-r: tabbedalt:rename_tab
    

Jump to last tab

There is a possibility to tell tabbedalt to use jump_to_tab action to jump to the last (rightmost) tab, instead of 10th. It can be done by setting resource:

URxvt.tabbedalt.zero-jump-last: true

so whatever keysym is assigned to tabbedalt:jump_to_tab:0 will select last tab, regardless if current number of tabs is more or less than 10. There is still a way for selecting 10th tab, i.e.:

URxvt.tabbedalt.zero-jump-last: true

URxvt.keysym.Control-F1: tabbedalt:jump_to_tab:1
URxvt.keysym.Control-F2: tabbedalt:jump_to_tab:2
…
URxvt.keysym.Control-F10: tabbedalt:jump_to_tab:10
URxvt.keysym.Control-F11: tabbedalt:jump_to_tab:11
URxvt.keysym.Control-F12: tabbedalt:jump_to_tab:12
URxvt.keysym.Control-0: tabbedalt:jump_to_tab:0

In the example above, there are mapping for jump to tabs 1 - 12 using function keys, and Control+0 to jump whatever last tab is.

Confirm closing window

When working with tabs, sometimes user accidentally could close the window, and loose all the applications run on the tabs. There might be multiple tabs open, or just one with running process on it (i.e. some editor), where closing window by accident could result in data loss. To prevent this, there are two additional resources that can be set. First one, disabled by default is:

URxvt.tabbedalt.confirm-quit: false

When set to true it will either execute a message program or will display an urxvt overlay with the dialog directly on current tab. Note that overlay dialog will expect the user to either press:

  • y or enter key to close the window
  • n or escape key to deny closing it

Second one is to provide X dialog program:

URxvt.tabbedalt.confirm-program:

It might be whatever X program, which can accept text as an argument, and can provide dialog which:

  • have two buttons (i.e. yes/no, ok/cancel) where first will exit dialog with 0 exit code and the latter will exit with whatever other number,
  • destroying the dialog also emit exit code higher than 0.

So, for example standard xmessage can be used:

URxvt.tabbedalt.confirm-program: xmessage -buttons ok:0,cancel:1

or zenity:

URxvt.tabbedalt.confirm-program: zenity --question --title 'Close window' --text

or kdialog:

URxvt.tabbedalt.confirm-program: kdialog --title 'Close window' --yesno

or… any other dialog programs which fulfill the above criteria.

Creating specific commands/shells

Let's assume, that one want to add three kind of custom shells:

  • simple one (default shell in the system),
  • midnight commander,
  • root (namely - su command)

A way to do this is to associate keystroke for it in .Xdefaults using urxvts keysym option, and the actions described above:

URxvt.keysym.Control-Shift-N: tabbedalt:new_tab:shell
URxvt.keysym.Control-Shift-R: tabbedalt:new_tab:root:su -
URxvt.keysym.Control-Shift-M: tabbedalt:new_tab:mc:mc

Resource values are colon separated values, which are in order:

  • plugin name:command, which in this case of creating new tab will be tabbedalt:new_tab.
  • title of the tab, it could be anything but the colon.
  • optional command. If omitted, default shell will be launched.

Renaming tabs

On runtime, tabs can be renamed using (by default) Shift+Up - now you can type name for the tab. Return accept change, ESC cancels it. This feature was taken from stepb tabbedx repository.

tabbedalt's People

Contributors

gryf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

tabbedalt's Issues

Button [new] doesn't respond to mouse click.

I received a bug report by email from one of the users, who have in settings:

URxvt.tabbed.new-button:	true

button [NEW] shows up, but fail to respond on mouse click with error message:

urxvt: Undefined subroutine &main::-1 called at /home/gryf/.urxvt/ext/tabbed line 364.

Geometry setting not honored when using tabs

Hi, the geometry setting in my .Xresources, neither the terminal size, nor the positioning, is taken into effect when using this extension. Apparently, this issue persists when using tabbed too.

Disable activity

I find that activity can be annoying to keep my concentration, is there a config to disable it ?

Session should be run only once per urxvt instance

Startup tabs (or session) was intended to be launched once - for the first urxvt window for particular user. If there is urxvt process already exists (whether or not contains session on it), every subsequent new urxvt processes must not run startup tabs.

commandline installation via curl | sh ?

Hey there,

I found another tabbed extension where a copy/paste line is shown
in the main README. Could this also be done here for tabbedalt?

May simplify installation for people to quickly test it.

TUI in tabs

Running a command with a TUI like htop or s-tui one can not switch to other buffers anymore as it will show the same result on all tabs (e.g. the output of the program with a TUI).
Thus, the whole functionality of tabs is not given anymore as long as the TUI program is running.

rxvt-unicode (urxvt) v9.22 - released: 2016-01-23
options: perl,xft,styles,combining,blink,iso14755,unicode3,encodings=eu+vn+jp+jp-ext+kr+zh+zh-ext,fade,transparent,tint,XIM,frills,selectionscrolling,wheel,slipwheel,cursorBlink,pointerBlank,scrollbars=plain+rxvt+NeXT+xterm

CTRL+SHIFT

How can i change CTRL+SHIFT to another keys? CTRL+SHIFT is rus/en switch in my OS.

Cannot create more than 5-7 tabs

As @maximhesed reported on PR #2, there is an issue, where user cannot create more than 5-7 tabs.
Here is a provided .Xdefaults file:

URxvt.termName: rxvt-unicode
URxvt.scrollBar: false

URxvt.background: #000000
URxvt.foreground: #FFFFFF

URxvt.font: xft:DejaVu Sans Mono:pixelsize=13
URxvt.boldFont: xft:DejaVu Sans Mono:pixelsize=13
URxvt.letterSpace: -1

URxvt.saveLines: 1000000

URxvt.perl-ext-common: default,matcher,vtwheel
URxvt.perl-ext: tabbed
URxvt.perl-lib: /home/ksyrx/.urxvt/

URxvt.UrlLauncher: /usr/bin/chromium
URxvt.matcher.button: C1

URxvt.keysym.Control-0x2b: perl:font-size:increase
URxvt.keysym.Control-0x2d: perl:font-size:decrease

URxvt.keysym.Home:          \033[1~
URxvt.keysym.End:           \033[4~
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.color0: #000000
URxvt.color1: #B21818
URxvt.color2: #18B218
URxvt.color3: #B26818
URxvt.color4: #1818B2
URxvt.color5: #B218B2
URxvt.color6: #18B2B2
URxvt.color7: #B2B2B2
URxvt.color8: #686868
URxvt.color9: #FF5454
URxvt.color10: #54FF54
URxvt.color11: #FFFF54
URxvt.color12: #5454FF
URxvt.color13: #FF54FF
URxvt.color14: #54FFFF
URxvt.color15: #FFFFFF

! Tabbed extension configuration
URxvt.tabbed.tabbar-fg: 8
URxvt.tabbed.tabbar-bg: 0
URxvt.tabbed.tab-fg: 15
URxvt.tabbed.tab-bg: 8
URxvt.tabbed.new-button: false

! Transparency
URxvt.transparent: true
URxvt.shading: 50

! Disable bell
URxvt.insecure: false

URxvt.iso14755: false

I can reproduce that - I can create only 7 tabs on my machine on urxvt being fullscreen and 17 on non maximized window (80x24 chars).

Tab bar position

Hello,

Is there possibility to change tab bar position: top or bottom?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.