Posted to tcl by patthoyts at Fri Nov 14 23:08:07 GMT 2008view raw

  1. # Use the Extended Window Manager Hints properties to find out the
  2. # name of the current window manager.
  3. proc get_wm_name {} {
  4. set result {}
  5. set atom _NET_SUPPORTING_WM_CHECK
  6. if {![catch {exec xprop -root -f $atom 32x " \$0+" $atom} check]} {
  7. set wid [lindex $check 1]
  8. set atom _NET_WM_NAME
  9. if {![catch {exec xprop -id $wid -f $atom 8t " \$0+" $atom} name]} {
  10. set result [lindex $name 1]
  11. }
  12. }
  13. return $result
  14. }
  15.  
  16. proc ::choosefont::select_system {} {
  17. package require Tk
  18. wm with .
  19. switch -exact -- [tk windowingsystem] {
  20. win32 {
  21. critcl::tsources choose_w32.tcl
  22. }
  23. x11 {
  24. switch -exact -- [lindex [set name [get_wm_name]] 0] {
  25. Metacity -
  26. IceWM - {
  27. critcl::tsources choose_gtk.tcl
  28. }
  29. KWin {
  30. return -code error "KDE version not implemented yet"
  31. }
  32. default {
  33. return -code error "window manager \"$name\" not supported"
  34. }
  35. }
  36. }
  37. aqua -
  38. default {
  39. return -code error "platform not supported"
  40. }
  41. }
  42. }