Commits

firefly committed a37aa8b

Updated herbstluftwm dzen2 panel, updated symbols file & various minor changes.

  • Participants
  • Parent commits d8a967c

Comments (0)

Files changed (6)

 !urxvt.font: xft:DejaVu Sans Mono-7
 !urxvt.font: xft:DejaVu Sans Mono:size=7
 !urxvt.font: xft:DejaVu Sans Mono:pixelsize=12
-urxvt.font: xft:DejaVu Sans Mono:size=9
+!urxvt.font: xft:DejaVu Sans Mono:size=7
+urxvt.font: xft:Source Code Pro:size=8
 !urxvt.font: xft:inconsolata:pixelsize=14
 !urxvt.font: xft:mplus 1mn light:size=9
 urxvt.urgentOnBell:    true

config/herbstluftwm/panel.sh

 #!/bin/bash
 
-# disable path name expansion or * will be expanded in the line
-# cmd=( $line )
-set -f
-
+# Check which monitor this is
 monitor=${1:-0}
 geometry=( $(herbstclient monitor_rect "$monitor") )
-if [ -z "$geometry" ] ;then
-    echo "Invalid monitor $monitor"
-    exit 1
+
+if [ -z "$geometry" ]; then
+  echo >&2 "Invalid monitor: $monitor"
+  exit 1
 fi
-# geometry has the format: WxH+X+Y
+
+# Config stuff
 x=${geometry[0]}
 y=${geometry[1]}
-panel_width=${geometry[2]}
+#panel_width=${geometry[2]}
 panel_height=14
+
+panel_left_width=600
+panel_right_width=$((${geometry[2]} - $panel_left_width))
+
 font="-*-fixed-medium-*-*-*-10-*-*-*-*-*-*-*"
-#font="DejaVu Sans Mono:size=8"
 bgcolor=$(herbstclient get frame_border_normal_color)
 selbg=$(herbstclient get window_border_active_color)
-#selfg='#101010'
-selfg='#cccccc'
+selfg='#CCC'
 
 ####
-# Try to find textwidth binary.
-# In e.g. Ubuntu, this is named dzen2-textwidth.
-if [ -e "$(which textwidth 2> /dev/null)" ] ; then
-    textwidth="textwidth";
-elif [ -e "$(which dzen2-textwidth 2> /dev/null)" ] ; then
-    textwidth="dzen2-textwidth";
-else
-    echo "This script requires the textwidth tool of the dzen2 project."
-    exit 1
-fi
-####
 # true if we are using the svn version of dzen2
 dzen2_version=$(dzen2 -v 2>&1 | head -n 1 | cut -d , -f 1|cut -d - -f 2)
 if [ -z "$dzen2_version" ] ; then
 fi
 
 function uniq_linebuffered() {
-    awk '$0 != l { print ; l=$0 ; fflush(); }' "$@"
+  awk '$0 != l { print ; l=$0 ; fflush(); }' "$@"
 }
 
