Back to blogging

Every year during the summer I take a break from my leisure activity of blogging and playing around in Arch Linux.  This is due to my busy work schedule.  I’m a little late in coming back to this blog due to my newborn baby girl!  With that said, I’ll be writing more personalization tips for my macbook air 6,2 2013 in the coming week.  Hope these guides and tips have helped some of you.

Manjaro is Manjaro. Archlinux is Archlinux.

Every so often there is a poor soul who believes he/she is running Archlinux showing up on the Arch Forums or #archlinux on Freenode.  They have a hard time coming to realization that the Manjaro they are using is not Archlinux.  Personally, I do not care what distro is used as everyone has their own preference but we should all know what we are using.  When I took a look at the Manjaro Forums, it is apparent why people think Manjaro is Arch.

1. People write threads talking about Manjaro with words like “My archlinux install” on the Manjaro forums.

2. Manjaro is advertised as an Archlinux based spinoff.

3. Misinformed youtube’rs who refer to Manjaro as Arch on training wheels and other silly descriptions.

Here is a quote from the Arch Forums rules:

Arch-based distributions often use different packages, package versions, repositories, and make custom system configurations surreptitiously, constituting support for such projects quite impossible on the Arch forums. Community technical support shall only be provided for the Arch Linux distribution and the Arch User Repository. Threads concerning issues with, and requesting support for, derivate distributions, or operating systems other than Arch Linux are strictly prohibited and will be closed.

Wait! Isn’t Manjaro based off Arch?  Therefore I’m using Arch right?

No.  Manjaro does not follow the KISS (keep it simple stupid) philosophy that drives Arch’s core.  Also, the repos and packages do differ as well as system configurations.  Manjaro seems to have hand picked pieces of Arch and created their own frankenstein version that although from far away seems to resemble Arch, a closer inspection will show that they are very, very different distros.

Here is a quote from the Manjaro FAQ:

Is Manjaro just an easy-to-install version of Arch?

No. Manjaro is unlike other Arch-based distributions such as Archbang or Bridge Linux. While there are numerous subtle differences between Manjaro and Arch, the most obvious examples, including the use of our own dedicated software repositories, are covered in the About Manjaro page.

Can Manjaro use the Arch Software Repositories?

No. Manjaro is configured to use its own dedicated software repositories, although you can still access the community-maintained Arch User Repository (AUR) for additional software, if you wish. In addition, if you want to access the very latest bleeding-edge software, Manjaro’s own testing and unstable repositories are also available.

 

DWM (Archlinux) – Patchset description

DWM is designed to be under 2000 SLOC (standard lines of code).  Due to this feature, DWM’s flexibility is entrusted to its user, you.  This means, you are free to use it as is, or to patch in whatever features you wish.  The only requirement is that the patch is already written by a community member, or that you write it yourself.  Lately, I’m looking to try different patches together and see what feels “right” for me.  Since there isn’t a single library for these patches, some digging around is required.

Resources:
Suckless Patch Site
Archlinux Forum’s DWM Patch Thread
Google-fu with search terms similar to “dwm patch” 

Current DWM Patchset:

  • statuscolors
    • Adds colours to elements in the statusbar.  This will enable colouring of tag names, and text/icons that you pipe to the statusbar
  • statusallmons
    • This patch draws and updates the statusbar on all monitors.
  • centredfloating
    • Adds ‘iscentered’ to the DWM Rules.  Values are either True or False.  If True and window is floating, it will center them on vertical and horizontal axis of your screen.  I like this as I can force MPV to open on the center of my screen instead of floating in a corner.  For Gimp, you can set this to False.
  • savefloats
    • This patch saves size and position of every floating window before it is forced into tiled mode. If the window is made floating again, the old dimensions will be restored.
    • I’ve always hated the fact when I tile a window and set it to float again and it stays in the same position as if it was tiled.  This can now save it!
  • notitle
    • Pretty self explanatory.  No window titles displayed in statusbar at top. Very useful if you have a small screen like I do on my 13″ macbook air.
  • pertag2  
    • Each tag has its own layout, floating, tile, etc!  Some tags are in floating layout like my Media tag and some are tiled as bstack.  Great stuff.
  • systray
    • Adds a systray feature at the right end of your statusbar.  I have a dropbox, clipboard, and steam showing in the systray.  I may add a connman gui applet if it works soon for roaming networks.  Otherwise netctl-auto really does a good job for me.
  • occupiedcol
    • When a tag is occupied, as in a window exists in it, this patch can enable different tag colours.  For example, my unoccupied tags are white.  When they get occupied they turn grey.  The tag I am viewing regardless of being occupied or not is white with a blue underline.
  • uselessgaps
    • You can customize how big the gaps will be or set it to have zero gaps between windows/screenedge.
  • keysymfix
    • XKeycodeToKeysym deprecated patch to fix Keysym.
  • bstack (bottom stack)
    • Main on top and multiple stacks at bottom layout
  • runorraise
    • I bind my browser to Modkey + shiftmask + w and if I press the binding it will open my browser or if it is already open it will bring me to the browser!!! Simply amazing
  • Push 
    • Push windows inside a tag up and down
  • Cycle 
    • Cycle through tags.  I have it set to Modkey + {left,right arrow}

DWM (Archlinux) – March Screenshot

DWM has been my WM of choice due to its simplicity, written in C, and a good knowledgable group of enthusiast at the Arch Forums.  Through my learning of DWM, an attempt at screenshotting each month will be made to journal my progress.

