customizing plan 9's acme - Other *nix-like OSes & POSIX related

Users browsing this thread: 3 Guest(s)
jmbi
Long time nixers
<center><h2 style="margin-top: -10px; margin-bottom: -10px;">customizing acme</h2></center>
<p>I've been putting off writing this thread, but I've finally mustered up enough motivation to do it for you guys. I know most of you have probably never used the **acme** editor, but hopefully after reading this you might change your mind. I'll start off with a little history to wet your panties. Acme was written by Rob Pike (aka our leader) in the 90's for the Plan 9 operating system. It has full UTF-8 support, runs on Linux, FreeBSD, OpenBSD, and NetBSD through <a href="http://swtch.com/plan9port/">plan9port</a>, is completely written in C, and has the unix philosophy written all over it. If that's not enough to get you going, I'm not sure what will. Here's one of acme's most notable users: </p>
<center><img src="http://acme.cat-v.org/_imgs/dmr_acme2.jpg"><p style="font-size: 11px;">Dennis Ritchie posing for a porn shot.</p></img></center>
<br />
Some people would advocate for the preservation of acme's defaults (*cough* #cat-v *cough*). I am not one of those people. If you're not either, here are the steps I go through to ricing acme (this works on plan 9 natively too).

<p style="font-size: 16px;"><b>Step 1</b>: download <a href="http://swtch.com/plan9port/">plan9port</a> or use your distro's ports / package manager (I know FreeBSD has both)</p>
<p style="font-size: 16px;"><b>Step 2</b>: compile and install (/usr/local/plan9/ is best), follow all instructions to set up your path </p>
<p style="font-size: 16px;"><b>Step 3</b>: go ahead and run "acme" in your terminal, you will see something like this: </p>
<center><img src="http://i.imgur.com/z8zpmVE.png"></img></center>
<p style="font-size: 16px;"><b>Step 4</b>: navigate to <b>/usr/local/plan9/src/cmd/acme/</b> (or where set your path + /src/cmd/acme)</p>
<p style="font-size: 16px;"><b>Step 5</b>: open up <b>acme.c</b> and navigate to line <b>964</b>, it should look like:</p>
Code:
/* Blue */
tagcols[BACK] = allocimagemix(display, DPalebluegreen, DWhite);
tagcols[HIGH] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DPalegreygreen);
tagcols[BORD] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DPurpleblue);
tagcols[TEXT] = display->black;
tagcols[HTEXT] = display->black;

/* Yellow */
textcols[BACK] = allocimagemix(display, DPaleyellow, DWhite);
textcols[HIGH] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DDarkyellow);
textcols[BORD] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DYellowgreen);
textcols[TEXT] = display->black;
textcols[HTEXT] = display->black;
<p style="font-size: 16px;"><b>Step 6</b>: change these 10 lines to look like:</p>
Code:
/* Blue */
tagcols[BACK] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, 0x<font color="red">151210</font>FF);
tagcols[HIGH] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, 0x<font color="red">8a776a</font>FF);
tagcols[BORD] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, 0x<font color="red">12100f</font>FF);
tagcols[TEXT] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, 0x<font color="red">8a776a</font>FF);
tagcols[HTEXT] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, 0x<font color="red">222222</font>FF);

/* Yellow */
textcols[BACK] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, 0x<font color="red">181512</font>FF);
textcols[HIGH] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, 0x<font color="red">8a776a</font>FF);
textcols[BORD] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, 0x<font color="red">12100f</font>FF);
textcols[TEXT] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, 0x<font color="red">bea492</font>FF);
textcols[HTEXT] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, 0x<font color="red">222222</font>FF);
<p style="font-size: 16px;"><b>Note</b>: the red strings above are the hex codes of the color that will be displayed, the same #ffffff codes that you use in your .Xdefaults<br />My advice is that you play around with the colors to see what corresponds to what in the GUI, it's fun and you'll be able to better customize it in the future.</p>
<p style="font-size: 16px;"><b>Step 7</b>: change the color values accordingly</p>
<p style="font-size: 16px;"><b>Step 8</b>: now that you've changed the basic colors, it's time to change the remaining buttons, look at lines <b>1000</b> and <b>1005</b>, they should look like: </p>
Code:
tmp = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DMedblue);
and
Code:
colbutton = allocimage(display, r, screen->chan, 0, DPurpleblue);
<p style="font-size: 16px;"><b>Step 9</b>: change them just like before, filling in your desired hex colors</p>
Code:
tmp = allocimage(display, Rect(0,0,1,1), RGBA32, 1, 0x<font color="red">949762</font>FF);
and
Code:
colbutton = allocimage(display, r, RGBA32, 1, 0x<font color="red">9f7155</font>FF);
<p style="font-size: 16px;"><b>Step 10</b>: make sure you're in <b>/usr/local/plan9/src/cmd/acme/</b> and run "mk install" to compile & overwrite the binaries</p>
<p style="font-size: 16px;"><b>Step 11</b>: run "acme" and see your new colors</p>
<center>
<img src="http://i.imgur.com/W4sgdHK.png"></img>
</center>
<p>So now that you've got your colors you're probably wondering how to change the ugly font that is enabled by default. You can do this with the <b>-f</b> command line argument, more information is <a href="http://swtch.com/plan9port/man/man4/fontsrv.html">here</a>. I won't go into much detail about that here, but I do have yrmt's gohufontmod11 converted for use in the 'fonts' folder of <a href="https://bitbucket.org/jmbi/scrots/src">my mercurial repo</a>. The command I use is: "acme -f fonts/gohu.font" for example.</p>
<p>Before you know it acme starts looking like a polished piece of software! Here is my end result:</p>
<center><img src="http://i.imgur.com/mQ5wCAG.png"></img></center>
<p>Thanks for reading, I hope I can convince at least some of you to give acme a try. Ask any questions you have, I'll be happy to answer.</p>
venam
Administrators
Awesome tutorial. I think it's the first real tutorial on the internet about ricing ACME.
yrmt
Grey Hair Nixers
Indeed, great article.
jmbi
Long time nixers
(11-06-2014, 01:06 PM)venam Wrote: Awesome tutorial. I think it's the first real tutorial on the internet about ricing ACME.
(11-06-2014, 01:12 PM)yrmt Wrote: Indeed, great article.
thanks muh nigs
pranomostro
Long time nixers
Very nice.
I always wanted to read the sam source code and write something like acmefs for sam.
Adding the scrollwheel to it and mouse1+mouse2=cut and mouse1+mouse3=paste would be nice to do, too.

So much to do, so little time.