Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2776 - (hide annotations) (download)
Thu Feb 11 15:05:16 2016 UTC (8 years, 3 months ago) by niro
File size: 4244 byte(s)
-fixed description
1 niro 1248 # $Id$
2    
3 niro 1257 # todo wallpaper?
4    
5 niro 1248 # what does this plugin provide?
6     provide fluxbox
7    
8 niro 1257 help_fluxbox_menuitem()
9 niro 1248 {
10 niro 1257 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 niro 1248 }
26    
27 niro 1257 # set_fluxbox_menuitem $name $exec $workdir $icon
28     set_fluxbox_menuitem()
29 niro 1248 {
30 niro 2269 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 niro 1253 local CONFIG
36 niro 1248
37 niro 1257 [[ -z ${action} ]] && help_fluxbox_menuitem && return 1
38 niro 1248
39 niro 1257 case "${action}" in
40     add)
41     [[ -z ${name} ]] && help_fluxbox_menuitem && return 1
42     [[ -z ${exec} ]] && help_fluxbox_menuitem && return 1
43 niro 2277 ${MCORE_LIBDIR}/fluxbox-menuitem --add --name "${name}" --exec "${exec}"
44 niro 1257 ;;
45     del)
46 niro 2277 if [[ -n ${name} ]]
47 niro 1257 then
48 niro 2277 ${MCORE_LIBDIR}/fluxbox-menuitem --del --name "${name}"
49     else
50 niro 1257 # delete all items
51 niro 2277 ${MCORE_LIBDIR}/fluxbox-menuitem --del
52 niro 1257 fi
53     ;;
54     *)
55     help_fluxbox_menuitem && return 1
56     ;;
57     esac
58 niro 1253
59 niro 1248 # rebuild the menu now
60 niro 2277 ${MCORE_LIBDIR}/fluxbox-rebuild-menu
61 niro 1248 }
62    
63 niro 1257 # get_fluxbox_menuitem
64     get_fluxbox_menuitem()
65 niro 1248 {
66 niro 2277 ${MCORE_LIBDIR}/fluxbox-menuitem --print
67 niro 1248 }
68    
69 niro 2623 help_fluxbox_autostart()
70     {
71     mecho "get fluxbox.autostart"
72     mecho " Shows all custom added autostarts of fluxbox."
73     mecho
74 niro 2625 mecho "set fluxbox.autostart [action] [name] [exec]"
75 niro 2623 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
83     mecho " If no [name] given, all entries will be deleted."
84     }
85    
86 niro 2625 # set_fluxbox_autostart $name $exec
87 niro 2623 set_fluxbox_autostart()
88     {
89     local action="${CLASS_ARGV[0]}"
90     local name="${CLASS_ARGV[1]}"
91     local exec="${CLASS_ARGV[2]}"
92     local CONFIG
93    
94     [[ -z ${action} ]] && help_fluxbox_autostart && return 1
95    
96     case "${action}" in
97     add)
98     [[ -z ${name} ]] && help_fluxbox_autostart && return 1
99     [[ -z ${exec} ]] && help_fluxbox_autostart && return 1
100 niro 2625 ${MCORE_LIBDIR}/fluxbox-autostart --add --name "${name}" --exec "${exec}"
101 niro 2623 ;;
102     del)
103     if [[ -n ${name} ]]
104     then
105     ${MCORE_LIBDIR}/fluxbox-autostart --del --name "${name}"
106     else
107     # delete all items
108     ${MCORE_LIBDIR}/fluxbox-autostart --del
109     fi
110     ;;
111     *)
112     help_fluxbox_autostart && return 1
113     ;;
114     esac
115    
116 niro 2776 # rebuild the autostart now
117 niro 2623 ${MCORE_LIBDIR}/fluxbox-rebuild-autostart
118     }
119    
120     # get_fluxbox_autostart
121     get_fluxbox_autostart()
122     {
123     ${MCORE_LIBDIR}/fluxbox-autostart --print
124     }
125    
126 niro 1257 help_fluxbox_theme()
127 niro 1248 {
128 niro 1257 mecho "get fluxbox.theme [method]"
129     mecho " Displays current installed or system-wide available themes."
130     mecho " Methods:"
131     mecho " system - shows systemwide available themes"
132     mecho " current - shows current selected theme"
133     mecho
134     mecho "set fluxbox.theme [theme]"
135     mecho " Sets a default theme for fluxbox."
136     }
137 niro 1248
138 niro 1257 set_fluxbox_theme()
139     {
140 niro 2269 local theme="${CLASS_ARGV[0]}"
141 niro 2152 local stylesdir="@@DATADIR@@/fluxbox/styles"
142 niro 1257
143     [[ -z ${theme} ]] && help_fluxbox_theme && return 1
144 niro 2153 [[ ! -x $(type -P fluxbox-remote) ]] && eecho "fluxbox-remote missing! Aborted" && return 1
145 niro 1257
146     if [[ -e ${stylesdir}/${theme} ]]
147 niro 1248 then
148 niro 1257 x11runas "fluxbox-remote 'SetStyle ${stylesdir}/${theme}'"
149     else
150 niro 2028 eecho "Theme '${theme}' does not exist!"
151 niro 1248 fi
152 niro 1257 }
153 niro 1248
154 niro 1257 get_fluxbox_theme()
155     {
156 niro 2269 local method="${CLASS_ARGV[0]}"
157 niro 2152 local stylesdir="@@DATADIR@@/fluxbox/styles"
158 niro 1257 local value
159     local i
160    
161     [[ -z ${method} ]] && help_fluxbox_theme && return 1
162    
163     case "${method}" in
164     system)
165 niro 2014 list_files_in_directory -type d -mindepth 1 -maxdepth 1 ${MROOT}/${stylesdir}
166 niro 1257 ;;
167    
168     current)
169 niro 2013 value=$(grep -i '^session.stylefile' ${MROOT}/${MCORE_UNPRIV_HOME}/.fluxbox/init | sed 's:.*/\(.*\):\1:')
170 niro 1642 rvecho "${value}"
171 niro 1257 ;;
172     *) help_fluxbox_theme && return 1 ;;
173     esac
174 niro 1248 }