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 2154 - (show annotations) (download)
Fri Jan 10 13:45:03 2014 UTC (10 years, 3 months ago) by niro
File size: 2936 byte(s)
-helpers are now provided by fluxbox-rebuild-autostart and fluxbox-rebuild-menu programs
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="$1"
31 local name="$2"
32 local exec="$3"
33 local workdir="$4"
34 local icon="$5"
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 CONFIG="${MROOT}/${MCORE_CONFIG_PATH}/fluxbox/menu/${name}"
44 clearconfig
45 addconfig "[exec] (${name}) {${exec}}"
46 ;;
47 del)
48 if [[ -f ${MROOT}/${MCORE_CONFIG_PATH}/fluxbox/menu/${name} ]]
49 then
50 rm ${MROOT}/${MCORE_CONFIG_PATH}/fluxbox/menu/"${name}"
51 elif [[ -z ${name} ]]
52 then
53 # delete all items
54 find ${MROOT}/${MCORE_CONFIG_PATH}/fluxbox/menu -type f | xargs --no-run-if-empty rm
55 fi
56 ;;
57 *)
58 help_fluxbox_menuitem && return 1
59 ;;
60 esac
61
62 # rebuild the menu now
63 fluxbox-rebuild-menu
64 }
65
66 # get_fluxbox_menuitem
67 get_fluxbox_menuitem()
68 {
69 list_files_in_directory ${MROOT}/${MCORE_CONFIG_PATH}/fluxbox/menu
70 }
71
72 help_fluxbox_theme()
73 {
74 mecho "get fluxbox.theme [method]"
75 mecho " Displays current installed or system-wide available themes."
76 mecho " Methods:"
77 mecho " system - shows systemwide available themes"
78 mecho " current - shows current selected theme"
79 mecho
80 mecho "set fluxbox.theme [theme]"
81 mecho " Sets a default theme for fluxbox."
82 }
83
84 set_fluxbox_theme()
85 {
86 local theme="$1"
87 local stylesdir="@@DATADIR@@/fluxbox/styles"
88
89 [[ -z ${theme} ]] && help_fluxbox_theme && return 1
90 [[ ! -x $(type -P fluxbox-remote) ]] && eecho "fluxbox-remote missing! Aborted" && return 1
91
92 if [[ -e ${stylesdir}/${theme} ]]
93 then
94 x11runas "fluxbox-remote 'SetStyle ${stylesdir}/${theme}'"
95 else
96 eecho "Theme '${theme}' does not exist!"
97 fi
98 }
99
100 get_fluxbox_theme()
101 {
102 local method="$1"
103 local stylesdir="@@DATADIR@@/fluxbox/styles"
104 local value
105 local i
106
107 [[ -z ${method} ]] && help_fluxbox_theme && return 1
108
109 case "${method}" in
110 system)
111 list_files_in_directory -type d -mindepth 1 -maxdepth 1 ${MROOT}/${stylesdir}
112 ;;
113
114 current)
115 value=$(grep -i '^session.stylefile' ${MROOT}/${MCORE_UNPRIV_HOME}/.fluxbox/init | sed 's:.*/\(.*\):\1:')
116 rvecho "${value}"
117 ;;
118 *) help_fluxbox_theme && return 1 ;;
119 esac
120 }