Commits

Julien Jehannet committed 99570a2

update documentation

Comments (0)

Files changed (5)

 
 - no alternate switch between column mode (ala dwm)
 - clean-up actions/ directory
+- support of XF86 multimedia key
 
-Event loop
-----------
+Events and hooks
+----------------
 
 All Wmii events can be hooked by zsh functions.
 
-For example, the **Wmii** hook is in charge of managing Wmii instance.
-The **FocusFloating** event hook change the color on the fly.
+For example, the **FocusFloating** event runs the hook responsible of changing the color on the fly and the **Wmii** hook is in charged of managing the session.
+
+See the `functions/events` directory for more examples.
+
 
 System menu
 -----------
 
-*MODKEY-F1* opens up a Wmii menu file with some utilities:
+*MODKEY-F1*  (or *MODKEY-MENU*) displays help about keybindings configuration.
 
+*MODKEY-F12* opens up Wmii menu for following actions:
+
+- access: go to actions menu
+- term: run a terminal
+- lock: run the $WMII_XLOCK program
 - kill: kill a process
-- lock: run the $WMII_XLOCK program
 - fontsel: select a new font with xfontsel
-- showkeys: generate a dynamic help file which describe keybindings
+- help: generate a dynamic help file which describe current key bindings
+- keys: reload keys configuration
+- autostart: launch programs found in *autostart/* directory
+- rbar: relaunch right bar applications
 - restart: reload Wmii instance and configuration
 - destroy: destroy a window with the process inside
 - quit: quit Wmii
 
-*MODKEY-F2* is the standard run command helper (*MODKEY-p*) but using zsh directly.
+*MODKEY-F2* (or *MODKEY-p*) is the standard run command helper (using zsh directly).
 
-*MODKEY-F3* list available actions. See it as a kind of shell scripts repository (*MODKEY-a*). I tried to pick some ideas from the `Ubiquity project <https://mozillalabs.com/ubiquity/>`__.
-To be honnest, It's quite unusable and bloated...
+*MODKEY-F3* (or *MODKEY-Return*) run a new terminal.
+
+*MODKEY-F4* list available actions. See it as a kind of shell scripts repository (*MODKEY-a*). I tried to pick some ideas from the `Ubiquity project <https://mozillalabs.com/ubiquity/>`__ and `simpled <http://www.logilab.org/project/simpled>`__:
 
 - 118k
 - browse
 - urls
 - wikipedia
 
-*MODKEY-F12* displays keybindings configuration.
+**Warning: to be honest, it's quite unstable and bloated...**
 
 Zsh functions
 -------------
 
-Some zsh functions are provided as wrapper to handy utilities:
+Some zsh functions are provided as handy wrappers for well-known utilities:
 
 - wmii_9menu
 - wmii_dmenu
 - wmii_msg
 - wmii_volume
 
-Usefull when you want to change command-line parameters of the subcalled programs. I'm not using theses ones much anymore since I re-compile suckless-tools myself now.
+Mainly used to group command-line options of the subcalled programs. I'm not using theses ones much anymore since new versions of Wmii provide their own commands now.
 
 Left status bar
 ---------------
 Tips
 ~~~~
 
+- type '-' as input to remove current tag for the current client
 - preprend tags with '.' to have them left-aligned
 - preprend tags with '#' if you want want to hide them from the tag bar
 
 Right status bar
 ----------------
 
-I add some generic "widgets" with possible mouse actions (see *RightBarClick* event):
+I add some "widgets" (humm..) with possible mouse actions (see *RightBarClick* event):
 
 - 00_hostname: host name
 - 10_network_eth: bandwidth statistics
 Keybindings
 -----------
 
-All keybindings are defined in the ``keys`` file, which could let you change easily.
-You can see current configuration thanks to the ``showkeys`` action (*MODKEY-F12*)
+All keybindings are defined in the `keys` file, which could let you change easily.
+You can see current configuration thanks to the ``help`` action (*MODKEY-F1*)
 
 Here is my configuration::
 
-	 Major Keys Variables
-		MODKEY=Mod4
-		UP=k
-		DOWN=j
-		LEFT=h
-		RIGHT=l
-		MENUKEY=Menu
+	 Major Keys Variables (read /usr/include/X11/keysymdef.h)
+			MODKEY=Mod4
+			UP=k
+			DOWN=j
+			LEFT=h
+			RIGHT=l
+			MENUKEY=Menu
+
+	 Font
+			WMII_FONT='-*-terminus-*-r-*-*-12-*-*-*-*-*-*-u'
+
+	 Wmii environment
+			WMII_TERM="xterm"
+			WMII_XLOCK=slock
+			WMII_LOGFILE=/tmp/wmii-$USER.log
+			WMII_VIEWFILE=$TMPDIR/wmii.view
+
+
+	 Theme
+
+		 Background color
+			WMII_BACKGROUND='	333333'
+
+		 Colors
+			WMII_NORMCOLORS='	888888 	111111 	333333'
+			WMII_FOCUSCOLORS='	ffff00 	333333 	ffff00'
+			WMII_NOTIFCOLORS='	AA11AA 	333333 	111111'
+			WMII_STATUSCOLORS="	222222 	6FCF87 	2A7F3F"
 
 	 Floating layer
 		 Toggle selected client between floating and managed layers
 			$MODKEY-Shift-space
 		 Toggle between floating and managed layers
-			$MODKEY-Control-space
+			$MODKEY-space $MODKEY-Control-space
 
 	 Client actions
 		 Toggle selected client's fullsceen state
 		 Close client
 			$MODKEY-BackSpace
 		 Destroy client
-			$MODKEY-Shift-c
+			XF86ClearGrab $MODKEY-Shift-c
 
 	 Changing column modes
 		 Set column to default mode
 			$MODKEY-s
 		 Set column to max mode
 			$MODKEY-m
-		 Toggles between current and previous layout
-			$MODKEY-space
 
-	 Wmii system menu
+	 Wmii oddities
+		 Wmii system menu
+			$MODKEY-F12 $MODKEY-$MENUKEY
+		 Wmii status bar
+			$MODKEY-b
+		 Wmii help
 			$MODKEY-F1
-			$MODKEY-$MENUKEY
-		 Keybindings
-			$MODKEY-F12
 
 	 Running programs
 		 Open program menu
-			$MODKEY-F2
-			$MODKEY-p
+			XF86Start $MODKEY-F2 $MODKEY-p
 		 Launch a terminal
-			$MODKEY-Return
+			XF86Terminal $MODKEY-F3 $MODKEY-Return
 		 Launch a terminal on right column
 			$MODKEY-Shift-Return
 		 Open wmii actions menu
-			$MODKEY-F3
-			$MODKEY-a
-		 Open X selection to browser
-			$MODKEY-o
+			$MODKEY-F4 $MODKEY-a
+		 Run file manager
+			XF86HomePage
+		 Open selected URL in browser
+			XF86OpenURL $MODKEY-o
+		 Run browser
+			XF86WWW
+		 Run mailer
+			XF86Mail
 		 Take a screenshot
 			$MODKEY-Print
 		 Edit file
 			$MODKEY-e
-		 Volume up
-			$MODKEY-KP_Add
-		 Volume down
-			$MODKEY-KP_Subtract
+		 Run messager
+			XF86Messenger
+		 Set away status
+			XF86Away
+		 Search
+			XF86Search
+		 Hot links
+			XF86HotLinks
 
 	 Tag actions
 		 Change to another tag
 
 	 Moving around
 		 Select the client to the left
-			$MODKEY-$LEFT
-			$MODKEY-Left
+			$MODKEY-$LEFT $MODKEY-Left
 		 Select the client to the right
-			$MODKEY-$RIGHT
-			$MODKEY-Right
+			$MODKEY-$RIGHT $MODKEY-Right
 		 Select the client below
-			$MODKEY-$DOWN
-			$MODKEY-Down
+			$MODKEY-$DOWN $MODKEY-Down
 		 Select the client above
-			$MODKEY-$UP
-			$MODKEY-Up
+			$MODKEY-$UP $MODKEY-Up
 
 	 Moving clients around
 		 Move selected client to the left
-			$MODKEY-Shift-$LEFT
-			$MODKEY-Shift-Left
+			$MODKEY-Shift-$LEFT $MODKEY-Shift-Left
 		 Move selected client to the right
-			$MODKEY-Shift-$RIGHT
-			$MODKEY-Shift-Right
+			$MODKEY-Shift-$RIGHT $MODKEY-Shift-Right
 		 Move selected client down
-			$MODKEY-Shift-$DOWN
-			$MODKEY-Shift-Down
+			$MODKEY-Shift-$DOWN $MODKEY-Shift-Down
 		 Move selected client up
-			$MODKEY-Shift-$UP
-			$MODKEY-Shift-Up
+			$MODKEY-Shift-$UP $MODKEY-Shift-Up
 
 	 Moving through stacks
 		 Swap selected client left
-			$MODKEY-Control-$LEFT
-			$MODKEY-Control-Left
+			$MODKEY-Control-$LEFT $MODKEY-Control-Left 
 		 Swap selected client right
-			$MODKEY-Control-$RIGHT
-			$MODKEY-Control-Right
+			$MODKEY-Control-$RIGHT $MODKEY-Control-Right
 		 Select the stack below
-			$MODKEY-Control-$DOWN
-			$MODKEY-Control-Down
+			$MODKEY-Control-$DOWN $MODKEY-Control-Down
 		 Select the stack above
-			$MODKEY-Control-$UP
-			$MODKEY-Control-Up
-		Move to the numbered tag
+			$MODKEY-Control-$UP $MODKEY-Control-Up
+		 Move to the numbered tag
 			$MODKEY-$i
-		Retag selected client with the numbered tag
+		 Retag selected client with the numbered tag
 			$MODKEY-Shift-$i
 
+	 Resizing clients
+		 Shrink horizontally
+			$MODKEY-y
+			$MODKEY-Shift-y
+		 Grow horizontally
+			$MODKEY-u
+			$MODKEY-Shift-u
+		 Shrink vertically
+			$MODKEY-i
+			$MODKEY-Shift-i
+		 Grow vertically
+			$MODKEY-g
+			$MODKEY-Shift-g
+
+	 Multimedia
+		 Volume up
+			$MODKEY-KP_Add
+			XF86AudioRaiseVolume
+		 Volume down
+			$MODKEY-KP_Subtract
+			XF86AudioLowerVolume
+		 Toggle Volume
+			XF86AudioMute
+		 Audio Pause
+			XF86AudioPause
+
+	 System
+		 Lock the session
+			XF86ScreenSaver
+		 Battery status
+			XF86Battery
+		 Network: Bluetooth status
+			XF86Bluetooth
+		 Network: Wireless status
+			XF86WLAN
+		 Log off
+			XF86LogOff
+
 
 Have fun.
-# Major Keys Variables
-# Read /usr/include/X11/keysymdef.h
-
+# Major Keys Variables (read /usr/include/X11/keysymdef.h)
 MODKEY=Mod4
 UP=k
 DOWN=j
 RIGHT=l
 MENUKEY=Menu
 
+# Font
+WMII_FONT='-*-terminus-*-r-*-*-12-*-*-*-*-*-*-u'
+
 # Wmii environment
 WMII_TERM="xterm"
 WMII_XLOCK=slock
 WMII_LOGFILE=/tmp/wmii-$USER.log
 WMII_VIEWFILE=$TMPDIR/wmii.view
-WMII_FONT='-*-terminus-*-r-*-*-12-*-*-*-*-*-*-u'
 
-# Define colors variables for some scripts when sourcing
+
+# Theme
+
+## Background color
 WMII_BACKGROUND='#333333'
 
-# Colors tuples: "<text> <background> <border>"
+## Colors
+#"<text> <background> <border>"
 WMII_NORMCOLORS='#888888 #111111 #333333'
 WMII_FOCUSCOLORS='#ffff00 #333333 #ffff00'
 WMII_NOTIFCOLORS='#AA11AA #333333 #111111'
 WMII_STATUSCOLORS="#222222 #6FCF87 #2A7F3F"
 
+#! Caution: color are extracted to shell parameters
 #set -- $(echo $WMII_NORMCOLORS $WMII_FOCUSCOLORS)
 set -- ${(s: :)$(echo $WMII_NORMCOLORS $WMII_FOCUSCOLORS)}

functions/events/Key

 #!/bin/zsh -f
 
-[[ -f ~/.echo ]] && wmii_key $@
+[[ -n $WMII_DEBUG ]] && wmii_key $@
 $@

functions/events/Wmii

 		source $WMII_PATH/keys
 		functions | sed -n "s/^\($MODKEY-.*\) () {/\1/p" | wmiir write /keys
 		#functions | sed -n "s/^\($MODKEY-.*\|XF86.*\) () {/\1/p" | wmiir write /keys
-		wmiir read /keys > ${WMII_LOGFILE}.keys
 		;;
 	start)
 		rm -rf $WMII_LOGFILE
 	lock)
 		$WMII_XLOCK
 		;;
-	showkeys)
-		sed -r -n -e '/^$/p' -e '/^#/p' -e 's/^(\w+=\w+)$/\t\t\1/p' -e 's/^function (.*) \{/\n\t\t\t\1/p' $WMII_PATH/keys | tr '#' '\t' > $TMPDIR/wmii.keys
-		xmessage -file $TMPDIR/wmii.keys -fn ${WMII_FONT%%,*}
-		rm -f $TMPDIR/wmii.keys
+	help)
+		HELP_FILE=$TMPDIR/wmii.keys
+		sed -r -n -e '/^$/p' -e '/#+ /p' -e '/^[[:upper:]]+/s/(.*)/###\1/p' $WMII_PATH/environ | tr '#' '\t' > $HELP_FILE
+		sed -r -n -e '/^$/p' -e '/^#/p' -e 's/^(\w+=\w+)$/\t\t\1/p' -e 's/^function (.*) \{/\n\t\t\t\1/p' $WMII_PATH/keys | tr '#' '\t' >> $HELP_FILE
+		xmessage -file $HELP_FILE
+		rm -f $HELP_FILE
 		;;
 	fontsel)
 		wmiir xwrite /ctl font $(xfontsel -print)
 		eval $PWD/$do &!
 		;;
 	menu)
-		menus=(actions term lock kill fontsel showkeys keys autostart rbar restart destroy quit)
+		menus=(actions term lock kill fontsel help keys autostart rbar restart destroy quit)
 		if [[ -n "$2" ]]; then
 			menu=$(wmii_9menu $menus)
 		else
 # Wmii oddities
 
 ## Wmii system menu
-function $MODKEY-$MENUKEY $MODKEY-F1 {
+function $MODKEY-F12 $MODKEY-$MENUKEY {
 	#CLIENT=$(wmiir read /client/sel/ctl)
 	#wmii_msg $CLIENT $(wmiir read /client/sel/label)
 	echo "Wmii menu" | wmiir write /event
 	fi
 }
 
-## Wmii keybindings
-function $MODKEY-F12 {
-	echo "Wmii showkeys" | wmiir write /event
+## Wmii help
+function $MODKEY-F1 {
+	echo "Wmii help" | wmiir write /event
 }
 
 
 }
 
 ## Launch a terminal
-function XF86Terminal $MODKEY-Return {
+function XF86Terminal $MODKEY-F3 $MODKEY-Return {
 	# eval wmiir setsid $WMII_TERM &
 	$WMII_TERM &!
 }
 }
 
 ## Open wmii actions menu
-function $MODKEY-F3 $MODKEY-a {
+function $MODKEY-F4 $MODKEY-a {
 	wmiir xwrite /event Wmii actions
 }
 
+## Run file manager
+function XF86HomePage {
+	rox-filer &
+}
+
 ## Open selected URL in browser
 function XF86OpenURL $MODKEY-o {
 	echo "Wmii actions open" | wmiir write /event
 }
 
+## Run browser
+function XF86WWW {
+	pick-web-browser &
+}
+
+## Run mailer
+function XF86Mail {
+	$WMII_TERM -e mutt &
+}
+
 ## Take a screenshot
 function $MODKEY-Print {
 	import -quality 60 -comment "%m:%f %wx%h" ~/screenshot.png
 	echo "Wmii actions edit" | wmiir write /event
 }
 
+## Run messager
+function XF86Messenger {
+}
+
+## Set away status
+function XF86Away {
+}
+
+## Search
+function XF86Search {
+}
+
+## Hot links
+function XF86HotLinks {
+	apwal &
+}
 
 # Tag actions
 
 	wmiir xwrite /tag/sel/ctl grow sel sel down 2
 	wmiir xwrite /tag/sel/ctl grow sel sel up 2
 }
-
-
  #for i in "'Mod1' grow" "Mod1-Control grow -1" "Mod1-Shift nudge"; {
  #	eval "set -- $i"; mod="$1"; cmd=$2; shift 2
  #	function $mod-$LEFT {
  #}
 
 
-# Desktop
-
+# Multimedia
 
 ## Volume up
 function $MODKEY-KP_Add {
 	wmii_volume 5%+
 }
+function XF86AudioRaiseVolume {
+	amixer set Master 10+
+}
 
 ## Volume down
 function $MODKEY-KP_Subtract {
 	wmii_volume 5%-
 }
-
 function XF86AudioLowerVolume {
 	amixer set Master 10-
 }
 
+## Toggle Volume
 function XF86AudioMute {
 	amixer set Master toggle
 }
 
-function XF86AudioRaiseVolume {
-	amixer set Master 10+
-}
-
+## Audio Pause
 function XF86AudioPause {
 }
 
-function XF86HomePage {
-	rox-filer &
-}
 
-function XF86WWW {
-	pick-web-browser &
-}
+# System
 
-function XF86Mail {
-	$WMII_TERM -e mutt &
-}
-
+## Lock the session
 function XF86ScreenSaver {
 	$WMII_XLOCK
 }
 
+## Battery status
 function XF86Battery {
 	$WMII_TERM -e acpitool && read &
 }
 
+## Network: Bluetooth status
 function XF86Bluetooth {
 }
 
+## Network: Wireless status
 function XF86WLAN {
 	#iwconfig wlan0 power off
+	wmii_msg $(iwlist wlan0 power)
+	wmii_osd $(iwlist wlan0 power)
 }
 
-function XF86Messenger {
-}
-
-function XF86Away {
-}
-
+## Log off
 function XF86LogOff {
 }
-
-function XF86Search {
-}
-
-function XF86HotLinks {
-	apwal &
-}
-
-