program[term] = xterm -e tmux
To open new term with tmux. That's what causing the 256 color issue. Seems like opening tmux like that made the xterm not setting the correct $TERM. That's why if I open an xterm, then open tmux, the 256 color will look as it's intended. So I changed that to xterm -tn xterm-256color -e tmux so that the xterm will open with 256 color $TERM correctly. And it works! Here's my ~/.scrotwm.conf for your pleasure. Feel free to use it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .scrotwm.conf Ahmad Zulkarnain - OpenBSD 4.8 | |
# Change modkey to Mod4 (Windows key) | |
modkey = Mod4 | |
# Status Bar | |
bar_font = -*-terminus-medium-*-*-*-*-*-*-*-*-*-*-* | |
#bar_action = conky | |
#bar_delay = 1 | |
# Region | |
#region = screen[1]:1024x753+0+0 | |
# Programs | |
program[tmux] = xterm -tn xterm-256color -e tmux | |
program[xterm] = xterm | |
program[lock] = xscreensaver-command -activate | |
program[shutdown] = sudo /sbin/shutdown -ph now | |
program[screenshot_all] = /usr/local/share/scrotwm/screenshot.sh full | |
program[screenshot_wind] = /usr/local/share/scrotwm/screenshot.sh window | |
program[initscr] = /usr/local/share/scrotwm/initscreen.sh | |
# Key Bindings | |
bind[lock] = Control+Mod1+Delete | |
bind[shutdown] = MOD+Control+Escape | |
#bind[spawn_term] = MOD+Return | |
bind[tmux] = MOD+Shift+Return | |
bind[xterm] = MOD+Control+Return | |
bind[screenshot_all] = MOD+s | |
bind[screenshot_wind] = MOD+Shift+s | |
bind[initscr] = MOD+Shift+i | |
# Quirk | |
quirk[MPlayer:xv] = FLOAT + ANYWHERE | |
quirk[Smplayer:smplayer] = FLOAT + ANYWHERE | |
quirk[OpenOffice.org 2.4:VCLSalFrame] = FLOAT | |
quirk[OpenOffice.org 3.0:VCLSalFrame] = FLOAT | |
quirk[OpenOffice.org 3.1:VCLSalFrame] = FLOAT | |
quirk[Firefox-bin:firefox-bin] = TRANSSZ | |
quirk[Firefox:Dialog] = FLOAT | |
quirk[Gimp:gimp] = FLOAT + ANYWHERE | |
quirk[XTerm:xterm] = XTERM_FONTADJ | |
quirk[Vlc:vlc] = FLOAT + FULLSCREEN | |
quirk[pidgin:pidgin] = FLOAT + ANYWHERE | |
quirk[Conky:Conky] = FLOAT + ANYWHERE |
Do note that I don't use spawn_term = xterm anymore. Initially I changed that to open tmux automatically, but defining other than "xterm" value just don't work. Hitting MOD+Return just didn't open any xterm at all. So that's why I had to use program[xterm] instead. As long as it works.
And here's my whole ~/.profile. Do take note on the upper part of the file especially on the xterm & tmux bit.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# $OpenBSD: dot.profile, Ahmad Zulkarnain | |
# | |
# sh/ksh initialization | |
PATH=$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games:. | |
# This is to check the TERM and change accordingly. | |
# Console default term = vt220, in X = xterm | |
if [[ $TERM == xterm || $TERM == screen ]]; | |
then | |
export TERM="xterm-256color"; | |
else | |
export TERM="wsvt25"; | |
fi | |
COLORTERM= | |
export PATH HOME TERM | |
# This is for tmux | |
[ -n "$TMUX" ] && export TERM="screen-256color" | |
# Aliases | |
alias ls='colorls -G' | |
alias rm='rm -i' | |
alias mv='mv -i' | |
#alias mplayer='nice --19 mplayer' | |
# Disabling SSL check for GIT | |
export GIT_SSL_NO_VERIFY=true | |
# Set up proxy | |
export http_proxy="http://my.proxy.com:8080/" | |
export ftp_proxy="http://my.proxy.com:8080/" | |
export HTTP_PROXY=$http_proxy | |
export FTP_PROXY=$ftp_proxy | |
export https_proxy=$http_proxy | |
export ssl_proxy=$http_proxy | |
export gopher_proxy=$http_proxy | |
export socks_proxy=$http_proxy | |
export no_proxy="localhost,127.0.0.1" | |
# This is to turn proxy on / off | |
function proxy { | |
if [[ $1 = "on" ]]; | |
then | |
echo "Turning proxy on..."; | |
export http_proxy="http://my.proxy.com:8080/" | |
export ftp_proxy="http://my.proxy.com:8080/" | |
export HTTP_PROXY=$http_proxy | |
export FTP_PROXY=$ftp_proxy | |
export https_proxy=$http_proxy | |
export ssl_proxy=$http_proxy | |
export gopher_proxy=$http_proxy | |
export socks_proxy=$http_proxy | |
export no_proxy="localhost,127.0.0.1" | |
elif [[ $1 = "off" ]]; | |
then | |
echo "Turning proxy off..."; | |
unset http_proxy | |
unset ftp_proxy | |
unset HTTP_PROXY | |
unset FTP_PROXY | |
unset https_proxy | |
unset ssl_proxy | |
unset gopher_proxy | |
unset socks_proxy | |
else | |
echo "Usage: $0 [on|off]"; | |
fi | |
} | |
# This is to dial celcom3g | |
function celcom3g { | |
# Some internal functions | |
function c3gConnect { | |
sudo ifconfig ppp0 create | |
pppd call celcom3g & | |
} | |
function c3gDisconnect { | |
pkill -9 pppd | |
sudo ifconfig ppp0 destroy | |
} | |
# Dialing function | |
if [[ $1 = "connect" ]]; | |
then | |
echo "Connecting to Celcom3G..."; | |
# proxy off; | |
c3gConnect; | |
elif [[ $1 = "disconnect" ]]; | |
then | |
echo "Disconnect from Celcom3G..."; | |
c3gDisconnect; | |
# proxy on; | |
elif [[ $1 = "restart" ]]; | |
then | |
echo "Restarting Celcom3G connection..."; | |
c3gDisconnect; | |
c3gConnect; | |
else | |
echo "Usage: $0 [connect|disconnect|restart]"; | |
fi | |
} |
As usual, use it if you want to. Later.
No comments:
Post a Comment