Below is my clean desktop.  I went with a blue grey color scheme which would be easy on the eyes and easy to find the information at a glance.

ss4

Below is my workspace.  I have part of my config.h displaying, rtorrent, weechat, and ranger.

ss5

Hrm, on another thought, I’ll have to add in my script and config even if you can find it on github.com/frank604 so that I can ‘freeze’ the settings here on my blog.

———————————————————————————

Edit:  NEW SCREENSHOTS!!  March 10 2014 update!!

screenshot screenbusy

So the strangest thing happened.  Last night I couldn’t sleep so I found a different patchset that was close to what I wanted and then patched in cycle and push.  Now this change makes my DWM complete.  However, I did have to rewrite my config.h and I also took some time out to touch up my statusbar.

The new patchset is in my github.  This is based off of Kieran Quinn’s dwm.  I modified JasonWRyan’s copy of Push and Cycle patches from his bitbucket to work with Kieran’s patchset

Read about Patches and Description on next post

config.h

#define NUMCOLORS       13
#define MODKEY          Mod4Mask
#define TAGKEYS(KEY,TAG) \
    { MODKEY,                       KEY,      view,           {.ui = 1 << TAG} }, \
    { MODKEY|ControlMask,           KEY,      toggleview,     {.ui = 1 << TAG} }, \
    { MODKEY|ShiftMask,             KEY,      tag,            {.ui = 1 << TAG} }, \
    { MODKEY|ControlMask|ShiftMask, KEY,      toggletag,      {.ui = 1 << TAG} },

static const unsigned int tagspacing = 1;       /* space between tags */
static const unsigned int tagpadding = 5;      /* inner padding of tags */
static const unsigned int taglinepx = 2;        /* height of tag underline */
static const unsigned int systrayspacing = 1;   /* systray spacing */
static const Bool showsystray = True;           /* false means no systray */
static const unsigned int gappx = 8;            /* gaps between windows */
static const unsigned int borderpx = 1;         /* border pixel of windows */
static const unsigned int snap = 32;            /* snap pixel */
static const Bool showbar = True;               /* false means no bar */
static const Bool topbar = True;                /* false means bottom bar */
static const float mfact = 0.50;                /* factor of master area size [0.05..0.95] */
static const int nmaster = 1;                   /* number of clients in master area */
static const Bool resizehints = False;          /* true means respect size hints in tiled resizals */
static const char font[] = "-*-tamsynmod-medium-r-*-*-18-*-*-*-*-*-*-*";

static const char colors[NUMCOLORS][ColLast][13] = {
    /* border    fg         bg */
    { "#2D2D2D", "#FFFFFF", "#2D2D2D" },        /* 01 - regular */
    { "#4d79ff", "#FFFFFF", "#2D2D2D" },        /* 02 - selected */
    { "#2D2D2D", "#FF0000", "#2D2D2D" },        /* 03 - urgent */
    { "#2D2D2D", "#666666", "#2D2D2D" },        /* 04 - occupied */
    { "#2D2D2D", "#A82222", "#2D2D2D" },        /* 05 - red */
    { "#2D2D2D", "#4779b3", "#2D2D2D" },        /* 06 - blue */
    { "#2D2D2D", "#349147", "#2D2D2D" },        /* 07 - green */
    { "#2D2D2D", "#666666", "#2D2D2D" },        /* 08 - dark grey */
    { "#2D2D2D", "#DCDCDC", "#2D2D2D" },        /* 09 - light grey */
    { "#2D2D2D", "#4779b3", "#2D2D2D" },        /* 0A - orange */
    { "#2D2D2D", "#B86A6A", "#2D2D2D" },        /* 0B - pink */
    { "#2D2D2D", "#FFFFFF", "#2D2D2D" },        /* 0C - white */
    { "#2D2D2D", "#000000", "#2D2D2D" },        /* 0D - black */
};

static const Layout layouts[] = {
    /* symbol   gaps    arrange */
    { "þ",      True,   tile },
    { "ü",      True,   bstack },
    { "ÿ",      False,  monocle },
    { "ý",      False,  NULL },
};

static const Tag tags[] = {
    /* name     layout          mfact   nmaster */
    { "web",    &layouts[0],    -1,     -1 },
    { "term",   &layouts[0],    -1,     -1 },
    { "media",  &layouts[3],    -1,     -1 },
    { "steam",  &layouts[0],    -1,     -1 },
    { "mail",   &layouts[0],    -1,     -1 },
    { "misc",   &layouts[0],    -1,     -1 },
};

static const Rule rules[] = {
    /* class        instance    title       tags mask     isfloating      iscentred       monitor */
   { "Chromium",    NULL,       NULL,       1 << 0,       False, True,       -1 },
   { "Filezilla",   NULL,       NULL,       1 << 0,       True,  True,       -1 },
   { "Spacefm",     NULL,       NULL,       0,            True,  True,       -1 },
   { "Truecrypt",   NULL,       NULL,       0,            True,  True,       -1 },
   { "Dwb",         NULL,       NULL,       1 << 0,       False, False,      -1 },
   { "Steam",       NULL,       NULL,       1 << 3,       False, True,       -1 },
   { "Gimp",        NULL,       NULL,       0,            True,  True,       -1 },
   {  NULL,         "mutt",     NULL,       1 << 4,       False, False,       -1 },
   {  NULL,         "tmux",     NULL,       1 << 1,       False, False,       -1 },
   {  NULL,         "YouTube",  NULL,       1 << 2,       True, True,       -1 },
   { "mpv",         NULL,       NULL,       0,            True,  True,       -1 },
};

/* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }

static const char *menu[] = { "dmenu_run", "-i", "-fn", font, "-nb", colors[0][ColBG], "-nf", colors[0][ColFG], "-sb", colors[1][ColBG], "-sf", colors[9][ColFG], NULL };
static const char *webb[] = { "dwb", NULL, "Dwb" };
static const char *file[] = { "pcmanfm", NULL, "Pcmanfm" };
static const char *term[] = { "termite", NULL,  };
static const char   *mailcmd[] = { "termite", "--name=mutt", "-e", "mutt", NULL };
static const char   *tmuxcmd[] = { "termite", "--name=tmux", "-e", "tmux", NULL };
static const char   *yt[] = { "termite", "--name=YouTube", "-e", "youtube-viewer", NULL };
static const char *fz[] = { "filezilla", NULL,  };

static Key keys[] = {
    { MODKEY,           XK_p,       spawn,          {.v = menu } },
    { MODKEY|ShiftMask, XK_w,       runorraise,          {.v = webb } },
    { MODKEY|ShiftMask, XK_Return,  spawn,     {.v = term } },
    { MODKEY|ShiftMask, XK_f,       runorraise,     {.v = file } },
    { MODKEY|ShiftMask, XK_t,       runorraise,     {.v = tmuxcmd } },
    { MODKEY|ShiftMask, XK_m,       runorraise,     {.v = mailcmd } },
    { MODKEY|ShiftMask, XK_y,       runorraise,     {.v = yt } },
    { MODKEY|ShiftMask, XK_z,       runorraise,     {.v = fz } },
    { MODKEY|ShiftMask, XK_q,       quit,           {0} },
    { MODKEY|ShiftMask, XK_b,       togglebar,      {0} },
    { MODKEY|ShiftMask, XK_c,       killclient,     {0} },
    { MODKEY,           XK_Return,  zoom,           {0} },
    { MODKEY,           XK_Tab,     view,           {0} },
    { MODKEY|ControlMask,           XK_f, togglefloating, {0} },
    { MODKEY,           XK_space,   setlayout,      {0} },
    { MODKEY,           XK_t,       setlayout,      {.v = &layouts[0] } },
    { MODKEY,           XK_b,       setlayout,      {.v = &layouts[1] } },
    { MODKEY,           XK_m,       setlayout,      {.v = &layouts[2] } },
    { MODKEY,           XK_f,       setlayout,      {.v = &layouts[3] } },
    { MODKEY,           XK_j,       focusstack,     {.i = +1 } },
    { MODKEY,           XK_k,       focusstack,     {.i = -1 } },
    { MODKEY,           XK_h,       setmfact,       {.f = -0.05 } },
    { MODKEY,           XK_l,       setmfact,       {.f = +0.05 } },
    { MODKEY,           XK_equal,   incnmaster,     {.i = +1 } },
    { MODKEY,           XK_minus,   incnmaster,     {.i = -1 } },
    { MODKEY,           XK_Down,    focusstack,     {.i = +1 } },
    { MODKEY,           XK_Up,      focusstack,     {.i = -1 } },
    { MODKEY,           XK_0,       view,           {.ui = ~0 } },
    { MODKEY|ShiftMask, XK_0,       tag,            {.ui = ~0 } },
    { MODKEY,           XK_comma,   focusmon,       {.i = -1 } },
    { MODKEY,           XK_period,  focusmon,       {.i = +1 } },
    { MODKEY|ShiftMask, XK_comma,   tagmon,         {.i = -1 } },
    { MODKEY|ShiftMask, XK_period,  tagmon,         {.i = +1 } },
    { MODKEY,                       XK_Left,   cycle,          {.i = -1 } },
    { MODKEY,                       XK_Right,  cycle,          {.i = +1 } },
    { MODKEY|ControlMask,           XK_Left,   tagcycle,       {.i = -1 } },
    { MODKEY|ControlMask,           XK_Right,  tagcycle,       {.i = +1 } },
    { MODKEY|ControlMask,           XK_j,      pushdown,       {0} },                                                                                      
    { MODKEY|ControlMask,           XK_k,      pushup,         {0} },
    { MODKEY|ControlMask,           XK_q,      quit,           {0} },
    TAGKEYS(            XK_1,       0)
    TAGKEYS(            XK_2,       1)
    TAGKEYS(            XK_3,       2)
    TAGKEYS(            XK_4,       3)
    TAGKEYS(            XK_5,       4)
    TAGKEYS(            XK_6,       5)
};

static Button buttons[] = {
    { ClkLtSymbol,      0,          Button1,        setlayout,      {0} },
    { ClkClientWin,     MODKEY,     Button1,        movemouse,      {0} },
    { ClkClientWin,     MODKEY,     Button2,        togglefloating, {0} },
    { ClkClientWin,     MODKEY,     Button3,        resizemouse,    {0} },
    { ClkTagBar,        0,          Button1,        view,           {0} },
    { ClkTagBar,        0,          Button3,        toggleview,     {0} },
    { ClkTagBar,        MODKEY,     Button1,        tag,            {0} },
    { ClkTagBar,        MODKEY,     Button3,        toggletag,      {0} },
};

 

 

dwm-statusbar

# ~/bin/dwm-statusbar
# Adapted from w0ng status bar: https://github.com/w0ng/bin
# Adapted from jasonwryan status bar: https://bitbucket.org/jasonwryan/shiv/src/1ad5950c3108a4e5a9dcb78888a1ccfeb9252b45/Scripts/dwm-status?at=default
# Some original work/modifications by frank: https://github.com/frank604

# Colour codes from dwm/config.h
color0="\x01" # normal  
color6="\x06" # brightblue

#---separator                              
sp="$(echo -ne "${color0} ")" 
sp1="$(echo -ne "${color0} | ")" 
sp2="$(echo -ne "${color0}| ")"
sp3="$(echo -ne "${color0}|")"

#print_song_info() {
#  track="$(mpc current)"
#  artist="${track%%- *}"
#  title="${track##*- }"
#  [[ -n "$artist" ]] && echo -e "${color0}ê${sp}${color5}${artist}${color9}${title} ${color0}|"
#}

print_power() {
  status="$(cat /sys/class/power_supply/ADP1/online)"
  battery="$(cat /sys/class/power_supply/BAT0/capacity)"
  if [ "${status}" == 1 ]; then
    echo -ne "${color6}Â${color0}ON ${battery}%"
  else
    echo -ne "${color6}ð${color0}${battery}%"
  fi
}

print_wifiqual() {
  wifiessid="$(/sbin/iwconfig 2>/dev/null | grep ESSID | cut -d: -f2)"
  wifiawk="$(echo $wifiessid | awk -F',' '{gsub(/"/, "", $1); print $1}')"
  wificut="$(echo $wifiawk | cut -d' ' -f1)"
  echo -ne "${color6}¤${color0}${wificut}"
}

print_hddfree() {
  hddfree="$(df -Ph /dev/sda4 | awk '$3 ~ /[0-9]+/ {print $4}')"
  echo -ne "${color6}¨${color0}${hddfree}"
}

print_email_count() {
   mail1="$(find $HOME/Mail/FWS/INBOX/new/ -type f | wc -l)"
   mail2="$(find $HOME/Mail/GMAIL/INBOX/new/ -type f | wc -l)"
   emailcount="$(($mail1 + $mail2))"
    if [[ "${emailcount}" -eq 0 ]]; then
        echo -en "${color6}Ð${color0}0"
    else
        echo -en "${color6}Ð${color0}${emailcount}"
    fi
}
print_pacup(){
   pup="$(pacman -Qqu --dbpath /tmp/checkup-db/frank604/ | wc -l)"
   if [[ "${pup}" -eq 0 ]]; then
        echo -en "${color0}0"
   else
        echo -en "${color0}${pup}"
   fi
}

print_aurups(){
    ups="$(awk '$0 !~ /tamsyn/' /tmp/aurupdates* | wc -l)"
    if [[ "${ups}" -eq 0 ]]; then
        echo -en "${color0}0"
    else 
        echo -en "${color0}${ups}"
    fi
}

print_aurphans(){
    aur="$(awk '$0 !~ /^No /' /tmp/aurphans* | wc -l)"
    if [[ "${aur}" -gt 0 ]]; then
        echo -en "∆"
    else 
        echo -en ""
    fi
}
 print_volume(){
    mix=`amixer get Master | tail -1`
    vol="$(amixer get Master | tail -n1 | sed -r 's/.*\[(.*)%\].*/\1/')"
    if [[ $mix == *\[off\]* ]]; then
      #red 2                                                
      echo -e "${color6}í${color2} OFF"
    elif [[ $mix == *\[on\]* ]]; then
      #green 9
      echo -e "${color6}í${color0}${vol}% "
    else
      #yellow6
      echo -e "${color6}í${color2} ---"
    fi
 }

