Browse Source

Update jekyll conf. New post w/ assets.

Tyler Hallada 9 years ago
parent
commit
62a03ab7e1

+ 6 - 1
Gemfile

@@ -1,2 +1,7 @@
1 1
 source 'http://rubygems.org'
2
-gem 'github-pages'
2
+
3
+require 'json'
4
+require 'open-uri'
5
+versions = JSON.parse(open('https://pages.github.com/versions.json').read)
6
+
7
+gem 'github-pages', versions['github-pages']

+ 2 - 1
_config.yml

@@ -1,8 +1,9 @@
1 1
 name: Tyler Hallada - Blog
2 2
 description: Musings on technology, literature, and interesting topics
3 3
 url: http://hallada.net/blog
4
+assets: http://hallada.net/assets/
4 5
 markdown: redcarpet
5
-pygments: true
6
+highlighter: pygments
6 7
 paginate: 10
7 8
 paginate_path: "blog/page:num"
8 9
 gems:

+ 257 - 0
_posts/2015-06-03-midnight-desktop.md

@@ -0,0 +1,257 @@
1
+---
2
+title: Midnight Desktop
3
+layout: post
4
+---
5
+
6
+I tend to use Linux (Ubuntu) on my desktop late at night in a dark room. To
7
+protect my eyes from the blinding light of my monitors I've tooled my desktop
8
+environment over the course of a few months to be as dark as possible. It has
9
+gotten complex enough that I thought it would be worth sharing now.
10
+
11
+###dotfiles###
12
+
13
+Before I begin, I want to note that all the configuration for the setup I'm
14
+describing is stored in a [dotfiles repo on my github
15
+profile](https://github.com/thallada/dotfiles). If you would like to replicate
16
+any of this setup, I would go there. Just note that I will probably be updating
17
+the master branch fairly often, but the
18
+[midnight](https://github.com/thallada/dotfiles/tree/midnight) branch will
19
+always contain the setup described here.
20
+
21
+###bspwm###
22
+
23
+Inspired by [/r/unixporn](http://www.reddit.com/r/unixporn), I decided to switch
24
+from gnome to bspwm, a minimal tiling window manager that positions windows like
25
+leaves on a binary tree.
26
+
27
+I don't really use the tiling features that often, though. I often do most of my
28
+work in the terminal and [tmux](http://tmux.sourceforge.net/) does the terminal
29
+pane management. But, when I do open another application, it's nice that bspwm
30
+forces it to use the maximum available space.
31
+
32
+I also like how hackable the whole manager is. There is a terminal command
33
+`bspc` that controls the entire desktop environment and a separate program
34
+`sxhkd` (probably the hardest program name ever to remember) handles all of the
35
+hotkeys for the environment. All of them are stored in a
36
+[`sxhkdrc`](https://github.com/thallada/dotfiles/blob/master/sxhkd/.config/sxhkd/sxhkdrc)
37
+under the home directory and it's super easy to add my own. The hotkeys make
38
+this superior to gnome for me because I never have to touch my mouse to move
39
+around the desktop.
40
+
41
+###gnome and gtk###
42
+
43
+I still love some of the features from gnome. Especially the text hinting, which
44
+is why I still run `gnome-settings-daemon` in my [bspwm startup
45
+script](https://github.com/thallada/dotfiles/blob/master/bspwm/bin/bspwm-session).
46
+
47
+To make gtk applications universally dark (and also to tune text hinting)
48
+install the `gnome-tweak-tool`. There should be a "Global Dark Theme" setting
49
+under the "Appearance" tab that can be enabled. I use the
50
+[Numix](https://numixproject.org/) gtk theme which seems to behave fine with
51
+this setting.
52
+
53
+###Gnome Terminal###
54
+
55
+I've tried using a few other lighter-weight terminals like xterm, but I still
56
+like the features of gnome-terminal more. I created a "bspwm" profile and set
57
+the background to be transparent with opacity at about half-way on the slider.
58
+My background, set in the [bspwm startup
59
+script](https://github.com/thallada/dotfiles/blob/master/bspwm/bin/bspwm-session)
60
+is a subtle [dark tiling pattern](http://subtlepatterns.com/dark-mosaic/) so
61
+this effectively makes the background of the terminal dark.
62
+
63
+In my
64
+[sxhkdrc](https://github.com/thallada/dotfiles/blob/master/sxhkd/.config/sxhkd/sxhkdrc)
65
+I can then map my hotkeys for starting a new terminal to the command
66
+`gnome-terminal --window-with-profile=bspwm`.
67
+
68
+###vim###
69
+
70
+Making vim dark is pretty easy. Just put this in the
71
+[`.vimrc`](https://github.com/thallada/dotfiles/blob/master/vim/.vimrc):
72
+
73
+```vim
74
+set background=dark
75
+```
76
+
77
+I use the colorscheme
78
+[distinguished](https://github.com/Lokaltog/vim-distinguished) which is
79
+installed by putting the `distinguished.vim` file under
80
+[`~/.vim/colors/`](https://github.com/thallada/dotfiles/tree/master/vim/.vim/colors)
81
+and adding this to the `.vimrc`:
82
+
83
+```vim
84
+colorscheme distinguished
85
+```
86
+
87
+###tmux/byobu###
88
+
89
+I like the abstraction that [byobu](http://byobu.co/) puts ontop of tmux, so
90
+that's what I use in the terminal. Colors can be configured by editing the
91
+[`~/.byobu/color.tmux`](https://github.com/thallada/dotfiles/blob/master/byobu/.byobu/color.tmux)
92
+file. This is what I have in mine:
93
+
94
+    BYOBU_DARK="\#333333"
95
+    BYOBU_LIGHT="\#EEEEEE"
96
+    BYOBU_ACCENT="\#4D2100"
97
+    BYOBU_HIGHLIGHT="\#303030"
98
+    MONOCHROME=0
99
+
100
+###evince###
101
+
102
+I tell my browser, firefox, to open pdfs in evince (aka. Document Viewer)
103
+because evince can darken pdfs.
104
+
105
+Select View > Invert Colors and then Edit > Save Current Settings as Default and
106
+now most pdfs will be displayed as white text on black background.
107
+
108
+###Firefox###
109
+
110
+I had to hack firefox a lot to get it to be universally dark since the web
111
+(unfortunately!) doesn't have a night mode switch. I'm using firefox instead of
112
+chrome because firefox has better customization for doing something this
113
+extreme.
114
+
115
+####Userstyles
116
+
117
+Firefox has a really neat addon called
118
+[Stylish](https://addons.mozilla.org/en-us/firefox/addon/stylish/) that allows
119
+you to install and edit user CSS files to change the style of any website you
120
+visit. A lot of popular websites have dark themes on
121
+[userstyles.org](https://userstyles.org/), but the rest of the internet still
122
+mostly has a white background by default.
123
+
124
+Luckily there's a few global dark themes. [Midnight Surfing
125
+Alternative](https://userstyles.org/styles/47391/midnight-surfing-alternative)
126
+seemed to work the best for me.
127
+
128
+However, since the theme is global, it overwrites the custom tailored dark
129
+themes that I had installed for specific popular sites (listed below) making the
130
+sites ugly. The Midnight Surfing Alternative theme can be edited through the
131
+Stylish extension to exclude the websites that I already have dark themes for.
132
+[This superuser question explains what to
133
+edit](http://superuser.com/questions/463153/disable-stylish-on-certain-sites-in-firefox).
134
+Now, whenever I add a new dark theme to Stylish, I edit the regex to add the
135
+domains it covers to the parenthesized list that is delimited by pipes.
136
+
137
+```css
138
+@-moz-document regexp("(https?|liberator|file)://(?!([^.]+\\.)?(maps\\.google\\.com|...other domains....)[/:]).*"){
139
+```
140
+
141
+Here is the list of dark themes I'm currently using with Stylish in addition to
142
+Midnight Surfing Alternative:
143
+
144
+* [Amazon Dark -
145
+    VisualPlastik](https://userstyles.org/styles/52294/amazon-dark-visualplastik)
146
+* [Dark Feedly
147
+    (Hauschild's)](https://userstyles.org/styles/89622/dark-feedly-hauschild-s)
148
+* [Dark Gmail mod by
149
+    Karsonito](https://userstyles.org/styles/107544/dark-gmail-mod-by-karsonito)
150
+    (this one is a bit buggy right now, though)
151
+* [Dark Netflix
152
+    [GRiMiNTENT]](https://userstyles.org/styles/102627/dark-netflix-grimintent)
153
+* [dark-facebook 2 [a dark facebook
154
+    theme]](https://userstyles.org/styles/95359/facebook-dark-facebook-2-a-dark-facebook-theme)
155
+* [Forecast.io - hide
156
+    map](https://userstyles.org/styles/104812/forecast-io-hide-map)
157
+* [GitHub Dark](https://userstyles.org/styles/37035/github-dark) (this one is
158
+    really well done, I love it)
159
+* [Google Play (Music) Dark \*Updated
160
+    5-15\*](https://userstyles.org/styles/107643/google-play-music-dark-updated-5-15)
161
+* [Messenger.com Dark](https://userstyles.org/styles/112722/messenger-com-dark)
162
+* [Telegram web dark / custom
163
+    color](https://userstyles.org/styles/109612/telegram-web-dark-custom-color)
164
+* [Youtube - Lights Out - A Dark Youtube
165
+    Theme](https://userstyles.org/styles/92164/youtube-lights-out-a-dark-youtube-theme)
166
+
167
+####UI Themes
168
+
169
+Most of my firefox UI is styled dark with the [FT
170
+DeepDark](https://addons.mozilla.org/en-US/firefox/addon/ft-deepdark/) theme.
171
+
172
+The firefox developer tools can be [themed dark in its
173
+settings](http://soledadpenades.com/2014/11/20/using-the-firefox-developer-edition-dark-theme-with-nightly/).
174
+
175
+####Addons
176
+
177
+For reddit, I use the [RES](http://redditenhancementsuite.com/) addon which has
178
+a night mode option.
179
+
180
+I also use [Custom New
181
+Tab](https://addons.mozilla.org/en-US/firefox/addon/custom-new-tab/) combined
182
+with [homepage.py](https://github.com/ok100/homepage.py) to display a list of my
183
+favorite websites when I start a new tab.
184
+
185
+[Vimperator](https://addons.mozilla.org/en-US/firefox/addon/vimperator/) allows
186
+me to control firefox completely with my keyboard which is really useful when I
187
+am switching back and forth between firefox and vim. By default, the vimperator
188
+window has a white background, so I had to [set it to a dark
189
+theme](https://github.com/vimpr/vimperator-colors). Also, in order to make all
190
+of the vimperator help pages dark, I had to add the protocol `liberator://` to
191
+the regex for Midnight Surfing Alternative (exact syntax for that above).
192
+
193
+###Redshift###
194
+
195
+At night, it's also useful to filter out blue light to help with sleep.
196
+[Redshift](http://jonls.dk/redshift/) is a utility that does this automatically
197
+while running in the background.
198
+
199
+![Midnight in action with redshift](/assets/midnight_screenshot_redshift.png)
200
+
201
+###Invert it all!###
202
+
203
+I noticed that with the dark colors and my monitor brightness turned low, it was
204
+hard to see the screen during the day because of glares. An easy solution to
205
+this is to simply invert the colors on the output of the monitor into an instant
206
+day theme.
207
+
208
+I would have used the command `xcalib -a -i` but that would only work on one
209
+monitor and I have two. Luckily, someone made a utility that would invert colors
210
+on more than one monitor called
211
+[xrandr-invert-colors](https://github.com/zoltanp/xrandr-invert-colors).
212
+
213
+```bash
214
+#!/bin/bash
215
+inverted=$(xcalib -a -p | head -c 1)
216
+if [ "$inverted" == "W" ]
217
+  then
218
+    if [ -z "$(pgrep redshift)" ]
219
+      then
220
+        xrandr-invert-colors
221
+        redshift &
222
+    fi
223
+  else
224
+    if [ -z "$(pgrep redshift)" ]
225
+      then
226
+        xrandr-invert-colors
227
+      else
228
+        killall redshift
229
+        sleep 3
230
+        xrandr-invert-colors
231
+    fi
232
+fi
233
+```
234
+
235
+The only problem was that this utility seemed to interfere with redshift, so I
236
+made [a script that would disable redshift before
237
+inverting](https://github.com/thallada/dotfiles/blob/master/invert/bin/invert).
238
+
239
+And, now I have [a
240
+shortcut](https://github.com/thallada/dotfiles/commit/e5153a90fa7c89a0e2ca16e5943f0fa20d4a9512)
241
+to invert the screen.
242
+
243
+However, images and videos look pretty ugly inverted. VLC has a setting under
244
+Tools > Effects and Filters > Video Effects > Colors called Negate colors that
245
+can fix that.
246
+
247
+For firefox, I made a global userstyle to invert images and videos.
248
+
249
+```css
250
+@-moz-document regexp("(https?|liberator|file)://(?!([^.]+\\.)?[/:]).*"){
251
+  img, video, div.html5-video-container, div.player-api, span.emoji, i.emoji, span.emoticon, object[type="application/x-shockwave-flash"], embed[type="application/x-shockwave-flash"] {
252
+      filter: invert(100%);
253
+    }
254
+}
255
+```
256
+
257
+![Midnight inverted into a day theme](/assets/midnight_screenshot_inverted.png)

BIN
assets/midnight_screenshot_inverted.png


BIN
assets/midnight_screenshot_redshift.png