Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Emacs tabbar-mode visual tweaks
;; This are setting for nice tabbar items
;; to have an idea of what it looks like http://imgur.com/b0SNN
;; inspired by Amit Patel screenshot http://www.emacswiki.org/pics/static/NyanModeWithCustomBackground.png
;; Tabbar
(require 'tabbar)
;; Tabbar settings
(set-face-attribute
'tabbar-default nil
:background "gray20"
:foreground "gray20"
:box '(:line-width 1 :color "gray20" :style nil))
(set-face-attribute
'tabbar-unselected nil
:background "gray30"
:foreground "white"
:box '(:line-width 5 :color "gray30" :style nil))
(set-face-attribute
'tabbar-selected nil
:background "gray75"
:foreground "black"
:box '(:line-width 5 :color "gray75" :style nil))
(set-face-attribute
'tabbar-highlight nil
:background "white"
:foreground "black"
:underline nil
:box '(:line-width 5 :color "white" :style nil))
(set-face-attribute
'tabbar-button nil
:box '(:line-width 1 :color "gray20" :style nil))
(set-face-attribute
'tabbar-separator nil
:background "gray20"
:height 0.6)
;; Change padding of the tabs
;; we also need to set separator to avoid overlapping tabs by highlighted tabs
(custom-set-variables
'(tabbar-separator (quote (0.5))))
;; adding spaces
(defun tabbar-buffer-tab-label (tab)
"Return a label for TAB.
That is, a string used to represent it on the tab bar."
(let ((label (if tabbar--buffer-show-groups
(format "[%s] " (tabbar-tab-tabset tab))
(format "%s " (tabbar-tab-value tab)))))
;; Unless the tab bar auto scrolls to keep the selected tab
;; visible, shorten the tab label to keep as many tabs as possible
;; in the visible area of the tab bar.
(if tabbar-auto-scroll-flag
label
(tabbar-shorten
label (max 1 (/ (window-width)
(length (tabbar-view
(tabbar-current-tabset)))))))))
(tabbar-mode 1)
@dnaumov

This comment has been minimized.

Copy link

@dnaumov dnaumov commented Mar 3, 2013

Thanks for the tabbar-buffer-tab-label!

@wh1tew0lf

This comment has been minimized.

Copy link

@wh1tew0lf wh1tew0lf commented Nov 17, 2013

It is really cool!

@ghost

This comment has been minimized.

Copy link

@ghost ghost commented Jan 9, 2014

How can I resize height of the tabbar? :(

@huyz

This comment has been minimized.

Copy link

@huyz huyz commented Aug 23, 2014

@darvein Resize height of the tabbar this way:

(set-face-attribute
 'tabbar-default nil
 :background "gray20"
 :foreground "gray20"
 :box '(:line-width 1 :color "gray20" :style nil)
 :height 1.3)
@banyudu

This comment has been minimized.

Copy link

@banyudu banyudu commented Jan 28, 2016

error: Invalid face, tabbar-default with emacsw64

@banyudu

This comment has been minimized.

Copy link

@banyudu banyudu commented Jan 28, 2016

move (tabbar-mode 1) to before set-face-attribute fixes the 'invalid face' error.

@xpopy

This comment has been minimized.

Copy link

@xpopy xpopy commented Apr 19, 2016

How would I enable this for the tabbar-ruler package?

@publicus

This comment has been minimized.

Copy link

@publicus publicus commented Jul 11, 2017

Thanks very much for this! Is there a license that you've assigned to this? I'd like to incorporate it into a GPLv3-licensed project I'm working on, and so would like to check with you about your expectations for this gist.

@yozhsh

This comment has been minimized.

Copy link

@yozhsh yozhsh commented Oct 9, 2018

Thank you very much!

@tavoaqp

This comment has been minimized.

Copy link

@tavoaqp tavoaqp commented Mar 3, 2019

thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.