print_datetime() {
  datetime="$(date "+%a %d %b %I:%M")"
  echo -ne "${color6}É${sp}${color0}${datetime}"
}

# cpu (from: https://bbs.archlinux.org/viewtopic.php?pid=661641#p661641)

while true; do
  # get new cpu idle and total usage
  eval $(awk '/^cpu /{print "cpu_idle_now=" $5 "; cpu_total_now=" $2+$3+$4+$5 }' /proc/stat)
  cpu_interval=$((cpu_total_now-${cpu_total_old:-0}))
  # calculate cpu usage (%)
  let cpu_used="100 * ($cpu_interval - ($cpu_idle_now-${cpu_idle_old:-0})) / $cpu_interval"

  # output vars
print_cpu_used() {
  printf "%-1b" "${color0}Ñ${sp}${color11}${cpu_used}%"
#"%-10b" "${color7}CPU:${cpu_used}%"
}

  # Pipe to status bar, not indented due to printing extra spaces/tabs
  xsetroot -name "$(print_power)${sp1}$(print_wifiqual)$(print_hddfree)${sp1}$(print_email_count)$(print_pacup)$(print_aurups)$(print_aurphans)${sp2}$(print_volume)${sp2}$(print_datetime)"

  # reset old rates
  cpu_idle_old=$cpu_idle_now
  cpu_total_old=$cpu_total_now
  # loop stats every 1 second
  sleep 1 
 done

Patching DWM (Dynamic Window Manager) with statuscolors

After you have DWM installed and running, the first step in customizing DWM is to patch it.  Today we are going to look at adding in a patch that will enable colours in the statusbar.