+# Begin actual bar implementation
 herbstclient pad $monitor $panel_height
 {
-    # events:
-    # TODO: Get this working properly, so that the panel is updated to reflect
-    # whether MPD is running.
-  # (mpc idleloop player | sed 's/^/mpd_/') &
-    (mpc idleloop player | cat) &
-  # mpc idleloop player &
+  #### Emit events here
+  # player (mpd)
+  (mpc idleloop player) &
+  mpc_pid=$!
 
-    # TODO: Replace tick with proper battry event checking.
-    while true; do echo 'tick'; sleep 20; done &
-    echo brightness # emit once to init
+  # tick
+  while true; do echo tick; sleep 20; done &
+  tick_pid=$!
 
-    while true ; do
-        date +'date ^fg()%H^fg(#909090):^fg()%M^fg(#909090), %Y-%m-^fg()%d'
-        sleep 1 || break
-    done > >(uniq_linebuffered)  &
+  # date
+  while true; do
+    date +'date ^fg()%H^fg(#909090):^fg()%M^fg(#909090), %Y-%m-^fg()%d'
+    sleep 1 || break
+  done > >(uniq_linebuffered) &
+  date_pid=$!
 
-    childpid=$!
-    herbstclient --idle
-    kill $childpid
+  # hlwm events
+  herbstclient --idle
 
-} 2> /dev/null | {
-    TAGS=( $(herbstclient tag_status $monitor) )
-    visible=true
+  # exiting; kill stray event-emitting processes
+  kill $date_pid
+  kill $mpc_pid
+  kill $tick_pid
 
-    date="^fg()--"
-    windowtitle=""
+} 2>/dev/null | {
+  # Defaults for the bar-drawing part
+  TAGS=( $(herbstclient tag_status $monitor) )
+  visible=true
 
-    brightstatus="^fg()--"
-    batstatus="^fg()--"
-    thermstatus="^fg()--"
-    nowplaying="^fg()--"
+  windowtitle=""
 
-    while true ; do
-        bordercolor="#26221C"
-        separator="^bg()^fg($selbg)|"
-        # draw tags
-        for i in "${TAGS[@]}" ; do
-            case ${i:0:1} in
-                '#')
-                    echo -n "^bg($selbg)^fg($selfg)"
-                    ;;
-                '+')
-                    echo -n "^bg(#9CA668)^fg(#141414)"
-                    ;;
-                ':')
-                    echo -n "^bg()^fg(#ffffff)"
-                    ;;
-                '!')
-                    echo -n "^bg(#FF0675)^fg(#141414)"
-                    ;;
-                *)
-                    echo -n "^bg()^fg(#ababab)"
-                    ;;
-            esac
-            if [ ! -z "$dzen2_svn" ] ; then
-                echo -n "^ca(1,herbstclient focus_monitor $monitor && "'herbstclient use "'${i:1}'") '"${i:1} ^ca()"
-            else
-                echo -n " ${i:1} "
-            fi
-        done
+  Default="^fg()--"
+  sep="^bg()^fg($selbg)|"
 
-        echo -n "$separator"
-        echo -n "^bg()^fg() ${windowtitle//^/^^}"
+  # fields of the right panel
+  date="$Default"
+  brightstatus="$Default"
+  batstatus="$Default"
+  thermstatus="$Default"
+  nowplaying="$Default"
 
-        S="$separator"
+  while true; do
+    # First, draw tags to left panel
+    for i in "${TAGS[@]}"; do
+      case ${i:0:1} in
+        '#')  echo -n "^bg($selbg)^fg($selfg)"    ;;
+        '+')  echo -n "^bg(#9CA668)^fg(#141414)"  ;;
+        ':')  echo -n "^bg()^fg(#ffffff)"         ;;
+        '!')  echo -n "^bg(#FF0675)^fg(#141414)"  ;;
+        *)    echo -n "^bg()^fg(#ababab)"         ;;
+      esac
 
-        # small adjustments
-        right="$separator^bg() $brightstatus $S $thermstatus $S $batstatus $S $nowplaying $S $date $S"
-        right_text_only=$(echo -n "$right"|sed 's.\^[^(]*([^)]*)..g')
+      if [ ! -z "$dzen2_svn" ] ; then
+        echo -n "^ca(1,herbstclient focus_monitor $monitor && "'herbstclient use "'${i:1}'") '"${i:1} ^ca()"
+      else
+        echo -n " ${i:1} "
+      fi
+    done
 
-        # get width of right aligned text.. and add some space..
-        width=$($textwidth "$font" "$right_text_only ")
-      # width=300
+    # Then, draw the rest of the left panel
+    echo -n "$sep"
+    echo "^bg()^fg() ${windowtitle//^/^^}"
 
-        echo -n "^pa($(($panel_width - $width)))$right"
-        echo
+    # Right panel is trickier...
+  # echo >&3 "$sep $date $sep "
+  # S="$sep"
+  # echo >&3 "$S^bg() $brightstatus $S $thermstatus $S $batstatus $S $date $S $nowplaying $S "
 
