5 |
# what does this plugin provide? |
# what does this plugin provide? |
6 |
provide fluxbox |
provide fluxbox |
7 |
|
|
|
# helper |
|
|
helper_rebuild_fluxbox_menu() |
|
|
{ |
|
|
local MMINCLUDE |
|
|
local CONFIG |
|
|
|
|
|
MMINCLUDE="${MCORE_CONFIG_PATH}/fluxbox/mcore-menu-include" |
|
|
CONFIG="${MROOT}/${MMINCLUDE}" |
|
|
clearconfig |
|
|
|
|
|
for file in ${MROOT}/${MCORE_CONFIG_PATH}/fluxbox/menu/* |
|
|
do |
|
|
[[ ! -z ${MROOT} ]] && file=$(echo ${file} | sed "s:${MROOT}::") |
|
|
addconfig "[include] (${file})" |
|
|
done |
|
|
|
|
|
# rebuild the user menu too atm |
|
|
CONFIG="${MROOT}/${MCORE_UNPRIV_HOME}/.fluxbox/menu" |
|
|
if [[ ! -d ${MROOT}/${MCORE_UNPRIV_HOME}/.fluxbox ]] |
|
|
then |
|
|
install -o ${MCORE_UNPRIV_USER} -o ${MCORE_UNPRIV_GROUP} -d ${MROOT}/${MCORE_UNPRIV_HOME}/.fluxbox |
|
|
fi |
|
|
|
|
|
# fluxbox menu header |
|
|
clearconfig |
|
|
local ver="$(< ${MROOT}/etc/mageversion)" |
|
|
addconfig "[begin] (mCore-${ver} #${MCORE_SERIAL})" |
|
|
|
|
|
# add a newline (maybe there is no crlf in the header) |
|
|
addconfig |
|
|
|
|
|
# our specific menu include |
|
|
addconfig "[include] (${MMINCLUDE})" |
|
|
|
|
|
# fluxbox menu footer |
|
|
addconfig '[separator]' |
|
|
addconfig '[exit] (Abmelden)' |
|
|
addconfig '[exec] (Neustarten) {sudo /sbin/reboot}' |
|
|
addconfig '[exec] (Herunterfahren) {sudo /sbin/halt}' |
|
|
addconfig '[end]' |
|
|
|
|
|
# add a newline (maybe there is no crlf in the footer) |
|
|
addconfig |
|
|
} |
|
|
|
|
|
helper_rebuild_fluxbox_autostart() |
|
|
{ |
|
|
local CONFIG |
|
|
|
|
|
CONFIG="${MROOT}/${MCORE_UNPRIV_HOME}/.fluxbox/apps" |
|
|
clearconfig |
|
|
for file in ${MROOT}/${MCORE_CONFIG_PATH}/fluxbox/autostart/* |
|
|
do |
|
|
addconfig "$(< ${file})" |
|
|
done |
|
|
|
|
|
# add a newline (maybe there is no crlf in the footer) |
|
|
addconfig |
|
|
} |
|
|
|
|
8 |
help_fluxbox_menuitem() |
help_fluxbox_menuitem() |
9 |
{ |
{ |
10 |
mecho "get fluxbox.menuitem" |
mecho "get fluxbox.menuitem" |
27 |
# set_fluxbox_menuitem $name $exec $workdir $icon |
# set_fluxbox_menuitem $name $exec $workdir $icon |
28 |
set_fluxbox_menuitem() |
set_fluxbox_menuitem() |
29 |
{ |
{ |
30 |
local action="$1" |
local action="${CLASS_ARGV[0]}" |
31 |
local name="$2" |
local name="${CLASS_ARGV[1]}" |
32 |
local exec="$3" |
local exec="${CLASS_ARGV[2]}" |
33 |
local workdir="$4" |
local workdir="${CLASS_ARGV[3]}" |
34 |
local icon="$5" |
local icon="${CLASS_ARGV[4]}" |
35 |
local CONFIG |
local CONFIG |
36 |
|
|
37 |
[[ -z ${action} ]] && help_fluxbox_menuitem && return 1 |
[[ -z ${action} ]] && help_fluxbox_menuitem && return 1 |
51 |
elif [[ -z ${name} ]] |
elif [[ -z ${name} ]] |
52 |
then |
then |
53 |
# delete all items |
# delete all items |
54 |
rm ${MROOT}/${MCORE_CONFIG_PATH}/fluxbox/menu/* |
find ${MROOT}/${MCORE_CONFIG_PATH}/fluxbox/menu -type f | xargs --no-run-if-empty rm |
55 |
fi |
fi |
56 |
;; |
;; |
57 |
*) |
*) |
60 |
esac |
esac |
61 |
|
|
62 |
# rebuild the menu now |
# rebuild the menu now |
63 |
helper_rebuild_fluxbox_menu |
fluxbox-rebuild-menu |
64 |
} |
} |
65 |
|
|
66 |
# get_fluxbox_menuitem |
# get_fluxbox_menuitem |
67 |
get_fluxbox_menuitem() |
get_fluxbox_menuitem() |
68 |
{ |
{ |
69 |
local i |
list_files_in_directory ${MROOT}/${MCORE_CONFIG_PATH}/fluxbox/menu |
|
local item |
|
|
|
|
|
for i in $(find ${MROOT}/${MCORE_CONFIG_PATH}/fluxbox/menu -type f | sort) |
|
|
do |
|
|
item="${item} $(basename ${i})" |
|
|
done |
|
|
|
|
|
rvecho "${item}" |
|
70 |
} |
} |
71 |
|
|
72 |
help_fluxbox_theme() |
help_fluxbox_theme() |
83 |
|
|
84 |
set_fluxbox_theme() |
set_fluxbox_theme() |
85 |
{ |
{ |
86 |
local theme="$1" |
local theme="${CLASS_ARGV[0]}" |
87 |
local stylesdir="/usr/share/fluxbox/styles" |
local stylesdir="@@DATADIR@@/fluxbox/styles" |
88 |
|
|
89 |
[[ -z ${theme} ]] && help_fluxbox_theme && return 1 |
[[ -z ${theme} ]] && help_fluxbox_theme && return 1 |
90 |
[[ ! -x $(which fluxbox-remote) ]] && eecho "fluxbox-remote missing! Aborted" && return 1 |
[[ ! -x $(type -P fluxbox-remote) ]] && eecho "fluxbox-remote missing! Aborted" && return 1 |
91 |
|
|
92 |
if [[ -e ${stylesdir}/${theme} ]] |
if [[ -e ${stylesdir}/${theme} ]] |
93 |
then |
then |
94 |
x11runas "fluxbox-remote 'SetStyle ${stylesdir}/${theme}'" |
x11runas "fluxbox-remote 'SetStyle ${stylesdir}/${theme}'" |
95 |
else |
else |
96 |
eechoe "Theme '${theme}' does not exist!" |
eecho "Theme '${theme}' does not exist!" |
97 |
fi |
fi |
98 |
} |
} |
99 |
|
|
100 |
get_fluxbox_theme() |
get_fluxbox_theme() |
101 |
{ |
{ |
102 |
local method="$1" |
local method="${CLASS_ARGV[0]}" |
103 |
local stylesdir="/usr/share/fluxbox/styles" |
local stylesdir="@@DATADIR@@/fluxbox/styles" |
104 |
local value |
local value |
105 |
local i |
local i |
106 |
|
|
108 |
|
|
109 |
case "${method}" in |
case "${method}" in |
110 |
system) |
system) |
111 |
for i in $(find ${MROOT}/${stylesdir} -mindepth 1 -maxdepth 1 | sort) |
list_files_in_directory -type d -mindepth 1 -maxdepth 1 ${MROOT}/${stylesdir} |
|
do |
|
|
value="${value} $(basename ${i})" |
|
|
done |
|
|
rvecho "${value}" |
|
112 |
;; |
;; |
113 |
|
|
114 |
current) |
current) |