diff --git a/i3/i3/config b/i3/i3/config index a0a620e..395fa1e 100644 --- a/i3/i3/config +++ b/i3/i3/config @@ -174,17 +174,19 @@ # regenerate and reload the configuration file # if genconfig gets any paramters, it will invoke i3-msg reload - bindsym $mod+$reload exec --no-startup-id bash ~/.i3/scripts/genconfig.bash 1 + bindsym $mod+$reload exec --no-startup-id ~/.i3/scripts/genconfig.bash 1 bindsym $mod+$restart restart bindsym $mod+$exit exit ### START APPLICATIONS ##################################################### - bindsym $mod+d exec j4-dmenu-desktop --dmenu="dmenu -b -i -l 10 -p '>' -nb '#222222' -nf '#ffffff' -sb '#e16b40' -sf '#000000'" + bindsym $mod+d exec j4-dmenu-desktop --dmenu="dmenu -fn 'DejaVu Sans Mono:size=11' -b -i -l 10 -p '>' -nb '#222222' -nf '#ffffff' -sb '#e16b40' -sf '#000000'" bindsym $mod+Return exec $terminal bindsym $mod+F1 exec firefox + bindsym Pause exec --no-startup-id ~/.i3/scripts/shutdown-menu.bash + ################################################################################ ### MODES ###################################################################### ################################################################################ @@ -214,23 +216,6 @@ } bindsym $mod+r mode "resize" - # Enabling a mode to shutdown, reboot, lock screen and so on - set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown - mode "$mode_system" { - bindsym $key_lock exec --no-startup-id $path_i3exit $signal_lock, mode "default" - bindsym $key_logout exec --no-startup-id $path_i3exit $signal_logout, mode "default" - bindsym $key_suspend exec --no-startup-id $path_i3exit $signal_suspend, mode "default" - bindsym $key_hibernate exec --no-startup-id $path_i3exit $signal_hibernate, mode "default" - bindsym $key_reboot exec --no-startup-id $path_i3exit $signal_reboot, mode "default" - bindsym $key_shutdown exec --no-startup-id $path_i3exit $signal_shutdown, mode "default" - - # back to normal: Enter or Escape - bindsym Return mode "default" - bindsym Escape mode "default" - } - bindsym $mod+Pause mode "$mode_system" - bindsym Pause exec --no-startup-id $path_i3exit lock - ################################################################################ ### GENERAL SETUP ############################################################## ################################################################################ @@ -321,6 +306,7 @@ client.urgent #2f343a #900000 #ffffff #900000 for_window [class="^main\.py$" ] floating enable for_window [class="^Xfce4-panel$"] floating enable for_window [class="^Thunderbird"] border none + for_window [instance="^shutdown-menu$"] border normal assign [class="^Thunderbird"] $workspace9 assign [class="^Skype$"] $workspace10 diff --git a/i3/i3/data/lockscreen/lockscreen_1024x600.png b/i3/i3/data/lockscreen/1024x600.png similarity index 100% rename from i3/i3/data/lockscreen/lockscreen_1024x600.png rename to i3/i3/data/lockscreen/1024x600.png diff --git a/i3/i3/data/lockscreen/lockscreen_1920x1080.png b/i3/i3/data/lockscreen/1920x1080.png similarity index 100% rename from i3/i3/data/lockscreen/lockscreen_1920x1080.png rename to i3/i3/data/lockscreen/1920x1080.png diff --git a/i3/i3/scripts/i3exit.bash b/i3/i3/scripts/i3exit.bash index 2abea31..6176993 100755 --- a/i3/i3/scripts/i3exit.bash +++ b/i3/i3/scripts/i3exit.bash @@ -12,6 +12,7 @@ touch "$LOGFILE" log() { + echo "$1" echo "[$(date +%FT%T)] $1" >> "$LOGFILE" } @@ -19,24 +20,30 @@ lock() { resolution=$(xrandr | grep '*' | awk '{ print $1 }' | head -n1) log "[I] Resolution found: \"$resolution\"" - lockscreen="$HOME/.i3/data/lockscreen_$resolution.png" + lockscreen="$HOME/.i3/data/lockscreen/$resolution.png" log "[I] Looking for lockscreen at \"$lockscreen\"" if [[ -f "$lockscreen" ]] ; then log "[I] Lockscreen found, will be used as background image." background_options="--image $lockscreen -t" else - log "[W] Lockscreen not found, using color #$FALLBACK_COLOR as background." + log "[W] Lockscreen not found, using color #$FALLBACK_COLOR as background." background_options="--color $FALLBACK_COLOR" fi i3lock $background_options #-p win --image "$HOME/pictures/windows-lockscreen.jpg" retval=$? - [[ -z "$1" ]] && sleep 1 && xset dpms force off + [[ -z "$1" ]] && sleep 3 && xset dpms force off return $retval } -log "[I] Received signal \"$1\"." +if [[ "$1" == '-' ]]; then + read signal +else + signal="$1" +fi -case "$1" in +log "[I] Received signal \"$signal\"." + +case "$signal" in lock) log "[I] Locking session." lock @@ -64,7 +71,7 @@ case "$1" in ;; *) echo "Usage: $0 {lock|logout|suspend|hibernate|reboot|shutdown}" - log "[E] Signal \"$1\" unknown. Aborting." + log "[E] Signal \"$signal\" unknown. Aborting." exit 2 esac diff --git a/i3/i3/scripts/shutdown-menu.bash b/i3/i3/scripts/shutdown-menu.bash new file mode 100755 index 0000000..7fc7cd8 --- /dev/null +++ b/i3/i3/scripts/shutdown-menu.bash @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +options=( +"lock" +"logout" +"suspend" +"hibernate" +"reboot" +"shutdown") + +i=1 +output=$( +for option in "${options[@]}"; do + echo "($i) $option" + (( i++ )) +done | dmenu -fn 'DejaVu Sans Mono:size=11' -b -i -l 10 -p '>' -nb '#222222' -nf '#ffffff' -sb '#e16b40' -sf '#000000' -w 200 -name 'shutdown-menu') + +[[ "$output" ]] && "$(dirname "$0")"/i3exit.bash "${output#(*) }" diff --git a/x/Xresources b/x/Xresources index 5e2314a..9993ab4 100644 --- a/x/Xresources +++ b/x/Xresources @@ -24,7 +24,7 @@ URxvt.termName: urxvt URxvt.cursorBlink: true URxvt.transparent: true -URxvt.shading: 10 +URxvt.shading: 15 ! Solarized color scheme for the X Window System ! diff --git a/x/xinitrc b/x/xinitrc index 062a2c2..7a54137 100755 --- a/x/xinitrc +++ b/x/xinitrc @@ -59,7 +59,7 @@ wallpaper_interval="900" # redshift settings redshift_lat_long="49.5:11" -redshift_colortemp="5500:4000" +redshift_colortemp="5500:3700" # start mpd if ! pgrep --euid hannes --exact '^mpd$' ; then diff --git a/zsh/zshrc b/zsh/zshrc index c6f04e5..4630bc5 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -12,9 +12,11 @@ SAVEHIST=10000 HISTFILE="$HOME/.zsh_history" PROMPT="%{$fg[white]%}╭─%{$fg[green]%}%M %{$fg[red]%}▶ %{$fg[yellow]%}%~ -%{$fg[white]%}╰─%B$%b " +%{$fg[white]%}╰─%B%#%b " RPROMPT="%{$fg[red]%}%? %{$fg[white]%}%*%{$reset_color%}" +PATH="$PATH:$HOME/bin" + man() { env LESS_TERMCAP_mb=$'\E[01;31m' \ LESS_TERMCAP_md=$'\E[01;38;5;74m' \ @@ -110,7 +112,7 @@ alias much="git" alias wow="git status" alias v="vim" -alias g="grep" +alias g="git" # rebase the current branch onto WTF ARE YOU DOING YOU ARE DRUNNK TO GO BED @@ -134,11 +136,11 @@ slideshow() { "$@" } -function cd() { +cd() { builtin cd $* && ls } -function mount() { +mount() { if [[ $# == 0 ]] ; then /usr/bin/env mount | column -t else @@ -147,42 +149,45 @@ function mount() { } ff() { - find . -type f -iname "*"$*"*" ; + find . -type f -iname "*"$*"*" ; } ffcs() { - find . -type f -name "*"$*"*" ; + find . -type f -name "*"$*"*" ; } -extract() # Handy Extract Program. +extr() { - if [ -f $1 ] ; then - case $1 in - *.tar.bz2 ) tar xvjf $1 ;; - *.tar.gz ) tar xvzf $1 ;; - *.bz2 ) bunzip2 $1 ;; - *.rar ) unrar x $1 ;; - *.gz ) gunzip $1 ;; - *.tar ) tar xvf $1 ;; - *.tbz2 ) tar xvjf $1 ;; - *.tgz ) tar xvzf $1 ;; - *.zip ) unzip $1 ;; - *.Z ) uncompress $1 ;; - *.7z ) 7z x $1 ;; - *) echo "$1 cannot be extracted via extract()" ;; - esac - else - echo "$1 is not a valid file" - fi + if [[ -f "$1" ]] ; then + case "$1" in + *.tar.bz2 ) tar xvjf "$1" ;; + *.tar.gz ) tar xvzf "$1" ;; + *.tar.xz ) tar xvJf "$1" ;; + *.bz2 ) bunzip2 "$1" ;; + *.rar ) unrar x "$1" ;; + *.gz ) gunzip "$1" ;; + *.tar ) tar xvf "$1" ;; + *.tbz2 ) tar xvjf "$1" ;; + *.tgz ) tar xvzf "$1" ;; + *.zip ) unzip "$1" ;; + *.Z ) uncompress "$1" ;; + *.7z ) 7z x "$1" ;; + *) + echo "$1 cannot be extracted via $0" + ;; + esac + else + echo "$1 is not a valid file" + fi } ruler() { - for s in '....^....|' '1234567890'; do - w=${#s} - str=$(for (( i=1; $i<=$(( ($COLUMNS + $w) / $w )) ; i=$i+1 )); do echo -n $s; done ) - str=$(echo $str | cut -c -$COLUMNS) - echo $str - done + for s in '....^....|' '1234567890'; do + w=${#s} + str=$(for (( i=1; $i<=$(( ($COLUMNS + $w) / $w )) ; i=$i+1 )); do echo -n $s; done ) + str=$(echo $str | cut -c -$COLUMNS) + echo $str + done } addext() { @@ -192,15 +197,15 @@ addext() { } ckwww() { - ping -c 3 www.google.com + ping -c 3 www.google.com } topcmds() { - history | awk '{print $2}' | awk 'BEGIN {FS="|"}{print $1}' | sort | uniq -c | sort -nr | head + history | awk '{print $2}' | awk 'BEGIN {FS="|"}{print $1}' | sort | uniq -c | sort -nr | head } fnottype() { - find . -maxdepth 1 ! -type $1 + find . -maxdepth 1 ! -type $1 } # simple calculator @@ -208,6 +213,19 @@ c () { echo "$*" | bc -l } -function http() { +http() { curl http://httpcode.info/$1 } + +bak() { + [[ -e "$1" ]] && cp -ai "$1" "$1.$(date +%FT%T).bak" +} + +fstab() { + # yeah + expand /etc/fstab | grep -v '^#' | grep -P '^.+$' | tr -s ' ' | tr ' ' '|' | cat <(grep -P '<.+>' /etc/fstab | cut -f 2- -d ' ' | sed 's/>[^<]*|