Getting the patch:

  1. Go to the suckless website to view the available patches.
  2. Under patches/  you will see statuscolor
  3. At the bottom there is a link for dwm-5.9-statuscolors.diff

Patching format:

<code>cd dwm-directory
git apply path/to/patch.diff</code>

Patching:

cd ~/dwm/src/dwm6.0 
patch -p1 &lt; ~/dwmpatch/dwm-5.9-statuscolors.diff

Output:

patching file config.def.h
Hunk #1 FAILED at 1.
Hunk #2 succeeded at 46 (offset 1 line).
1 out of 2 hunks FAILED -- saving rejects to file config.def.h.rej
patching file dwm.c
Hunk #1 succeeded at 49 (offset 1 line).
Hunk #2 succeeded at 100 (offset 2 line).
Hunk #3 succeeded at 178 (offset 3 line).
Hunk #4 succeeded at 731 (offset -6 line).
Hunk #5 succeeded at 747 (offset -6 line).
Hunk #6 succeeded at 774 (offset -6 line).
Hunk #7 succeeded at 815 (offset -6 line).
Hunk #8 succeeded at 834 (offset -6 line).
Hunk #9 succeeded at 884 (offset -6 line).
Hunk #10 succeeded at 1173 with fuzz 2 (offset 7 line).
Hunk #11 succeeded at 1641 (offset 62 line).
Hunk #12 succeeded at 1804 (offset 60 line).

Resolved failed hunks:

Hunk #1 failed while patching config.def.h and patch saved the rejects to file config.def.h.rej

config.def.h.rej content:

--- config.def.h 2011-07-10 16:24:25.000000000 -0400
+++ config.def.h 2011-08-18 02:02:47.033830823 -0400
@@ -1,13 +1,16 @@
/* See LICENSE file for copyright and license details. */

/* appearance */
+#define NUMCOLORS 4 // need at least 3
+static const char colors[NUMCOLORS][ColLast][8] = {
+ // border foreground background
+ { "#cccccc", "#000000", "#cccccc" }, // 0 = normal
+ { "#0066ff", "#ffffff", "#0066ff" }, // 1 = selected
+ { "#0066ff", "#0066ff", "#ffffff" }, // 2 = urgent/warning
+ { "#ff0000", "#ffffff", "#ff0000" }, // 3 = error
+ // add more here
+};
static const char font[] = "-*-terminus-medium-r-*-*-16-*-*-*-*-*-*-*";
-static const char normbordercolor[] = "#cccccc";
-static const char normbgcolor[] = "#cccccc";
-static const char normfgcolor[] = "#000000";
-static const char selbordercolor[] = "#0066ff";
-static const char selbgcolor[] = "#0066ff";
-static const char selfgcolor[] = "#ffffff";
static const unsigned int borderpx = 1; /* border pixel of windows */
static const unsigned int snap = 32; /* snap pixel */
static const Bool showbar = True; /* False means no bar */

The lines that start with a minus (-) indicate which lines to remove.  The entire Hunk #1 failed because one or more lines weren’t found.  This is most likely happening because the dwm version we have is 6.0 and this patch was diff’d against a 5.9 version (just my guess).  That means we need to edit the default config.def.h to match the (-) lines.

Snippet of default config.def.h:

static const char normbordercolor[] = "#444444";
static const char normbgcolor[] = "#222222";
static const char normfgcolor[] = "#bbbbbb";
static const char selbordercolor[] = "#005577";
static const char selbgcolor[] = "#005577";
static const char selfgcolor[] = "#eeeeee";

All we need to do is edit the values in the dwm-5.9-statuscolors.diff to match the default config.def.h so replace #cccccc with #444444 and so on and so forth.  Then save the patch as dwm-6.0-statuscolors.diff and then whenever you reinstall DWM and need to patch statuscolors, you can do so without all this hassle.

Keep in mind that some patches can’t patch over a pre-patched source, so there is a general order of patches you must follow.  That will be covered at a later time.

Resources:

https://wiki.archlinux.org/index.php/Dwm

DWM Hackers Unite! Share (or request) dwm patches.

 

Putty or Kitty – Changing Color Scheme

My work environment is on windows and often I need to ssh into my server with putty (edit: I now use Kitty).  The coloring is determined through the putty color settings and I quickly found that I couldn’t look at my terminal without wincing in pain when weird color combinations plague my sight.

A quick google search found a russian site that had really nice color schemes.  You can browse through and find the one that resonates with you.  Personally, I am enjoying the chalkboard theme.  For fear of having this site go down, I’ve copied the theme settings below.

 

chalkboard putty color theme
http://putty.org.ru/themes/index.html
putty chalkboard code
http://putty.org.ru/themes/index.html

 

I’ve now switched to the Kasugano colour theme.  I’ve converted the hex colours to RGB below:

URxvt.background: #1b1b1b 27-27-27
URxvt.foreground: #FFFFFF 255-255-255
URxvt.colorBD: #CFCFCF 207-207-207
URxvt.colorUL: #969696 150-150-150
URxvt.colorIT: #686868 104-104-104
!Black
*color0: #3D3D3D 61-61-61
*color8: #4D4D4D 77-77-77
!Red
*color1: #6673BF 102-115-191
*color9: #899AFF 137-154-255
!Green
*color2: #3EA290 62-162-144
*color10: #52AD91 82-173-145
!Yellow
*color3: #B0EAD9 176-234-217
*color11: #98C9BB 152-201-187
!Blue
*color4: #31658C 49-101-140
*color12: #477AB3 71-122-179
!Magenta
*color5: #596196 89-97-150
*color13: #7882BF 120-130-191
!Cyan
*color6: #8292B2 130-146-178
*color14: #95A7CC 149-167-204
!White
*color7: #C8CACC 200-202-204
*color15: #EDEFF2 237-239-242

