Magellan Linux

Contents of /mcore-src/trunk/mcore-tools/src/modules/fluxbox/fluxbox.client.class.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2277 - (show annotations) (download)
Tue Jan 14 14:36:04 2014 UTC (10 years, 3 months ago) by niro
File size: 2868 byte(s)
-split of fluxbox-menuitem from fluxbox.client.class.in to make things more modular
1 # $Id$
2
3 # todo wallpaper?
4
5 # what does this plugin provide?
6 provide fluxbox
7
8 help_fluxbox_menuitem()
9 {
10 mecho "get fluxbox.menuitem"
11 mecho " Shows all custom added menuitems of fluxbox."
12 mecho
13 mecho "set fluxbox.menuitem [action] [name] [exec] [workdir] [icon]"
14 mecho " Adds or deletes a fluxbox menu entry."
15 mecho " Actions:"
16 mecho " add - adds a menuitem"
17 mecho " del - deletes a menuitem"
18 mecho
19 mecho " name - menu entry name"
20 mecho " exec - executable to start"
21 mecho " workdir - working directory for the executable - optional"
22 mecho " icon - pixmap icon of the entry - optional"
23 mecho
24 mecho " If no [name] given, all entries will be deleted."
25 }
26
27 # set_fluxbox_menuitem $name $exec $workdir $icon
28 set_fluxbox_menuitem()
29 {
30 local action="${CLASS_ARGV[0]}"
31 local name="${CLASS_ARGV[1]}"
32 local exec="${CLASS_ARGV[2]}"
33 local workdir="${CLASS_ARGV[3]}"
34 local icon="${CLASS_ARGV[4]}"
35 local CONFIG
36
37 [[ -z ${action} ]] && help_fluxbox_menuitem && return 1
38
39 case "${action}" in
40 add)
41 [[ -z ${name} ]] && help_fluxbox_menuitem && return 1
42 [[ -z ${exec} ]] && help_fluxbox_menuitem && return 1
43 ${MCORE_LIBDIR}/fluxbox-menuitem --add --name "${name}" --exec "${exec}"
44 ;;
45 del)
46 if [[ -n ${name} ]]
47 then
48 ${MCORE_LIBDIR}/fluxbox-menuitem --del --name "${name}"
49 else
50 # delete all items
51 ${MCORE_LIBDIR}/fluxbox-menuitem --del
52 fi
53 ;;
54 *)
55 help_fluxbox_menuitem && return 1
56 ;;
57 esac
58
59 # rebuild the menu now
60 ${MCORE_LIBDIR}/fluxbox-rebuild-menu
61 }
62
63 # get_fluxbox_menuitem
64 get_fluxbox_menuitem()
65 {
66 ${MCORE_LIBDIR}/fluxbox-menuitem --print
67 }
68
69 help_fluxbox_theme()
70 {
71 mecho "get fluxbox.theme [method]"
72 mecho " Displays current installed or system-wide available themes."
73 mecho " Methods:"
74 mecho " system - shows systemwide available themes"
75 mecho " current - shows current selected theme"
76 mecho
77 mecho "set fluxbox.theme [theme]"
78 mecho " Sets a default theme for fluxbox."
79 }
80
81 set_fluxbox_theme()
82 {
83 local theme="${CLASS_ARGV[0]}"
84 local stylesdir="@@DATADIR@@/fluxbox/styles"
85
86 [[ -z ${theme} ]] && help_fluxbox_theme && return 1
87 [[ ! -x $(type -P fluxbox-remote) ]] && eecho "fluxbox-remote missing! Aborted" && return 1
88
89 if [[ -e ${stylesdir}/${theme} ]]
90 then
91 x11runas "fluxbox-remote 'SetStyle ${stylesdir}/${theme}'"
92 else
93 eecho "Theme '${theme}' does not exist!"
94 fi
95 }
96
97 get_fluxbox_theme()
98 {
99 local method="${CLASS_ARGV[0]}"
100 local stylesdir="@@DATADIR@@/fluxbox/styles"
101 local value
102 local i
103
104 [[ -z ${method} ]] && help_fluxbox_theme && return 1
105
106 case "${method}" in
107 system)
108 list_files_in_directory -type d -mindepth 1 -maxdepth 1 ${MROOT}/${stylesdir}
109 ;;
110
111 current)
112 value=$(grep -i '^session.stylefile' ${MROOT}/${MCORE_UNPRIV_HOME}/.fluxbox/init | sed 's:.*/\(.*\):\1:')
113 rvecho "${value}"
114 ;;
115 *) help_fluxbox_theme && return 1 ;;
116 esac
117 }