monochromatic

monochromatic blog: http://blog.z3bra.org
git clone git://z3bra.org/monochromatic
Log | Files | Refs

commit 6ab1a2e7730462a5d5f5e72d9a43168ea04abd7d
parent 33857befeb807a0d546209be18f1217daa1a0282
Author: z3bra <willy@mailoo.org>
Date:   Fri, 30 May 2014 11:17:25 +0200

New article about me, myself and I

Diffstat:
2014/05/grok-that-workflow.txt | 360+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
config.mk | 5+++--
css/monochrome.css | 17+++++++++++++----
index.txt | 6++++++
4 files changed, 382 insertions(+), 6 deletions(-)

diff --git a/2014/05/grok-that-workflow.txt b/2014/05/grok-that-workflow.txt @@ -0,0 +1,360 @@ +# [Grok that workflow](#) +## &mdash; 30 May, 2014 + +### Introduction +> A workflow consists of an orchestrated and repeatable pattern of business +> activity enabled by the systematic organization of resources into processes +> that transform materials, provide services, or process information. It can be +> depicted as a sequence of operations, declared as work of a person or group, +> an organization of staff, or one or more simple or complex mechanisms. +> +> &mdash; <cite>From our savior Wikipedia, the free encyclopedia</cite> + +This has absolutely nothing to do with the subject of this post (or at least, +not much..). + +The workflow I'm going to discuss here is my **personnal day-to-day +computer workflow**. In other word, how I use my desktop. I'm not going to teach +any trick, script, tweak or whatever you might think of. However, I'll provide +links to software I use, piece of relevant config files, and animated images to +illustrate some points. +Now, shall we begin ? + +### Summary + +* [GNU/Linux distribution](#os) +* [Managing windows](#wm) +* [Scripting the shell](#sh) +* [Using aaplications](#apps) +* [Playing with the terminal](#term) +* [FAQ](#faq) + +<h3 id='os'>GNU/Linux distribution</h3> +#### crux +I'm a fairly new [crux](http://crux.nu) user. But I must say that I love it +already.. Crux is the kind of distro you build with your bare hands in a whole +week, while other would just it the "*install*" button, and watch the magic +happen for an hour or so, and get the same result. You're barely helped, you do +almost anything from scratch, you compile **everything**, and it is not even +working as you want ! that's how I like my personnal desktop: **raw**. + +Here is a typical crux workflow: + +1. Prepare your hard drive +2. Compile your kernel +3. Install the distro +4. Update your packages +5. Install package <xxx> +6. Ah, it's not packaged.. +7. Create ports <xxx> +8. Install package <xxx> +9. Use package <xxx> +10. GOTO 4 + +[![installing packages under +crux](/img/thumb/2014-05-26-prtutils.jpg)](/img/2014-05-26-prtutils.gif) +<span class='caption'>Here is a show case of a package installation under crux. +[prtmk](http://git.z3bra.org/cgit.cgi/scripts/tree/prtmk) is a small script I +wrote that will create `Pkgfile`s using templates. Once the Pkgfile is created, +you just need to download, compile the sources and install the package. Pretty +easy :)</span> + +<h3 id='wm'>Managing windows</h3> +My window manager of choice is venam's [2bwm](https://github.com/venam/2bwm). +It's a light and simple +[floater](https://wiki.archlinux.org/index.php/Window_Manager#Types) that comes +with an impressive set of features and is configured at compile time using the +special `config.h` file. + +Here is how my keybinds are organised: + +#### Managing windows + +<table> +<tr> <th>prefix</th> <th>key</th> <th>function</th> </tr> +<tr> <td>MOD4</td> <td>h,j,k,l</td> <td>move (10px)</td> </tr> +<tr> <td>MOD4+SHIFT</td> <td>h,j,k,l</td> <td>move (40px)</td> </tr> +<tr> <td>MOD4+ALT</td> <td>h,j,k,l</td> <td>resize (10px)</td> </tr> +<tr> <td>MOD4+ALT+SHIFT</td> <td>h,j,k,l</td> <td>resize (40px)</td> </tr> +<tr> <td>MOD4</td> <td>y,u,b,n</td> <td>put in the corner</td> </tr> +<tr> <td>MOD4</td> <td>g</td> <td>put in the middle</td> </tr> +<tr> <td>MOD4</td> <td>=</td> <td>maximize (horiz.)</td> </tr> +<tr> <td>MOD4+SHIFT</td> <td>=</td> <td>maximize (vert.)</td> </tr> +<tr> <td>MOD4</td> <td>x</td> <td>maximize (full)</td> </tr> +<tr> <td>ALT</td> <td>TAB</td> <td>focus next window</td> </tr> +<tr> <td>ALT+SHIFT</td> <td>TAB</td> <td>focus prev window</td> </tr> +</table> + +[![managning +windows](/img/thumb/2014-05-27-windows.jpg)](/img/2014-05-27-windows.gif) +<span class='caption'>Here are the movements I use on a daily basis. There are +more features, but that's the one I use the most (other are just combination of +those)</span> + +#### Managing groups + +Before using 2bwm, I was using [cwm](http://monkey.org/~marius/pages/?page=cwm), +which is itself a rewrite of [evilwm](http://www.6809.org.uk/evilwm/). `Cwm` has +a feature I like a lot: *groups*. These are basically like workspaces, with a +neat-feature: you can show/hide them whenever you want. +this allow grouping windows by tasks, and then raise groups depending on what +you want to do. And if you wanna work on two tasks at the same time, well, just +raise both tasks ! See the following animated image to get a visual idea of how +it works. + +When I switched to `2bwm`, I missed this feature.. Because it uses only the +traditionnal workspaces behavior (aka "*a-single-group-shown-at-the-time*"). So +I [forked](http://git.z3bra.org/cgit.cgi/2bwm) the whole repo and implemented +this feature. It's know perfectly working (as I can't find any bug, but there +might be..), and you can even switch between groups and workspaces behavior with +a hotkey ! + +<table> +<tr><th>prefix</th> <th>key</th> <th>function</th> </tr> +<tr><td>ALT</td> <td>F&lt;x&gt;</td> <td>switch to ws &lt;x&gt;</td></tr> +<tr><td>ALT+SHIFT</td> <td>F&lt;x&gt;</td> <td>send to ws &lt;x&gt;</td> </tr> +<tr><td>ALT</td> <td>g</td> <td>change behavior</td> </tr> +</table> + +[![managning +groups](/img/thumb/2014-05-27-groups.jpg)](/img/2014-05-27-groups.gif) +<span class='caption'>Showing the two behavior: workspaces VS. groups. Each +windows holds the number of the group it's sitting on</span> + +<h3 id='sh'>Scripting the shell</h3> +The shell is a really powerfull toy. Not only because it looks badass, but +because you can automate boring tasks by writing shell scripts. Here are my +prefered: + +#### detach applications +Sometimes, I need to start an application, and then detach it from my current +terminal (to reattach it somewhere, or later). To solve this, `tmux` or `screen` +could cut it, but I decided to use [dtach](http://dtach.sourceforge.net/) +instead, which *ONLY* emulate the detach feature, without multiplexing terminal +and such. I prefer it over `screen` or `tmux` because it's really lighter, and I +can then move my `dtach` sessions between my `tmux` sessions. + +To deal with it, I use a simple script named `dm` (for "*dtach manager*") that +let me create and attach sessions easily: + + ─── dm -h + dm [-hl] <alias> [command] + + # start a new session for IRC and fork it + ─── dm irc irssi & + [1] 4379 + + # list existing sessions + ─── dm -l + irc + + # attach the "irc" session + ─── dm irc + +#### compile softwares +This one might be specific to me, but when I'm programming, I often encounter +the following issue: + + ─── git pull + Updating 74bbe97..9b40eba + error: Your local changes to the following files would be overwritten by merge: + config.h + Please, commit your changes or stash them before you can merge. + Aborting + +**RRRAAAAAAHAHH !** You will have to rename the config.h to keep your changes, restore default +config, pull the changes, then recover your saved config.h... + +It's not much.. But it's enough to get on my nerves. I then wrote another small +script to help me with the boring task of constantly switching between default +and personnal file (But you can typically use it in any case you wanna switch +between multiple files). It goes like this: + + # check which file is in use + ─── hm -c + config.h is different from stored config + + # save current config + ─── hm -s 2bwm/$USER.h + + # list stored configs + ─── hm -l 2bwm + 2bwm + ├── config.def.h + └── z3bra.h + + # restore default config (previously store) + ─── hm -r 2b/config.def.h + +And now my life's much easier ! + +I use a few others, to get links from a youtube search, translate some text, +change my speakers, volume, ... Check my whole +[~/bin/](http://git.z3bra.org/cgit.cgi/scripts) for more! + + +<h3 id='apps'>Using applications</h3> +To start my application, I used `xbindkeys` a lot. But I found that `sxhkd` is +as efficient, but its config file is way more subtile and clean. I do not use my +window manager to spawn applications, so that I don't have to tweak every WM +config to spawn a terminal, and it even works WITHOUT a window manager :) + +Anyway, I don't have many shortcuts.. Here is a table to relate: + +<table> +<tr> <th>shortcut</th> <th>command</th> </tr> +<tr> <td>MOD4 + Enter</td> <td>urxvt</td> </tr> +<tr> <td>MOD4 + m</td> <td>urxvt -e mail</td> </tr> +<tr> <td>MOD4 + w</td> <td>dwb</td> </tr> +<tr> <td>Menu</td> <td>~/bin/menu</td> </tr> +<tr> <td>XF86Audio..</td> <td>~/bin/volume ..</td></tr> +</table> + +I use my menu key to spawn a menu with some applications (pdf, term, web, ..), +but I don't use it that often. It's nice though, so I just keep it. + +One interresting point, though. About the interaction between applications. I use `urxvt` as my terminal, and `dwb` as my web browser. This terminal has the powerful feature of being extensive in perl. I personnaly use two extensions: +`url_select` and `keyboard_select`. The first one let you select URLs with +`ALT+u` and open/yank them up with `Enter` or `y`. The second let you select +text and yank it using `ALT+v`. It's pretty nice to avoid grabbing the mouse ! + + +<h3 id="term">Playing with the terminal</h3> + +Pretty much everything I do on my desktop imply to interact with the terminal. +So that's one of my most tweaked application. But before speaking about any +tweak, let's see how I find my way through the file system. + + $ tree -L 2 $HOME + + /home/z3bra + ├── bin + │   ├── backup + │   ├── [...] + │   └── ys + ├── etc + │   ├── bashrc + │   ├── [...] + │   └── zshrc + ├── src + │   ├── bf + │   ├── c + │   ├── cpp + │   ├── java + │   ├── pkg + │   ├── sql + │   └── www + ├── tmp + ├── usr + │   ├── doc + │   ├── img + │   ├── msc + │   ├── ports + │   └── vid + └── var + ├── btp + ├── irc + ├── log + ├── mail + ├── run + └── to + + 31 directories, 47 files + +I try to mimic the unix filesystem: + +* `~/bin` : Holds my script and personnal binaries (it's in my $PATH, too) +* `~/etc` : Where my config files are stored. They are then symlink everywhere +* `~/src` : Every source of software goes there. They're sorted by language +* `~/tmp` : A piece of ram used for download, it forces myself to class the + files I download, as everything in this dir will be wiped on reboot +* `~/usr` : User files. from documents, to images, videos or distro packages +* `~/var` : For every files created by softwares. I use it to store my emails, + dtach's sockets, log files, torrents, and such + +Now that you visited my `$HOME`, let's see how I use it. My main shell is +`bash`. Mostly because I don't find `zsh` that useful, because I don't need all +those plugins. So my `~/.bashrc` is pretty heavily tweaked: + + $ wc ~/etc/bashrc + 225 733 5291 /home/willy/etc/bashrc + +The reason is that I hve many functions for everything that's to simple to put +in a script or that I don't plan to run non-interactively. You could see simple +monitoring function to get the top 10 processes, or memory usage. Or online +pastebin.. Nothing really fancy in fact. + +Then there are the aliases. Most of them are just command shortener : + + # command shortner + alias g='grep' + alias v="vim" + alias t='tmux' + alias btc="btcli -d ~/var/btp" + alias csv='column -t -s\;' + alias vol="alsamixer" + +So that's my config. There's not much to say after that.. I use `cd -`, `pushd` +and `popd` to navigate the whole tree, and I start my application from the CLI, +rather than menus or shortcuts (because having to remember shortcuts for the WM +is enough, and it does not leave much room for any other shortcuts!). + +When I have to deal wiht USB sticks, I just start +[ldm](https://github.com/LemonBoy/ldm) so that the stick mounts itself using my +UID/GID. I do not start it by default because I seldom need it, and it fucks +up the mounting of my `/` and `/home` on boot. + +Oh, also, I'm a big fan of text files, mostly because the GNU userland (or +any good user space) provides enough tools to play with them: + + $ grep z3bra ~/usr/doc/contacts.txt + z3bra, willy@mailoo.org, http://z3bra.org + + $ column -t -s, ~/usr/doc/bookmarks.txt + Arch linux forum https://bbs.archlinux.org + Nixers forum http://nixers.net + Ypnose blog http://ypnose.org/blog/ + Suckless website http://suckless.org + + $ cat ~/usr/doc/todo.txt + 1. polish report's appendix + 2. record a video for the blog + 3. publish the workflow post [URGENT] + 4. buy some bananas + + $ sed -i '/^[23]/d;s/^4/2/' $_ + +Talking about this, Reihar wrote a nice +[article](http://blag.necronomicon.fr/2013/12/21/libreoffice-batch-convert) +about converting document using libreoffice. I use it from time to time to +convert spreadsheets to CSV files, it's handy! + +### Bonus + +And there ends that narcissic article. I hope you found it interesting, even if +everything I present here is totally specific to me. As a bonus, to thank you +for reading this, here is a small video of my day to day workflow. Enjoy! + +<video controls src="/vid/2014-05-30-workflow.webm" type="video/webm"> +Your browser do not support embedded video. But you can download the files +</video> + +<div class='center'> +download : +<a href="/vid/2014-05-30-workflow.mp4"> mp4 </a> | +<a href="/vid/2014-05-30-workflow.webm"> webm </a> +</div><br> + +<div class='caption-large'> +That's a typical use of my desktop. IRC chat in +bottom left (group 1), dev window on top left (group 3) and web session on the +right for having enough space. Any other app would go on groups 4-9, and their +placement would depend on my mood :)</div> + + +<h3 id='faq'>FAQ</h3> +This section is left *intentionnaly* empty. If I receeive interesting questions +by mail, I'll answer back and quote the mail here, as a reference, so don't +be shy and [feel free to ask](mailto:willy@mailoo.org) ! + +<!-- vim: set ft=markdown ts=4 et tw=80: --> diff --git a/config.mk b/config.mk @@ -14,7 +14,8 @@ PAGES = index.html \ 2014/01/images-in-terminal.html \ 2014/03/toolbox.html \ 2014/04/meeting-at-the-bar.html \ - 2014/04/pop-it-up.html + 2014/04/pop-it-up.html \ + 2014/05/grok-that-workflow.html FEEDS = rss/feed.xml -EXTRA = css img favicon.ico +EXTRA = css img vid errors favicon.ico diff --git a/css/monochrome.css b/css/monochrome.css @@ -225,9 +225,8 @@ blockquote { margin-left: -8px; } -.strike { - text-decoration: line-through; -} +.center { text-align: center; } +.strike { text-decoration: line-through; } .smiley { font-style: normal; @@ -239,6 +238,7 @@ blockquote { border-radius: 6px; transform: rotate(90deg); } + /* }}} */ /* Images and associated text {{{ */ @@ -252,13 +252,22 @@ img { margin-top: 8px; } +video { width: 100%; } + /* Comment images - use with <span> or <div> */ .caption { - width:60%; + width: 60%; display: inline-block; font-style: italic; font-size: 80%; margin-left:20px; margin-top:20px; } + +.caption-large { + width: 100%; + display: block; + font-style: italic; + font-size: 80%; +} /* }}} */ diff --git a/index.txt b/index.txt @@ -1,3 +1,9 @@ +# [Grok that workflow](/2014/05/grok-that-workflow.html) +## &mdash; 30 May, 2014 +In a pretty narcissic pulsion, I decided that it could be interesting to +describe my day-to-day workflow. I'll cover the distribution, graphical windows, +terminal usage and even answer questions ! + # [Pop it up !](/2014/04/pop-it-up.html) ## &mdash; 30 April, 2014 What about a dynamic way to get in touch with your system infos? Something