revamp the autostart functionality, so autostart apps launch after openbox.
add /usr/libexec/openbox-autostart which runs the global/user scripts and launches /usr/libexec/openbox-xdg-autostart (which runs .desktop autostart stuff) make openbox-session call openbox with --startup option, to make openbox launch /usr/libexec/openbox-autostart *after* it is initialized. add /etc/xdg/openbox/environment and ~/.config/openbox/environment files to let user change environment variables (locale) for their Openbox session, which openbox-session loads before running openbox.
This commit is contained in:
parent
7d71fb8a77
commit
bcc31faf7e
10 changed files with 122 additions and 71 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -97,5 +97,4 @@ tests/strut
|
||||||
tests/title
|
tests/title
|
||||||
tests/urgent
|
tests/urgent
|
||||||
tests/usertimewin
|
tests/usertimewin
|
||||||
data/autostart.sh
|
data/autostart/openbox-autostart
|
||||||
<+
|
|
||||||
|
|
22
Makefile.am
22
Makefile.am
|
@ -12,7 +12,7 @@ obtpubincludedir= $(includedir)/openbox/@OBT_VERSION@/obt
|
||||||
rrpubincludedir = $(includedir)/openbox/@RR_VERSION@/obrender
|
rrpubincludedir = $(includedir)/openbox/@RR_VERSION@/obrender
|
||||||
pixmapdir = $(datadir)/pixmaps
|
pixmapdir = $(datadir)/pixmaps
|
||||||
xsddir = $(datadir)/openbox
|
xsddir = $(datadir)/openbox
|
||||||
secretbindir = $(libdir)/openbox
|
libexecdir = $(prefix)/libexec
|
||||||
appsdir = $(datadir)/applications
|
appsdir = $(datadir)/applications
|
||||||
|
|
||||||
theme = Clearlooks
|
theme = Clearlooks
|
||||||
|
@ -36,14 +36,20 @@ bin_PROGRAMS = \
|
||||||
tools/gnome-panel-control/gnome-panel-control \
|
tools/gnome-panel-control/gnome-panel-control \
|
||||||
tools/obxprop/obxprop
|
tools/obxprop/obxprop
|
||||||
|
|
||||||
dist_secretbin_SCRIPTS = \
|
|
||||||
tools/xdg-autostart/xdg-autostart
|
|
||||||
|
|
||||||
nodist_bin_SCRIPTS = \
|
nodist_bin_SCRIPTS = \
|
||||||
data/xsession/openbox-session \
|
data/xsession/openbox-session \
|
||||||
data/xsession/openbox-gnome-session \
|
data/xsession/openbox-gnome-session \
|
||||||
data/xsession/openbox-kde-session
|
data/xsession/openbox-kde-session
|
||||||
|
|
||||||
|
dist_rc_SCRIPTS = \
|
||||||
|
data/environment \
|
||||||
|
data/autostart/autostart
|
||||||
|
|
||||||
|
dist_libexec_SCRIPTS = \
|
||||||
|
data/autostart/openbox-xdg-autostart \
|
||||||
|
data/autostart/openbox-autostart
|
||||||
|
|
||||||
|
|
||||||
## obrender ##
|
## obrender ##
|
||||||
|
|
||||||
obrender_rendertest_CPPFLAGS = \
|
obrender_rendertest_CPPFLAGS = \
|
||||||
|
@ -446,9 +452,6 @@ dist_apps_DATA = \
|
||||||
dist_pixmap_DATA = \
|
dist_pixmap_DATA = \
|
||||||
data/openbox.png
|
data/openbox.png
|
||||||
|
|
||||||
nodist_rc_DATA = \
|
|
||||||
data/autostart.sh
|
|
||||||
|
|
||||||
dist_rc_DATA = \
|
dist_rc_DATA = \
|
||||||
data/rc.xml \
|
data/rc.xml \
|
||||||
data/menu.xml
|
data/menu.xml
|
||||||
|
@ -456,10 +459,10 @@ dist_rc_DATA = \
|
||||||
edit = $(SED) \
|
edit = $(SED) \
|
||||||
-e 's!@version\@!$(VERSION)!' \
|
-e 's!@version\@!$(VERSION)!' \
|
||||||
-e 's!@configdir\@!$(configdir)!' \
|
-e 's!@configdir\@!$(configdir)!' \
|
||||||
-e 's!@secretbindir\@!$(secretbindir)!' \
|
-e 's!@libexecdir\@!$(libexecdir)!' \
|
||||||
-e 's!@bindir\@!$(bindir)!'
|
-e 's!@bindir\@!$(bindir)!'
|
||||||
|
|
||||||
data/autostart.sh: $(srcdir)/data/autostart.sh.in Makefile
|
data/autostart/openbox-autostart: $(srcdir)/data/autostart/openbox-autostart.in Makefile
|
||||||
@echo make: creating $@
|
@echo make: creating $@
|
||||||
@$(edit) $< >$@
|
@$(edit) $< >$@
|
||||||
|
|
||||||
|
@ -488,7 +491,6 @@ nodist_xsessions_DATA = \
|
||||||
data/xsession/openbox-kde.desktop
|
data/xsession/openbox-kde.desktop
|
||||||
|
|
||||||
dist_noinst_DATA = \
|
dist_noinst_DATA = \
|
||||||
data/autostart.sh.in \
|
|
||||||
data/rc.xsd \
|
data/rc.xsd \
|
||||||
data/menu.xsd \
|
data/menu.xsd \
|
||||||
data/xsession/openbox.desktop.in \
|
data/xsession/openbox.desktop.in \
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
# This shell script is run before Openbox launches.
|
|
||||||
# Environment variables set here are passed to the Openbox session.
|
|
||||||
|
|
||||||
# Set a background color
|
|
||||||
BG=""
|
|
||||||
if which hsetroot >/dev/null; then
|
|
||||||
BG=hsetroot
|
|
||||||
else
|
|
||||||
if which esetroot >/dev/null; then
|
|
||||||
BG=esetroot
|
|
||||||
else
|
|
||||||
if which xsetroot >/dev/null; then
|
|
||||||
BG=xsetroot
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
test -z $BG || $BG -solid "#303030"
|
|
||||||
|
|
||||||
# D-bus
|
|
||||||
if which dbus-launch >/dev/null && test -z "$DBUS_SESSION_BUS_ADDRESS"; then
|
|
||||||
eval `dbus-launch --sh-syntax --exit-with-session`
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Make GTK apps look and behave how they were set up in the gnome config tools
|
|
||||||
if test -x /usr/libexec/gnome-settings-daemon >/dev/null; then
|
|
||||||
/usr/libexec/gnome-settings-daemon &
|
|
||||||
elif which gnome-settings-daemon >/dev/null; then
|
|
||||||
gnome-settings-daemon &
|
|
||||||
# Make GTK apps look and behave how they were set up in the XFCE config tools
|
|
||||||
elif which xfce-mcs-manager >/dev/null; then
|
|
||||||
xfce-mcs-manager n &
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Preload stuff for KDE apps
|
|
||||||
if which start_kdeinit >/dev/null; then
|
|
||||||
LD_BIND_NOW=true start_kdeinit --new-startup +kcminit_startup &
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Run XDG autostart things. By default don't run anything desktop-specific
|
|
||||||
# See xdg-autostart --help more info
|
|
||||||
DESKTOP_ENV="OPENBOX"
|
|
||||||
if which @secretbindir@/xdg-autostart >/dev/null; then
|
|
||||||
@secretbindir@/xdg-autostart $DESKTOP_ENV
|
|
||||||
fi
|
|
|
@ -1,4 +1,4 @@
|
||||||
all clean install:
|
all clean install:
|
||||||
$(MAKE) -C ../.. -$(MAKEFLAGS) $@
|
$(MAKE) -C .. -$(MAKEFLAGS) $@
|
||||||
|
|
||||||
.PHONY: all clean install
|
.PHONY: all clean install
|
17
data/autostart/autostart
Normal file
17
data/autostart/autostart
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#
|
||||||
|
# These things are run when an Openbox X Session is started.
|
||||||
|
# You may place a similar script in $HOME/.config/openbox/autostart
|
||||||
|
# to run user-specific things.
|
||||||
|
#
|
||||||
|
|
||||||
|
# If you want to use GNOME config tools...
|
||||||
|
#
|
||||||
|
#if test -x /usr/libexec/gnome-settings-daemon >/dev/null; then
|
||||||
|
# /usr/libexec/gnome-settings-daemon &
|
||||||
|
#elif which gnome-settings-daemon >/dev/null; then
|
||||||
|
# gnome-settings-daemon &
|
||||||
|
#fi
|
||||||
|
|
||||||
|
# If you want to use XFCE config tools...
|
||||||
|
#
|
||||||
|
#xfce-mcs-manager &
|
34
data/autostart/openbox-autostart.in
Executable file
34
data/autostart/openbox-autostart.in
Executable file
|
@ -0,0 +1,34 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Set a background color
|
||||||
|
BG=""
|
||||||
|
if which hsetroot >/dev/null; then
|
||||||
|
BG=hsetroot
|
||||||
|
elif which esetroot >/dev/null; then
|
||||||
|
BG=esetroot
|
||||||
|
elif which xsetroot >/dev/null; then
|
||||||
|
BG=xsetroot
|
||||||
|
fi
|
||||||
|
test -z $BG || $BG -solid "#303030"
|
||||||
|
|
||||||
|
GLOBALAUTOSTART="@configdir@/autostart"
|
||||||
|
AUTOSTART="${XDG_CONFIG_HOME:-"$HOME/.config"}/openbox/autostart"
|
||||||
|
|
||||||
|
# Run the global openbox autostart script
|
||||||
|
if test -f $GLOBALAUTOSTART; then
|
||||||
|
sh $GLOBALAUTOSTART
|
||||||
|
elif test -f $GLOBALAUTOSTART.sh; then
|
||||||
|
sh $GLOBALAUTOSTART.sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run the user openbox autostart script
|
||||||
|
if test -f $AUTOSTART; then
|
||||||
|
sh $AUTOSTART
|
||||||
|
elif test -f $AUTOSTART.sh; then
|
||||||
|
sh $AUTOSTART.sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run the XDG autostart stuff. These are found in /etc/xdg/autostart and
|
||||||
|
# in $HOME/.config/autostart. This requires PyXDG to be installed.
|
||||||
|
# See openbox-xdg-autostart --help for more details.
|
||||||
|
@libexecdir@/openbox-xdg-autostart OPENBOX
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
# xdg-autostart runs things based on the XDG autostart specification
|
# openbox-xdg-autostart runs things based on the XDG autostart specification
|
||||||
# Copyright (C) 2008 Dana Jansens
|
# Copyright (C) 2008 Dana Jansens
|
||||||
#
|
#
|
||||||
# XDG autostart specification can be found here:
|
# XDG autostart specification can be found here:
|
||||||
|
@ -19,8 +19,8 @@
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
ME="xdg-autostart"
|
ME="openbox-xdg-autostart"
|
||||||
VERSION="1.0"
|
VERSION="1.1"
|
||||||
|
|
||||||
import os, glob, sys
|
import os, glob, sys
|
||||||
try:
|
try:
|
10
data/environment
Normal file
10
data/environment
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#
|
||||||
|
# Set system-wide environment variables here for Openbox
|
||||||
|
# User-specific variables should be placed in $HOME/.config/openbox/environment
|
||||||
|
#
|
||||||
|
|
||||||
|
# To set your language for displaying messages and time/date formats, use the following:
|
||||||
|
#LANG=en_CA.UTF8
|
||||||
|
|
||||||
|
# To set your keyboard layout, you need to modify your X config:
|
||||||
|
# http://www.google.com/search?q=how+to+set+keyboard+layout+xorg
|
|
@ -12,15 +12,11 @@ xprop -root -remove _NET_NUMBER_OF_DESKTOPS \
|
||||||
-remove _NET_DESKTOP_NAMES \
|
-remove _NET_DESKTOP_NAMES \
|
||||||
-remove _NET_CURRENT_DESKTOP 2> /dev/null
|
-remove _NET_CURRENT_DESKTOP 2> /dev/null
|
||||||
|
|
||||||
AUTOSTART="${XDG_CONFIG_HOME:-"$HOME/.config"}/openbox/autostart.sh"
|
# Set up the environment
|
||||||
GLOBALAUTOSTART="@configdir@/openbox/autostart.sh"
|
A="@configdir@/openbox/environment"
|
||||||
|
test -r $A && . $A
|
||||||
|
A="${XDG_CONFIG_HOME:-"$HOME/.config"}/openbox/environment"
|
||||||
|
test -r $A && . $A
|
||||||
|
|
||||||
if test -r $AUTOSTART; then
|
# Run Openbox, and have it run the autostart stuff
|
||||||
. $AUTOSTART
|
exec @bindir@/openbox --startup "@libexecdir@/openbox-autostart OPENBOX" "$@"
|
||||||
else
|
|
||||||
if test -r $GLOBALAUTOSTART; then
|
|
||||||
. $GLOBALAUTOSTART
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec @bindir@/openbox "$@"
|
|
||||||
|
|
|
@ -102,6 +102,7 @@ static gint exitcode = 0;
|
||||||
static guint remote_control = 0;
|
static guint remote_control = 0;
|
||||||
static gboolean being_replaced = FALSE;
|
static gboolean being_replaced = FALSE;
|
||||||
static gchar *config_file = NULL;
|
static gchar *config_file = NULL;
|
||||||
|
static gchar *startup_cmd = NULL;
|
||||||
|
|
||||||
static void signal_handler(gint signal, gpointer data);
|
static void signal_handler(gint signal, gpointer data);
|
||||||
static void remove_args(gint *argc, gchar **argv, gint index, gint num);
|
static void remove_args(gint *argc, gchar **argv, gint index, gint num);
|
||||||
|
@ -342,6 +343,29 @@ gint main(gint argc, gchar **argv)
|
||||||
|
|
||||||
ob_set_state(OB_STATE_RUNNING);
|
ob_set_state(OB_STATE_RUNNING);
|
||||||
|
|
||||||
|
if (startup_cmd) {
|
||||||
|
gchar **argv = NULL;
|
||||||
|
GError *e = NULL;
|
||||||
|
gboolean ok;
|
||||||
|
|
||||||
|
if (!g_shell_parse_argv(startup_cmd, NULL, &argv, &e)) {
|
||||||
|
g_message("Error parsing startup command: %s",
|
||||||
|
e->message);
|
||||||
|
g_error_free(e);
|
||||||
|
e = NULL;
|
||||||
|
}
|
||||||
|
ok = g_spawn_async(NULL, argv, NULL,
|
||||||
|
G_SPAWN_SEARCH_PATH |
|
||||||
|
G_SPAWN_DO_NOT_REAP_CHILD,
|
||||||
|
NULL, NULL, NULL, &e);
|
||||||
|
if (!g_shell_parse_argv(startup_cmd, NULL, &argv, &e)) {
|
||||||
|
g_message("Error launching startup command: %s",
|
||||||
|
e->message);
|
||||||
|
g_error_free(e);
|
||||||
|
e = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* look for parsing errors */
|
/* look for parsing errors */
|
||||||
{
|
{
|
||||||
xmlErrorPtr e = xmlGetLastError();
|
xmlErrorPtr e = xmlGetLastError();
|
||||||
|
@ -519,6 +543,7 @@ static void print_help(void)
|
||||||
g_print(_(" --exit Exit Openbox\n"));
|
g_print(_(" --exit Exit Openbox\n"));
|
||||||
g_print(_("\nDebugging options:\n"));
|
g_print(_("\nDebugging options:\n"));
|
||||||
g_print(_(" --sync Run in synchronous mode\n"));
|
g_print(_(" --sync Run in synchronous mode\n"));
|
||||||
|
g_print(_(" --startup CMD Run CMD after starting\n"));
|
||||||
g_print(_(" --debug Display debugging output\n"));
|
g_print(_(" --debug Display debugging output\n"));
|
||||||
g_print(_(" --debug-focus Display debugging output for focus handling\n"));
|
g_print(_(" --debug-focus Display debugging output for focus handling\n"));
|
||||||
g_print(_(" --debug-session Display debugging output for session management\n"));
|
g_print(_(" --debug-session Display debugging output for session management\n"));
|
||||||
|
@ -580,6 +605,18 @@ static void parse_args(gint *argc, gchar **argv)
|
||||||
else if (!strcmp(argv[i], "--sync")) {
|
else if (!strcmp(argv[i], "--sync")) {
|
||||||
xsync = TRUE;
|
xsync = TRUE;
|
||||||
}
|
}
|
||||||
|
else if (!strcmp(argv[i], "--startup")) {
|
||||||
|
if (i == *argc - 1) /* no args left */
|
||||||
|
g_printerr(_("--startup requires an argument\n"));
|
||||||
|
else {
|
||||||
|
/* this will be in the current locale encoding, which is
|
||||||
|
what we want */
|
||||||
|
startup_cmd = argv[i+1];
|
||||||
|
remove_args(argc, argv, i, 2);
|
||||||
|
--i; /* this arg was removed so go back */
|
||||||
|
ob_debug("--startup %s", startup_cmd);
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (!strcmp(argv[i], "--debug")) {
|
else if (!strcmp(argv[i], "--debug")) {
|
||||||
ob_debug_enable(OB_DEBUG_NORMAL, TRUE);
|
ob_debug_enable(OB_DEBUG_NORMAL, TRUE);
|
||||||
ob_debug_enable(OB_DEBUG_APP_BUGS, TRUE);
|
ob_debug_enable(OB_DEBUG_APP_BUGS, TRUE);
|
||||||
|
|
Loading…
Reference in a new issue