Archive for the 'Software' Tag

Stop XQuartz from showing icon in the OSX dock and stop loading xterm on start

Edit /Applications/Utilities/XQuartz.app/Contents/Info.plist as root (ie, sudo vim in a terminal), and add the following key/value inside of <dict>:

<key>NSUIElement</key>
<string>1</string>

…. and in your terminal run defaults write org.macosforge.xquartz.X11 app_to_run /usr/bin/true, and then restart XQuartz: the dock icon should be gone and it shouldn’t start xterm anymore.

Features Safari needs to have to be considered as an everyday browser

I’ve recently switched to Safari over Firefox to see how Safari has caught up using my Macbook Pro 13″ Retina. It came with OSX 10.8 and Safari 6, and I didn’t even bother trying out Safari, and Firefox was one of the first things I installed.

It does do many thing better than Firefox:

  • It renders text much better than Firefox on a Retina display. They’re different but neither is outright better on a non-Retina display. I’m pretty sure Firefox on OSX supports Retina, so I don’t know why the text rendering is inferior.
  • It uses less memory loading the same pages (Gmail, G+, HN, Reddit, Feedly, which comprise my daily viewing experience).
  • It supports ICCv4 color profiles, and supports per-monitor color profiles. Firefox only supports ICCv2 (most color profiling tools output either ICCv4 only, or ICCv4 by default and the option is hidden in the preferences), and it only uses the primary monitor profile instead of the profile for the monitor the window is currently on. Firefox really needs to fix this.
  • It does seem to increase my battery life over Firefox.

It does things better than it used to:

  • It’s a lot faster than it used to be, especially with Javascript. Apple says it is faster than Firefox stable, but I can’t tell if it is faster than Firefox nightly (what I usually run) without benchmarking it. Firefox and Safari are now both fast enough with Javascript execution that I can’t tell the difference between the two.
  • It now supports session restore. I think this was added in Safari 6, but it was a long time sore point for Safari users and one of the reasons I never used Safari.

What it doesn’t do and shouldn’t leave up to extensions:

  • Lack of useful undo history. Safari 5 introduced undo close tab, but it still doesn’t have undo close window, or selectively undoing close tab/window out of your history. Plus, undo closed tab is bound to ctrl-z instead of ctrl-shift-t. There is no extension to fix this.
  • Does not pop up the URL at the bottom of the screen when hovering a link. I installed Ultimate Status Bar to add this
  • Keyword Search. Safari still lacks this, and I added Safari Omnikey to fill in the gap, however the Omnikey button must remain in the toolbar or it won’t function, cluttering your toolbar up.
    • Does not display Favicon on tab label.
    • Cannot position new tabs flexibly (such as at the end of the tab bar).
    • Does not focus last selected tab when closing a tab.
    • Minimum tab size is far too large.
    • Cannot maximize Safari

    These can be fixed by installing Glims, but I recommend if you use Glims on Safari 7 disable everything in Glims (in the Glims->General preferences panel) except “Other Tabs Improvements” and “Add Max Window Size Menu Option”, everything else conflicts with Safari 7’s built in functionality (but is still useful for earlier versions of Safari); look in the Glims->Tabs Misc preferences panel to enable Favicons, smaller tab sizes, focus last selected, and new tab position, and remember to turn off Glims’ ads in the Glims->Ads/Shopping preferences panel.

Apple could catch up to Firefox as a modern browser by implementing these features.

How to make the Insert/Help key emit Insert in iTerm2