-        # wait for next event
-        read line || break
-        cmd=( $line )
-        # find out event origin
-        case "${cmd[0]}" in
-            tag*)
-                #echo "reseting tags" >&2
-                TAGS=( $(herbstclient tag_status $monitor) )
-                ;;
-            date)
-                #echo "reseting date" >&2
-                date="${cmd[@]:1}"
-                ;;
-            quit_panel)
-                exit
-                ;;
-            togglehidepanel)
-                echo "^togglehide()"
-                if $visible ; then
-                    visible=false
-                    herbstclient pad $monitor 0
-                else
-                    visible=true
-                    herbstclient pad $monitor $panel_height
-                fi
-                ;;
-            reload)
-                exit
-                ;;
-            focus_changed|window_title_changed)
-                windowtitle="${cmd[@]:2}"
-                ;;
+    echo >&3 -n " $sep $brightstatus"
+    echo >&3 -n " $sep $thermstatus"
+    echo >&3 -n " $sep $batstatus"
+    echo >&3 -n " $sep $nowplaying"
+    echo >&3 -n " $sep $date"
+    echo >&3    " $sep "
 
-            toggle_runner)
-                dmenu_run -fn "$font" -nb "$bgcolor" -nf "#efefef" \
-                          -sb "$selbg" -sf "$selfg"
-                ;;
+    # Wait for next event
+    read line || break
+    cmd=( $line )
+    # branch on event origin
+    case "${cmd[0]}" in
+      # First, herbstluft's built-in events...
+      tag*)
+        #echo "reseting tags" >&2
+        TAGS=( $(herbstclient tag_status $monitor) )
+        ;;
 
-            brightness)
-                brightstatus="$(printf '^fg()%d^fg(#909090)%%' $(backlight.sh '?'))"
-                ;;
+      quit_panel|reload)
+        exit ;;
 
-            tick)
-                batstatus="$( t='/sys/class/power_supply/BAT1/'
-                              curr=$(cat $t/charge_now)
-                              full=$(cat $t/charge_full_design)
-                              status=$(cat $t/status)
-                              percent=$(printf '100 * %d / %d\n' $curr $full | bc)
+      togglehidepanel)
+        echo "^togglehide()"
+        if $visible ; then
+            visible=false
+            herbstclient pad $monitor 0
+        else
+            visible=true
+            herbstclient pad $monitor $panel_height
+        fi
+        ;;
 
-                              if [ $status == Full ]; then
-                                printf '^fg(#909090)%s' $status
-                              else
-                                printf '^fg(#909090)%s: ^fg()%d%%' $status $percent
-                              fi )"
+      focus_changed|window_title_changed)
+        windowtitle="${cmd[@]:2}"
+        ;;
 
-                thermstatus="$( t='/sys/class/thermal/thermal_zone0'
-                                curr=$(cat $t/temp)
-                                degrees=$(printf '%d / 1000\n' $curr | bc)
-                                printf '^fg()%d^fg(#909090)C' $degrees )"
-                ;;
+      focus_changed|window_title_changed)
+        windowtitle="${cmd[@]:2}"
+        ;;
 
-            mpd_player|player)
-              # nowplaying="$(mpc current -f '^fg()[%artist% - ][%title%|%file%][ [%time%]]')"
-                nowplaying="$(mpc current -f '^fg()%artist% - %title%')"
-                ;;
-        esac
-        done
-} 2> /dev/null | dzen2 -w $panel_width -x $x -y $y -fn "$font" -h $panel_height \
-    -ta l -bg "$bgcolor" -fg '#efefef'
+      # ...then, custom events
+      toggle_runner)
+        dmenu_run -fn "$font" -nb "$bgcolor" -nf "#efefef" \
+                  -sb "$selbg" -sf "$selfg"
+        ;;
 
+      date)
+        #echo "reseting date" >&2
+        date="${cmd[@]:1}"
+        ;;
 
