# sakura == xterm-256color
# konsole == xterm
if [[ $TERM == "xterm" ]]; then
- # make ctrl-backspace work
- stty werase '^?'
# control + arrow keys. for other terminals, see http://unix.stackexchange.com/questions/10806/how-to-change-previous-next-word-shortcut-in-bash
bind '"\e[1;5C": shell-forward-word' 2>/dev/null
bind '"\e[1;5D": shell-backward-word' 2>/dev/null
else
- #stty werase '^h'
+ # make ctrl-backspace work. for konsole, i fixed it through
+# /home/iank/.local/share/konsole/default.keytab
+ stty werase '^h'
bind '"\eOc": shell-forward-word'
bind '"\eOd": shell-backward-word'
fi
}
faf() { # find all files
- find -L $1 -type f -not \( -name .svn -prune -o -name .git -prune \
+ find -L $1 -not \( -name .svn -prune -o -name .git -prune \
-o -name .hg -prune -o -name .editor-backups -prune \
-o -name .undo-tree-history -prune \) 2>/dev/null
}
tx() { # toggle set -x, and the prompt so it doesn't spam
if [[ $- == *x* ]]; then
set +x
- PROMPT_COMMAND=prompt_command
+ PROMPT_COMMAND=prompt-command
else
unset PROMPT_COMMAND
PS1="\w \$ "
wtr() { curl wttr.in/boston; }
xl() {
- # this succeeds even if gnome-screensaver isn\'t running.
+ if pgrep gnome-screensav &>/dev/null; then
+ # this command actually starts gnome-screensaver if it isn't running.
+ # lololol, what crap
gnome-screensaver-command --exit &>/dev/null
+ fi
mate-screensaver-command --exit &>/dev/null
if ! pidof xscreensaver; then
pushd /
# 1 was not long enough
sleep 3
fi
- xscreensaver-command -lock
+ xscreensaver-command -activate
}
#############################
PS1="\h $PS1"
fi
- prompt_command() {
+
+
+
+ prompt-command() {
local return=$? # this MUST COME FIRST
local psc pst ps_char ps_color stale_subvol
unset IFS
history -a # save history
- # for titlebar
- if [[ $TERM == *(screen*|xterm*|rxvt*) ]]; then
- # from the screen man page
- if [[ $TERM == screen* ]]; then
- local title_escape="\033]..2;"
- else
- local title_escape="\033]0;"
- fi
- echo -ne "$title_escape${PWD/#$HOME/~} $USER@$HOSTNAME\007"
- fi
case $return in
# emacs completion doesn't like the git prompt atm, so disabling it.
#PS1="${PS1%"${PS1#*[wW]}"}$(__git_ps1 ' (%s)') \[$ps_color\]$ps_char\[$(get_term_color nocolor)\] "
}
- PROMPT_COMMAND=prompt_command
+ PROMPT_COMMAND=prompt-command
+
+ settitle () {
+ if [[ $TERM == screen* ]]; then
+ local title_escape="\033]..2;"
+ else
+ local title_escape="\033]0;"
+ fi
+ if [[ $* != prompt-command ]]; then
+ echo -ne "$title_escape$USER@$HOSTNAME ${PWD/#$HOME/~} $*\007"
+ fi
+ }
+
+ # for titlebar
+ # condition from the screen man page i think
+ if [[ $TERM == *(screen*|xterm*|rxvt*) ]]; then
+ trap 'settitle "$BASH_COMMAND"' DEBUG
+ else
+ trap DEBUG
+ fi
+
fi
reset-konsole() {
# we also have a file in /a/c/...konsole...
- setini ShowMenuBarByDefault false KonsoleWindow $HOME/.config/konsolerc
- while read k v; do
- setini $k $v TabBar $HOME/.config/konsolerc
- done <<'EOF'
-TabBarVisibility ShowTabBarWhenNeeded
-TabBarPosition Top
-EOF
+ local f=$HOME/.config/konsolerc
+ setini DefaultProfile profileian.profile "Desktop Entry" $f
+ setini Favorites profileian.profile "Favorite Profiles" $f
+ setini ShowMenuBarByDefault false KonsoleWindow $f
+ setini TabBarPosition Top TabBar $f
}
reset-sakura() {
EOF
}
+reset-xscreensaver() {
+ # except for spash, i set these by setting gui options in
+ # xscreensaver-command -demo
+ # then finding the corresponding option in .xscreensaver
+ # spash, i happened to notice in .xscreensaver
+ cat > /home/iank/.xscreensaver <<'EOF'
+mode: blank
+dpmsEnabled: True
+dpmsStandby: 0:01:00
+dpmsSuspend: 0:01:00
+dpmsOff: 0:02:00
+timeout: 0:01:00
+lock: True
+lockTimeout: 0:02:00
+splash: False
+EOF
+
+}
+
###########################################
# stuff that makes sense to be at the end #