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 2623 - (show annotations) (download)
Fri Sep 25 13:06:52 2015 UTC (8 years, 8 months ago) by niro
File size: 4377 byte(s)
-added autostart mechanics
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_autostart()
70 {
71 mecho "get fluxbox.autostart"
72 mecho " Shows all custom added autostarts of fluxbox."
73 mecho
74 mecho "set fluxbox.autostart [action] [name] [exec] [comment]"
75 mecho " Adds or deletes a fluxbox autostart entry."
76 mecho " Actions:"
77 mecho " add - adds an autostart entry"
78 mecho " del - deletes an autostart entry"
79 mecho
80 mecho " name - autostart entry name"
81 mecho " exec - executable to start"
82 mecho " comment - comment about this autostart - optional"
83 mecho
84 mecho " If no [name] given, all entries will be deleted."
85 }
86
87 # set_fluxbox_autostart $name $exec $comment
88 set_fluxbox_autostart()
89 {
90 local action="${CLASS_ARGV[0]}"
91 local name="${CLASS_ARGV[1]}"
92 local exec="${CLASS_ARGV[2]}"
93 local comment="${CLASS_ARGV[3]}"
94 local CONFIG
95
96 [[ -z ${action} ]] && help_fluxbox_autostart && return 1
97
98 case "${action}" in
99 add)
100 [[ -z ${name} ]] && help_fluxbox_autostart && return 1
101 [[ -z ${exec} ]] && help_fluxbox_autostart && return 1
102 ${MCORE_LIBDIR}/fluxbox-autostart --add --name "${name}" --exec "${exec}" --comment "${comment}"
103 ;;
104 del)
105 if [[ -n ${name} ]]
106 then
107 ${MCORE_LIBDIR}/fluxbox-autostart --del --name "${name}"
108 else
109 # delete all items
110 ${MCORE_LIBDIR}/fluxbox-autostart --del
111 fi
112 ;;
113 *)
114 help_fluxbox_autostart && return 1
115 ;;
116 esac
117
118 # rebuild the menu now
119 ${MCORE_LIBDIR}/fluxbox-rebuild-autostart
120 }
121
122 # get_fluxbox_autostart
123 get_fluxbox_autostart()
124 {
125 ${MCORE_LIBDIR}/fluxbox-autostart --print
126 }
127
128 help_fluxbox_theme()
129 {
130 mecho "get fluxbox.theme [method]"
131 mecho " Displays current installed or system-wide available themes."
132 mecho " Methods:"
133 mecho " system - shows systemwide available themes"
134 mecho " current - shows current selected theme"
135 mecho
136 mecho "set fluxbox.theme [theme]"
137 mecho " Sets a default theme for fluxbox."
138 }
139
140 set_fluxbox_theme()
141 {
142 local theme="${CLASS_ARGV[0]}"
143 local stylesdir="@@DATADIR@@/fluxbox/styles"
144
145 [[ -z ${theme} ]] && help_fluxbox_theme && return 1
146 [[ ! -x $(type -P fluxbox-remote) ]] && eecho "fluxbox-remote missing! Aborted" && return 1
147
148 if [[ -e ${stylesdir}/${theme} ]]
149 then
150 x11runas "fluxbox-remote 'SetStyle ${stylesdir}/${theme}'"
151 else
152 eecho "Theme '${theme}' does not exist!"
153 fi
154 }
155
156 get_fluxbox_theme()
157 {
158 local method="${CLASS_ARGV[0]}"
159 local stylesdir="@@DATADIR@@/fluxbox/styles"
160 local value
161 local i
162
163 [[ -z ${method} ]] && help_fluxbox_theme && return 1
164
165 case "${method}" in
166 system)
167 list_files_in_directory -type d -mindepth 1 -maxdepth 1 ${MROOT}/${stylesdir}
168 ;;
169
170 current)
171 value=$(grep -i '^session.stylefile' ${MROOT}/${MCORE_UNPRIV_HOME}/.fluxbox/init | sed 's:.*/\(.*\):\1:')
172 rvecho "${value}"
173 ;;
174 *) help_fluxbox_theme && return 1 ;;
175 esac
176 }