#!/bin/sh # X session startup script: /etc/X11/Xsession.d/50_light-themes-borders # When ubuntu-2d session is used, set the window border widths of Ambiance # and Radiance themes to 4 pixels, instead of 1 (for normal frame geometry) # Restore default values for other sessions. # 2012 if [ "$(cat /etc/lsb-release | grep DISTRIB_CODENAME | awk -F = '{print $2}')" = "precise" ]; then SCRIPT_NAME="50_light-themes-borders" THEMES="Ambiance Radiance" THEMES_VERSION="$(dpkg -l | grep light-themes | awk '{print $3}')" LAST_THEMES_VERSION="$THEMES_VERSION" if [ "$GDMSESSION" = "ubuntu-2d" ] || [ "$GDMSESSION" = "gnome-fallback" ]; then for i in $THEMES; do # check last recorded light-themes version if [ -f $HOME/.themes/$SCRIPT_NAME-$i ]; then LAST_THEMES_VERSION="$(cat $HOME/.themes/$SCRIPT_NAME-$i | grep THEME_VERSION | awk -F = '{print $2}')" fi # avoid to overwrite already present customizations if ! [ -d $HOME/.themes/$i ] || [ "$THEMES_VERSION" != "$LAST_THEMES_VERSION" ]; then # remove theme directories if light-themes version has changed if [ "$THEMES_VERSION" != "$LAST_THEMES_VERSION" ]; then rm -rf $HOME/.themes/$i rm -f $HOME/.themes/$SCRIPT_NAME-$i fi mkdir $HOME/.themes # placeholder for changes made by this script touch $HOME/.themes/$SCRIPT_NAME-$i echo "This file was generated by /etc/X11/Xsession.d/$SCRIPT_NAME." > $HOME/.themes/$SCRIPT_NAME-$i echo "Remove it if you want to customize the $i theme." >> $HOME/.themes/$SCRIPT_NAME-$i echo "" >> $HOME/.themes/$SCRIPT_NAME-$i echo "THEME_VERSION=$THEMES_VERSION" >> $HOME/.themes/$SCRIPT_NAME-$i # copy themes to $HOME/.themes directory and modify the border width cp -af /usr/share/themes/$i $HOME/.themes sed -i ' /^/ { N N N s/[\t\ ]*\n[\t\ ]*\n[\t\ ]*/ \ \ /g }' $HOME/.themes/$i/metacity-1/metacity-theme-1.xml fi done else # delete theme directories modified by this script when using other sessions for i in $THEMES; do if [ -f $HOME/.themes/$SCRIPT_NAME-$i ]; then rm -rf $HOME/.themes/$i rm -f $HOME/.themes/$SCRIPT_NAME-$i fi done fi fi