+      brightness)
+        brightstatus="$(printf '^fg()%d^fg(#909090)%%' $(backlight.sh '?'))"
+        ;;
+
+      tick)
+        batstatus="$( t='/sys/class/power_supply/BAT1/'
+                      curr=$(cat $t/charge_now)
+                      full=$(cat $t/charge_full_design)
+                      status=$(cat $t/status)
+                      percent=$(printf '100 * %d / %d\n' $curr $full | bc)
+
+                      if [ $status == Full ]; then
+                        printf '^fg(#909090)%s' $status
+                      else
+                        printf '^fg(#909090)%s: ^fg()%d%%' $status $percent
+                      fi )"
+
+        thermstatus="$( t='/sys/class/thermal/thermal_zone0'
+                        curr=$(cat $t/temp)
+                        degrees=$(printf '%d / 1000\n' $curr | bc)
+                        printf '^fg()%d^fg(#909090)°C' $degrees )"
+        ;;
+
+      mpd_player|player)
+      # nowplaying="$(mpc current -f '^fg()[%artist% - ][%title%|%file%][ [%time%]]')"
+        nowplaying="$(mpc current -f '^fg()%artist% - %title%')"
+        ;;
+    esac
+  done
+} 2>/dev/null \
+  1> >(dzen2 -fn "$font" -y $y -h $panel_height -fg '#efefef' -bg "$bgcolor" \
+             -ta l  -x $x  -w $panel_left_width) \
+  3> >(dzen2 -fn "$font" -y $y -h $panel_height -fg '#efefef' -bg "$bgcolor" \
+             -ta r  -x $panel_left_width  -w $panel_right_width)
+
+

other/X11/xorg.conf.d/10-evdev.conf

         MatchDevicePath "/dev/input/event*"
         Driver "evdev"
        #Option "XkbSymbols" "pc+se-ff+inet(evdev)+ctrl(swapcaps)"
+        Option "XkbCompat" "firefly"
         Option "XkbLayout"  "se-ff"
        #Option "XkbOptions" "ctrl:nocaps"
        #Option "XkbOptions" "ctrl:swapcaps"
 // $XKeyboardConfig$
 // $XFree86: xc/programs/xkbcomp/symbols/se,v 1.5 2003/01/26 02:01:48 dawes Exp $
 