Go into iTerm2 preferences and go to the keys tab. Hit the + button at the bottom to add a new key. Press your Insert/Help key to set that as your shortcut key, then select Send Escape Sequence as your action, and set [2~ as your escape sequence.

Running DRM/DRI/Mesa/DDX/Xorg from git on Debian Sid

A lot of the guides out there on how to build the entire X stack from scratch are missing steps or are only for part of the stack. This assumes you’re on Radeon, substitute appropriately for Intel or NVidia (download different driver, use different options with Mesa).

Please note: I haven’t been able to get i386 on amd64 builds to work yet, so if you need to run 32 bit apps on 64 bit, stick with your distro’s build for everything, don’t mix and match.

To get the source:

sudo apt-get build-dep libdrm mesa xserver-xorg-video-ati xorg-server
sudo apt-get install git llvm-3.4-dev libelf-dev linux-headers-`uname -r` build-essential
mkdir xorg && cd xorg
git clone git://anongit.freedesktop.org/git/xorg/util/macros
git clone git://anongit.freedesktop.org/git/xorg/proto/x11proto
git clone git://anongit.freedesktop.org/git/mesa/drm
git clone git://anongit.freedesktop.org/git/xorg/lib/libXau
git clone git://anongit.freedesktop.org/xorg/xserver
git clone git://anongit.freedesktop.org/git/mesa/mesa
git clone git://anongit.freedesktop.org/git/xorg/driver/glamor
git clone git://anongit.freedesktop.org/xorg/driver/xf86-video-ati
git clone git://anongit.freedesktop.org/xorg/driver/xf86-input-evdev

LLVM version
Mesa requires LLVM 3.4 or newer, and Debian Sid is still on 3.3 as default. Until this is fixed, make sure the package llvm-3.3 is not installed, and do ln -s /usr/bin/llvm-config-3.4 /usr/bin/llvm-config

Modify the environment
Add to /etc/environment:

LIBGL_DRIVERS_PATH=/opt/xorg/lib/dri/
R600_DEBUG=sb

Add to /etc/X11/xorg.conf:

Section "Files"
        ModulePath "/opt/xorg/lib/xorg/modules,/usr/lib/xorg/modules"
EndSection

Section "Module"
  Load "dri2"
  Load "glamoregl"
EndSection

… and in the Device section for your video card add Option "AccelMethod" "glamor" and make sure Driver is set to "radeon".

Create /etc/ld.so.conf.d/0-xorg-git.conf:

/opt/xorg/lib

Build the code

export PKG_CONFIG_PATH=/opt/xorg/lib/pkgconfig:\
/opt/xorg/share/pkgconfig:${PKG_CONFIG_PATH}
export LD_LIBRARY_PATH=/opt/xorg/lib:${LD_LIBRARY_PATH}
export LD_RUN_PATH=/opt/xorg/lib:${LD_RUN_PATH}
export LDFLAGS=-L/opt/xorg/lib CPPFLAGS=-I/opt/xorg/include
export ACLOCAL="/usr/bin/aclocal -I /opt/xorg/share/aclocal"

cd macros
./autogen.sh --prefix=/opt/xorg
sudo make install
cd ..

cd x11proto
./autogen.sh --prefix=/opt/xorg
sudo make install
cd ..

cd drm
./autogen.sh --prefix=/opt/xorg
make -j4
sudo make install
cd ..

cd libXau
./autogen.sh --prefix=/opt/xorg
make -j4
sudo make install
cd ..

cd xserver
./autogen.sh --prefix=/opt/xorg --enable-xorg --disable-dmx --disable-xvfb --disable-xnest --disable-xwin
make -j4
sudo make install
cd ..
sudo chown root /opt/xorg/bin/Xorg
sudo chmod u+s /opt/xorg/bin/Xorg
sudo ldconfig
sudo ln -s /usr/bin/xkbcomp /opt/xorg/bin/xkbcomp
sudo ln -s /usr/share/X11/xkb/rules /opt/xorg/share/X11/xkb/rules

cd mesa
export DRI_DRIVERS="radeon,r200"
export GALLIUM_DRIVERS="r300,r600,radeonsi,swrast"
./autogen.sh --prefix=/opt/xorg --with-dri-drivers=$DRI_DRIVERS --with-gallium-drivers=$GALLIUM_DRIVERS --with-egl-platforms=x11,drm --enable-gbm --enable-shared-glapi --enable-glx-tls --enable-driglx-direct --enable-gles1 --enable-gles2 --enable-r600-llvm-compiler --enable-xorg --enable-xa --enable-gallium-egl --enable-gallium-gbm --enable-texture-float
make -j4
sudo make install
cd ..

cd glamor
./autogen.sh --prefix=/opt/xorg
make -j4
sudo make install
cd ..

cd xf86-video-ati
./autogen.sh --prefix=/opt/xorg --enable-glamor
make -j4
sudo make install
cd ..

cd xf86-input-evdev
./autogen.sh --prefix=/opt/xorg
make -j4
sudo make install
cd ..

All you have to do now is tell your XDM to use /opt/xorg/bin/Xorg and then restart it. The Xserver puts its log in /opt/xorg/var/log/Xorg.0.log

Firefox can be fast under FGLRX

Use about:config to set:

gfx.xrender.enabled = false
layers.acceleration.force-enabled = true

Canvas rendering should be much much faster. Remember to set these to defaults if you switch drivers, the same isn’t true on DRI/Gallium Radeon.