AWESOME! This is a small program for linux to switch between desktop/workspaces with customizable labels.
Requires the package NX (descendant of Xotcl)
http://wiki.tcl.tk/36705
Tested on Ubuntu 12.04 with Unity 2D and Gnome (no effects).
At the moment will not work on Unity 3D or Gnome with effects, but it can easily be fixed by modifing the wmctrl -s statement.
ENJOY..!!!
package require Tk
package require Tclx
package require nx
namespace import ::nx::*
set deskCount 0
set activeDesk [exec wmctrl -d | cut -f 1,3 -d { } | grep \* | cut -f 1 -d { }]
Class create Desk {
:variable deskName {}
:method init {} {
wm withdraw .
destroy .desk
toplevel .desk
wm attributes .desk -topmost 1 ; # on top
wm geometry .desk +0+0
wm overrideredirect .desk yes ; # remove window decorations
}
:public method add {name} {
global deskCount
global deskCountList
lappend :deskName $name
lappend deskCountList $deskCount
label .desk.lbl_$deskCount -text $name -height 1 -padx 7 -pady 0 -bg #222222 -fg #bdbdbd
bind .desk.lbl_$deskCount <ButtonPress-1> "[self] pressed $deskCount"
pack .desk.lbl_$deskCount -side left ; incr deskCount
}
:public method pressed {desk} {
global deskCountList
set active [.desk.lbl_$desk cget -text]
foreach c $deskCountList {
.desk.lbl_$c configure -fg [expr {[.desk.lbl_$c cget -text] eq $active ? "#efefef" : "#bdbdbd"}]
.desk.lbl_$c configure -bg [expr {[.desk.lbl_$c cget -text] eq $active ? "#535d6c" : "#222222"}] }
exec wmctrl -s $desk
global deskCount
global activeDesk
foreach app [lindex ${:deskApp} $activeDesk] {
label .desk.lbl_$deskCount -text $app -height 1 -padx 7 -pady 0 -bg #535149 -fg #DFDBD2
pack .desk.lbl_$deskCount -side left ; incr deskCount
}
}
}
Desk create desk
desk add main
desk add development
desk add television
desk add office
desk pressed $activeDesk