Macbook Air 6,2 (2013) Setting it up with Archlinux

Changelog

March 9 2014

  • Added ICC profiles back from the macos

February 11 2014

  • Added 20-intel.conf to /etc/X11/xorg.conf.d

January 22 2014

  • Added /etc/modprobe.d/hid_apple.conf to fix the tilde and set right keyboard
  • Removed tilde xmodmap

January 19 2014

  • Suspend/Resume fixed by patjak.  Please report bugs issues to his git hub and give him thanks!  This is experimental so please do not install unless you are willing to take a risk.
  • Updated .xbindkeysrc – bind F3 and F4

January 18 2014

  • Originally, this post’s content was in my previous post here.  However, the length grew as more items were added to the list.  Below you will find my most current setup/tips.

Credit:

Written below is a grouping of information spread out across the forums, wiki, and personal experience in implementing them.  I provided a step by step instruction for the lazy.  However, please be aware of what each implementation does prior by reading the wiki or google-fu.

Wifi

I have used both broadcom-wl and broadcom-wl-no-dkms.  They both worked for me.  However, I am currently on broadcom-wl as broadcom-wl-no-dkms has no maintainer.  For initial wifi, I tethered my android device (note 2) via usb and internet worked out of box for me.  Then I manually installed the broadcom-wl.  Please note, the version of the .pkg.tar.xz may differ as new versions are pushed.

wget broadcom-wl.tar.gz https://aur.archlinux.org/packages/br/broadcom-wl/broadcom-wl.tar.gz
tar -xvf broadcom-wl.tar.gz
cd broadcom-wl
makepkg -s
pacman -U broadcom-wl-6.30.223.141-4-x86_64.pkg.tar.xz

Audio

Legogris from the Arch Forums posted his /etc/.asoundrc and on a base system with only alsa (no pulse), I was able to get sound working perfectly out of box with this config:

defaults.pcm.card 1
defaults.pcm.device 0
defaults.ctl.card 1

Edit: I realized that many steam games needed pulse, so I removed the .asoundrc I wrote above

Trackpad

The trackpad works out of box with the regular synaptics package.  I modified the default /etc/X11/xorg.conf.d/50-synaptics.conf to have natural scrolling and some palm detection.  3+ finger motions do not work out of box but I read that with some tweaking you can get the same gestures like mac osx.

Section "InputClass"
Identifier "touchpad catchall"
Driver "synaptics"
...
Option "VertScrollDelta" "-111"
Option "HorizScrollDelta" "-111"
Option "PalmDetect" "1"
Option "PalmMinWidth" "20"
Option "PalmMinZ" "200"
EndSection

Kernel Parameters

Note: The below steps are valid if your installation process is same as mine.

I edited the /etc/default/grub line 4 to show the following

GRUB_CMDLINE_LINUX_DEFAULT="quiet <del>acpio_osi=Linux acpi_backlight=vendor</del> libata.force=1:noncq i195.i195_enable_rc6=1 resume=/dev/sda3

You can take out the ‘quiet’ parameter for debugging.  The only must haves from above for my setup are the libata.force=1:noncq and resume=/dev/sda3.

I regenerate grub.cfg by running a script but you can just run it yourself

sudo grub-mkconfig -o /boot/efi/EFI/grub/grub.cfg
sudo cp /boot/efi/EFI/grub/grub.cfg /boot/grub/grub.cfg

 

Suspend/Resume Bug

<strong>Note: The suspend bug has been fixed unofficially by <a href="https://github.com/patjak/mba6x_bl">Patjak</a>.  This is experimental and risks are involved.</strong>

Currently as of 1-13-2014, the bug still exists where if you suspend and resume, the screen backlight will either be at 0% brightness or 100% brightness depending on value.

Hibernate Enabling

To enable hibernate:

Edit /etc/mkinitcpio.conf to add ‘resume’ hook

HOOKS="base udev autodetect modconf block resume filesystems keyboard fsck"

Regenerate initramfs with:

mkinitcpio -p linux

Enable hibernate on laptop lid close:

Note: I no longer need this as the suspend bug is fixed.

Edit /etc/systemd/logind.conf

<del>HandleLidSwitch=hibernate</del>

Multimedia Keys

In some DEs like gnome/kde/cinnamon, I think the multimedia keys mostly work out of box.  However, if you are only running a WM like DWM you will have to bind them yourself. Make sure to add “xbindkeys” to your .xinitrc or whichever binding program you like.

In your home folder you should create your .xbindkeysrc which should look like this or whatever you want to map it to:

# Decrease monitor backlight by 5%.  Change to value you wish
"xbacklight -dec 5"
m:0x0 + c:232

# Increase monitor backlight by 5%
"xbacklight -inc 5"
m:0x0 + c:233

# requires kbdlight from aur
# keyboard backlight increase
"kbdlight up"
m:0x0 + c:238

# keyboard backlight decrease
"kbdlight down"
m:0x0 + c:237