-//partial hidden modifier_keys xkb_symbols "tweaks" {
-//	// rebind caps to escape
-////	key <caps> { [ escape,      escape     ] }; // caps:escape
-////	key <esc>  { [ voidsymbol,  voidsymbol ] };
-//    key <caps> { [ control_l,   control_l  ] };
-//
-//    replace key <caps>  {  [ control_l  ] };
-//    replace key <lctl>  {  [ voidsymbol ] };
-// // modifier_map  control { <caps>, <lctl> };
-//
-////	key <tab>  { [ escape,      escape     ] };
-////	key <lctl> { [ tab,         tab        ] };
-////	key <lsgt> { [ control_l,   control_l  ] };
-//
-//	// rebind altgr to act as ctrl, and move altgr to the right (to rwin/menu)
-////	key <ralt> { [ control_r               ] };
-////	key <rwin> { [ iso_level3_shift        ] };
-////	key <menu> { [ iso_level3_shift        ] };
-////	modifier_map control { <ralt> };
-//
-////	key <lctl> { [ voidsymbol              ] };
-////	key <rtsh> { [ menu                    ] };
-//
-////	key <menu> { [ control_r,   control_r  ] }; // ctrl:menu_rctrl
-//};
 default partial alphanumeric_keys xkb_symbols "crazy" {
     name[Group1]="Sweden - Dvorak";
 
     include "se(basic)"
 
-    key <AD01> { [     aring,      Aring,           at,           at ]	};  // U+2200 FOR ALL
-    key <AD02> { [ adiaeresis, Adiaeresis,          at,           at ]	};  // U+2203 THERE EXISTS
-    key <AD03> { [ odiaeresis, Odiaeresis,    EuroSign,           at ]	};
-    key <AD04> { [         p,          P,           at,           at ]	};
-    key <AD05> { [         y,          Y,           at,           at ]	};  // U+2286 SUBSET OF OR EQUAL TO
-    key <AD06> { [         f,          F,           at,           at ]	};  // U+2287 SUPERSET OF OR EQUAL TO
-    key <AD07> { [         g,          G,          jot,           at ]	}; // U+2219 BULLET OPERATOR
-    key <AD08> { [         c,          C,           at,           at ]	};
-    key <AD09> { [         r,          R,           at,           at ]	};
-    key <AD10> { type[Group1] = "THREE_LEVEL", symbols[Group1] = [ l, L, Right ] };
-    key <AD11> { [     comma,  semicolon,      radical,  dead_ogonek ]	};
-    key <AD12> { [ dead_diaeresis, dead_circumflex, asciitilde, asciicircum ]	};
- // key <AD12> { [ dead_diaeresis, dead_circumflex, dead_tilde, asciicircum ]	};
+  //key.type[group1]="EIGHT_LEVEL_ALPHABETIC";
 
-// elementof, notelementof; containsas, U220C; therefore, because
+    key <AD01> { [     aring,      Aring,           at,           at ] };
+    key <AD02> { [ adiaeresis, Adiaeresis,          at,           at ] };
+    key <AD03> { [ odiaeresis, Odiaeresis,    EuroSign,           at ] };
+    key <AD04> { [         p,          P,           at,           at ] };
+    key <AD05> { [         y,          Y,           at,           at ] };
+    key <AD06> { [         f,          F,           at,           at ] };
+    key <AD07> { [         g,          G,          jot,           at ] };
+    key <AD08> { [         c,          C,           at,           at ] };
+    key <AD09> { [         r,          R,           at,           at ] };
+    key <AD10> { [         l,          L,        Right               ] };
+    key <AD11> { [     comma,  semicolon,      radical,  dead_ogonek ] };
+    key <AD12> { [ dead_diaeresis, dead_circumflex, asciitilde, asciicircum ] };
 
-    key <AC01> { [         a,          A,           ae,           AE ]	};
-    key <AC02> { [         o,          O,       oslash,       Oslash ]	};
-    key <AC03> { [         e,          E,          Tab,           at ]	};
-    key <AC04> { [         u,          U, ISO_Left_Tab,           at ]	};
-    key <AC05> { [         i,          I,     infinity,           at ]	};
-    key <AC06> { [         d,          D,           at,           at ]	};
+  //key <AC01> { [         a,          A,           ae,           AE ] };
+    key <AC01> { [         a,          A,           ae,           AE, o,o,o,o ] };
+    key <AC02> { [         o,          O,       oslash,       Oslash ] };
+    key <AC03> { [         e,          E,          Tab,           at ] };
+    key <AC04> { [         u,          U, ISO_Left_Tab,           at ] };
+    key <AC05> { [         i,          I,     infinity,           at ] };
+    key <AC06> { [         d,          D,           at,           at ] };
     // TODO: make sure that e.g. altgr+shift+h gets interpreted as Shift+Left
-    key <AC07> { type[Group1] = "THREE_LEVEL", symbols[Group1] = [ h, H,  Left ] };
-    key <AC08> { type[Group1] = "THREE_LEVEL", symbols[Group1] = [ t, T,  Down ] };
-    key <AC09> { type[Group1] = "THREE_LEVEL", symbols[Group1] = [ n, N,    Up ] };
-    key <AC10> { type[Group1] = "THREE_LEVEL", symbols[Group1] = [ s, S, Right ] };
-    key <AC11> { [     minus, underscore, dead_belowdot, dead_macron ]	};
+    key <AC07> { [         h,          H,         Left               ] };
+    key <AC08> { [         t,          T,         Down               ] };
+    key <AC09> { [         n,          N,           Up               ] };
+    key <AC10> { [         s,          S,        Right               ] };
+ // key <AC07> { symbols[Group1] = [ h, H,  Left ] };
+ // key <AC08> { symbols[Group1] = [ t, T,  Down ] };
+ // key <AC09> { symbols[Group1] = [ n, N,    Up ] };
+ // key <AC10> { symbols[Group1] = [ s, S, Right ] };
+    key <AC11> { [     minus, underscore, dead_belowdot, dead_macron ] };
+//  key <AC12> { [     minus, underscore, dead_belowdot, dead_macron ] };
+    key <BKSL> { [ apostrophe,  asterisk,         grave,    multiply ] };
 
-    key <AB01> { [    period,   colon, periodcentered, dead_abovedot ]	};
-    key <AB02> { [         q,          Q,           at,      because ]	};
-    key <AB03> { type[Group1] = "THREE_LEVEL", symbols[Group1] = [ j, J,  Down ] };
-  //key <AB03> { [         j,          J,    elementof, notelementof ]	};
-    key <AB04> { type[Group1] = "THREE_LEVEL", symbols[Group1] = [ k, K,    Up ] };
-  //key <AB04> { [         k,          K,           at,           at ]	};
-    key <AB05> { [         x,          X,           at,           at ]	};
-    key <AB06> { [         b,          B,           at,           at ]	};
-    key <AB07> { [         m,          M,           mu,           at ]	};
-    key <AB08> { [         w,          W,           at,           at ]	};
-    key <AB09> { [         v,          V,           at,           at ]	};
-    key <AB10> { [         z,          Z,           at,           at ]	};
+    key <AB01> { [    period,   colon, periodcentered, dead_abovedot ] };
+    key <AB02> { [         q,          Q,           at,      because ] };
+    key <AB03> { [         j,          J,         Down               ] };
+ // key <AB03> { symbols[Group1] = [ j, J,  Down ] };
+  //key <AB03> { [         j,          J,    elementof, notelementof ] };
+    key <AB04> { [         k,          K,           Up               ] };
+ // key <AB04> { symbols[Group1] = [ k, K,    Up ] };
+  //key <AB04> { [         k,          K,           at,           at ] };
+    key <AB05> { [         x,          X,           at,           at ] };
+    key <AB06> { [         b,          B,           at,           at ] };
+    key <AB07> { [         m,          M,           mu,           at ] };
+    key <AB08> { [         w,          W,           at,           at ] };
+    key <AB09> { [         v,          V,           at,           at ] };
+    key <AB10> { [         z,          Z,           at,           at ] };
 
-    replace key <CAPS>  {  [ Control_L  ] };
-    replace key <LCTL>  {  [ VoidSymbol ] };
+    replace key <CAPS>  { type="ONE_LEVEL", [ Control_L  ] };
+    replace key <LCTL>  { type="ONE_LEVEL", [ VoidSymbol ] };
+
+  //replace key <MENU>  { type="ONE_LEVEL", [ ISO_Level5_Shift ] };
 
     // åäöpyfgcrl,¨  ÅÄÖPYFGCRL;^  ..........√   ..........
     // aoeuidhtns-   AOEUIDHTNS_   æø()∞.{}..    ÆØ....[]..¯
 
 };
 
