;;;
;  This file includes scwm configuration for using with wm-icons.
;  Optimized for the default scwm-0.9 configuration.
;  Using this file doesn't break your existing .scwmrc, just extends it.
;  You probably need to edit it if you have a non-default configuration.
;
;  Instructions:
;    1) Install wm-icons (configure & make install)
;    2) Copy this file to home directory (add leading dot) and put this line:
;         (load ".scwmrc-wm-icons")
;       as the last line of your .scwmrc
;    3) (Re)Start scwm
;
;  The file is not perfect, it'll be better in the next versions.
;  Send your comments to migo@homemail.com.
;;;


(set! image-load-path
	(append! (list
		(string-append (user-home) "~/@userdir@") "@icondir@"
	) image-load-path)
)
(use-modules (app scwm flux))  ; for window-info

;; You can comment this out or in to get title-icon for any window a-la fvwm95.
;(set-button-face! 1 (make-face '((relief raised)) '((pixmap mini-program-icon))))


{{DEFINE_ALL_ICONS}}


;;;
;  Change Icon Set submenu
;;;

;;
;; This defines the submenu for changing icon set online.
;; wm-icons-config must be in your path or put full path in #:action below.
;;

(define menu-icon-sets (menu (list
	(menuitem "Change Icon Set" #:image-left wmi-menu-themes)
	menu-title menu-separator
{{MINI_ICON_SET_ITERATOR("
	(menuitem "menu	@ICON_SET@" @ADJUST@#:image-left wmi-menu-item #:action "wm-icons-config -q -p -f menu @ICON_SET@")
")}}
	menu-separator
{{MINI_ICON_SET_ITERATOR("
	(menuitem "mini	@ICON_SET@" @ADJUST@#:image-left wmi-menu-item #:action "wm-icons-config -q -p -f mini @ICON_SET@")
")}}
	menu-separator
{{NORM_ICON_SET_ITERATOR("
	(menuitem "norm	@ICON_SET@" @ADJUST@#:image-left wmi-menu-item #:action "wm-icons-config -q -p -f norm @ICON_SET@")
")}}
	menu-separator
{{SIZE_ICON_SET_ITERATOR("16x16", "
	(menuitem "16x16	@ICON_SET@" @ADJUST@#:image-left wmi-menu-item #:action "wm-icons-config -q -p -f 16x16 @ICON_SET@")
")}}
	menu-separator
	(menuitem "Restart	to activate" #:image-left wmi-menu-restart #:action (lambda () (restart "scwm")))
)))

;; You can comment the following out or in.
(bind-mouse 'root "C-M-S-3" (lambda () (popup-menu menu-icon-sets)))
;! How can we dynamically add submenu in scwm?
;!AddToMenu "menu-root-start" "&Icon Set%menu/themes.xpm" Popup Icon-Sets
;!AddToMenu "menu-modules" "&Icon Set%menu/themes.xpm" Popup Icon-Sets

;;;
;  Window operations
;;;

;;
;; This defines the most common window operations.
;; It seems that window-ops-menu is most common name for this menu.
;;
;(define menu-window-ops (menu (list
(define window-ops-menu (menu (list
	(menuitem "Window Operations" #:image-left wmi-menu-window)
	menu-title menu-separator
	(menuitem "&Move"     #:image-left wmi-menu-window-move     #:action interactive-move)
	(menuitem "&Resize"   #:image-left wmi-menu-window-resize   #:action interactive-resize)
	(menuitem "&Iconify"  #:image-left wmi-menu-window-iconify  #:action toggle-iconify)
	(menuitem "Ma&ximize" #:image-left wmi-menu-window-maximize #:action toggle-maximize)
;	(menuitem "&Tall"     #:image-left wmi-menu-window-maximize #:action toggle-max-vert)
;	(menuitem "&Wide"     #:image-left wmi-menu-window-maximize #:action toggle-max-horz)
	(menuitem "S&hade"    #:image-left wmi-menu-window-shade    #:action toggle-window-shade)
	(menuitem "&Sticky"   #:image-left wmi-menu-window-stick    #:action toggle-stick)
	(menuitem "R&aise"    #:image-left wmi-menu-window-raise    #:action raise-window)
	(menuitem "&Lower"    #:image-left wmi-menu-window-lower    #:action lower-window)
	menu-separator
	(menuitem "In&fo"     #:image-left wmi-menu-window-identify #:action window-info)
	(menuitem "&On-top"   #:image-left wmi-menu-window-raise    #:action toggle-on-top)
	(menuitem "&Print"    #:image-left wmi-menu-printing        #:action print-window)
	menu-separator
	(menuitem "&Close"    #:image-left wmi-menu-window-close    #:action close-window)
	(menuitem "&Delete"   #:image-left wmi-menu-window-delete   #:action delete-window)
	(menuitem "&Destroy"  #:image-left wmi-menu-window-destroy  #:action destroy-window)
	menu-separator
	(menuitem "Switch to..." #:image-left wmi-menu-windows      #:action (lambda () (show-window-list-menu #:show-geometry #t)))
	(menuitem "Re&fresh"  #:image-left wmi-menu-refresh         #:action refresh)
	(menuitem "&Icon Set" #:image-left wmi-menu-themes          #:action menu-icon-sets)
)))

;; You can comment the following in if not bound yet.
;(bind-mouse 'root 3 (lambda () (popup-menu window-ops-menu)))


;;;
;  Quit submenu
;;;

;;
;; This defines (overrides) quit menu.
;;
(define menu-quit-verify (menu (list
	(menuitem "Really quit scwm?" #:image-left wmi-menu-quit)
	menu-title menu-separator
	(menuitem "Restart"       #:image-left wmi-menu-restart #:action (lambda () (restart "scwm")))
	(menuitem "Refresh"       #:image-left wmi-menu-refresh #:action (lambda () (refresh)))
	menu-separator
	(menuitem "Restart dummy" #:image-left wmi-menu-terminal   #:action (lambda () (restart "xterm")))
	menu-separator
	(menuitem "Yes"           #:image-left wmi-menu-choice-yes #:action quit)
	(menuitem "No"            #:image-left wmi-menu-choice-no  #:action #f)
	menu-separator
)))

;; You can comment the following out or in.
(bind-mouse 'root "C-M-3" (lambda () (popup-menu menu-quit-verify)))


;;;
;  Known applications
;;;

{{STYLE_ICONS}}