# Increase volume by 5%
# change to any value you wish
"amixer -c 1 set Master 5%+"
m:0x0 + c:123

# Decrease volume by 5%
"amixer -c 1 set Master 5%-"
m:0x0 + c:122

# Toggle mute/unmute audio
"amixer -c 1 set Master toggle"
m:0x0 + c:121

# Play/pause for ncmpcpp
"ncmpcpp toggle"
m:0x0 + c:172

# play next for ncmpcpp
"ncmpcpp next"
m:0x0 + c:171

# play prev for ncmpcpp
"ncmpcpp prev"
m:0x0 + c:173

# turn on screen blanking 
# powersave
"xset s on +dpms"
m:0x0 + c:212

# turn off screen blanking
# good for watching video
"xset s off -dpms"
m:0x0 + c:128

You can download kbdlight from the AUR and special thanks to hobarrera for making this!  To find out the “m:0x0 + c:122″ you can run “xbindkeys -k” and press the key.  Or visit the Arch Wiki on this.

~ (missing Tilde key)

Add /etc/modprobe.d/hid_apple.conf

options hid_apple iso_layout=0

 

Right now if you press ` or shift+` (~) the output will be < or >.  I just added a simple xmodmap line into my .xinitrc:

<del>xmodmap -e 'keycode 94 = acsiitilde' &amp;</del>