+//xkb_compatibility "compat" {
+//  include "complete"
+//
+//  replace indicator "Caps Lock" {
+//    !allowExplicit;
+// // whichModState= locked;
+//    whichModState = latched;
+//    modifiers     = Lock;
+//  };
+//};
+
+//partial hidden modifier_keys xkb_symbols "tweaks" {
+//	// rebind caps to escape
+////	key <caps> { [ escape,      escape     ] }; // caps:escape
+////	key <esc>  { [ voidsymbol,  voidsymbol ] };
+//    key <caps> { [ control_l,   control_l  ] };
+//
+//    replace key <caps>  {  [ control_l  ] };
+//    replace key <lctl>  {  [ voidsymbol ] };
+// // modifier_map  control { <caps>, <lctl> };
+//
+////	key <tab>  { [ escape,      escape     ] };
+////	key <lctl> { [ tab,         tab        ] };
+////	key <lsgt> { [ control_l,   control_l  ] };
+//
+//	// rebind altgr to act as ctrl, and move altgr to the right (to rwin/menu)
+////	key <ralt> { [ control_r               ] };
+////	key <rwin> { [ iso_level3_shift        ] };
+////	key <menu> { [ iso_level3_shift        ] };
+////	modifier_map control { <ralt> };
+//
+////	key <lctl> { [ voidsymbol              ] };
+////	key <rtsh> { [ menu                    ] };
+//
+////	key <menu> { [ control_r,   control_r  ] }; // ctrl:menu_rctrl
+//};
+
 
 //default partial alphanumeric_keys xkb_symbols "crazy" {
 partial alphanumeric_keys xkb_symbols "crazy" {
 "nnoremap <Leader>-  :split<CR>
 "nnoremap <Leader>\| :vsplit<CR>
 
-nnoremap <Leader>q :q<CR>
+" NO! use <C-w>q
+"nnoremap <Leader>q :q<CR>
 
 " Make Y behave similar to D
 map Y y$
 #exec xterm
 #exec openbox-session
 #exec twm
- exec awesome
-#exec herbstluftwm
+#exec awesome
+exec herbstluftwm