From 2e85f7d684142dc5b12c25cc4fcf876baadf06d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20K=C3=B6rber?= Date: Thu, 17 Apr 2014 19:35:04 +0200 Subject: [PATCH] Update i3 configuration, move session commands in xinitrc. --- i3/i3/config | 43 +++++++++++----------------------- i3/i3/config.d/notebook.config | 39 ++++++++++++++++++++++++++++++ i3/i3/scripts/genconfig.bash | 5 ++++ i3/i3/scripts/i3exit.bash | 5 +++- x/xinitrc | 40 ++++++++++++++++++++++++++----- x/xinitrc.d/notebook.xinitrc | 3 +++ 6 files changed, 99 insertions(+), 36 deletions(-) create mode 100644 i3/i3/config.d/notebook.config create mode 100644 x/xinitrc.d/notebook.xinitrc diff --git a/i3/i3/config b/i3/i3/config index 6ac24bb..6b9805f 100644 --- a/i3/i3/config +++ b/i3/i3/config @@ -39,23 +39,16 @@ set $signal_reboot reboot set $signal_shutdown shutdown - # Path and options for the wallpaper changer script - set $path_wallchanger ~/.i3/scripts/wallchanger.bash - set $wallpaper_directory "$HOME/Bilder/wallpaper/misc" - set $wallpaper_logfile "$HOME/.i3/logs/wallpaper.log" - set $wallpaper_fallback "$HOME/.i3/data/wallpaper/" - set $wallpaper_interval 900 - - set $workspace1 1:www - set $workspace2 2:mail + set $workspace1 1 + set $workspace2 2 set $workspace3 3 set $workspace4 4 set $workspace5 5 set $workspace6 6 set $workspace7 7 - set $workspace8 8:irc - set $workspace9 9:im - set $workspace10 10:skype + set $workspace8 8 + set $workspace9 9 + set $workspace10 10 set $key_workspace1 1 set $key_workspace2 2 @@ -73,7 +66,7 @@ set $up k set $right l - set $splith g + set $splith c set $splitv v set $fullscreen f @@ -99,8 +92,8 @@ set $redshift_latitude 49.5 set $redshift_longitude 11 - set $redshift_colortemp_day - set $redshift_colortemp_night + set $redshift_colortemp_day 6500 + set $redshift_colortemp_night 4500 ################################################################################ ### KEYBINDINGS ################################################################ @@ -173,7 +166,8 @@ bindsym $mod+Shift+$next_on_output move container to workspace next_on_output # regenerate and reload the configuration file - bindsym $mod+$reload exec --no-startup-id bash ~/.i3/scripts/genconfig.bash ; reload + # 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+$restart restart bindsym $mod+$exit exit @@ -293,16 +287,7 @@ for_window [class="^Firefox$"] border 1pixel for_window [class="^Truecrypt$"] floating enable for_window [class="^URxvt$"] border 1pixel - -################################################################################ -### APPLICATION AUTOSTART ###################################################### -################################################################################ - - set $redshift_lat_long 49.5:11 - set $redshift_colortemp 5500:3700 - - exec --no-startup-id $path_wallchanger $wallpaper_directory $wallpaper_interval $wallpaper_fallback > $wallpaper_logfile & - exec --no-startup-id wicd-gtk --tray & - exec --no-startup-id gtk-redshift -l $redshift_lat_long -t $redshift_colortemp & - #exec --no-startup-id conky - + for_window [class="^Cairo-dock$"] floating enable ; border none + for_window [class="^Pavucontrol$"] floating enable + for_window [title="^Skype.*for Linux$" ] floating enable + for_window [class="^Chromium$" ] border none diff --git a/i3/i3/config.d/notebook.config b/i3/i3/config.d/notebook.config new file mode 100644 index 0000000..d3c350b --- /dev/null +++ b/i3/i3/config.d/notebook.config @@ -0,0 +1,39 @@ +# bind some keys +bindsym XF86Sleep exec --no-startup-id $path_i3exit suspend +bindsym XF86AudioMute exec --no-startup-id amixer set Master toggle +#bindsym XF86AudioRaiseVolume exec --no-startup-id amixer set Master %5+ +#bindsym XF86AudioLowerVolume exec --no-startup-id amixer set Master %5- +# keys seemingly switched +bindsym XF86MonBrightnessUp exec --no-startup-id sudo /usr/local/bin/backlight.sh -10 +bindsym XF86MonBrightnessDown exec --no-startup-id sudo /usr/local/bin/backlight.sh +10 + +# start i3bar to display a workspace bar (plus the system information i3status +# finds out, if available) +bar { + # always show at the top of the screen + mode dock + position top + + tray_output primary + + # show workspace buttons + workspace_buttons yes + + id bar-0 + + font pango:DejaVu Sans Mono, Icons 10 + + colors { + background #000000 + statusline #ffffff + separator #666666 + + focused_workspace #4c7899 #285577 #ffffff + active_workspace #333333 #5f676a #ffffff + inactive_workspace #333333 #222222 #888888 + urgent_workspace #2f343a #900000 #ffffff + } + + i3bar_command i3bar + status_command bash ~/.i3/i3bar_wrapper.bash ~/.i3/conky/virtualarch.conkyrc +} diff --git a/i3/i3/scripts/genconfig.bash b/i3/i3/scripts/genconfig.bash index d76f409..f410bbe 100644 --- a/i3/i3/scripts/genconfig.bash +++ b/i3/i3/scripts/genconfig.bash @@ -31,3 +31,8 @@ else fi echo "$SESSION_CONF" + +# if we got any parameters, tell i3 to reload the config +# so the script can be used both on startup without reload (as i3 is not even +# running yet) and later when reloading +[[ -n "$1" ]] && i3-msg reload diff --git a/i3/i3/scripts/i3exit.bash b/i3/i3/scripts/i3exit.bash index 8a0ae66..3d72b64 100755 --- a/i3/i3/scripts/i3exit.bash +++ b/i3/i3/scripts/i3exit.bash @@ -28,6 +28,9 @@ lock() background_options="--color $FALLBACK_COLOR" fi i3lock $background_options + retval=$? + [[ -z "$1" ]] && sleep 1 && xset dpms force off + return $retval } log "[I] Received signal \"$1\"." @@ -43,7 +46,7 @@ case "$1" in ;; suspend) log "[I] Suspending." - lock && systemctl suspend + lock "1" && systemctl suspend ;; hibernate) log "[I] Hibernating." diff --git a/x/xinitrc b/x/xinitrc index 1138a61..fc9b9c1 100755 --- a/x/xinitrc +++ b/x/xinitrc @@ -12,24 +12,52 @@ fi export LANG=en_US.UTF-8 - # keyboard options keyboard_layout=de keyboard_variant=nodeadkeys keyboard_repeat_delay=150 keyboard_repeat_speed=30 +# path and options for the wallpaper changer script +path_wallchanger="$HOME/.i3/scripts/wallchanger.bash" +wallpaper_directory="$HOME/pictures/wallpaper/misc" +wallpaper_logfile="$HOME/.i3/logs/wallpaper.log" +wallpaper_fallback="$HOME/.i3/data/wallpaper/" +wallpaper_interval="900" + +# redshift settings +redshift_lat_long="49.5:11" +redshift_colortemp="5500:3700" + +# start the pulseaudio volume control tray applet +pasystray & + +# start dropbox +dropboxd & + +# start the wallpaper changer +$path_wallchanger "$wallpaper_directory" "$wallpaper_interval" "$wallpaper_fallback" > "$wallpaper_logfile" & + +# start redshift +redshift-gtk -l "$redshift_lat_long" -t "$redshift_colortemp" & + +# set keyboard layout +setxkbmap -layout "$keyboard_layout" -variant "$keyboard_variant" & + +# set key repeat delay +xset r rate "$keyboard_repeat_delay" "$keyboard_repeat_speed" & + # execute the host-specific .xinitrc-addition hostfile="$HOME/.xinitrc.d/$(hostname).xinitrc" [[ -f "$hostfile" ]] && bash "$hostfile" & -# set keyboard layout -setxkbmap -layout "$keyboard_layout" -variant "$keyboard_variant" +[[ -f ~/.Xresources ]] && xrdb -merge ~/.Xresources & -# set key repeat delay -xset r rate "$keyboard_repeat_delay" "$keyboard_repeat_speed" +LOG="$HOME/.i3/logs/i3.log" +LOGOLD="$HOME/.i3/logs/i3.log.old" -[[ -f ~/.Xresources ]] && xrdb -merge ~/.Xresources +# simple logrotate so we can still get info about the last session +[[ -f "$LOG" ]] && mv -f "$LOG" "$LOGOLD" SESSION_CONF=$(bash "$HOME/.i3/scripts/genconfig.bash") exec i3 -c "$SESSION_CONF" >> ~/.i3/logs/i3.log diff --git a/x/xinitrc.d/notebook.xinitrc b/x/xinitrc.d/notebook.xinitrc new file mode 100644 index 0000000..62035d8 --- /dev/null +++ b/x/xinitrc.d/notebook.xinitrc @@ -0,0 +1,3 @@ +#!/bin/bash + +xrandr --output eDP1 --primary