From 3caa35488c1fb19141d42fbe279791abed55f0fb Mon Sep 17 00:00:00 2001 From: Thomas Kolb Date: Sun, 19 Mar 2017 21:59:32 +0100 Subject: [PATCH] Added i3 config --- i3/config | 190 +++++++++++++++++++++++++ i3/conky_bar.sed | 10 ++ i3/conky_lua/network.lua | 8 ++ i3/conky_wrap.sh | 47 ++++++ i3/conkyrc_thommy | 25 ++++ i3/dunstrc | 50 +++++++ i3/scripts/toggle_compositing.sh | 12 ++ i3/scripts/update_xplanet_wallpaper.sh | 14 ++ i3/scripts/wallpaper_autoupdate.sh | 7 + 9 files changed, 363 insertions(+) create mode 100644 i3/config create mode 100644 i3/conky_bar.sed create mode 100644 i3/conky_lua/network.lua create mode 100755 i3/conky_wrap.sh create mode 100644 i3/conkyrc_thommy create mode 100644 i3/dunstrc create mode 100755 i3/scripts/toggle_compositing.sh create mode 100755 i3/scripts/update_xplanet_wallpaper.sh create mode 100755 i3/scripts/wallpaper_autoupdate.sh diff --git a/i3/config b/i3/config new file mode 100644 index 0000000..443b2fd --- /dev/null +++ b/i3/config @@ -0,0 +1,190 @@ +# This file has been auto-generated by i3-config-wizard(1). +# It will not be overwritten, so edit it as you like. +# +# Should you change your keyboard layout some time, delete +# this file and re-run i3-config-wizard(1). +# + +# i3 config file (v4) +# +# Please see http://i3wm.org/docs/userguide.html for a complete reference! + +set $mod Mod4 + +# Font for window titles. Will also be used by the bar unless a different font +# is used in the bar {} block below. +# This font is widely installed, provides lots of unicode glyphs, right-to-left +# text rendering and scalability on retina/hidpi displays (thanks to pango). +font pango:DejaVu Sans Mono 8 +# Before i3 v4.8, we used to recommend this one as the default: +# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 +# The font above is very space-efficient, that is, it looks good, sharp and +# clear in small sizes. However, its unicode glyph coverage is limited, the old +# X core fonts rendering does not support right-to-left and this being a bitmap +# font, it doesn’t scale on retina/hidpi displays. + +# Use Mouse+$mod to drag floating windows to their wanted position +floating_modifier $mod + +# start a terminal +bindsym $mod+Return exec i3-sensible-terminal + +# kill (close) focused window +bindsym $mod+c kill + +# start dmenu (a program launcher) +#bindsym $mod+d exec dmenu_run +# There also is the (new) i3-dmenu-desktop which only displays applications +# shipping a .desktop file. It is a wrapper around dmenu, so you need that +# installed. +#bindsym $mod+r exec --no-startup-id i3-dmenu-desktop + +bindsym $mod+r exec "rofi -show run" + +# change focus +#bindsym $mod+j focus left +#bindsym $mod+k focus down +#bindsym $mod+l focus up +#bindsym $mod+odiaeresis focus right + +# alternatively, you can use the cursor keys: +bindsym $mod+Left focus left +bindsym $mod+Down focus down +bindsym $mod+Up focus up +bindsym $mod+Right focus right + +# move focused window +#bindsym $mod+Shift+j move left +#bindsym $mod+Shift+k move down +#bindsym $mod+Shift+l move up +#bindsym $mod+Shift+odiaeresis move right + +# alternatively, you can use the cursor keys: +bindsym $mod+Shift+Left move left +bindsym $mod+Shift+Down move down +bindsym $mod+Shift+Up move up +bindsym $mod+Shift+Right move right + +# split in horizontal orientation +bindsym $mod+h split h + +# split in vertical orientation +bindsym $mod+v split v + +# enter fullscreen mode for the focused container +bindsym $mod+f fullscreen + +# change container layout (stacked, tabbed, toggle split) +bindsym $mod+s layout stacking +bindsym $mod+t layout tabbed +bindsym $mod+e layout toggle split + +# toggle tiling / floating +bindsym $mod+Ctrl+space floating toggle + +# change focus between tiling / floating windows +bindsym $mod+space focus mode_toggle + +# focus the parent container +bindsym $mod+a focus parent + +# focus the child container +#bindsym $mod+d focus child + +# switch to workspace +bindsym $mod+1 workspace "1: chat" +bindsym $mod+2 workspace "2: www" +bindsym $mod+3 workspace 3 +bindsym $mod+4 workspace 4 +bindsym $mod+5 workspace 5 +bindsym $mod+6 workspace 6 +bindsym $mod+7 workspace 7 +bindsym $mod+8 workspace 8 +bindsym $mod+9 workspace 9 +bindsym $mod+0 workspace 10 + +# move focused container to workspace +bindsym $mod+Shift+1 move container to workspace "1: chat" +bindsym $mod+Shift+2 move container to workspace "2: www" +bindsym $mod+Shift+3 move container to workspace 3 +bindsym $mod+Shift+4 move container to workspace 4 +bindsym $mod+Shift+5 move container to workspace 5 +bindsym $mod+Shift+6 move container to workspace 6 +bindsym $mod+Shift+7 move container to workspace 7 +bindsym $mod+Shift+8 move container to workspace 8 +bindsym $mod+Shift+9 move container to workspace 9 +bindsym $mod+Shift+0 move container to workspace 10 + +# reload the configuration file +bindsym $mod+Ctrl+l reload +# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) +bindsym $mod+Ctrl+r restart +# exit i3 (logs you out of your X session) +bindsym $mod+Shift+q exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'" + +# resize window (you can also use the mouse for that) +mode "resize" { + # These bindings trigger as soon as you enter the resize mode + + # Pressing left will shrink the window’s width. + # Pressing right will grow the window’s width. + # Pressing up will shrink the window’s height. + # Pressing down will grow the window’s height. + #bindsym j resize shrink width 10 px or 10 ppt + #bindsym k resize grow height 10 px or 10 ppt + #bindsym l resize shrink height 10 px or 10 ppt + #bindsym odiaeresis resize grow width 10 px or 10 ppt + + # same bindings, but for the arrow keys + bindsym Left resize shrink width 10 px or 10 ppt + bindsym Down resize grow height 10 px or 10 ppt + bindsym Up resize shrink height 10 px or 10 ppt + bindsym Right resize grow width 10 px or 10 ppt + + # back to normal: Enter or Escape + bindsym Return mode "default" + bindsym Escape mode "default" +} + +#hide_edge_borders both + +bindsym $mod+Shift+r mode "resize" + +# Start i3bar to display a workspace bar (plus the system information i3status +# finds out, if available) +bar { + position top + #status_command i3status + status_command ~/.config/i3/conky_wrap.sh + mode hide + hidden_state hide + modifier $mod + separator_symbol "•" +} + +# window rules +for_window [class="Conky"] floating enable +for_window [class="Fldigi"] floating enable +for_window [class="URxvt"] border 1pixel +for_window [class="Gajim"] move container to workspace "1: chat" +for_window [window_role="roster"] floating enable + +# autorun +exec --no-startup-id setxkbmap de neo +#exec --no-startup-id dunst -config ~/.config/i3/dunstrc +exec --no-startup-id ~/.config/i3/scripts/wallpaper_autoupdate.sh +exec --no-startup-id ~/.config/i3/scripts/toggle_compositing.sh +exec --no-startup-id xautolock -time 8 -locker "i3lock -i /tmp/xplanet/wallpaper.png" -notify 15 -notifier "notify-send -t 15000 Locking screen..." +exec --no-startup-id redshift-gtk + +# shortcuts +# volume +bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume alsa_output.pci-0000_05_04.0.analog-stereo +1dB +bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume alsa_output.pci-0000_05_04.0.analog-stereo -1dB +bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute alsa_output.pci-0000_05_04.0.analog-stereo toggle + +# compositing +bindsym $mod+F12 exec --no-startup-id ~/.config/i3/scripts/toggle_compositing.sh + +# lock +bindsym $mod+l exec xautolock -locknow diff --git a/i3/conky_bar.sed b/i3/conky_bar.sed new file mode 100644 index 0000000..acc368c --- /dev/null +++ b/i3/conky_bar.sed @@ -0,0 +1,10 @@ +# conky_bar.sed +s/#\{8\}/█/g +s/#\{7\}_\{1\}/▉/g +s/#\{6\}_\{2\}/▊/g +s/#\{5\}_\{3\}/▋/g +s/#\{4\}_\{4\}/▌/g +s/#\{3\}_\{5\}/▍/g +s/#\{2\}_\{6\}/▎/g +s/#\{1\}_\{7\}/▏/g +s/_\{8\}/ /g diff --git a/i3/conky_lua/network.lua b/i3/conky_lua/network.lua new file mode 100644 index 0000000..0127a7d --- /dev/null +++ b/i3/conky_lua/network.lua @@ -0,0 +1,8 @@ +--vim: ts=2 sw=2 noet sts=0 +function conky_eth_link_speed(eth) + local f = assert(io.open("/sys/class/net/" .. eth .. "/speed", "r")) + local t = f:read("*all") + f:close() + + return string.sub(t,1,-2) .. " Mbps" +end diff --git a/i3/conky_wrap.sh b/i3/conky_wrap.sh new file mode 100755 index 0000000..f8bf9be --- /dev/null +++ b/i3/conky_wrap.sh @@ -0,0 +1,47 @@ +#!/bin/sh + +# Send the header so that i3bar knows we want to use JSON: +echo '{"version":1}' + +# Begin the endless array. +echo '[' + +# We send an empty first array of blocks to make the loop simpler: +echo '[],' + +cd $(dirname $0) + +POTENTIAL_MPD_HOSTS="cubietruck mpid music.bingo localhost" + +find_mpd() { + for host in $POTENTIAL_MPD_HOSTS + do + ping -c 1 $host >/dev/null 2>&1 + if [ $? -eq 0 ]; then + NEW_HOST="$host" + break + fi + done +} + +find_mpd +export MPD_HOST="$NEW_HOST" + +while true +do + stdbuf -o L conky -c "conkyrc_$HOSTNAME" | stdbuf -i 0 -o 0 sed -f conky_bar.sed & + CHILD_PID=$! + + NEW_HOST=$MPD_HOST + until [ "$NEW_HOST" != "$MPD_HOST" ] + do + sleep 300 + + find_mpd + done + + kill $CHILD_PID >/dev/null 2>&1 + sleep 3 + + export MPD_HOST="$NEW_HOST" +done diff --git a/i3/conkyrc_thommy b/i3/conkyrc_thommy new file mode 100644 index 0000000..e0674bb --- /dev/null +++ b/i3/conkyrc_thommy @@ -0,0 +1,25 @@ +out_to_x no +own_window no +out_to_console yes + +max_text_width 0 +update_interval 2.0 +total_run_times 0 +short_units on +if_up_strictness link +use_spacer left +#override_utf8_locale no +cpu_avg_samples 1 +lua_load conky_lua/network.lua + +#• BAT0: ${battery_short BAT0} ${battery_time BAT0} \#${battery_bar 1,79 BAT0}▏ \ + +TEXT +[ + {"full_text": "MPD: ${if_match "${mpd_status}" == "Playing"}▶${endif}${if_match "${mpd_status}" == "Paused"}‖${endif}${if_match "${mpd_status}" == "Stopped"}◼${endif} ${if_match "${mpd_status}" != "Stopped"}${mpd_artist} - ${mpd_title} ${mpd_elapsed} \#${mpd_bar 1,63}▏${endif}", "color": "\#ffffff"}, + {"full_text": "Eth: ${if_up enp3s0}${lua eth_link_speed enp3s0}, ${addrs enp3s0}, ↑${upspeed enp3s0} ↓${downspeed enp3s0}${else}down${endif}", "color": "${if_up enp3s0}\#aaffaa${else}\#ffaaaa${endif}"}, + {"full_text": "CPUs: \#${cpubar cpu1 1,31}▏\#${cpubar cpu2 1,31}▏\#${cpubar cpu3 1,31}▏\#${cpubar cpu4 1,31}▏", "color": "\#ffffff"}, + {"full_text": "Mem: ${mem} \#${membar 1,79}▏", "color": "${if_match ${memperc}<90}\#aaffaa${else}\#ffaaaa${endif}"}, + {"full_text": "Swp: ${swap}", "color": "${if_match ${swapperc}<75}\#aaffaa${else}\#ffaaaa${endif}"}, + {"full_text": "${time %a %d.%m.%Y %H:%M:%S}", "color": "\#ffffff"} +], diff --git a/i3/dunstrc b/i3/dunstrc new file mode 100644 index 0000000..efbbd0e --- /dev/null +++ b/i3/dunstrc @@ -0,0 +1,50 @@ +[global] + font = Cousine 10 + + format = "%a: %s %b" + sort = yes + indicate_hidden = yes + alignment = left + bounce_freq = 0 + show_age_threshold = 60; + + word_wrap = yes + + geometry = "0x0-3+3" + transparency = 0 + + idle_threshold = 20 + + monitor = 0 + follow = none + + sticky_history = yes + line_height = 0 + + separator_height = 2; + + separator_color = auto + + padding = 3 + horizontal_padding = 9 + + +#[urgency_low] +# background = "#404040" +# foreground = "#CCCCCC" +# timeout = 10 +# +#[urgency_normal] +# background = "#859900" +# foreground = "#DDDDDD" +# timeout = 10 +# +#[urgency_critical] +# background = "#dc322f" +# foreground = "#DDDDDD" +# timeout = 0 +# +#[ignore] +# appname = "Spotify" +# summary = "*" +# format = "" diff --git a/i3/scripts/toggle_compositing.sh b/i3/scripts/toggle_compositing.sh new file mode 100755 index 0000000..ecdac76 --- /dev/null +++ b/i3/scripts/toggle_compositing.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +PIDFILE="/tmp/.compositing_mgr_$DISPLAY.pid" + +if [ -e "$PIDFILE" ]; then + kill `cat "$PIDFILE"` + rm "$PIDFILE" +else + #compton -c -f -C -t-5 -l-5 -r4.2 -o.55 -I0.08 -O0.08 -D16 & + compton -cCzf -O 0.035 --backend glx --blur-background & + echo $! > "$PIDFILE" +fi diff --git a/i3/scripts/update_xplanet_wallpaper.sh b/i3/scripts/update_xplanet_wallpaper.sh new file mode 100755 index 0000000..859ed6f --- /dev/null +++ b/i3/scripts/update_xplanet_wallpaper.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +SDIR=`dirname $0` +TMPDIR='/tmp/xplanet' + +GEO=$(xrandr --query | fgrep \* | head -n 1 | awk '{print $1}') + +mkdir -p "$TMPDIR" + +nice -n 19 xplanet -latitude 33 -longitude 11 -background $SDIR/xplanet/background.jpg \ + -output $TMPDIR/xplanet.png -geometry 1920x1200 -num_times 1 +nice -n 19 composite -geometry $GEO $SDIR/xplanet/xplanet_halo.png $TMPDIR/xplanet.png $TMPDIR/wallpaper.png +#nice -n 19 composite /tmp/xplanet/xplanet_atm.png ~/Bilder/Hintergrund_Feh/code_merged_1920.png /tmp/wallpaper.png +feh --bg-center $TMPDIR/wallpaper.png diff --git a/i3/scripts/wallpaper_autoupdate.sh b/i3/scripts/wallpaper_autoupdate.sh new file mode 100755 index 0000000..17c6413 --- /dev/null +++ b/i3/scripts/wallpaper_autoupdate.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +while true +do + ~/.config/i3/scripts/update_xplanet_wallpaper.sh + sleep 30m +done