trenchant.org

by adam mathes
archive · subscribe

Lost Time On Titlebars

Let’s pretend during a weekend of record heat I decided the best use of my time is to create a MacOS desktop of terminals and editors with less chrome and a more consistent color scheme.

Well, we don’t have to pretend.

Window Management

Amethyst is a tiling window manager. It’s great.

Alternatives –

  • kwm and its successor chunkwm but I’ve always found the setup and usage too complicated
  • use XQuartz and i3 or dwm or something, but I want to be able to use MacOS apps, not just X stuff

Minimal System Chrome

Hide the menu and dock by default.

System Preferences > Dock > Automatically hide and show the Dock

System Preferences > General > Automatically hide and show the menu bar

It’s pretty hard to get rid of MacOS system adornments like title bars, or change to square windows.

So I just changed the background to a solid image color to fake it.

Editor

I rely on Aquamacs as my primary editor. I love it.

To import and set the theme via .emacs –

; tomorrow night theme
(load "~/emacs/color-theme-tomorrow.el")
(color-theme-tomorrow-night-blue)

Natural Title Bars

I adapted the “natural title bars” from these patches –

Natural-Title-Bars

title-bar-patch

– into my fork of the Aquamacs source tree.

I didn’t integrate it into Aquamacs UI, because, uhh, I don’t know how to do that.

So instead, we drop to a terminal for –

defaults write org.gnu.Aquamacs TransparentTitleBar DARK

Great! Now we have an Emacs for MacOS that has a transparent title bar, and all we had to do was create a 200mb binary from source code and set NSUserDefaults from the command line.

Colored Tab Bar

But the tab bar doesn’t match the title bar and it’s like, why even bother if we’re not going to finish this.

Luckily it’s customizable, because everything in emacs is.

Added to .emacs to change the colors of the tabs to match my theme –

(require 'tabbar)
;; Tabbar settings
(set-face-attribute
 'tabbar-default nil
 :background "#002451"
 :foreground "#ffffff"
 :box '(:line-width 1 :color "#002451" :style nil))
(set-face-attribute
 'tabbar-unselected nil
 :background "#002451"
 :foreground "#ffffff"
 :box '(:line-width 5 :color "#002451" :style nil))
(set-face-attribute
 'tabbar-selected nil
 :background "#003f8e"
 :foreground "#ffffff"
 :box '(:line-width 5 :color "#002451" :style nil))
(set-face-attribute
 'tabbar-highlight nil
 :background "#002451"
 :foreground "#ffffff"
 :underline nil
 :box '(:line-width 5 :color "#002451" :style nil))
(set-face-attribute
 'tabbar-button nil
 :box '(:line-width 1 :color "#002451" :style nil))
(set-face-attribute
 'tabbar-separator nil
 :background "#ff9da4"
 :height 0.6)
(tabbar-mode 1)

A Brief Diversion into iTerm2

I normally use the stock Terminal.app but you can change color of iTerm2 title bars with proprietary escape codes!

Like this –

#!/bin/sh

echo -e "\033]6;1;bg;red;brightness;0\a"
echo -e "\033]6;1;bg;green;brightness;36\a"
echo -e "\033]6;1;bg;blue;brightness;81\a"
clear

The problem is iTerm2 is slow.

Turns out iTerm2 feels significantly laggier than good old Terminal.app.

This is actually not my imagination, you can benchmark it.

In fact, pretty much all of the “cool” terminals like Hyper.sh are insanely slow. I don’t know how any of you guys use Hyper. Or any of these weird electron/javascript/frankenstein native/web apps, really.

Back to Emacs

Anyway those results made me think I should try to embrace eshell in my emacs of choice.

Eshell

Emacs (and thus Aquamacs) offers a number of terminal and terminal-alikes. Including but probably not limited to shell, eshell, term, and ansi-term.

shell is the minimal one for little mini-buffers and things, you probably don’t want that.

term and ansi-term function as terminals, but seem just different enough to not work the way you want the minute you like ssh somewhere.

eshell is the weirdest and most interesting and I’ve been trying to grok it. Everyone knows that your shell and editor are separate, but what eshell pre-supposes is, maybe they aren’t?

Like everything in emacs, I will never truly embrace and understand it because of my distaste for Lisp.

So I spent like an hour figuring out how to customize the prompt and other bits to something saner –

;; eshell
(setq eshell-prompt-function
      (lambda nil
        (concat
         (eshell/whoami)
         "@"
         car (split-string (system-name) "\\.")
         ":"
         (abbreviate-file-name (eshell/pwd))
         "$ ")))
(setq eshell-prompt-regexp ".*$ ")
(setq eshell-highlight-prompt nil)

(defun m-eshell-mode-hook ()
  (setenv "TERM" "xterm-color")
  (setenv "PAGER" "cat")
  )

(add-hook 'eshell-mode-hook 'm-eshell-mode-hook)

term feels slowish, especially over ssh, which got me to finally figure out how to use tramp mode for remote editing. Which is nice.

eshell does feel responsive, mostly, except when you output a ton of text. Being able to edit commands, pipe to buffers, there’s something interesting to it, but it’s… weird.

Getting used to using Aquamacs frames/windows instead of Terminal.app windows is also kind of icky.

Who knows if I’ll stick with it – when it’s 105° out you make questionable decisions.

Conclusion

But it looks cool?

· · ·

If you enjoyed this post, please join my mailing list