There are other ways around this but I don’t need the ` and being able to output ~ without using shift was a two-birds-with-one-stone type of thing for me.

 

Intel Driver issues

On 2/11/2014 I noticed an issue with my intel drivers.  Specifically, if I fullscreen and minimize a youtube video, my screen would go black and unrecoverable.  A hard reboot would be required.  I cannot get into TTY2.

In my Xorg.0.log I would see things like:

(EE) intel(0): sna_mode_redisplay: page flipping failed, disabling CRTC:3 (pipe=0)

So I read the intel driver archwiki, about acceleration modes.  The default is “SNA – (Sandybridge’s New Acceleration) is the faster successor for hardware supporting it.”  What I needed to set is “UXA – (Unified Acceleration Architecture) is the mature backend that was introduced to support the GEM driver model.”

You can read more on the differences at the wiki.

To do the switch I needed to add an Options line in my /etc/X11/xorg.conf.d/20-intel.conf

Section “Device”

Identifier “Intel Graphics”

Driver “intel”

Option “AccelMethod” “uxa”

Option “TearFree” “true”

EndSection

 

Please note that I also have an Option for tearfree.  I added that in as some music videos were tearing on youtube.  It resolved it but if you don’t need it, you should exclude that in your 20-intel.conf

 

ICC Profiles for Monitor

Lately I’ve been staring at my screen and realized the white is REALLY white.  Then I remember’d I made a backup of ICC profiles on Mac OSx before I installed arch.  So, I installed xcalib from AUR and downloaded my backup ICC profiles.  In case you didn’t make a backup, you can find them here.

Un tar the file and read the README I wrote in there.  It will provide examples of how to use xcalib and ICC as well as autostart your settings.

Archlinux – Exploring Into Tiling Window Managers

Mainstream linux news is filled with updates to desktop environments(DE) like Gnome, KDE, Cinnamon, Unity, XFCE, LXDE, etc.  As a newcomer to the linux world, these DEs are the only choices I had to try.  Each one has its advantages and disadvantages such as ram overhead of simply running the DE to the choice of preferred apps they utilize GTK vs QT.  But that is not the point of discussion for this post!

This all changed when I began to lurk more in the Contributions & Discussion area of the Archlinux Forums.  This is an area where Arch users share their desktop configurations, what apps they use for browsing, editing, file management, etc.  In addition to all that, this is where they freely share a screenshot of their desktop and how they configured it.  Obviously, many of the screenshots posted looked amazing and then I started noticing a trend emerging.  There is a great number of Arch users who are running with only a windows manager.

Screenshot by Earsplit on Archlinux Forum

The above screenshot is from Earsplit running BSPWM.  There are many screenshots from different tiling WMs such as i3, awesome, xmonad, dwm, etc etc the list literally goes on and on.  At that time I was deciding which one to install and learn from so I digged around asking various members of the forum why they use the tiling WM that they use.

The bottom line is that all of them are great and people move around between different tiling window managers.  Well, that didn’t really help in choosing a tiling WM.  The best solution possible was to download them all and fire it up, which highlights Archlinux’s flexibility in changing the userland to whatever you want.

The first of these that I tried and mostly stuck with is DWM. Here is a quote from the suckless website:

  • dwm is only a single binary, and its source code is intended to never exceed 2000 SLOC.
  • dwm is customized through editing its source code, which makes it extremely fast and secure – it does not process any input data which isn’t known at compile time, except window titles and status text read from the root window’s name. You don’t have to learn Lua/sh/ruby or some weird configuration file format (like X resource files), beside C, to customize it for your needs: you only have to learn C (at least in order to edit the header file).

These two bullet points really struck my interest.  As a linux hobbyist and enthusiast, this provided a playground to potentially create/modify some patches in C language.  The additional benefit of being fast and secure was the cream topping.  I have been using DWM casually for half a year and as my main WM for a few months now.

I also watched JasonWRyan’s introduction video to DWM, where he did an excellent job in showcasing DWM’s basic functionality as well as some great patches that add extra functions.

 

Progress update

January 16 2014

Hello Readers,

I recently launched my blog a few days ago with the installation of Archlinux on my Macbook Air 6,2 (mid 2013). Since the launch I’ve had a number of visitors to my page and I surely do not wish to give off the impression that this is a one post blog.  The truth is, I’ve been spending the last couple of days securing this site as well as editing permissions so that my WordPress plugins, updates, and uploads are functional.

The next few posts will be on setting up a CLI userland on Archlinux with DWM + apps (rtorrent, mutt, tmux, vim, etc).  And most importantly, how to make them look pretty.  As a breather I may make a post about how to function in Putty for those who wish to ssh into their box while they are using a windows client (work/school/etc).  This blog is going to be orientated to an intermediate level of crowd but that doesn’t mean beginners will not benefit.  I will dumb down most of the content because truth be told, I am a dummy myself.

To those that do not know me, here is a photo of my wife and I when we were in Thailand last month.

Frank Shin and Wife in Thailand
Frank and Wife in Thailand

Sincerely,

Frank

Installing Archlinux on Macbook Air 2013

Macbook Air 6,2 Archlinux
Macbook Air 6,2 Archlinux (config from Jason W Ryan @ https://bitbucket.org/jasonwryan)

This Christmas I decided to gift myself a new portable computer as my previous Asus 1005ha was on its deathbed.  When the new 13″ mid 2013 Macbook Air arrived, I booted it up for the first time.  Upgraded any firmware needed and backed up the Mac files as stated in the Arch Wiki.  Also to be noted is to turn down the volume all the way and exit Mac OS X to avoid the chime at boot up.

At first I followed the wiki by installing rEFInd in Mac OS X into the ESP and shrinking the mac partition to make room for a dual boot Arch.  Being new to EFI and rEFInd, I had difficulty passing kernel parameters.  Also, I didn’t make a swap partition.  After running this setup for a week, I decided to completely ditch Mac OS X and redo the installation as a pure Arch only installation.

Ryan Gehrig’s Steps

I stumbled across a wonderful blog by Ryan Gehrig that described this process.  Thank you Ryan.  This is my first EFI device and to be honest, I was head over heels even after reading wiki after wiki.  For the sake of my own reference, I’ve copied his process here in this post.  Please note that all installation steps belong to Ryan Gehrig.

I found it very difficult to get Arch booting via EFI as all directions I found were inconsistent. You can also try REFind, as I was able to at least get that to boot up instead of my old broken grub prompt, but I got nowhere with Refind, so I went with reinstalling grub in this article. This is what my system currently uses. No MBR, grub is booted via EFI. For partitioning, you can use a 200MB HFS+ partition to store your EFI data, or you can use FAT32 (vfat). I went the VFAT route and it worked for me, so this guide assumes you have a VFAT partition for EFI, with the scheme like this:

[root@mac ~]# fdisk -l

Disk /dev/sda: 113 GiB, 121332826112 bytes, 236978176 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: xxxx

Device Start End Size Type
/dev/sda1 2048 411647 200M Microsoft basic data
/dev/sda2 411648 935935 256M Linux filesystem
/dev/sda3 935936 9324543 4G Linux swap
/dev/sda4 9324544 236978142 108.6G Linux filesystem

I used the following to setup the filesystems:

mkfs.vfat -F 32 /dev/sda1
mkfs.ext2 /dev/sda2
mkswap /dev/sda3
swapon /dev/sda3
mkfs.ext4 /dev/sda4

mount /dev/sda4 /mnt
mkdir /mnt/boot

mount /dev/sda2 /mnt/boot
mkdir /mnt/boot/efi

mount /dev/sda1 /mnt/boot/efi

Finish your installation according to the main guide (skipping anything after the bootloader), now chroot into your installation, and setup Grub:

arch-chroot /mnt

pacman -S grub efibootmgr

# The directory paths are everything here.
mount -t efivarfs efivarfs /sys/firmware/efi/efivars
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub --recheck --debug
grub-mkconfig -o /boot/efi/EFI/grub/grub.cfg
cp /boot/efi/EFI/grub/grub.cfg /boot/grub/grub.cfg

# Not necessary but hey, helped me out
cp /boot/efi/EFI/grub/grubx64.efi /boot/efi/EFI/boot/bootx64.efi

Note that above, –efi-directory means that grub will append a directory named “EFI” (caps, yes) to whatever you specify. As for –bootloader-id, this gets a directory created in the –efi-directory you specified, so in this example, it’d create the directory /boot/efi/EFI/grub.

If you need to wipe out your MBR for some reason, see this page: https://bbs.archlinux.org/viewtopic.php?id=119702

Post Installation (Avoid bugs, get wifi, key functions, etc to work)

Please read the next post located here on how to do your post installation setup.

 

Congratulations!

You just installed Arch Linux on a Macbook Air 6,2 (mid 2013).  As I mentioned above, there is one bug that really affects us and that is the inability to suspend/resume without the brightness bug.  However, if you are running on 100% brightness all the time, this should not affect you.  Although I wrote this mostly for myself in the case that I have to re-install, I hope that it helps the community as well.  Please feel free to share and give credit where due to Ryan Gehrig. Without his blog post I would have had a damn difficult time getting the EFI part setup.

 

Reference:

https://wiki.archlinux.org/index.php/MacBook

https://bbs.archlinux.org/viewtopic.php?id=165899&p=1

http://ryangehrig.com/index.php/arch-linux-on-macbook-air-2013/