/etc/skel/.zshrc: added function fluxkey-change 0.3.3
authorMichael Prokop <mika@grml.org>
Thu, 17 May 2007 13:09:51 +0000 (15:09 +0200)
committerMichael Prokop <mika@grml.org>
Thu, 17 May 2007 13:09:51 +0000 (15:09 +0200)
debian/changelog
etc/skel/.zshrc

index 83496f4..1580439 100644 (file)
@@ -1,3 +1,11 @@
+grml-etc-core (0.3.3) unstable; urgency=low
+
+  * /etc/skel/.zshrc:
+    - added function fluxkey-change to change fluxbox keys
+      from 'Alt-#' to 'Alt-F#' and vice versa
+
+ -- Michael Prokop <mika@grml.org>  Thu, 17 May 2007 15:08:57 +0200
+
 grml-etc-core (0.3.2) unstable; urgency=low
 
   * /etc/skel/.zshrc: added zsh-mime-setup, thanks wuehlmaus!
index 27d1045..aa1b3e3 100644 (file)
@@ -3,7 +3,7 @@
 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
 # Bug-Reports:   see http://grml.org/bugs/
 # License:       This file is licensed under the GPL v2.
-# Latest change: Die Mai 15 11:21:56 CEST 2007 [mika]
+# Latest change: Don Mai 17 15:08:21 CEST 2007 [mika]
 ################################################################################
 
 # source ~/.zshrc.global {{{
     | sed 's/value=//;s/"//g'
 }
 
+# change fluxbox keys from 'Alt-#' to 'Alt-F#' and vice versa
+  fluxkey-change() {
+    [ -n "$FLUXKEYS" ] || local FLUXKEYS="$HOME/.fluxbox/keys"
+    if ! [ -r "$FLUXKEYS" ] ; then
+       echo "Sorry, \$FLUXKEYS file $FLUXKEYS could not be read - nothing to be done."
+       return 1
+    else
+       if grep -q 'Mod1 F[0-9] :Workspace [0-9]' $FLUXKEYS ; then
+          echo -n 'Switching to Alt-# mode in ~/.fluxbox/keys: '
+          sed -i -e 's|^\(Mod[0-9]\+[: space :]\+\)F\([0-9]\+[: space :]\+:Workspace.*\)|\1\2|' $FLUXKEYS && echo done || echo failed
+       elif grep -q 'Mod1 [0-9] :Workspace [0-9]' $FLUXKEYS ; then
+          echo -n 'Switching to Alt-F# mode in ~/.fluxbox/keys: '
+          sed -i -e 's|^\(Mod[0-9]\+[: space :]\+\)\([0-9]\+[: space :]\+:Workspace.*\)|\1F\2|' $FLUXKEYS && echo done || echo failed
+       else
+          echo 'Sorry, do not know what to do.'
+          return 1
+       fi
+    fi
+  }
+
 # }}}
 
 # mercurial related stuff {{{