Session script changes.

SVN revision: 18403
This commit is contained in:
Kim Woelders 2005-11-09 20:36:35 +00:00
parent 55f143d899
commit c78760575d
6 changed files with 78 additions and 14 deletions

View File

@ -1,5 +1,5 @@
EXTRA_DIST = e_gen_menu e_cache_clean e_cache_query
script_SCRIPTS = e_gen_menu e_cache_clean e_cache_query
EXTRA_DIST = e_gen_menu e_cache_clean e_cache_query session.sh
script_SCRIPTS = e_gen_menu e_cache_clean e_cache_query session.sh
scriptdir = $(ENLIGHTENMENT_ROOT)/scripts

49
scripts/session.sh Executable file
View File

@ -0,0 +1,49 @@
#!/bin/sh
#
# Default script for e16 session start/restart/stop management
#
# Assuming misc.session.enable_script is set and misc.session.script
# points to this script it will be called with parameter
#
# - "init" first time an X-session (with e16) starts
# - "start" every time e16 (re)starts
# - "stop" when e16 exits without restarting
#
# On init, start, and stop the script will run any executable found in
# ~/.e16/Init/, ~/.e16/Start/, and ~/.e16/Stop/, respectively.
# These executables do not have to exit as they are called with '&' from here.
#
# NOTE:
# In multi-display/screen setups the DISPLAY environment variable can be used
# to differentiate.
#
#echo $DISPLAY
RunApps() {
local d;
d="$ECONFDIR/$1"
test -d "$d" || return
for f in "$d"/*
do
if [ -x $f ]; then
# echo $f
$f &
fi
done
}
case "$1" in
init)
RunApps Init
;;
start)
RunApps Start
;;
stop)
RunApps Stop
;;
esac

View File

@ -68,7 +68,7 @@
#define ENABLE_TRANSPARENCY 1
#define ENABLE_THEME_TRANSPARENCY 1
#define ENABLE_OLD_SESSION_HELPERS 1
#define ENABLE_OLD_SESSION_HELPERS 0
/* dmalloc debugging */
/*#include <dmalloc.h> */
@ -500,9 +500,10 @@ typedef struct
} place;
struct
{
char enable_script;
char *script;
char enable_logout_dialog;
char enable_reboot_halt;
char *cmd;
#if ENABLE_OLD_SESSION_HELPERS
char *cmd_init;
char *cmd_start;

View File

@ -131,9 +131,10 @@ static const CfgItem MiscCfgItems[] = {
CFG_ITEM_BOOL(Conf, place.ignore_struts, 0),
CFG_ITEM_BOOL(Conf, place.raise_fullscreen, 0),
CFG_ITEM_BOOL(Conf, session.enable_script, 0),
CFG_ITEM_STR(Conf, session.script),
CFG_ITEM_BOOL(Conf, session.enable_logout_dialog, 1),
CFG_ITEM_BOOL(Conf, session.enable_reboot_halt, 0),
CFG_ITEM_STR(Conf, session.cmd),
#if ENABLE_OLD_SESSION_HELPERS
CFG_ITEM_STR(Conf, session.cmd_init),
CFG_ITEM_STR(Conf, session.cmd_start),

View File

@ -712,6 +712,8 @@ SessionInit(void)
LoadWindowStates();
#endif
if (!Conf.session.script)
Conf.session.script = Estrdup("$EROOT/scripts/session.sh");
if (!Conf.session.cmd_reboot)
Conf.session.cmd_reboot = Estrdup("reboot");
if (!Conf.session.cmd_halt)
@ -1036,24 +1038,24 @@ SessionHelper(int when)
switch (when)
{
case ESESSION_INIT:
if (Conf.session.cmd)
SessionRunProg(Conf.session.cmd, "init");
if (Conf.session.enable_script && Conf.session.script)
SessionRunProg(Conf.session.script, "init");
#if ENABLE_OLD_SESSION_HELPERS
else if (Conf.session.cmd_init)
SessionRunProg(Conf.session.cmd_init, NULL);
#endif
break;
case ESESSION_START:
if (Conf.session.cmd)
SessionRunProg(Conf.session.cmd, "start");
if (Conf.session.enable_script && Conf.session.script)
SessionRunProg(Conf.session.script, "start");
#if ENABLE_OLD_SESSION_HELPERS
else if (Conf.session.cmd_start)
SessionRunProg(Conf.session.cmd_start, NULL);
#endif
break;
case ESESSION_STOP:
if (Conf.session.cmd)
SessionRunProg(Conf.session.cmd, "stop");
if (Conf.session.enable_script && Conf.session.script)
SessionRunProg(Conf.session.script, "stop");
#if ENABLE_OLD_SESSION_HELPERS
else if (Conf.session.cmd_stop)
SessionRunProg(Conf.session.cmd_stop, NULL);

View File

@ -478,9 +478,10 @@ SettingsAutoRaise(void)
}
static char tmp_dialog_headers;
static char tmp_button_image;
static char tmp_session_script;
static char tmp_logout_dialog;
static char tmp_reboot_halt;
static char tmp_button_image;
static char tmp_animate_startup;
static char tmp_saveunders;
@ -490,9 +491,10 @@ CB_ConfigureMiscellaneous(Dialog * d __UNUSED__, int val, void *data __UNUSED__)
if (val < 2)
{
Conf.dialogs.headers = tmp_dialog_headers;
Conf.dialogs.button_image = tmp_button_image;
Conf.session.enable_script = tmp_session_script;
Conf.session.enable_logout_dialog = tmp_logout_dialog;
Conf.session.enable_reboot_halt = tmp_reboot_halt;
Conf.dialogs.button_image = tmp_button_image;
Conf.startup.animate = tmp_animate_startup;
Conf.save_under = tmp_saveunders;
}
@ -516,9 +518,10 @@ SettingsMiscellaneous(void)
SoundPlay("SOUND_SETTINGS_MISCELLANEOUS");
tmp_dialog_headers = Conf.dialogs.headers;
tmp_button_image = Conf.dialogs.button_image;
tmp_session_script = Conf.session.enable_script;
tmp_logout_dialog = Conf.session.enable_logout_dialog;
tmp_reboot_halt = Conf.session.enable_reboot_halt;
tmp_button_image = Conf.dialogs.button_image;
tmp_animate_startup = Conf.startup.animate;
tmp_saveunders = Conf.save_under;
@ -542,6 +545,14 @@ SettingsMiscellaneous(void)
DialogItemSetText(di, _("Enable Button Images"));
DialogItemCheckButtonSetPtr(di, &tmp_button_image);
di = DialogAddItem(table, DITEM_SEPARATOR);
DialogItemSetColSpan(di, 2);
di = DialogAddItem(table, DITEM_CHECKBUTTON);
DialogItemSetColSpan(di, 2);
DialogItemSetText(di, _("Enable Session Script"));
DialogItemCheckButtonSetPtr(di, &tmp_session_script);
di = DialogAddItem(table, DITEM_CHECKBUTTON);
DialogItemSetColSpan(di, 2);
DialogItemSetText(di, _("Enable Logout Dialog"));