├── .gitignore ├── AUTHORS ├── COPYING ├── ChangeLog ├── Makefile.am ├── NEWS ├── README ├── TODO ├── acinclude.m4 ├── autogen.sh ├── configure.ac ├── data ├── Makefile.am ├── conffiles.conf.example ├── desktop.conf.example ├── images │ ├── gnome-session-hibernate.png │ ├── gnome-session-reboot.png │ ├── gnome-session-suspend.png │ ├── gnome-session-switch.png │ ├── system-log-out.png │ └── system-shutdown.png ├── lxpolkit.desktop.in.in ├── lxsession-default-apps.desktop.in ├── lxsession-edit.desktop.in └── ui │ ├── Makefile.am │ ├── lxpolkit.ui │ ├── lxsession-default-apps.ui │ └── lxsession-edit.ui ├── lxclipboard ├── clipboard.c ├── clipboard.h └── main.vala ├── lxlock └── lxlock ├── lxpolkit ├── lxpolkit-listener.c ├── lxpolkit-listener.h ├── lxpolkit.c ├── lxpolkit.h └── main.vala ├── lxsession-db ├── desktop-files-backend.vala └── main.vala ├── lxsession-default-apps ├── autostart.vala ├── combobox.vala ├── dbus-backend.vala ├── main.vala └── utils.vala ├── lxsession-default ├── lxsession-default └── lxsession-default-terminal ├── lxsession-edit ├── lxsession-edit-common.c ├── lxsession-edit-common.h ├── lxsession-edit.c └── lxsession-edit.h ├── lxsession-logout ├── lxsession-logout-dbus-interface.c ├── lxsession-logout-dbus-interface.h └── lxsession-logout.c ├── lxsession-message ├── Makefile.am └── main-gtk.vala ├── lxsession-utils └── lxsession-xsettings ├── lxsession ├── app.vala ├── autostart.vala ├── conffiles.vala ├── control.vala ├── dbus-common.vala ├── dbus-gnome-session.vala ├── dbus-lxde-session.vala ├── environement.vala ├── main.vala ├── notifications.vala ├── options.vala ├── plugins.vala ├── process.vala ├── settings.vala └── utils.vala ├── lxsettings-daemon ├── main.vala ├── settings-daemon.c ├── settings-daemon.h ├── xevent.c ├── xevent.h ├── xsettings-common.c ├── xsettings-common.h ├── xsettings-manager.c ├── xsettings-manager.h ├── xutils.c └── xutils.h ├── man ├── Makefile.am ├── lxclipboard.1 ├── lxlock.1 ├── lxpolkit.1 ├── lxsession-db.1 ├── lxsession-default-apps.1 ├── lxsession-default-terminal.1 ├── lxsession-default.1 ├── lxsession-edit.1 ├── lxsession-logout.1 ├── lxsession-logout.xml ├── lxsession-xdg-autostart.1 ├── lxsession.1 ├── lxsession.xml └── lxsettings-daemon.1 ├── po ├── ChangeLog ├── POTFILES.in ├── POTFILES.skip ├── af.po ├── am.po ├── ar.po ├── ast.po ├── be.po ├── bg.po ├── bn.po ├── bn_IN.po ├── ca.po ├── cs.po ├── da.po ├── de.po ├── el.po ├── en_GB.po ├── eo.po ├── es.po ├── et.po ├── eu.po ├── fa.po ├── fi.po ├── fo.po ├── fr.po ├── frp.po ├── gl.po ├── he.po ├── hr.po ├── hu.po ├── id.po ├── is.po ├── it.po ├── ja.po ├── ka.po ├── kk.po ├── ko.po ├── lg.po ├── lt.po ├── lxsession.pot ├── ml.po ├── ms.po ├── nb.po ├── nl.po ├── nn.po ├── pa.po ├── pl.po ├── ps.po ├── pt.po ├── pt_BR.po ├── ro.po ├── ru.po ├── si.po ├── sk.po ├── sl.po ├── sr.po ├── sr@latin.po ├── sv.po ├── te.po ├── th.po ├── tr.po ├── tt_RU.po ├── ug.po ├── uk.po ├── ur.po ├── ur_PK.po ├── vi.po ├── zh_CN.po └── zh_TW.po ├── vapi ├── config.vapi ├── lxclipboard.vapi ├── lxpolkit.vapi ├── lxsession-edit.vapi ├── lxsettings-daemon.vapi └── xdg-autostart.vapi └── xdg-autostart ├── main.vala ├── xdg-autostart.c └── xdg-autostart.h /.gitignore: -------------------------------------------------------------------------------- 1 | Makefile.in 2 | aclocal.m4 3 | m4/*.m4 4 | compile 5 | config.h.in 6 | configure 7 | depcomp 8 | install-sh 9 | lxsession-logout/Makefile.in 10 | lxsession/Makefile.in 11 | man/Makefile.in 12 | missing 13 | po/Makefile.in.in 14 | config.guess 15 | config.h 16 | config.h.in~ 17 | config.log 18 | config.status 19 | config.sub 20 | data/*.desktop 21 | data/lxpolkit.desktop.in 22 | libtool 23 | lxclipboard/lxclipboard 24 | lxclipboard/main.c 25 | lxsession-logout/lxsession-logout 26 | lxsession/lxsession 27 | lxsession/*.c 28 | lxsession/lxsession 29 | lxsession-default-apps/*.c 30 | lxsession-default-apps/lxsession-default-apps 31 | lxsession-edit/lxsession-edit 32 | lxsession-db/*.c 33 | lxsession-db/lxsession-db 34 | lxsession-message/*.c 35 | lxsession-message/lxsession-message-gtk 36 | lxsettings-daemon/lxsettings-daemon 37 | lxsettings-daemon/main.c 38 | lxpolkit/lxpolkit 39 | lxpolkit/main.c 40 | man/Makefile 41 | po/LINGUAS 42 | po/POTFILES 43 | po/*.gmo 44 | po/stamp-it 45 | po/.intltool-merge-cache 46 | stamp-h1 47 | Makefile 48 | */Makefile 49 | */*/Makefile 50 | */.deps/ 51 | */*.o 52 | *_vala.stamp 53 | */.dirstamp 54 | lxsession-*.tar.xz 55 | xdg-autostart/lxsession-xdg-autostart 56 | xdg-autostart/main.c 57 | autom4te.cache/ 58 | debian/files 59 | debian/lxsession.debhelper.log 60 | debian/lxsession.substvars 61 | debian/lxsession/ 62 | debian/lxsession-dbg.debhelper.log 63 | debian/lxsession-dbg.substvars 64 | debian/lxsession-dbg/ 65 | debian/tmp/ 66 | debian/lxpolkit.debhelper.log 67 | debian/lxpolkit.substvars 68 | debian/lxpolkit/ 69 | debian/lxsession-data.debhelper.log 70 | debian/lxsession-data.substvars 71 | debian/lxsession-data/ 72 | debian/lxsession-edit.debhelper.log 73 | debian/lxsession-edit.substvars 74 | debian/lxsession-edit/ 75 | debian/lxsession-logout.debhelper.log 76 | debian/lxsession-logout.substvars 77 | debian/lxsession-logout/ 78 | debian/lxsession-default-apps/ 79 | debian/lxsession-default-apps.debhelper.log 80 | debian/lxsession-default-apps.substvars 81 | debian/lxsession-message-gtk.debhelper.log 82 | debian/lxsession-message-gtk.substvars 83 | debian/lxsession-message-gtk/ 84 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Lead developer: Hong Jen Yee (aka PCMan) 2 | 3 | Most of the session manager is based on XSM by The Open Group. 4 | Copyright 1994, 1998 The Open Group 5 | 6 | The GDM support of lxsession-logout is taken from gnome-session. 7 | Copyright (C) 2005 Raffaele Sandrini 8 | Copyright (C) 2005 Red Hat, Inc. 9 | Copyright (C) 2002, 2003 George Lebl 10 | Copyright (C) 2001 Queen of England 11 | 12 | HAL support of lxsession-logout is taken from xfce4-session. 13 | Copyright (c) 2003-2006 Benedikt Meurer 14 | 15 | The XSettings-related parts of lxde-settings-daemon use MIT licensed 16 | source code from gnome-settings-daemon: 17 | Copyright (C) 2001 Owen Taylor, Matthias Clasen, Red Hat, Inc. 18 | 19 | Vala code and various improvements 20 | Copyright (C) 2012-2013 Julien Lavergne 21 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | 2005-12-20 Kevin E. Martin 2 | 3 | * configure.ac: 4 | Update package version for X11R7 release. 5 | 6 | 2005-12-14 Kevin E. Martin 7 | 8 | * configure.ac: 9 | Update package version number for final X11R7 release candidate. 10 | 11 | 2005-12-07 Kevin E. Martin 12 | 13 | * Makefile.am: 14 | * configure.ac: 15 | Change to use the app-defaults default dir configured in libXt. 16 | 17 | 2005-12-06 Kevin E. Martin 18 | 19 | * Makefile.am: 20 | Change *man_SOURCES ==> *man_PRE to fix autotools warnings. 21 | 22 | 2005-12-03 Kevin E. Martin 23 | 24 | * configure.ac: 25 | Update package version number for X11R7 RC3 release. 26 | 27 | 2005-11-09 Kevin E. Martin 28 | 29 | * configure.ac: 30 | Update package version number for X11R7 RC2 release. 31 | 32 | 2005-10-18 Kevin E. Martin 33 | 34 | * configure.ac: 35 | Update package version number for RC1 release. 36 | 37 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lxde/lxsession/886b9ad90f98b12c775313331431769295138f69/NEWS -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | * Use Compact when possible, like no signals (see http://live.gnome.org/Vala/ReferenceHandling) 2 | * Try to replace multiple GObject in App by a data memeber : 3 | public enum AppType { 4 | WM, 5 | PANEL, 6 | DESKTOP 7 | } 8 | public class App { 9 | private AppType type; 10 | } 11 | * Implement stages from GNOME 12 | * Find a clean solution to the enable flags with automake (see http://lists.gnu.org/archive/html/bug-automake/2013-07/msg00002.html) 13 | -------------------------------------------------------------------------------- /acinclude.m4: -------------------------------------------------------------------------------- 1 | # Checks the location of the XML Catalog 2 | # Usage: 3 | # JH_PATH_XML_CATALOG([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) 4 | # Defines XMLCATALOG and XML_CATALOG_FILE substitutions 5 | AC_DEFUN([JH_PATH_XML_CATALOG], 6 | [ 7 | # check for the presence of the XML catalog 8 | AC_ARG_WITH([xml-catalog], 9 | AC_HELP_STRING([--with-xml-catalog=CATALOG], 10 | [path to xml catalog to use]),, 11 | [with_xml_catalog=/etc/xml/catalog]) 12 | jh_found_xmlcatalog=true 13 | XML_CATALOG_FILE="$with_xml_catalog" 14 | AC_SUBST([XML_CATALOG_FILE]) 15 | AC_MSG_CHECKING([for XML catalog ($XML_CATALOG_FILE)]) 16 | if test -f "$XML_CATALOG_FILE"; then 17 | AC_MSG_RESULT([found]) 18 | else 19 | jh_found_xmlcatalog=false 20 | AC_MSG_RESULT([not found]) 21 | fi 22 | 23 | # check for the xmlcatalog program 24 | AC_PATH_PROG(XMLCATALOG, xmlcatalog, no) 25 | if test "x$XMLCATALOG" = xno; then 26 | jh_found_xmlcatalog=false 27 | fi 28 | 29 | if $jh_found_xmlcatalog; then 30 | ifelse([$1],,[:],[$1]) 31 | else 32 | ifelse([$2],,[AC_MSG_ERROR([could not find XML catalog])],[$2]) 33 | fi 34 | ]) 35 | 36 | # Checks if a particular URI appears in the XML catalog 37 | # Usage: 38 | # JH_CHECK_XML_CATALOG(URI, [FRIENDLY-NAME], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) 39 | AC_DEFUN([JH_CHECK_XML_CATALOG], 40 | [ 41 | AC_REQUIRE([JH_PATH_XML_CATALOG],[JH_PATH_XML_CATALOG(,[:])])dnl 42 | AC_MSG_CHECKING([for ifelse([$2],,[$1],[$2]) in XML catalog]) 43 | if $jh_found_xmlcatalog && \ 44 | AC_RUN_LOG([$XMLCATALOG --noout "$XML_CATALOG_FILE" "$1" >&2]); then 45 | AC_MSG_RESULT([found]) 46 | ifelse([$3],,,[$3 47 | ])dnl 48 | else 49 | AC_MSG_RESULT([not found]) 50 | ifelse([$4],, 51 | [AC_MSG_ERROR([could not find ifelse([$2],,[$1],[$2]) in XML catalog])], 52 | [$4]) 53 | fi 54 | ]) 55 | 56 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | AC_VERSION= 3 | 4 | AUTOMAKE=${AUTOMAKE:-automake} 5 | AM_INSTALLED_VERSION=$($AUTOMAKE --version | sed -e '2,$ d' -e 's/.* \([0-9]*\.[0-9]*\).*/\1/') 6 | 7 | # FIXME: we need a better way for version check later. 8 | case "$AM_INSTALLED_VERSION" in 9 | 1.1[0-9]) 10 | ;; 11 | *) 12 | echo 13 | echo "You must have automake 1.10 or newer installed." 14 | echo "Install the appropriate package for your distribution," 15 | echo "or get the source tarball at http://ftp.gnu.org/gnu/automake/" 16 | exit 1 17 | ;; 18 | esac 19 | 20 | if [ "x${ACLOCAL_DIR}" != "x" ]; then 21 | ACLOCAL_ARG=-I ${ACLOCAL_DIR} 22 | fi 23 | 24 | test -d m4 || mkdir m4 25 | set -x 26 | 27 | ${ACLOCAL:-aclocal$AM_VERSION} ${ACLOCAL_ARG} 28 | ${AUTOHEADER:-autoheader$AC_VERSION} --force 29 | AUTOMAKE=$AUTOMAKE intltoolize -c --automake --force 30 | $AUTOMAKE --add-missing --copy --include-deps 31 | ${AUTOCONF:-autoconf$AC_VERSION} 32 | 33 | rm -rf autom4te.cache 34 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | AC_INIT([lxsession],[0.5.6],[],[lxsession]) 2 | 3 | # Autotols programs 4 | AM_INIT_AUTOMAKE([1.11.1 -Wall -Werror foreign no-dist-gzip dist-xz]) 5 | AC_PREREQ([2.68]) 6 | IT_PROG_INTLTOOL([0.40.0],[no-xml]) 7 | 8 | # Support silent build rules. Disable by either passing --disable-silent-rules 9 | # to configure or passing V=1 to make 10 | AM_SILENT_RULES([yes]) 11 | 12 | AC_CONFIG_HEADERS([config.h]) 13 | AC_CONFIG_MACRO_DIR([m4]) 14 | 15 | # C compiler 16 | AC_PROG_CC 17 | AC_PROG_INSTALL 18 | AM_PROG_CC_C_O 19 | AC_PROG_CC_STDC 20 | 21 | 22 | AC_CHECK_FUNC([mkstemp], 23 | AC_DEFINE(HAS_MKSTEMP,1,[Define to 1 if you have the 'mkstemp' function.])) 24 | 25 | AC_ARG_ENABLE(man, 26 | [AS_HELP_STRING([--enable-man], 27 | [regenerate roff man pages from Docbook @<:@default=no@:>@])], 28 | [enable_man="${enableval}"], 29 | [enable_man=no] 30 | ) 31 | 32 | AC_ARG_ENABLE(more_warnings, 33 | [AS_HELP_STRING([--enable-more-warnings], 34 | [Add more warnings @<:@default=no@:>@])], 35 | [enable_more_warnings="${enableval}"], 36 | [enable_more_warnings=no] 37 | ) 38 | 39 | if test x"$enable_more_warnings" = x"yes"; then 40 | ADDITIONAL_FLAGS="-Wall -Werror=all -Werror=format -Werror=implicit-function-declaration -Werror=implicit-int -Werror=missing-braces -Werror=parentheses -Werror=return-type -Werror=strict-aliasing -Werror=switch -Wuninitialized -Werror=unused-label -Werror=unused-value -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Werror=missing-declarations -Wredundant-decls -Wmissing-noreturn -Wpointer-arith -Wcast-align -Wwrite-strings -Werror=inline -Werror=format-nonliteral -Wformat-nonliteral -Werror=format-security -Wformat-security -Winit-self -Werror=missing-include-dirs -Werror=undef -Werror=aggregate-return -Wmissing-format-attribute -Werror=nested-externs -fno-strict-aliasing -fmessage-length=0 -Wp,-D_FORTIFY_SOURCE=2 -DG_DISABLE_DEPRECATED -DG_DISABLE_SINGLE_INCLUDES -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_DEPRECATED -DGTK_DISABLE_SINGLE_INCLUDES" 41 | fi 42 | AC_SUBST(ADDITIONAL_FLAGS) 43 | 44 | PKG_CHECK_MODULES(X11, [x11]) 45 | AC_SUBST(X11_CFLAGS) 46 | AC_SUBST(X11_LIBS) 47 | 48 | PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.32.0]) 49 | AC_SUBST(GLIB_CFLAGS) 50 | AC_SUBST(GLIB_LIBS) 51 | 52 | PKG_CHECK_MODULES(GIO, [gio-unix-2.0]) 53 | AC_SUBST(GIO_CFLAGS) 54 | AC_SUBST(GIO_LIBS) 55 | 56 | AC_ARG_ENABLE( 57 | [gtk], 58 | AS_HELP_STRING([--enable-gtk], 59 | [Build with gtk support (default: yes)]), 60 | use_gtk=$enableval, use_gtk="yes") 61 | 62 | AM_CONDITIONAL(USE_GTK, test "$use_gtk" = "yes") 63 | 64 | if test "x$use_gtk" = "xno" ; then 65 | enable_gtk3="no" 66 | use_buildin_clipboard="no" 67 | use_buildin_polkit="no" 68 | else 69 | AC_ARG_ENABLE([gtk3], 70 | AS_HELP_STRING([--enable-gtk3], 71 | [enable to use gtk-3.0 instead of gtk-2.0]), 72 | enable_gtk3=$enableval, enable_gtk3="no") 73 | 74 | if test "x$enable_gtk3" = "xyes" ; then 75 | CFLAGS="$CFLAGS -D USE_GTK3 -Wno-deprecated-declarations" 76 | gtk_modules="gtk+-3.0 >= 3.0.0" 77 | VALA_GTK_LIBS="gtk+-3.0" 78 | else 79 | CFLAGS="$CFLAGS -D USE_GTK2" 80 | gtk_modules="gtk+-2.0 >= 2.12.0" 81 | VALA_GTK_LIBS="gtk+-2.0" 82 | fi 83 | PKG_CHECK_MODULES(GTK, [$gtk_modules]) 84 | AC_SUBST(GTK_CFLAGS) 85 | AC_SUBST(GTK_LIBS) 86 | 87 | AC_SUBST(VALA_GTK_LIBS) 88 | 89 | polkit_modules="polkit-agent-1" 90 | PKG_CHECK_MODULES(POLKIT, [$polkit_modules]) 91 | AC_SUBST(POLKIT_CFLAGS) 92 | AC_SUBST(POLKIT_LIBS) 93 | 94 | AC_ARG_ENABLE( 95 | [buildin-clipboard], 96 | AS_HELP_STRING([--enable-buildin-clipboard], 97 | [Build with build-in clipboard support (default: no)]), 98 | use_buildin_clipboard=$enableval, use_buildin_clipboard="no") 99 | 100 | AC_ARG_ENABLE( 101 | [buildin-polkit], 102 | AS_HELP_STRING([--enable-buildin-polkit], 103 | [Build with build-in polkit-agent support (default: no)]), 104 | use_buildin_polkit=$enableval, use_buildin_polkit="no") 105 | 106 | AC_ARG_ENABLE( 107 | [advanced-notifications], 108 | AS_HELP_STRING([--enable-advanced-notifications], 109 | [Build with advanced notification using indicators and libnotify (default: no)]), 110 | use_advanced_notifications=$enableval, use_advanced_notifications="no") 111 | 112 | fi 113 | 114 | AM_CONDITIONAL(USE_BUILDIN_CLIPBOARD, test "$use_buildin_clipboard" = "yes") 115 | AM_CONDITIONAL(USE_BUILDIN_POLKIT, test "$use_buildin_polkit" = "yes") 116 | AM_CONDITIONAL(USE_GTK3, test "$enable_gtk3" = "yes") 117 | AM_CONDITIONAL(USE_ADVANCED_NOTIFICATIONS, test "$use_advanced_notifications" = "yes") 118 | 119 | if test "$use_advanced_notifications" = "yes"; then 120 | PKG_CHECK_MODULES(INDICATORS, [indicator-0.4 >= 0.4.93 appindicator-0.1]) 121 | AC_SUBST(INDICATORS_CFLAGS) 122 | AC_SUBST(INDICATORS_LIBS) 123 | 124 | PKG_CHECK_MODULES(LIBNOTIFY, [libnotify]) 125 | AC_SUBST(LIBNOTIFY_CFLAGS) 126 | AC_SUBST(LIBNOTIFY_LIBS) 127 | fi 128 | 129 | if test "$use_buildin_polkit" = "yes"; then 130 | HIDE_LXPOLKIT_AUTOSTART=true 131 | else 132 | HIDE_LXPOLKIT_AUTOSTART=false 133 | fi 134 | AC_SUBST(HIDE_LXPOLKIT_AUTOSTART) 135 | 136 | AM_PROG_VALAC([0.20]) 137 | if test "x$VALAC" = "x"; then 138 | AC_MSG_ERROR([You need Vala compiler]) 139 | else 140 | VALAFLAGS="$VALAFLAGS --enable-deprecated" 141 | AC_SUBST(VALAFLAGS) 142 | fi 143 | 144 | # debug flags 145 | AC_ARG_ENABLE(debug, 146 | [AS_HELP_STRING([--enable-debug],[build lxsession with debug support @<:@default=no@:>@])], 147 | [enable_debug="${enableval}"], 148 | [enable_debug=no] 149 | ) 150 | if test "$enable_debug" = "yes"; then 151 | # turn on debug and disable optimization 152 | CPPFLAGS="$CPPFLAGS -DG_ENABLE_DEBUG -O0 -g" 153 | else 154 | # turn off glib debug checks 155 | CPPFLAGS="$CPPFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS" 156 | fi 157 | 158 | # Generate po/LINGUAS on the fly rather than relying on translators 159 | # to maintain it manually. This also overcome the problem that Transifex 160 | # cannot add a language to po/LINGUAS if a new po file is submitted. 161 | rm -f $srcdir/po/LINGUAS 162 | for po_file in `ls $srcdir/po/*.po | sort`; 163 | do 164 | lang=`echo "$po_file" | sed "s|.*/po/\(.*\)\.po|\1|g"` 165 | echo $lang >> $srcdir/po/LINGUAS 166 | done 167 | 168 | GETTEXT_PACKAGE=lxsession 169 | AC_SUBST(GETTEXT_PACKAGE) 170 | AM_GLIB_GNU_GETTEXT 171 | AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.]) 172 | 173 | if test x"$enable_man" = x"yes"; then 174 | AC_PATH_PROG([XSLTPROC], [xsltproc]) 175 | if test -z "$XSLTPROC"; then 176 | AC_MSG_ERROR([xsltproc is required to regenerate the pre-built man pages; consider --disable-man]) 177 | fi 178 | 179 | dnl check for DocBook DTD and stylesheets in the local catalog. 180 | JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.1.2//EN], 181 | [DocBook XML DTD V4.1.2], [], AC_MSG_ERROR([DocBook XML DTD is required to regenerate the pre-built man pages; consider --disable-man])) 182 | JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl], 183 | [DocBook XSL Stylesheets >= 1.70.1], [], AC_MSG_ERROR([DocBook XSL Stylesheets are required to regenerate the pre-built man pages; consider --disable-man])) 184 | 185 | rm -f $srcdir/man/lxsession.1 186 | rm -f $srcdir/man/lxsession-logout.1 187 | fi 188 | 189 | AM_CONDITIONAL(ENABLE_REGENERATE_MAN, test "x$enable_man" != "xno") 190 | 191 | dnl Fix invalid sysconfdir when --prefix=/usr 192 | if test `eval "echo $sysconfdir"` = /usr/etc 193 | then 194 | sysconfdir=/etc 195 | fi 196 | 197 | AC_CONFIG_FILES([ 198 | Makefile 199 | data/Makefile 200 | data/ui/Makefile 201 | data/lxpolkit.desktop.in 202 | man/Makefile 203 | po/Makefile.in 204 | ]) 205 | AC_OUTPUT 206 | 207 | echo 208 | echo LXSession.................................... : Version $VERSION 209 | echo 210 | echo Prefix....................................... : $prefix 211 | echo Sysconfdir................................... : $sysconfdir 212 | echo GTK support.................................. : $use_gtk 213 | echo GTK Cliboard build-in suport................. : $use_buildin_clipboard 214 | echo GTK Polkit-agent build-in suport............. : $use_buildin_polkit 215 | echo Enable GTK3 support.......................... : $enable_gtk3 216 | echo Enable debug................................. : $enable_debug 217 | echo Man pages generation support................. : $enable_man 218 | echo 219 | echo The binary will be installed in $prefix/bin 220 | echo 221 | echo http://lxde.org/ 222 | echo 223 | echo Have fun! 224 | echo 225 | -------------------------------------------------------------------------------- /data/Makefile.am: -------------------------------------------------------------------------------- 1 | NULL= 2 | 3 | SUBDIRS= \ 4 | ui \ 5 | $(NULL) 6 | 7 | desktopdir = $(datadir)/applications 8 | desktop_in_files = \ 9 | lxsession-default-apps.desktop.in \ 10 | lxsession-edit.desktop.in \ 11 | $(NULL) 12 | desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) 13 | autostartdir = $(sysconfdir)/xdg/autostart 14 | autostart_in_files = lxpolkit.desktop.in 15 | autostart_DATA = $(autostart_in_files:.desktop.in=.desktop) 16 | @INTLTOOL_DESKTOP_RULE@ 17 | DISTCLEANFILES = \ 18 | lxsession-default-apps.desktop \ 19 | lxsession-edit.desktop \ 20 | lxpolkit.desktop \ 21 | $(NULL) 22 | 23 | imagedir=$(datadir)/lxsession/images 24 | image_DATA= \ 25 | images/system-shutdown.png \ 26 | images/system-log-out.png \ 27 | images/gnome-session-hibernate.png \ 28 | images/gnome-session-reboot.png \ 29 | images/gnome-session-suspend.png \ 30 | images/gnome-session-switch.png 31 | 32 | EXTRA_DIST= \ 33 | desktop.conf.example \ 34 | conffiles.conf.example \ 35 | $(desktop_DATA) \ 36 | $(desktop_in_files) \ 37 | $(autostart_DATA) \ 38 | $(autostart_in_files) \ 39 | $(image_DATA) \ 40 | $(NULL) 41 | -------------------------------------------------------------------------------- /data/conffiles.conf.example: -------------------------------------------------------------------------------- 1 | [Openbox] 2 | source= 3 | 4 | [XScreensaver] 5 | source= 6 | 7 | [Qt] 8 | source= 9 | 10 | [Leafpad] 11 | source= 12 | 13 | [LXterminal] 14 | source= 15 | 16 | [cairo-dock] 17 | source= 18 | -------------------------------------------------------------------------------- /data/desktop.conf.example: -------------------------------------------------------------------------------- 1 | [Session] 2 | # Default program launched at startup 3 | # Windows manager : Simple way to launch window manager (backward compatible). Let it empty if you want to use the advanced mode 4 | window_manager=openbox-lxde 5 | 6 | # Window manager : Advanced mode to launch the window manager (with session, usefull for launching openbox with specific arguments (like configuration file) and extras commands) 7 | windows_manager/command= 8 | windows_manager/session= 9 | windows_manager/extras= 10 | 11 | # Panel and its session (if necessary) 12 | panel/command=lxpanel 13 | panel/session=LXDE 14 | 15 | # Dock (or 2nd panel) and its session (if necessary) 16 | dock/command= 17 | dock/session= 18 | 19 | # Screensaver 20 | screensaver/command=xscreensaver 21 | 22 | # Power management 23 | power_manager/command= 24 | 25 | # File manager (session if necessary, extras commands if necessary) 26 | file_manager/command=pcmanfm 27 | file_manager/session=LXDE 28 | file_manager/extras= 29 | 30 | # Desktop manager (handler to draw and manager the desktop) 31 | # options possible : filemanager (to use the default file manager), feh (to use feh just to draw the background) 32 | desktop_manager/command= 33 | desktop_manager/wallpaper= 34 | 35 | # Polkit agent (use lxpolkit to use build-in support if enable at build time) 36 | polkit/command=lxpolkit 37 | 38 | # Network GUI manager (auto to try to guess the best choice) 39 | network_gui/command= 40 | 41 | # Instant message or communication program n°1 (pidgin, IRC, skype ...) 42 | im1/command= 43 | im1/autostart= 44 | 45 | # Instant message or communication program n°2 (pidgin, IRC, skype ...) 46 | im2/command= 47 | im2/autostart= 48 | 49 | # Widget program (conky, screenlet ...) 50 | widget1/command= 51 | widget1/autostart= 52 | 53 | # Audio preferences (dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.AudioManagerLaunch) 54 | audio_manager/command= 55 | 56 | # Logout dialog (dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.QuitManagerLaunch) 57 | quit_manager/command=lxsession-logout 58 | quit_manager/image=/usr/share/lxde/images/logout-banner.png 59 | quit_manager/layout=top 60 | 61 | # Workspace manager (dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.WorkspaceManagerLaunch) 62 | workspace_manager/command= 63 | 64 | # Launcher to launch applications (dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.LauncherManagerLaunch) 65 | launcher_manager/command= 66 | 67 | # Terminal by default (dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.TerminalManagerLaunch) 68 | terminal_manager/command= 69 | 70 | # Screenshot utility by default 71 | # main program : dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/ScreenshotManager org.lxde.SessionManager.ScreenshotManagerLaunch 72 | # only windows : dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/ScreenshotManager org.lxde.SessionManager.ScreenshotWindowManagerLaunch 73 | screenshot_manager/command= 74 | 75 | # Upgrade by default (dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.UpgradeManagerLaunch) 76 | upgrade_manager/command= 77 | 78 | # Updates checker, support update-notifier-clone. 79 | updates_manager/command= 80 | # Timemout between the launch of the crash manager (to avoid running to often when the directory change) 81 | updates_manager/timeout=60 82 | 83 | # Crash report looging facility, launch crash report when a crash file is deteted (support apport-gtk only) 84 | crash_manager/command= 85 | # Add an option to delete the crash report, usefull for developers which crash apps too often 86 | crash_manager/dev_mode= 87 | # Timemout between the launch of the crash manager (to avoid running to often when the directory change) 88 | crash_manager/timeout=60 89 | 90 | # Clipboard support (use lxclipboard to use build-in support if enable at build time) 91 | clipboard/command=lxclipboard 92 | 93 | # Use a standalone composite manager (with possibility to autostart it) 94 | composite_manager/command= 95 | composite_manager/autostart=true 96 | 97 | # Utility to lock screen 98 | lock_manager/command=lxlock 99 | 100 | # Utility to display messages (only lxsession-message-* supported) 101 | message_manager/command=lxsession-message-gtk 102 | 103 | # Utility to load and apply xsettings (options available : "gnome", "xfce" and "build-in" for using build-in support of lxsession) 104 | xsettings_manager/command=build-in 105 | 106 | # Utility for displaying notification 107 | notification/command= 108 | notification/autostart=true 109 | 110 | # Utility for running a keybindings daemon 111 | keybindings/command= 112 | keybindings/autostart=true 113 | 114 | # Utility to set proxy environment variable. Options available : build-in 115 | # http: Set the variable to export 116 | proxy_manager/command=build-in 117 | proxy_manager/http= 118 | 119 | # Aaccessibility to enable (GNOME, KDE or other). Only GNOME supported now. 120 | a11y/command = gnome 121 | 122 | # Default Keyring program (default for ssh-agent, gnome-all for gnome-keyring-daemon full support) 123 | keyring/command=ssh-agent 124 | 125 | # Command to launch for configuring Xrandr ex: xrandr --mode ... 126 | xrandr/command= 127 | 128 | # Im method by default (fcitx, ibus) 129 | im_manager/command= 130 | im_manager/autostart= 131 | 132 | # Default web browser (desktop is the corresponding desktop file) 133 | webbrowser/command= 134 | webbrowser/desktop= 135 | 136 | # Default email client (desktop is the corresponding desktop file) 137 | email/command= 138 | email/desktop= 139 | 140 | # Other default application 141 | pdf_reader/command= 142 | video_player/command= 143 | audio_player/command= 144 | image_display/command= 145 | text_editor/command= 146 | archive/command= 147 | charmap/command= 148 | calculator/command= 149 | spreadsheet/command= 150 | bittorent/command= 151 | document/command= 152 | webcam/command= 153 | burn/command= 154 | notes/command= 155 | disk_utility/command= 156 | tasks/command= 157 | 158 | # Disable autostart of applications in system and home autostart directory 159 | # all : disable all applications (home, system, specify in this config file) 160 | # config-only : disable applications from home and system (start only the ones in this config file) 161 | # no : autostart all applications 162 | disable_autostart=no 163 | 164 | [State] 165 | # unknown if untested, yes if on laptop, no if not 166 | laptop_mode=unknown 167 | # Try to guess the default 168 | guess_default=true 169 | 170 | [Dbus] 171 | # Default Dbus interfaces, should be always true 172 | lxde=true 173 | # Implement gnome-session Dbus API 174 | gnome=false 175 | 176 | [Keymap] 177 | # Read configuration from : user (this file) or system 178 | mode= 179 | # Keyboard configuration for user mode, all 4 should be present 180 | model= 181 | layout= 182 | variant= 183 | options= 184 | 185 | [Environment] 186 | type= 187 | menu_prefix=lxde- 188 | # Enable appmenu integration 189 | ubuntu_menuproxy=false 190 | # Use this toolkit integration when only can be use, like LibreOffice (example : kde4, gtk2, gtk3) 191 | toolkit_integration=gtk2 192 | # Disable gtk3 overlay scrollbar (GTK_OVERLAY_SCROLLING=0) "true" or "false". 193 | gtk/overlay_scrollbar_disable=false 194 | # Force using theme for QT apps (example gtk by QT_STYLE_OVERRIDE=gtk) 195 | qt/force_theme= 196 | # Set Qt platform settings 197 | qt/platform=lxqt 198 | 199 | [Environment_variable] 200 | # Export TEST variable with value test 201 | TEST=test 202 | 203 | [GTK] 204 | #iNet/DoubleClickTime=400 205 | #iNet/DoubleClickDistance 206 | #iNet/DndDragThreshold 207 | #iNet/CursorBlink 208 | #iNet/CursorBlinkTime 209 | sNet/ThemeName=Clearlooks 210 | sNet/IconThemeName=nuoveXT2 211 | sGtk/FontName=Sans 10 212 | #iGtk/IconSizes 213 | #sGtk/KeyThemeName 214 | iGtk/ToolbarStyle=3 215 | #iGtk/ToolbarIconSize 216 | #iGtk/IMPreeditStyle 217 | #iGtk/IMStatusStyle 218 | iGtk/ButtonImages=1 219 | iGtk/MenuImages=1 220 | #sGtk/CursorThemeName= 221 | iGtk/CursorThemeSize=18 222 | iXft/Antialias=1 223 | #iXft/Hinting 224 | #iXft/HintStyle 225 | #iXft/RGBA 226 | #iXft/DPI 227 | #iGtk/TouchscreenMode 228 | 229 | [Mouse] 230 | AccFactor=20 231 | AccThreshold=10 232 | LeftHanded=0 233 | 234 | [Keyboard] 235 | Delay=500 236 | Interval=30 237 | -------------------------------------------------------------------------------- /data/images/gnome-session-hibernate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lxde/lxsession/886b9ad90f98b12c775313331431769295138f69/data/images/gnome-session-hibernate.png -------------------------------------------------------------------------------- /data/images/gnome-session-reboot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lxde/lxsession/886b9ad90f98b12c775313331431769295138f69/data/images/gnome-session-reboot.png -------------------------------------------------------------------------------- /data/images/gnome-session-suspend.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lxde/lxsession/886b9ad90f98b12c775313331431769295138f69/data/images/gnome-session-suspend.png -------------------------------------------------------------------------------- /data/images/gnome-session-switch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lxde/lxsession/886b9ad90f98b12c775313331431769295138f69/data/images/gnome-session-switch.png -------------------------------------------------------------------------------- /data/images/system-log-out.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lxde/lxsession/886b9ad90f98b12c775313331431769295138f69/data/images/system-log-out.png -------------------------------------------------------------------------------- /data/images/system-shutdown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lxde/lxsession/886b9ad90f98b12c775313331431769295138f69/data/images/system-shutdown.png -------------------------------------------------------------------------------- /data/lxpolkit.desktop.in.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | _Name=LXPolKit 4 | _Comment=Policykit Authentication Agent 5 | Exec=lxpolkit 6 | TryExec=lxpolkit 7 | Icon=gtk-dialog-authentication 8 | NotShowIn=GNOME;KDE;MATE;LXQt;XFCE;Unity;X-Cinnamon; 9 | NoDisplay=true 10 | -------------------------------------------------------------------------------- /data/lxsession-default-apps.desktop.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Icon=preferences-desktop 4 | Exec=lxsession-default-apps 5 | _Name=Default applications for LXSession 6 | _Comment=Change the default applications on LXDE 7 | Categories=GTK;Settings;DesktopSettings;X-LXDE-Settings; 8 | OnlyShowIn=LXDE; 9 | -------------------------------------------------------------------------------- /data/lxsession-edit.desktop.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Icon=preferences-desktop 4 | Exec=lxsession-edit 5 | _Name=Desktop Session Settings 6 | _Comment=Manage applications loaded in desktop session 7 | Categories=GTK;Settings;DesktopSettings;X-LXDE-Settings; 8 | OnlyShowIn=LXDE; 9 | -------------------------------------------------------------------------------- /data/ui/Makefile.am: -------------------------------------------------------------------------------- 1 | NULL= 2 | 3 | # GtkBuilder UI definition files 4 | uidir=$(datadir)/lxsession/ui 5 | ui_DATA= \ 6 | lxpolkit.ui \ 7 | lxsession-default-apps.ui \ 8 | lxsession-edit.ui \ 9 | $(NULL) 10 | 11 | EXTRA_DIST= \ 12 | $(ui_DATA) \ 13 | $(NULL) 14 | -------------------------------------------------------------------------------- /data/ui/lxpolkit.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | False 7 | 5 8 | Authentication 9 | False 10 | center 11 | normal 12 | 13 | 14 | True 15 | False 16 | 2 17 | 18 | 19 | True 20 | False 21 | end 22 | 23 | 24 | gtk-cancel 25 | True 26 | True 27 | True 28 | True 29 | 30 | 31 | False 32 | False 33 | 0 34 | 35 | 36 | 37 | 38 | gtk-ok 39 | True 40 | True 41 | True 42 | True 43 | True 44 | True 45 | 46 | 47 | False 48 | False 49 | 1 50 | 51 | 52 | 53 | 54 | False 55 | True 56 | end 57 | 0 58 | 59 | 60 | 61 | 62 | True 63 | False 64 | 12 65 | 6 66 | 67 | 68 | True 69 | False 70 | 71 | 72 | True 73 | False 74 | dialog-password 75 | 76 | 77 | False 78 | True 79 | 0 80 | 81 | 82 | 83 | 84 | True 85 | False 86 | 0 87 | 0 88 | True 89 | 90 | 91 | True 92 | True 93 | 1 94 | 95 | 96 | 97 | 98 | False 99 | True 100 | 0 101 | 102 | 103 | 104 | 105 | True 106 | False 107 | 6 108 | 109 | 110 | True 111 | False 112 | 0 113 | Identity: 114 | 115 | 116 | False 117 | True 118 | 0 119 | 120 | 121 | 122 | 123 | True 124 | False 125 | 126 | 127 | 128 | 0 129 | 130 | 131 | 132 | 133 | True 134 | True 135 | 1 136 | 137 | 138 | 139 | 140 | False 141 | True 142 | 1 143 | 144 | 145 | 146 | 147 | True 148 | False 149 | 6 150 | 151 | 152 | True 153 | False 154 | 0 155 | 156 | 157 | False 158 | True 159 | 0 160 | 161 | 162 | 163 | 164 | True 165 | True 166 | True 167 | False 168 | 169 | True 170 | False 171 | False 172 | True 173 | True 174 | 175 | 176 | True 177 | True 178 | 1 179 | 180 | 181 | 182 | 183 | False 184 | True 185 | 2 186 | 187 | 188 | 189 | 190 | True 191 | False 192 | 0 193 | 0 194 | 195 | 196 | False 197 | True 198 | 3 199 | 200 | 201 | 202 | 203 | False 204 | True 205 | 1 206 | 207 | 208 | 209 | 210 | 211 | cancel 212 | ok 213 | 214 | 215 | 216 | both 217 | 218 | 219 | 220 | 221 | 222 | 223 | both 224 | 225 | 226 | 227 | 228 | 229 | 230 | -------------------------------------------------------------------------------- /lxclipboard/clipboard.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- 2 | * 3 | * Copyright (C) 2007 William Jon McCann 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along 16 | * with this program; if not, write to the Free Software Foundation, Inc., 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | */ 20 | 21 | #ifndef __GSD_CLIPBOARD_MANAGER_H 22 | #define __GSD_CLIPBOARD_MANAGER_H 23 | 24 | #include 25 | 26 | G_BEGIN_DECLS 27 | 28 | typedef struct _GsdClipboardManager GsdClipboardManager; 29 | typedef struct _GsdClipboardManagerClass GsdClipboardManagerClass; 30 | typedef struct _GsdClipboardManagerPrivate GsdClipboardManagerPrivate; 31 | 32 | #define GSD_TYPE_CLIPBOARD_MANAGER (gsd_clipboard_manager_get_type ()) 33 | #define GSD_CLIPBOARD_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_CLIPBOARD_MANAGER, GsdClipboardManager)) 34 | #define GSD_CLIPBOARD_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_CLIPBOARD_MANAGER, GsdClipboardManagerClass)) 35 | #define GSD_IS_CLIPBOARD_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_CLIPBOARD_MANAGER)) 36 | #define GSD_IS_CLIPBOARD_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_CLIPBOARD_MANAGER)) 37 | #define GSD_CLIPBOARD_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_CLIPBOARD_MANAGER, GsdClipboardManagerClass)) 38 | 39 | struct _GsdClipboardManager 40 | { 41 | GObject parent; 42 | GsdClipboardManagerPrivate *priv; 43 | }; 44 | 45 | struct _GsdClipboardManagerClass 46 | { 47 | GObjectClass parent_class; 48 | }; 49 | 50 | GType gsd_clipboard_manager_get_type (void); 51 | 52 | gboolean gsd_clipboard_manager_start (GsdClipboardManager *manager, 53 | gboolean replace); 54 | 55 | void gsd_clipboard_manager_stop (GsdClipboardManager *manager); 56 | 57 | void clipboard_start (); 58 | 59 | void clipboard_stop (); 60 | 61 | G_END_DECLS 62 | 63 | #endif /* __GSD_CLIPBOARD_MANAGER_H */ 64 | -------------------------------------------------------------------------------- /lxclipboard/main.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Julien Lavergne 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 17 | * MA 02110-1301, USA. 18 | */ 19 | using Gtk; 20 | 21 | namespace Lxsession 22 | { 23 | public class Main: GLib.Object 24 | { 25 | public static int main(string[] args) 26 | { 27 | Gtk.init (ref args); 28 | GLib.Application app = new GLib.Application ( 29 | "org.lxde.lxclipboard", 30 | GLib.ApplicationFlags.FLAGS_NONE); 31 | app.register (); 32 | 33 | if(app.is_remote) 34 | { 35 | message("lxclipboard is already running. Existing"); 36 | return 0; 37 | } 38 | 39 | clipboard_start (); 40 | 41 | /* start main loop */ 42 | new MainLoop().run(); 43 | 44 | /* Stop clipboard */ 45 | clipboard_stop (); 46 | 47 | return 0; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /lxlock/lxlock: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # 4 | # Copyright (C) 1999, 2003 Olivier Fourdan (fourdan@xfce.org) 5 | # Copyright (C) 2012 Julien Lavergne (gilir@ubuntu.com) 6 | # Copyright (C) 2013 Jarno Suni (8@iki.fi) 7 | # 8 | # This program is free software; you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation; either version 2 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with this program; if not, write to the Free Software 20 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 21 | # MA 02110-1301, USA. 22 | 23 | # Try to lock the screen with these applications (in this order): 24 | 25 | if pidof light-locker >/dev/null; then 26 | light-locker-command -l >/dev/null 2>&1 27 | elif pidof xscreensaver >/dev/null; then 28 | xscreensaver-command -lock >/dev/null 2>&1 29 | elif pidof gnome-screensaver >/dev/null; then 30 | gnome-screensaver-command --lock 31 | elif which slock >/dev/null 2>&1; then 32 | slock & 33 | elif which xlock >/dev/null 2>&1; then 34 | xlock $* 35 | elif which i3lock >/dev/null 2>&1; then 36 | i3lock 37 | elif which slimlock >/dev/null 2>&1; then 38 | slimlock 39 | elif which xtrlock >/dev/null 2>&1; then 40 | xtrlock 41 | elif which xsecurelock >/dev/null 2>&1; then 42 | xsecurelock 43 | else 44 | # In the end, try to fallback to xscreensaver 45 | 46 | # assert: gnome-screensaver is not running 47 | xscreensaver -nosplash >/dev/null 2>&1 & 48 | xscreensaver-command -lock >/dev/null 2>&1 49 | fi 50 | exit 0 51 | -------------------------------------------------------------------------------- /lxpolkit/lxpolkit-listener.h: -------------------------------------------------------------------------------- 1 | /* 2 | * lx-polkit-listener.h 3 | * 4 | * Copyright 2010 PCMan 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 19 | * MA 02110-1301, USA. 20 | */ 21 | 22 | 23 | #ifndef __LX_POLKIT_LISTENER_H__ 24 | #define __LX_POLKIT_LISTENER_H__ 25 | 26 | #define POLKIT_AGENT_I_KNOW_API_IS_SUBJECT_TO_CHANGE 27 | #include 28 | 29 | G_BEGIN_DECLS 30 | 31 | #define LXPOLKIT_LISTENER_TYPE (lxpolkit_listener_get_type()) 32 | #define LXPOLKIT_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),\ 33 | LXPOLKIT_LISTENER_TYPE, LXPolkitListener)) 34 | #define LXPOLKIT_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),\ 35 | LXPOLKIT_LISTENER_TYPE, LXPolkitListenerClass)) 36 | #define IS_LXPOLKIT_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),\ 37 | LXPOLKIT_LISTENER_TYPE)) 38 | #define IS_LXPOLKIT_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),\ 39 | LXPOLKIT_LISTENER_TYPE)) 40 | 41 | typedef struct _LXPolkitListener LXPolkitListener; 42 | typedef struct _LXPolkitListenerClass LXPolkitListenerClass; 43 | 44 | struct _LXPolkitListener 45 | { 46 | PolkitAgentListener parent; 47 | }; 48 | 49 | struct _LXPolkitListenerClass 50 | { 51 | PolkitAgentListenerClass parent_class; 52 | }; 53 | 54 | GType lxpolkit_listener_get_type(void); 55 | PolkitAgentListener* lxpolkit_listener_new(void); 56 | 57 | G_END_DECLS 58 | 59 | #endif /* __LX_POLKIT_LISTENER_H__ */ 60 | -------------------------------------------------------------------------------- /lxpolkit/lxpolkit.c: -------------------------------------------------------------------------------- 1 | /* 2 | * lxpolkit.c 3 | * 4 | * Copyright 2010 - 2011 PCMan 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 19 | * MA 02110-1301, USA. 20 | */ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #include "lxpolkit-listener.h" 31 | #include "lxpolkit.h" 32 | 33 | static PolkitAgentListener *listener; 34 | static PolkitSubject* session; 35 | 36 | void show_msg(GtkWindow* parent, GtkMessageType type, const char* msg) 37 | { 38 | GtkWidget* dlg = gtk_message_dialog_new(parent, GTK_DIALOG_MODAL, type, 39 | GTK_BUTTONS_OK, "%s", msg); 40 | const char* title = NULL; 41 | switch(type) 42 | { 43 | case GTK_MESSAGE_ERROR: 44 | title = _("Error"); 45 | break; 46 | case GTK_MESSAGE_INFO: 47 | title = _("Information"); 48 | break; 49 | } 50 | if(title) 51 | gtk_window_set_title(GTK_WINDOW(dlg), title); 52 | gtk_dialog_run(GTK_DIALOG(dlg)); 53 | gtk_widget_destroy(dlg); 54 | } 55 | 56 | gboolean policykit_agent_init() 57 | { 58 | GError* err = NULL; 59 | 60 | listener = lxpolkit_listener_new(); 61 | session = polkit_unix_session_new_for_process_sync(getpid(), NULL, &err); 62 | if(session == NULL) 63 | { 64 | /* show error msg */ 65 | g_object_unref(listener); 66 | show_msg(NULL, GTK_MESSAGE_ERROR, err->message); 67 | return 1; 68 | } 69 | if(!polkit_agent_register_listener(listener, session, NULL, &err)) 70 | { 71 | /* show error msg */ 72 | g_object_unref(listener); 73 | g_object_unref(session); 74 | /* lxsession_show_msg(NULL, GTK_MESSAGE_ERROR, err->message); */ 75 | show_msg(NULL, GTK_MESSAGE_ERROR, err->message); 76 | listener = NULL; 77 | session = NULL; 78 | return FALSE; 79 | } 80 | return TRUE; 81 | } 82 | 83 | void policykit_agent_finalize() 84 | { 85 | g_object_unref(listener); 86 | g_object_unref(session); 87 | } 88 | -------------------------------------------------------------------------------- /lxpolkit/lxpolkit.h: -------------------------------------------------------------------------------- 1 | /* 2 | * lxpolkit.h 3 | * 4 | * Copyright 2011 Hong Jen Yee (PCMan) 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 19 | * MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __LXPOLKIT_H__ 23 | #define __LXPOLKIT_H__ 24 | 25 | #include 26 | #include 27 | 28 | G_BEGIN_DECLS 29 | 30 | void show_msg(GtkWindow* parent, GtkMessageType type, const char* msg); 31 | 32 | gboolean policykit_agent_init(); 33 | void policykit_agent_finalize(); 34 | 35 | G_END_DECLS 36 | 37 | #endif 38 | 39 | -------------------------------------------------------------------------------- /lxpolkit/main.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Julien Lavergne 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 17 | * MA 02110-1301, USA. 18 | */ 19 | using Gtk; 20 | 21 | const string GETTEXT_PACKAGE = "lxsession"; 22 | 23 | namespace Lxsession 24 | { 25 | public class Main: GLib.Object 26 | { 27 | public static int main(string[] args) 28 | { 29 | Intl.textdomain(GETTEXT_PACKAGE); 30 | Intl.bind_textdomain_codeset(GETTEXT_PACKAGE, "utf-8"); 31 | 32 | Gtk.init (ref args); 33 | GLib.Application app = new GLib.Application ( 34 | "org.lxde.lxpolkit", 35 | GLib.ApplicationFlags.FLAGS_NONE); 36 | app.register (); 37 | 38 | if(app.is_remote) 39 | { 40 | message(_("lxpolkit is already running. Exiting")); 41 | return 0; 42 | } 43 | 44 | policykit_agent_init(); 45 | 46 | /* start main loop */ 47 | new MainLoop().run(); 48 | 49 | /* Stop polkit agent */ 50 | policykit_agent_finalize(); 51 | 52 | return 0; 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /lxsession-db/main.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Julien Lavergne 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 17 | * MA 02110-1301, USA. 18 | */ 19 | 20 | namespace Lxsession 21 | { 22 | DBDefaultApps global_db; 23 | 24 | public class Main: GLib.Object 25 | { 26 | //static string settings = ""; 27 | static string mode = ""; 28 | //static string backend = ""; 29 | 30 | const OptionEntry[] option_entries = { 31 | // { "settings", 's', 0, OptionArg.STRING, ref mode, "specify the settings to read (default to lxsession)", "NAME" }, 32 | { "mode", 'm', 0, OptionArg.STRING, ref mode, "specify the mode to launch (display or write)", "NAME" }, 33 | // { "backend", 'b', 0, OptionArg.STRING, ref mode, "specify the backend to write (default to lxsession-default-apps)", "NAME" }, 34 | { null } 35 | }; 36 | 37 | public static int main(string[] args) 38 | { 39 | try 40 | { 41 | var options_args = new OptionContext("- Lxsession database utility"); 42 | options_args.set_help_enabled(true); 43 | options_args.add_main_entries(option_entries, null); 44 | options_args.parse(ref args); 45 | } 46 | catch (OptionError e) 47 | { 48 | critical ("Option parsing failed: %s\n", e.message); 49 | return -1; 50 | } 51 | 52 | Gtk.init (ref args); 53 | 54 | /* Init */ 55 | var db = new DBDefaultApps(mode); 56 | global_db = db; 57 | 58 | global_db.update(); 59 | 60 | var loop = new MainLoop(); 61 | 62 | global_db.exit_now.connect(loop.quit); 63 | 64 | /* start main loop */ 65 | loop.run(); 66 | 67 | return 0; 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /lxsession-default-apps/dbus-backend.vala: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2012 Julien Lavergne 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | namespace LDefaultApps 19 | { 20 | [DBus(name = "org.lxde.SessionManager")] 21 | public interface DbusLxsession : GLib.Object 22 | { 23 | public abstract string SessionGet (string key1, string? key2) throws IOError; 24 | public abstract void SessionSet (string key1, string? key2, string command_to_set) throws IOError; 25 | public abstract void SessionLaunch (string name, string option) throws IOError; 26 | public abstract string[] SessionSupport () throws IOError; 27 | public abstract string[] SessionSupportDetail (string key1) throws IOError; 28 | 29 | public abstract void KeymapActivate () throws IOError; 30 | public abstract void KeymapSet (string key1, string? key2, string command_to_set) throws IOError; 31 | public abstract string KeymapGet (string key1, string? key2) throws IOError; 32 | 33 | public abstract void StateSet (string key1, string? key2, string command_to_set) throws IOError; 34 | public abstract string StateGet (string key1, string? key2) throws IOError; 35 | 36 | public abstract void DbusSet (string key1, string? key2, string command_to_set) throws IOError; 37 | public abstract string DbusGet (string key1, string? key2) throws IOError; 38 | 39 | public abstract void EnvironmentSet (string key1, string? key2, string command_to_set) throws IOError; 40 | public abstract string EnvironmentGet (string key1, string? key2) throws IOError; 41 | } 42 | 43 | public class DbusBackend : GLib.Object 44 | { 45 | DbusLxsession dbus_lxsession = null; 46 | string dbus_type = null; 47 | 48 | public DbusBackend (string type) 49 | { 50 | try 51 | { 52 | dbus_lxsession = GLib.Bus.get_proxy_sync(BusType.SESSION, 53 | "org.lxde.SessionManager", 54 | "/org/lxde/SessionManager"); 55 | } 56 | catch (GLib.IOError err) 57 | { 58 | warning (err.message); 59 | } 60 | 61 | if (type == null) 62 | { 63 | dbus_type = "session"; 64 | } 65 | else 66 | { 67 | dbus_type = type; 68 | } 69 | } 70 | 71 | public string Get (string key1, string? key2) 72 | { 73 | string return_value = ""; 74 | 75 | switch (dbus_type) 76 | { 77 | case "session": 78 | return_value = SessionGet (key1, key2); 79 | break; 80 | } 81 | 82 | return return_value; 83 | } 84 | 85 | public void Set (string key1, string? key2, string command_to_set) 86 | { 87 | switch (dbus_type) 88 | { 89 | case "session": 90 | SessionSet (key1, key2, command_to_set); 91 | break; 92 | } 93 | } 94 | 95 | public void Launch (string name, string option) 96 | { 97 | switch (dbus_type) 98 | { 99 | case "session": 100 | SessionLaunch (name, option); 101 | break; 102 | } 103 | } 104 | 105 | 106 | public string SessionGet (string key1, string? key2) 107 | { 108 | string return_value = null; 109 | if (key2 == null) 110 | { 111 | key2 = ""; 112 | } 113 | try 114 | { 115 | return_value = dbus_lxsession.SessionGet(key1, key2); 116 | } 117 | catch (GLib.IOError err) 118 | { 119 | warning (err.message); 120 | } 121 | return return_value; 122 | } 123 | 124 | public void SessionLaunch (string name, string option) 125 | { 126 | try 127 | { 128 | dbus_lxsession.SessionLaunch(name, option); 129 | } 130 | catch (GLib.IOError err) 131 | { 132 | warning (err.message); 133 | } 134 | } 135 | 136 | public void SessionSet (string key1, string? key2, string command_to_set) 137 | { 138 | if (key2 == null) 139 | { 140 | key2 = ""; 141 | } 142 | try 143 | { 144 | dbus_lxsession.SessionSet(key1, key2, command_to_set); 145 | } 146 | catch (GLib.IOError err) 147 | { 148 | warning (err.message); 149 | } 150 | } 151 | 152 | public string[] SessionSupport () 153 | { 154 | string[] return_value = null; 155 | try 156 | { 157 | return_value = dbus_lxsession.SessionSupport(); 158 | } 159 | catch (GLib.IOError err) 160 | { 161 | warning (err.message); 162 | } 163 | return return_value; 164 | } 165 | 166 | public string[] SessionSupportDetail (string key1) 167 | { 168 | string[] return_value = null; 169 | try 170 | { 171 | return_value = dbus_lxsession.SessionSupportDetail(key1); 172 | } 173 | catch (GLib.IOError err) 174 | { 175 | warning (err.message); 176 | } 177 | return return_value; 178 | } 179 | 180 | public void KeymapActivate() 181 | { 182 | try 183 | { 184 | dbus_lxsession.KeymapActivate(); 185 | } 186 | catch (GLib.IOError err) 187 | { 188 | warning (err.message); 189 | } 190 | } 191 | 192 | public void KeymapSet(string key1, string? key2, string command_to_set) 193 | { 194 | if (key2 == null) 195 | { 196 | key2 = ""; 197 | } 198 | try 199 | { 200 | dbus_lxsession.KeymapSet(key1, key2, command_to_set); 201 | } 202 | catch (GLib.IOError err) 203 | { 204 | warning (err.message); 205 | } 206 | } 207 | 208 | public string KeymapGet(string key1, string? key2) 209 | { 210 | if (key2 == null) 211 | { 212 | key2 = ""; 213 | } 214 | string return_value = null; 215 | try 216 | { 217 | return_value = dbus_lxsession.KeymapGet(key1, key2); 218 | } 219 | catch (GLib.IOError err) 220 | { 221 | warning (err.message); 222 | } 223 | return return_value; 224 | } 225 | 226 | public void StateSet(string key1, string? key2, string command_to_set) 227 | { 228 | if (key2 == null) 229 | { 230 | key2 = ""; 231 | } 232 | try 233 | { 234 | dbus_lxsession.StateSet(key1, key2, command_to_set); 235 | } 236 | catch (GLib.IOError err) 237 | { 238 | warning (err.message); 239 | } 240 | } 241 | 242 | public string StateGet(string key1, string? key2) 243 | { 244 | string return_value = null; 245 | if (key2 == null) 246 | { 247 | key2 = ""; 248 | } 249 | try 250 | { 251 | return_value = dbus_lxsession.StateGet(key1, key2); 252 | } 253 | catch (GLib.IOError err) 254 | { 255 | warning (err.message); 256 | } 257 | return return_value; 258 | } 259 | 260 | public void DbusSet(string key1, string? key2, string command_to_set) 261 | { 262 | if (key2 == null) 263 | { 264 | key2 = ""; 265 | } 266 | try 267 | { 268 | dbus_lxsession.DbusSet(key1, key2, command_to_set); 269 | } 270 | catch (GLib.IOError err) 271 | { 272 | warning (err.message); 273 | } 274 | } 275 | 276 | public string DbusGet(string key1, string? key2) 277 | { 278 | string return_value = null; 279 | if (key2 == null) 280 | { 281 | key2 = ""; 282 | } 283 | try 284 | { 285 | return_value = dbus_lxsession.DbusGet(key1, key2); 286 | } 287 | catch (GLib.IOError err) 288 | { 289 | warning (err.message); 290 | } 291 | return return_value; 292 | } 293 | 294 | public void EnvironmentSet(string key1, string? key2, string command_to_set) 295 | { 296 | if (key2 == null) 297 | { 298 | key2 = ""; 299 | } 300 | try 301 | { 302 | dbus_lxsession.EnvironmentSet(key1, key2, command_to_set); 303 | } 304 | catch (GLib.IOError err) 305 | { 306 | warning (err.message); 307 | } 308 | } 309 | 310 | public string EnvironmentGet(string key1, string? key2) 311 | { 312 | string return_value = null; 313 | if (key2 == null) 314 | { 315 | key2 = ""; 316 | } 317 | try 318 | { 319 | return_value = dbus_lxsession.EnvironmentGet(key1, key2); 320 | } 321 | catch (GLib.IOError err) 322 | { 323 | warning (err.message); 324 | } 325 | return return_value; 326 | } 327 | } 328 | } 329 | -------------------------------------------------------------------------------- /lxsession-default-apps/utils.vala: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2013 Julien Lavergne 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | namespace LDefaultApps 19 | { 20 | public class LDefaultAppsSignals : Object 21 | { 22 | public signal void update_ui(); 23 | } 24 | 25 | KeyFile load_key_conf (string config_path_directory, string conf_name) 26 | { 27 | KeyFile kf = new KeyFile(); 28 | var config_directory_file = File.new_for_path (config_path_directory); 29 | 30 | message("config_path_directory: %s", config_path_directory); 31 | 32 | string config_path = Path.build_filename(config_path_directory, conf_name); 33 | var config_file = File.new_for_path (config_path); 34 | 35 | if (!config_directory_file.query_exists ()) 36 | { 37 | try 38 | { 39 | config_directory_file.make_directory_with_parents(); 40 | } 41 | catch (GLib.Error e) 42 | { 43 | GLib.stderr.printf ("Could not write settings: %s\n", e.message); 44 | } 45 | } 46 | 47 | if (!config_file.query_exists ()) 48 | { 49 | try 50 | { 51 | config_file.create (FileCreateFlags.PRIVATE); 52 | } 53 | catch (GLib.Error e) 54 | { 55 | GLib.stderr.printf ("Could not write settings: %s\n", e.message); 56 | } 57 | } 58 | 59 | try 60 | { 61 | kf.load_from_file(config_path, KeyFileFlags.NONE); 62 | } 63 | catch (KeyFileError err) 64 | { 65 | warning (err.message); 66 | } 67 | catch (FileError err) 68 | { 69 | warning (err.message); 70 | } 71 | 72 | return kf; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /lxsession-default/lxsession-default: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright (C) 2013 Julien Lavergne (gilir@ubuntu.com) 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 2 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 18 | # MA 02110-1301, USA. 19 | 20 | echo $1 # first argument 21 | echo $2 # second argument 22 | 23 | case "$1" in 24 | "audio") 25 | if ["$2" = "preferences" ] 26 | then 27 | echo "Launching audio preferences" 28 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:"audio_manager" string:'' > /dev/null 2>&1 29 | fi 30 | ;; 31 | "quit") 32 | echo "Launching quit manager" 33 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:"quit_manager" string:'' > /dev/null 2>&1 34 | # Backward compatibility with previous API, make possible to reboot when lxsession-default is updated before restarting lxsession 35 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.QuitManagerLaunch > /dev/null 2>&1 36 | ;; 37 | "workspace") 38 | echo "Launching workspace manager" 39 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:"workspace_manager" string:'' > /dev/null 2>&1 40 | ;; 41 | "launcher") 42 | echo "Launching launcher manager" 43 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:"launcher_manager" string:'' > /dev/null 2>&1 44 | ;; 45 | "terminal") 46 | echo "Launching terminal manager" 47 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:"terminal_manager" string:"$PWD"> /dev/null 2>&1 48 | ;; 49 | "upgrades") 50 | echo "Launching upgrades manager" 51 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:"upgrades_manager" string:'' > /dev/null 2>&1 52 | ;; 53 | "screenshot") 54 | if [ "$2" = "window" ] 55 | then 56 | echo "Launching screenshot manager (current window)" 57 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:"screenshot_manager" string:'window'> /dev/null 2>&1 58 | else 59 | echo "Launching screenshot manager" 60 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:"screenshot_manager" string:'' > /dev/null 2>&1 61 | fi 62 | ;; 63 | "file_manager") 64 | echo "Launching file manager" 65 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:"file_manager" string:'' > /dev/null 2>&1 66 | ;; 67 | "desktop_manager") 68 | if [ "$2" = "settings" ] 69 | then 70 | echo "Launching settings for desktop manager" 71 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:"desktop_manager" string:"settings" > /dev/null 2>&1 72 | fi 73 | ;; 74 | "crash_manager") 75 | if [ "$2" = "report" ] 76 | then 77 | echo "Launching crash manager reporter" 78 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:"crash_manager" string:'report'> /dev/null 2>&1 79 | else 80 | echo "Launching crash manager" 81 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:"crash_manager" string:'' > /dev/null 2>&1 82 | fi 83 | ;; 84 | "windows_manager") 85 | echo "Launching windows manager" 86 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:"windows_manager" string:'' > /dev/null 2>&1 87 | ;; 88 | "lock") 89 | echo "Launching lock manager" 90 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:"lock_manager" string:'' > /dev/null 2>&1 91 | ;; 92 | "lock_manager") 93 | echo "Launching lock manager" 94 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:"lock_manager" string:'' > /dev/null 2>&1 95 | ;; 96 | "webbrowser") 97 | echo "Launching webbrowser application" 98 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:'webbrowser' string:'' > /dev/null 2>&1 99 | ;; 100 | "email") 101 | echo "Launching email application" 102 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:'email' string:'' > /dev/null 2>&1 103 | ;; 104 | "im1") 105 | echo "Launching im application 1" 106 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:"im1" string:'' > /dev/null 2>&1 107 | ;; 108 | "webcam") 109 | echo "Launching webcam application" 110 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:"webcam" string:'' > /dev/null 2>&1 111 | ;; 112 | "video_player") 113 | echo "Launching video player application" 114 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:"video_player" string:'' > /dev/null 2>&1 115 | ;; 116 | "audio_player") 117 | echo "Launching audio player application" 118 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:"audio_player" string:'' > /dev/null 2>&1 119 | ;; 120 | "pdf_reader") 121 | echo "Launching pdf reader application" 122 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:"pdf_reader" string:'' > /dev/null 2>&1 123 | ;; 124 | "spreadsheet") 125 | echo "Launching spreadsheet application" 126 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:"spreadsheet" string:'' > /dev/null 2>&1 127 | ;; 128 | "document") 129 | echo "Launching document application" 130 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:"document" string:'' > /dev/null 2>&1 131 | ;; 132 | "bittorent") 133 | echo "Launching bittorent application" 134 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:"bittorent" string:'' > /dev/null 2>&1 135 | ;; 136 | "notes") 137 | echo "Launching notes application" 138 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:"notes" string:'' > /dev/null 2>&1 139 | ;; 140 | "disk_utility") 141 | echo "Launching disk utility application" 142 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:"disk_utility" string:'' > /dev/null 2>&1 143 | ;; 144 | "image_display") 145 | echo "Launching images application" 146 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:"image_display" string:'' > /dev/null 2>&1 147 | ;; 148 | "text_editor") 149 | echo "Launching text editor application" 150 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:"text_editor" string:'' > /dev/null 2>&1 151 | ;; 152 | "archive") 153 | echo "Launching archive application" 154 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:"archive" string:'' > /dev/null 2>&1 155 | ;; 156 | "calculator") 157 | echo "Launching calculator application" 158 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:"calculator" string:'' > /dev/null 2>&1 159 | ;; 160 | "tasks") 161 | echo "Launching tasks application" 162 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:"tasks" string:'' > /dev/null 2>&1 163 | ;; 164 | "burn") 165 | echo "Launching burning application" 166 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:"burn" string:'' > /dev/null 2>&1 167 | ;; 168 | *) 169 | ;; 170 | esac 171 | 172 | exit 0 173 | -------------------------------------------------------------------------------- /lxsession-default/lxsession-default-terminal: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright (C) 2013 Julien Lavergne (gilir@ubuntu.com) 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 2 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 18 | # MA 02110-1301, USA. 19 | 20 | echo "Launching terminal manager" 21 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.SessionLaunch string:"terminal_manager" string:"$PWD"> /dev/null 2>&1 22 | 23 | exit 0 24 | -------------------------------------------------------------------------------- /lxsession-edit/lxsession-edit-common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * lxsession-edit-common.h 3 | * 4 | * Copyright 2008 PCMan 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 19 | * MA 02110-1301, USA. 20 | */ 21 | 22 | void load_autostart(const char* session_name); 23 | 24 | void save_autostart(const char* session_name); 25 | 26 | void init_list_view( GtkTreeView* view ); 27 | 28 | GtkListStore* get_autostart_list (); 29 | 30 | -------------------------------------------------------------------------------- /lxsession-edit/lxsession-edit.c: -------------------------------------------------------------------------------- 1 | /* 2 | * lxsession-edit.c 3 | * 4 | * Copyright 2008 PCMan 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 19 | * MA 02110-1301, USA. 20 | */ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #include "lxsession-edit-common.h" 32 | 33 | #define CONFIG_FILE_NAME "desktop.conf" 34 | 35 | int main(int argc, char** argv) 36 | { 37 | GtkBuilder *builder; 38 | GtkWidget *dlg, *autostarts, *wm, *adv_page; 39 | GKeyFile* kf; 40 | char *cfg, *wm_cmd = NULL; 41 | gboolean loaded; 42 | 43 | const char* session_name = NULL; 44 | 45 | #ifdef ENABLE_NLS 46 | bindtextdomain ( GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR ); 47 | bind_textdomain_codeset ( GETTEXT_PACKAGE, "UTF-8" ); 48 | textdomain ( GETTEXT_PACKAGE ); 49 | #endif 50 | 51 | gtk_init( &argc, &argv ); 52 | if( argc > 1 ) 53 | session_name = argv[1]; 54 | else 55 | { 56 | session_name = g_getenv("XDG_CURRENT_DESKTOP"); 57 | if(!session_name) 58 | { 59 | session_name = g_getenv("DESKTOP_SESSION"); 60 | if( G_UNLIKELY(!session_name) ) 61 | session_name = "LXDE"; 62 | } 63 | } 64 | 65 | builder = gtk_builder_new(); 66 | if( !gtk_builder_add_from_file( builder, PACKAGE_UI_DIR "/lxsession-edit.ui", NULL ) ) 67 | return 1; 68 | 69 | dlg = (GtkWidget*) gtk_builder_get_object( builder, "dlg" ); 70 | autostarts = (GtkWidget*) gtk_builder_get_object( builder, "autostarts" ); 71 | adv_page = (GtkWidget*) gtk_builder_get_object( builder, "adv_page" ); 72 | wm = (GtkWidget*) gtk_builder_get_object( builder, "wm" ); 73 | g_object_unref(builder); 74 | 75 | gtk_dialog_set_alternative_button_order((GtkDialog*)dlg, GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1); 76 | 77 | /* Set icon name for main (dlg) window so it displays in the panel. */ 78 | gtk_window_set_icon_name(GTK_WINDOW(dlg), "preferences-desktop"); 79 | 80 | /* autostart list */ 81 | init_list_view((GtkTreeView*)autostarts); 82 | load_autostart(session_name); 83 | gtk_tree_view_set_model( (GtkTreeView*)autostarts, (GtkTreeModel*)get_autostart_list() ); 84 | 85 | kf = g_key_file_new(); 86 | 87 | /* if we are running under LXSession */ 88 | if( g_getenv("_LXSESSION_PID") ) 89 | { 90 | /* wm settings (only show this when we are under lxsession) */ 91 | cfg = g_build_filename( g_get_user_config_dir(), "lxsession", session_name, CONFIG_FILE_NAME, NULL ); 92 | loaded = g_key_file_load_from_file(kf, cfg, 0, NULL); 93 | if( !loaded ) 94 | { 95 | const char* const *dirs = g_get_system_config_dirs(); 96 | const char* const *dir; 97 | g_free(cfg); 98 | for( dir = dirs; *dir; ++dir ) 99 | { 100 | cfg = g_build_filename( *dir, "lxsession", session_name, CONFIG_FILE_NAME, NULL ); 101 | loaded = g_key_file_load_from_file(kf, cfg, 0, NULL); 102 | g_free( cfg ); 103 | if( loaded ) 104 | break; 105 | } 106 | } 107 | if( loaded ) 108 | wm_cmd = g_key_file_get_string(kf, "Session", "windows_manager/command", NULL); 109 | 110 | if( ! wm_cmd || !*wm_cmd ) 111 | { 112 | g_free(wm_cmd); 113 | /* If it's our favorite, LXDE */ 114 | if( strcmp(session_name, "LXDE") == 0 ) 115 | wm_cmd = g_strdup("openbox-lxde"); 116 | else 117 | wm_cmd = g_strdup("openbox"); 118 | } 119 | gtk_entry_set_text((GtkEntry*)wm, wm_cmd); 120 | } 121 | else 122 | { 123 | gtk_widget_destroy(adv_page); 124 | wm = adv_page = NULL; 125 | wm_cmd = NULL; 126 | } 127 | 128 | if( gtk_dialog_run((GtkDialog*)dlg) == GTK_RESPONSE_OK ) 129 | { 130 | save_autostart(session_name); 131 | 132 | if( wm ) /* if wm settings is available. */ 133 | { 134 | char* dir; 135 | dir = g_build_filename( g_get_user_config_dir(), "lxsession", session_name, NULL ); 136 | g_mkdir_with_parents( dir, 0700 ); 137 | cfg = g_build_filename( dir, "desktop.conf", NULL ); 138 | g_free( dir ); 139 | wm_cmd = (char*)gtk_entry_get_text((GtkEntry*)wm); 140 | if( wm_cmd ) 141 | { 142 | char* data; 143 | gsize len; 144 | g_key_file_set_string( kf, "Session", "windows_manager/command", wm_cmd ); 145 | data = g_key_file_to_data(kf, &len, NULL); 146 | g_file_set_contents(cfg, data, len, NULL); 147 | } 148 | } 149 | } 150 | g_key_file_free(kf); 151 | 152 | gtk_widget_destroy(dlg); 153 | return 0; 154 | } 155 | -------------------------------------------------------------------------------- /lxsession-edit/lxsession-edit.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lxde/lxsession/886b9ad90f98b12c775313331431769295138f69/lxsession-edit/lxsession-edit.h -------------------------------------------------------------------------------- /lxsession-logout/lxsession-logout-dbus-interface.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010 LxDE Developers, see the file AUTHORS for details. 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software Foundation, 16 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 | */ 18 | 19 | #ifndef _DBUS_INTERFACE_H 20 | #define _DBUS_INTERFACE_H 21 | 22 | #include 23 | 24 | /* Interface to ConsoleKit for suspend, hibernate, shutdown and reboot. */ 25 | extern gboolean dbus_ConsoleKit_CanPowerOff(void); 26 | extern gboolean dbus_ConsoleKit_CanReboot(void); 27 | extern gboolean dbus_ConsoleKit_CanSuspend(void); 28 | extern gboolean dbus_ConsoleKit_CanHibernate(void); 29 | extern void dbus_ConsoleKit_PowerOff(GError **); 30 | extern void dbus_ConsoleKit_Reboot(GError **); 31 | extern void dbus_ConsoleKit_Suspend(GError **); 32 | extern void dbus_ConsoleKit_Hibernate(GError **); 33 | 34 | /* Interface to UPower for suspend and hibernate. */ 35 | extern gboolean dbus_UPower_CanSuspend(void); 36 | extern gboolean dbus_UPower_CanHibernate(void); 37 | extern gboolean dbus_UPower_Suspend(GError **); 38 | extern gboolean dbus_UPower_Hibernate(GError **); 39 | 40 | /* Interface to systemd for suspend, hibernate, shutdown and reboot. */ 41 | extern gboolean dbus_systemd_CanPowerOff(void); 42 | extern gboolean dbus_systemd_CanReboot(void); 43 | extern gboolean dbus_systemd_CanSuspend(void); 44 | extern gboolean dbus_systemd_CanHibernate(void); 45 | extern void dbus_systemd_PowerOff(GError **); 46 | extern void dbus_systemd_Reboot(GError **); 47 | extern void dbus_systemd_Suspend(GError **); 48 | extern void dbus_systemd_Hibernate(GError **); 49 | 50 | /* Interface to lightdm for switch user. */ 51 | extern gboolean dbus_Lightdm_SwitchToGreeter (GError **error); 52 | 53 | /* Interface to lxde for logout. */ 54 | extern gboolean dbus_LXDE_Logout (GError **error); 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /lxsession-message/Makefile.am: -------------------------------------------------------------------------------- 1 | if USE_GTK 2 | bin_PROGRAMS = lxsession-message-gtk 3 | 4 | lxsession_message_gtk_SOURCES = \ 5 | main-gtk.vala \ 6 | $(NULL) 7 | 8 | lxsession_message_gtk_VALAFLAGS = \ 9 | --vapidir=$(srcdir)/../vapi \ 10 | --pkg gtk+-3.0 \ 11 | $(NULL) 12 | 13 | lxsession_message_gtk_CFLAGS = \ 14 | $(GTK_CFLAGS) \ 15 | $(GLIB_CFLAGS) \ 16 | $(ADDITIONAL_FLAGS) \ 17 | -include config.h -w \ 18 | $(NULL) 19 | 20 | lxsession_message_gtk_LDADD = \ 21 | $(GTK_LIBS) \ 22 | $(GLIB_LIBS) \ 23 | $(X11_LIBS) \ 24 | $(NULL) 25 | 26 | CLEAN = \ 27 | main.c 28 | endif 29 | -------------------------------------------------------------------------------- /lxsession-message/main-gtk.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Julien Lavergne 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 17 | * MA 02110-1301, USA. 18 | */ 19 | 20 | using Gtk; 21 | 22 | namespace Lxsession 23 | { 24 | public class GenericWindow : Gtk.Window 25 | { 26 | public GenericWindow (string message) 27 | { 28 | // Prepare Gtk.Window: 29 | this.title = "Lxsession Message"; 30 | this.window_position = Gtk.WindowPosition.CENTER; 31 | this.destroy.connect (Gtk.main_quit); 32 | this.set_default_size (350, 70); 33 | 34 | // The MessageDialog 35 | Gtk.MessageDialog msg = new Gtk.MessageDialog ( this, 36 | Gtk.DialogFlags.MODAL, 37 | Gtk.MessageType.WARNING, 38 | Gtk.ButtonsType.OK_CANCEL, 39 | message); 40 | 41 | msg.response.connect ((response_id) => 42 | { 43 | switch (response_id) { 44 | case Gtk.ResponseType.OK: 45 | stdout.puts ("Ok\n"); 46 | break; 47 | case Gtk.ResponseType.CANCEL: 48 | stdout.puts ("Cancel\n"); 49 | break; 50 | case Gtk.ResponseType.DELETE_EVENT: 51 | stdout.puts ("Delete\n"); 52 | break; 53 | } 54 | msg.destroy(); 55 | Gtk.main_quit(); 56 | }); 57 | msg.show (); 58 | } 59 | } 60 | 61 | public class Main: GLib.Object 62 | { 63 | static string message = ""; 64 | static string type = ""; 65 | 66 | const OptionEntry[] option_entries = { 67 | { "message", 'm', 0, OptionArg.STRING, ref message, "specify a string to be to displayed as a message", "NAME" }, 68 | { "type", 't', 0, OptionArg.STRING, ref type, "specify the type of the message (w = warning, i = info)", "NAME" }, 69 | { null } 70 | }; 71 | 72 | public static int main(string[] args) 73 | { 74 | try 75 | { 76 | var options_args = new OptionContext("- Lxsession message utility"); 77 | options_args.set_help_enabled(true); 78 | options_args.add_main_entries(option_entries, null); 79 | options_args.parse(ref args); 80 | } 81 | catch (OptionError e) 82 | { 83 | critical ("Option parsing failed: %s\n", e.message); 84 | return -1; 85 | } 86 | 87 | Gtk.init (ref args); 88 | 89 | /* TODO Handle type of message with new class of window */ 90 | GenericWindow app = new GenericWindow (message); 91 | app.show_all (); 92 | 93 | /* start main loop */ 94 | Gtk.main (); 95 | 96 | return 0; 97 | } 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /lxsession-utils/lxsession-xsettings: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright (C) 2013 Julien Lavergne (gilir@ubuntu.com) 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 2 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program; if not, write to the Free Software 17 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 18 | # MA 02110-1301, USA. 19 | 20 | echo $1 # first argument 21 | echo $2 # second argument 22 | 23 | if [ "$1" = "reload" ] 24 | then 25 | echo "Restart Xsettings" 26 | dbus-send --session --print-reply --dest="org.lxde.SessionManager" /org/lxde/SessionManager org.lxde.SessionManager.ReloadSettingsDaemon > /dev/null 2>&1 27 | 28 | fi 29 | 30 | exit 0 31 | -------------------------------------------------------------------------------- /lxsession/autostart.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Julien Lavergne 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 17 | * MA 02110-1301, USA. 18 | */ 19 | 20 | namespace Lxsession { 21 | 22 | public class LxsessionAutostartConfig: GLib.Object { 23 | 24 | private Array stock_list ; 25 | 26 | public LxsessionAutostartConfig() { 27 | 28 | /* Copy the Array, can't be modify inside constructor */ 29 | stock_list = load_autostart_file(); 30 | /* 31 | foreach (AppType s in stock_list) { 32 | stdout.printf ("%s\n", s.command); 33 | stdout.printf ("%s\n", s.guard.to_string()); 34 | */ 35 | } 36 | 37 | public Array load_autostart_file() { 38 | 39 | var file = File.new_for_path (get_config_path ("autostart")); 40 | var app_list = new Array (); 41 | 42 | message ("Autostart path : %s", file.get_path()); 43 | 44 | if (file.query_exists ()) { 45 | 46 | try { 47 | var dis = new DataInputStream (file.read ()); 48 | string line; 49 | 50 | while ((line = dis.read_line (null)) != null) 51 | { 52 | string first = line[0:1]; 53 | 54 | switch (first) 55 | { 56 | case ("@"): 57 | var builder = new StringBuilder (); 58 | builder.append(line); 59 | builder.erase(0,1); 60 | string[] command = builder.str.split_set(" ",0); 61 | AppType app = { command[0], command, true, "" }; 62 | app_list.append_val (app); 63 | break; 64 | case ("#"): 65 | /* Commented, skip */ 66 | break; 67 | default: 68 | string[] command = line.split_set(" ",0); 69 | AppType app = { command[0], command, false, "" }; 70 | app_list.append_val (app); 71 | break; 72 | } 73 | } 74 | } catch (Error e) { 75 | error ("%s", e.message); 76 | } 77 | 78 | } 79 | 80 | return app_list; 81 | 82 | } 83 | 84 | public void start_applications() { 85 | 86 | for (int i = 0; i < stock_list.length; ++i) { 87 | unowned AppType s = stock_list.index(i); 88 | var launch_app = new GenericAppObject(s); 89 | launch_app.launch(); 90 | } 91 | 92 | } 93 | 94 | public void check_dupplicate() { 95 | 96 | /* TODO Check if the application is already autostarted before trying to autostart it 97 | if ("three" in my_set) { // same as my_set.contains ("three") 98 | stdout.printf ("heureka\n"); 99 | } 100 | */ 101 | 102 | } 103 | } 104 | 105 | } 106 | -------------------------------------------------------------------------------- /lxsession/conffiles.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Julien Lavergne 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 17 | * MA 02110-1301, USA. 18 | */ 19 | 20 | namespace Lxsession 21 | { 22 | public class ConffilesObject: GLib.Object 23 | { 24 | 25 | public KeyFile kf; 26 | 27 | public string Openbox_dest; 28 | public string Qt_dest = Path.build_filename(Environment.get_user_config_dir(),"Trolltech.conf"); 29 | public string Leafpad_dest = Path.build_filename(Environment.get_user_config_dir(),"leafpad","leafpadrc"); 30 | public string Lxterminal_dest = Path.build_filename(Environment.get_user_config_dir(),"lxterminal","lxterminal.conf"); 31 | public string XScreensaver_dest = Path.build_filename(Environment.get_home_dir(),".xscreensaver"); 32 | public string libfm_dest = Path.build_filename(Environment.get_user_config_dir(),"libfm","libfm.conf"); 33 | public string cairo_dock_dest = Path.build_filename(Environment.get_user_config_dir(),"cairo-dock","cairo-dock.conf"); 34 | 35 | 36 | public ConffilesObject(string conffiles_conf) 37 | { 38 | /* Constructor */ 39 | kf = load_keyfile (conffiles_conf); 40 | if (global_settings.get_item_string("Session", "windows_manager", "command") == "openbox") 41 | { 42 | if (global_settings.get_item_string("Session", "windows_manager", "session") == "LXDE") 43 | { 44 | Openbox_dest = Path.build_filename(Environment.get_user_config_dir(),"openbox", "lxde-rc.xml"); 45 | } 46 | else if (global_settings.get_item_string("Session", "windows_manager", "session") == "Lubuntu") 47 | { 48 | Openbox_dest = Path.build_filename(Environment.get_user_config_dir(),"openbox", "lubuntu-rc.xml"); 49 | } 50 | } 51 | else 52 | { 53 | Openbox_dest = Path.build_filename(Environment.get_user_config_dir(),"openbox", "lxde-rc.xml"); 54 | } 55 | } 56 | 57 | public void copy_file (string source_path, string dest_path) 58 | { 59 | File source_file = File.new_for_path (source_path); 60 | File dest_file = File.new_for_path (dest_path); 61 | File dest_directory = dest_file.get_parent(); 62 | 63 | if (!dest_file.query_exists ()) 64 | { 65 | if (!dest_directory.query_exists ()) 66 | { 67 | try 68 | { 69 | dest_directory.make_directory_with_parents(); 70 | } 71 | catch (GLib.Error err) 72 | { 73 | message (err.message); 74 | } 75 | } 76 | 77 | try 78 | { 79 | source_file.copy(dest_file, FileCopyFlags.NONE, null); 80 | } 81 | catch (GLib.Error err) 82 | { 83 | message (err.message); 84 | } 85 | } 86 | } 87 | public string load_source_path(string config_type) 88 | { 89 | string source; 90 | try 91 | { 92 | source = this.kf.get_value (config_type, "source"); 93 | return source; 94 | } 95 | catch (KeyFileError err) 96 | { 97 | message (err.message); 98 | return ""; 99 | } 100 | } 101 | public void copy_conf (string config_type, string dest_path) 102 | { 103 | if (this.kf.has_group (config_type)) 104 | { 105 | copy_file(load_source_path(config_type), dest_path); 106 | } 107 | } 108 | public void apply () 109 | { 110 | copy_conf ("Openbox", Openbox_dest); 111 | copy_conf ("Qt", Qt_dest); 112 | copy_conf ("Leafpad", Leafpad_dest); 113 | copy_conf ("Lxterminal", Lxterminal_dest); 114 | copy_conf ("XScreensaver", XScreensaver_dest); 115 | copy_conf ("libfm", libfm_dest); 116 | copy_conf ("cairo-dock", cairo_dock_dest); 117 | } 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /lxsession/control.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Julien Lavergne 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 17 | * MA 02110-1301, USA. 18 | */ 19 | 20 | /* TODO Implement multiple request by using the inhib_cookie in a array 21 | and to remove the cookie when the application request it 22 | */ 23 | 24 | namespace Lxsession 25 | { 26 | public class ControlObject: GLib.Object 27 | { 28 | public void set_status_busy (uint toplevel_xid) 29 | /* Status : Busy doing something, disable idle behavior of application */ 30 | { 31 | inhib_screensaver (toplevel_xid); 32 | } 33 | 34 | public void exit_status_busy () 35 | { 36 | uninhibit_screensaver (); 37 | } 38 | 39 | public void inhib_screensaver (uint toplevel_xid) 40 | { 41 | string create_command = "xdg-screensaver suspend" + " " + toplevel_xid.to_string(); 42 | lxsession_spawn_command_line_async(create_command); 43 | message("Inhib Screensaver"); 44 | } 45 | 46 | public void uninhibit_screensaver () 47 | { 48 | lxsession_spawn_command_line_async("xdg-screensaver reset"); 49 | message("Disable Inhib Screensaver"); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /lxsession/dbus-common.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Julien Lavergne 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 17 | * MA 02110-1301, USA. 18 | */ 19 | 20 | namespace Lxsession 21 | { 22 | 23 | public class SessionObject: Object { 24 | 25 | public ConsoleKitObject dbus_interface; 26 | 27 | public SessionObject() 28 | { 29 | try 30 | { 31 | dbus_interface = GLib.Bus.get_proxy_sync( BusType.SYSTEM, 32 | "org.freedesktop.ConsoleKit", 33 | "/org/freedesktop/ConsoleKit/Manager"); 34 | } 35 | catch (IOError e) 36 | { 37 | message ("Could not register service\n"); 38 | } 39 | } 40 | 41 | public async bool lxsession_can_shutdown() { 42 | bool can_shutdown_available = false; 43 | try { 44 | can_shutdown_available = yield dbus_interface.can_stop (); 45 | } 46 | catch (IOError err) { 47 | warning ("%s", err.message); 48 | can_shutdown_available = false; 49 | } 50 | return can_shutdown_available; 51 | 52 | } 53 | 54 | public void lxsession_shutdown() { 55 | try { 56 | dbus_interface.stop (); 57 | } 58 | catch (IOError err) { 59 | warning ("%s", err.message); 60 | } 61 | } 62 | 63 | public void lxsession_restart() { 64 | try { 65 | dbus_interface.restart (); 66 | } 67 | catch (IOError err) { 68 | warning ("%s", err.message); 69 | } 70 | } 71 | 72 | } 73 | 74 | [DBus (name = "org.freedesktop.ConsoleKit.Manager")] 75 | public interface ConsoleKitObject: Object { 76 | public const string UNIQUE_NAME = "org.freedesktop.ConsoleKit"; 77 | public const string OBJECT_PATH = "/org/freedesktop/ConsoleKit/Manager"; 78 | public const string INTERFACE_NAME = "org.freedesktop.ConsoleKit.Manager"; 79 | 80 | public abstract void restart () throws IOError; 81 | public abstract void stop () throws IOError; 82 | public abstract async bool can_restart () throws IOError; 83 | public abstract async bool can_stop () throws IOError; 84 | } 85 | 86 | void on_bus_aquired (DBusConnection conn) { 87 | try { 88 | conn.register_object ("/org/lxde/SessionManager", new LxdeSessionServer()); 89 | } catch (IOError e) { 90 | stderr.printf ("Could not register service\n"); 91 | } 92 | } 93 | 94 | void on_gnome_bus_aquired (DBusConnection conn) { 95 | try { 96 | conn.register_object ("/org/gnome/SessionManager", new GnomeSessionServer()); 97 | } catch (IOError e) { 98 | stderr.printf ("Could not register service\n"); 99 | } 100 | } 101 | 102 | } 103 | -------------------------------------------------------------------------------- /lxsession/dbus-gnome-session.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Julien Lavergne 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 17 | * MA 02110-1301, USA. 18 | */ 19 | 20 | /* http://live.gnome.org/Vala/DBusServerSample#Using_GDBus */ 21 | 22 | namespace Lxsession 23 | { 24 | 25 | [DBus(name = "org.gnome.SessionManager")] 26 | public class GnomeSessionServer : Object { 27 | string not_implemented = "Error, lxsession doesn't implement this API"; 28 | /* 29 | string gnome_session_version = "3.2.1"; 30 | */ 31 | 32 | /* Public property, exported via D-Bus */ 33 | public int something { get; set; } 34 | 35 | /* Public signal, exported via D-Bus 36 | * Can be emitted on the server side and can be connected to on the client side. 37 | */ 38 | public signal void ClientAdded(out string path); 39 | public signal void ClientRemoved(out string path); 40 | public signal void InhibitorAdded(out string path); 41 | public signal void InhibitorRemoved(out string path); 42 | public signal void SessionRunning(); 43 | public signal void SessionOver(); 44 | 45 | /* Public method, exported via D-Bus */ 46 | 47 | public void Setenv( string value ) { 48 | /* TODO To implement */ 49 | /* Adds the variable name to the application launch environment with the specified value. May only be used during the Session Manager initialization phase. */ 50 | /* */ 51 | message(not_implemented); 52 | } 53 | 54 | public void InitializationError ( string mess, bool fatal ) { 55 | /* TODO To implement 56 | May be used by applications launched during the Session Manager initialization phase to indicate there was a problem. 57 | 58 | The error message 59 | 60 | Whether the error should be treated as fatal 61 | */ 62 | message(not_implemented); 63 | } 64 | 65 | public async void RegisterClient(string app_id, string client_startup_id) { 66 | /* TODO To implement 67 | Register the caller as a Session Management client. 68 | 69 | 70 | The application identifier 71 | 72 | Client startup identifier 73 | 74 | The object path of the newly registered client 75 | */ 76 | message(not_implemented); 77 | } 78 | 79 | public async void UnregisterClient() { 80 | /* TODO To implement 81 | Unregister the specified client from Session Management. 82 | 83 | 84 | The object path of the client 85 | */ 86 | message(not_implemented); 87 | } 88 | 89 | public async void Inhibit(string app_id, uint toplevel_xid, string reason, uint flags, out uint inhibit_cookie) 90 | { 91 | /* TODO implement completly */ 92 | /* Description : 93 | Applications should invoke this method when they begin an operation that 94 | should not be interrupted, such as creating a CD or DVD. The types of actions 95 | that may be blocked are specified by the flags parameter. When the application 96 | completes the operation it should call Uninhibit() 97 | or disconnect from the session bus. 98 | 99 | app_id : The application identifier 100 | toplevel_xid : the toplevel X window identifier 101 | reason : The reason for the inhibit 102 | flags : Flags that spefify what should be inhibited (Values for flags may be bitwise or'ed together.) 103 | 1 Inhibit logging out 104 | 2 Inhibit user switching 105 | 4 Inhibit suspending the session or computer 106 | 8 Inhibit the session being marked as idle 107 | 108 | inhibit_cookie : The returned cookie is used to uniquely identify this request. It should be used 109 | as an argument to Uninhibit() in order to remove the request. 110 | */ 111 | message("Call Inhibit function"); 112 | inhibit_cookie = 0; 113 | if (flags == 8) 114 | { 115 | var control = new ControlObject(); 116 | control.set_status_busy(toplevel_xid); 117 | uint cookie = Random.next_int(); 118 | inhibit_cookie = cookie; 119 | } 120 | } 121 | 122 | public async void Uninhibit(uint inhibit_cookie) 123 | { 124 | /* Description : Cancel a previous call to Inhibit() identified by the cookie. */ 125 | var control = new ControlObject(); 126 | control.exit_status_busy(); 127 | } 128 | /* 129 | 130 | 131 | 132 | 133 | Flags that spefify what should be inhibited 134 | 135 | 136 | 137 | 138 | Returns TRUE if any of the operations in the bitfield flags are inhibited 139 | 140 | 141 | 142 | 143 | Determine if operation(s) specified by the flags 144 | are currently inhibited. Flags are same as those accepted 145 | by the 146 | Inhibit() 147 | method. 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | an array of client IDs 156 | 157 | 158 | 159 | 160 | This gets a list of all the Clients 161 | that are currently known to the session manager. 162 | Each Client ID is an D-Bus object path for the object that implements the 163 | Client interface. 164 | 165 | org.gnome.SessionManager.Client 166 | 167 | 168 | 169 | 170 | 171 | 172 | an array of inhibitor IDs 173 | 174 | 175 | 176 | 177 | This gets a list of all the Inhibitors 178 | that are currently known to the session manager. 179 | Each Inhibitor ID is an D-Bus object path for the object that implements the 180 | Inhibitor interface. 181 | 182 | org.gnome.SessionManager.Inhibitor 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | The autostart condition string 191 | 192 | 193 | 194 | 195 | True if condition is handled, false otherwise 196 | 197 | 198 | 199 | 200 | Allows the caller to determine whether the session manager is 201 | handling changes to the specified autostart condition. 202 | 203 | 204 | 205 | */ 206 | 207 | public void Shutdown() { 208 | var session = new SessionObject(); 209 | session.lxsession_shutdown(); 210 | } 211 | public async void CanShutdown(out bool is_available) { 212 | var session = new SessionObject(); 213 | is_available = yield session.lxsession_can_shutdown(); 214 | } 215 | 216 | public void Logout(uint mode) { 217 | /* TODO To implement */ 218 | /* 219 | 0 Normal 220 | 1 No confirmation inferface should be shown. 221 | 2 Forcefully logout. No confirmation will be shown and any inhibitors will be ignored. 222 | */ 223 | /* 224 | var session = new SessionObject(); 225 | session.lxsession_restart(); */ 226 | stdout.printf(not_implemented); 227 | } 228 | 229 | public void IsSessionRunning(out bool running ) 230 | { 231 | /* TODO To implement 232 | 233 | 234 | True if the session has entered the Running phase, false otherwise 235 | 236 | 237 | 238 | 239 | Allows the caller to determine whether the session manager 240 | has entered the Running phase, in case the client missed the 241 | SessionRunning signal. 242 | 243 | 244 | */ 245 | running = false; 246 | } 247 | 248 | 249 | } 250 | 251 | } 252 | -------------------------------------------------------------------------------- /lxsession/notifications.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Julien Lavergne 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 17 | * MA 02110-1301, USA. 18 | */ 19 | #if USE_GTK 20 | using Gtk; 21 | #if USE_ADVANCED_NOTIFICATIONS 22 | using AppIndicator; 23 | using Notify; 24 | #endif 25 | #endif 26 | 27 | namespace Lxsession 28 | { 29 | #if USE_GTK 30 | public class MenuItemObject : Gtk.MenuItem 31 | #else 32 | public class MenuItemObject : MenuItemGenericObject 33 | #endif 34 | { 35 | public MenuItemObject () 36 | { 37 | 38 | } 39 | } 40 | 41 | public class MenuItemGenericObject 42 | { 43 | public MenuItemGenericObject () 44 | { 45 | 46 | } 47 | } 48 | 49 | 50 | #if USE_GTK 51 | public class MenuObject : Gtk.Menu 52 | #else 53 | public class MenuObject : MenuGenericObject 54 | #endif 55 | { 56 | public MenuObject () 57 | { 58 | 59 | } 60 | } 61 | 62 | public class MenuGenericObject : GLib.Object 63 | { 64 | public delegate void ActionCallback (); 65 | 66 | public void add_item (string text, owned ActionCallback callback) 67 | { 68 | warning("Not implemented"); 69 | } 70 | } 71 | 72 | public class IconObject : GLib.Object 73 | { 74 | public string name; 75 | public string icon_name; 76 | public string notification_text; 77 | 78 | public MenuObject menu; 79 | #if USE_GTK 80 | #if USE_ADVANCED_NOTIFICATIONS 81 | public Indicator indicator; 82 | public Notify.Notification notification; 83 | #endif 84 | #endif 85 | 86 | public delegate void ActionCallback (); 87 | 88 | public IconObject(string name_param, string? icon_name_param, string? notification_param, MenuObject? menu_param) 89 | { 90 | this.name = name_param; 91 | 92 | if (icon_name_param != null) 93 | { 94 | this.icon_name = icon_name_param; 95 | } 96 | else 97 | { 98 | this.icon_name = "dialog-warning"; 99 | } 100 | 101 | if (notification_param != null) 102 | { 103 | this.notification_text = notification_param; 104 | } 105 | 106 | this.menu = menu_param; 107 | #if USE_GTK 108 | #if USE_ADVANCED_NOTIFICATIONS 109 | this.indicator = new Indicator(this.name, this.icon_name, IndicatorCategory.APPLICATION_STATUS); 110 | this.notification = new Notify.Notification ("LXsession", this.notification_text, this.icon_name); 111 | this.notification.set_timeout(6000); 112 | #endif 113 | #endif 114 | } 115 | 116 | #if USE_GTK 117 | #if USE_ADVANCED_NOTIFICATIONS 118 | public void init() 119 | { 120 | if (this.indicator == null) 121 | { 122 | this.indicator = new Indicator(this.name, this.icon_name, IndicatorCategory.APPLICATION_STATUS); 123 | } 124 | 125 | this.indicator.set_status(IndicatorStatus.ACTIVE); 126 | 127 | if (this.menu != null) 128 | { 129 | this.indicator.set_menu(this.menu); 130 | } 131 | } 132 | 133 | public void activate() 134 | { 135 | message("Try activate"); 136 | if (this.indicator != null) 137 | { 138 | message("Activate"); 139 | this.indicator.set_status(IndicatorStatus.ACTIVE); 140 | try 141 | { 142 | this.notification.show (); 143 | } 144 | catch (GLib.Error e) 145 | { 146 | message ("Error: %s\n", e.message); 147 | } 148 | message("Activate done"); 149 | } 150 | } 151 | 152 | public void inactivate() 153 | { 154 | message("Try inactivate"); 155 | if (this.indicator != null) 156 | { 157 | message("Inactivate"); 158 | this.indicator.set_status(IndicatorStatus.PASSIVE); 159 | message("Inactivate done"); 160 | } 161 | } 162 | 163 | public void set_icon(string param_icon_name) 164 | { 165 | this.icon_name = param_icon_name; 166 | message("Set new icon"); 167 | this.indicator.icon_name = param_icon_name; 168 | } 169 | 170 | public void set_menu(MenuObject param_menu) 171 | { 172 | this.menu = param_menu; 173 | this.indicator.set_menu(param_menu); 174 | } 175 | 176 | public void add_action (string action, string label, owned ActionCallback callback) 177 | { 178 | if (this.notification != null) 179 | { 180 | this.notification.add_action (action, label, (n, a) => 181 | { 182 | callback (); 183 | }); 184 | } 185 | } 186 | 187 | public void set_notification_body(string text) 188 | { 189 | if (this.notification != null) 190 | { 191 | this.notification_text = text; 192 | this.notification.body = text; 193 | } 194 | } 195 | 196 | public void clear_actions () 197 | { 198 | if (this.notification != null) 199 | { 200 | this.notification.clear_actions() ; 201 | } 202 | } 203 | #else 204 | public void init() 205 | { 206 | 207 | } 208 | 209 | public void activate() 210 | { 211 | 212 | } 213 | 214 | public void inactivate() 215 | { 216 | 217 | } 218 | 219 | public void set_icon(string param_icon_name) 220 | { 221 | 222 | } 223 | 224 | public void set_menu(MenuObject param_menu) 225 | { 226 | 227 | } 228 | 229 | public void add_action (string action, string label, owned ActionCallback callback) 230 | { 231 | 232 | } 233 | 234 | public void set_notification_body(string text) 235 | { 236 | 237 | } 238 | 239 | public void clear_actions () 240 | { 241 | 242 | } 243 | #endif 244 | } 245 | } 246 | -------------------------------------------------------------------------------- /lxsession/options.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Julien Lavergne 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 17 | * MA 02110-1301, USA. 18 | */ 19 | 20 | /* TODO Replace other utlity in the start script */ 21 | 22 | namespace Lxsession 23 | { 24 | public class Option: GLib.Object 25 | { 26 | public string command; 27 | 28 | public Option (LxsessionConfig config) 29 | { 30 | 31 | } 32 | 33 | public void activate() 34 | { 35 | switch (command) 36 | { 37 | case null: 38 | break; 39 | case "": 40 | break; 41 | case " ": 42 | break; 43 | default: 44 | message ("Options - Launch command %s",command); 45 | lxsession_spawn_command_line_async(command); 46 | break; 47 | } 48 | } 49 | } 50 | 51 | public class KeymapOption: Option 52 | { 53 | public KeymapOption (LxsessionConfig config) 54 | { 55 | base (config); 56 | if (config.get_item_string("Keymap", "mode", null) == "user") 57 | { 58 | command = create_user_mode_command(config); 59 | } 60 | } 61 | public string create_user_mode_command(LxsessionConfig config) 62 | { 63 | var builder = new StringBuilder (); 64 | builder.append("setxkbmap "); 65 | if (config.get_item_string("Keymap", "model", null) != null) 66 | { 67 | builder.append("-model "); 68 | builder.append(config.get_item_string("Keymap", "model", null)); 69 | builder.append(" "); 70 | } 71 | if (config.get_item_string("Keymap", "layout", null) != null) 72 | { 73 | builder.append("-layout "); 74 | builder.append(config.get_item_string("Keymap", "layout", null)); 75 | builder.append(" "); 76 | } 77 | if (config.get_item_string("Keymap", "variant", null) != null) 78 | { 79 | builder.append("-variant "); 80 | message ("Show keymap variant : %s", config.get_item_string("Keymap", "variant", null)); 81 | builder.append(config.get_item_string("Keymap", "variant", null)); 82 | builder.append(" "); 83 | } 84 | if (config.get_item_string("Keymap", "options", null) != null) 85 | { 86 | builder.append("-options "); 87 | message ("Show keymap options : %s", config.get_item_string("Keymap", "options", null)); 88 | builder.append(config.get_item_string("Keymap", "options", null)); 89 | builder.append(" "); 90 | } 91 | 92 | command = (builder.str); 93 | message ("Keymap options - return user command %s", command); 94 | return command; 95 | } 96 | } 97 | 98 | public class ClipboardOption: Option 99 | { 100 | public ClipboardOption (LxsessionConfig config) 101 | { 102 | base (config); 103 | switch (config.get_item_string("Session", "clipboard", "command")) 104 | { 105 | case "lxclipboard": 106 | #if BUILDIN_CLIPBOARD 107 | message("Create build-in Clipboard"); 108 | clipboard_start (); 109 | #else 110 | message("Create Option Clipboard"); 111 | command = "lxclipboard"; 112 | #endif 113 | break; 114 | } 115 | } 116 | public void desactivate() 117 | { 118 | #if BUILDIN_CLIPBOARD 119 | clipboard_stop (); 120 | #endif 121 | } 122 | } 123 | 124 | public class UpstartUserSessionOption: Option 125 | { 126 | private string command1; 127 | 128 | public UpstartUserSessionOption (LxsessionConfig config) 129 | { 130 | base (config); 131 | if (config.get_item_string("Session", "upstart_user_session", null) == "true") 132 | { 133 | command1 = "init --user"; 134 | } 135 | } 136 | public new void activate() 137 | { 138 | lxsession_spawn_command_line_async(command1); 139 | } 140 | } 141 | 142 | public class XSettingsOption: GLib.Object 143 | { 144 | private string command; 145 | 146 | public XSettingsOption () 147 | { 148 | 149 | } 150 | 151 | public new void activate () 152 | { 153 | command = global_settings.get_item_string("Session", "xsettings_manager", "command"); 154 | 155 | switch (command) 156 | { 157 | case null: 158 | break; 159 | case "": 160 | break; 161 | case " ": 162 | break; 163 | case "build-in": 164 | message("Activate xsettings_manager build-in"); 165 | settings_daemon_start(load_keyfile (get_config_path ("desktop.conf"))); 166 | break; 167 | case "gnome": 168 | lxsession_spawn_command_line_async("gnome-settings-daemon"); 169 | break; 170 | case "xfce": 171 | lxsession_spawn_command_line_async("xfsettingsd"); 172 | break; 173 | default: 174 | lxsession_spawn_command_line_async(command); 175 | break; 176 | } 177 | } 178 | 179 | public void reload () 180 | { 181 | command = global_settings.get_item_string("Session", "xsettings_manager", "command"); 182 | 183 | switch (command) 184 | { 185 | case "build-in": 186 | message("Reload xsettings_manager build-in"); 187 | settings_daemon_reload(load_keyfile (get_config_path ("desktop.conf"))); 188 | break; 189 | default: 190 | message("Reload xsettings_manager default"); 191 | this.activate(); 192 | break; 193 | } 194 | } 195 | } 196 | } 197 | -------------------------------------------------------------------------------- /lxsession/plugins.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Julien Lavergne 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 17 | * MA 02110-1301, USA. 18 | */ 19 | -------------------------------------------------------------------------------- /lxsession/process.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Julien Lavergne 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 17 | * MA 02110-1301, USA. 18 | */ 19 | 20 | namespace Lxsession 21 | { 22 | /* Facility for launching application by extending the env variable set by lxsession 23 | TODO : replace by something smart and using upstart / systemd if available 24 | */ 25 | public void lxsession_spawn_command_line_async(string command_line) 26 | { 27 | string[] command = command_line.split_set(" ",0); 28 | 29 | try 30 | { 31 | string[] spawn_env = Environ.get (); 32 | Pid child_pid; 33 | 34 | Process.spawn_async ( 35 | null, 36 | command, 37 | spawn_env, 38 | SpawnFlags.SEARCH_PATH | SpawnFlags.DO_NOT_REAP_CHILD, 39 | null, 40 | out child_pid); 41 | 42 | ChildWatch.add (child_pid, (pid, status) => { 43 | Process.close_pid (pid); 44 | }); 45 | 46 | } 47 | catch (SpawnError err) 48 | { 49 | warning (err.message); 50 | warning ("Error when launching %s", command[0]); 51 | } 52 | } 53 | 54 | 55 | } 56 | -------------------------------------------------------------------------------- /lxsession/utils.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Julien Lavergne 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 17 | * MA 02110-1301, USA. 18 | */ 19 | 20 | namespace Lxsession{ 21 | 22 | public string session_global; 23 | 24 | public struct AppType { 25 | public string name; 26 | public string[] command; 27 | public bool guard; 28 | public string application_type; 29 | } 30 | 31 | public KeyFile load_keyfile (string config_path) { 32 | 33 | KeyFile kf = new KeyFile(); 34 | 35 | try { 36 | kf.load_from_file(config_path, KeyFileFlags.NONE); 37 | } catch (KeyFileError err) { 38 | warning (err.message); 39 | } catch (FileError err) { 40 | warning (err.message); 41 | } 42 | 43 | return kf; 44 | } 45 | 46 | public string get_config_home_path (string conf_file) 47 | { 48 | 49 | string user_config_dir = Path.build_filename( 50 | Environment.get_user_config_dir (), 51 | "lxsession", 52 | session_global, 53 | conf_file); 54 | 55 | return user_config_dir; 56 | 57 | } 58 | 59 | 60 | public string get_config_path (string conf_file) { 61 | 62 | string final_config_file; 63 | 64 | string user_config_dir = get_config_home_path(conf_file); 65 | 66 | if (FileUtils.test (user_config_dir, FileTest.EXISTS)) 67 | { 68 | message ("User config used : %s", user_config_dir); 69 | final_config_file = user_config_dir; 70 | } 71 | else 72 | { 73 | string[] system_config_dirs = Environment.get_system_config_dirs (); 74 | string config_system_location = null; 75 | string path_system_config_file = null; 76 | 77 | foreach (string config in (system_config_dirs)) { 78 | config_system_location = Path.build_filename (config, "lxsession", session_global); 79 | message ("Config system location : %s", config_system_location); 80 | if (FileUtils.test (config_system_location, FileTest.EXISTS)) { 81 | path_system_config_file = Path.build_filename (config_system_location, conf_file); 82 | break; 83 | } 84 | } 85 | message ("System system path location : %s", path_system_config_file); 86 | final_config_file = path_system_config_file; 87 | 88 | } 89 | message ("Final file used : %s", final_config_file); 90 | return final_config_file; 91 | 92 | } 93 | 94 | public class LxSignals : Object 95 | { 96 | public signal void update_window_manager (string dbus_arg, string kf_categorie = "Session", string kf_key1 = "window_manager", string? kf_key2 = null); 97 | 98 | /* Xsettings */ 99 | public signal void reload_settings_daemon(); 100 | 101 | public signal void generic_set_signal (string categorie, string key1, string? key2, string type, string dbus_arg); 102 | 103 | } 104 | 105 | public bool detect_laptop() 106 | { 107 | string test_laptop_detect = Environment.find_program_in_path("laptop-detect"); 108 | if (test_laptop_detect != null) 109 | { 110 | int exit_status; 111 | string standard_output, standard_error; 112 | try 113 | { 114 | Process.spawn_command_line_sync ("laptop-detect", out standard_output, 115 | out standard_error, 116 | out exit_status); 117 | if (exit_status == 0) 118 | { 119 | message ("Laptop detect return true"); 120 | return true; 121 | } 122 | else 123 | { 124 | message ("Laptop detect return false"); 125 | return false; 126 | } 127 | } 128 | catch (SpawnError err) 129 | { 130 | warning (err.message); 131 | return false; 132 | } 133 | } 134 | else 135 | { 136 | message ("Laptop detect not find"); 137 | /* TODO check upower, and /proc files like laptop-detect to find bateries */ 138 | return false; 139 | } 140 | } 141 | 142 | public bool check_package_manager_running () 143 | { 144 | GLib.File dpkg, apt_archives, apt_lists, unattended_upgrades; 145 | bool return_value = false; 146 | 147 | dpkg = File.new_for_path("/var/lib/dpkg/lock"); 148 | apt_archives = File.new_for_path("/var/cache/apt/archives/lock"); 149 | apt_lists = File.new_for_path("/var/lib/apt/lists/lock"); 150 | unattended_upgrades = File.new_for_path("/var/run/unattended-upgrades.lock"); 151 | 152 | if (dpkg.query_exists ()) 153 | { 154 | return_value = true; 155 | } 156 | 157 | if (apt_archives.query_exists ()) 158 | { 159 | return_value = true; 160 | } 161 | 162 | if (apt_lists.query_exists ()) 163 | { 164 | return_value = true; 165 | } 166 | 167 | if (unattended_upgrades.query_exists ()) 168 | { 169 | return_value = true; 170 | } 171 | 172 | return return_value; 173 | } 174 | 175 | } 176 | -------------------------------------------------------------------------------- /lxsettings-daemon/main.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Julien Lavergne 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 17 | * MA 02110-1301, USA. 18 | */ 19 | public class Main: GLib.Object 20 | { 21 | static bool persistent = false; 22 | static string file = null; 23 | 24 | const OptionEntry[] option_entries = { 25 | { "file", 'f', 0, OptionArg.STRING, ref file, "path of the configuration file", "NAME" }, 26 | { "persistent", 'p', 0, OptionArg.NONE, ref persistent, "reload configuration on file change", null }, 27 | { null } 28 | }; 29 | 30 | public static int main(string[] args) 31 | { 32 | if (file == null) 33 | { 34 | critical("Error, you need to specify a configuration file using -f argument. Exit"); 35 | return -1; 36 | } 37 | else 38 | { 39 | KeyFile kf = new KeyFile(); 40 | 41 | try 42 | { 43 | kf.load_from_file(file, KeyFileFlags.NONE); 44 | } 45 | catch (KeyFileError err) 46 | { 47 | warning (err.message); 48 | critical("Problem when loading the configuration file. Exit"); 49 | return -1; 50 | } 51 | catch (FileError err) 52 | { 53 | warning (err.message); 54 | critical("Problem when loading the configuration file. Exit"); 55 | return -1; 56 | } 57 | 58 | /* Start settings daemon */ 59 | settings_daemon_start(kf); 60 | 61 | if (persistent == false) 62 | { 63 | /* Nothing to do, just exit */ 64 | return 0; 65 | } 66 | else 67 | { 68 | /* TODO Monitor desktop file change and reload on modification change */ 69 | return 0; 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /lxsettings-daemon/settings-daemon.c: -------------------------------------------------------------------------------- 1 | /* 2 | * lxde-settings.c - XSettings daemon of LXDE 3 | * 4 | * Copyright 2008 PCMan 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 19 | * MA 02110-1301, USA. 20 | */ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #include "xevent.h" 37 | #include "xsettings-manager.h" 38 | #include "xutils.h" 39 | 40 | #include 41 | 42 | static XSettingsManager **managers = NULL; 43 | 44 | /* FORWARDS */ 45 | gboolean settings_daemon_start(GKeyFile* kf); 46 | void settings_manager_selection_clear( XEvent* evt ); 47 | void settings_daemon_reload(GKeyFile* kf); 48 | /* End FORWARDS */ 49 | 50 | static void terminate_cb (void *data) 51 | { 52 | gboolean *terminated = data; 53 | 54 | if (*terminated) 55 | return; 56 | 57 | *terminated = TRUE; 58 | exit( 0 ); 59 | // gtk_main_quit (); 60 | } 61 | 62 | static void merge_xrdb(const char* content, int len) 63 | { 64 | gchar* argv[] = { "xrdb", "-merge", "-", NULL }; 65 | GPid pid; 66 | int stdi, status, w; 67 | if( g_spawn_async_with_pipes(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, 68 | NULL, NULL, &pid, &stdi, NULL, NULL, NULL ) ) 69 | { 70 | if (len < 0) 71 | { 72 | w = write( stdi, content, strlen(content)); 73 | } 74 | else 75 | { 76 | w = write( stdi, content, len); 77 | } 78 | close(stdi); 79 | waitpid( pid, &status, 0 ); 80 | } 81 | } 82 | 83 | 84 | /* This function is taken from Gnome's control-center 2.6.0.3 (gnome-settings-mouse.c) and was modified*/ 85 | #define DEFAULT_PTR_MAP_SIZE 128 86 | static void set_left_handed_mouse( gboolean mouse_left_handed ) 87 | { 88 | unsigned char *buttons; 89 | gint n_buttons, i; 90 | gint idx_1 = 0, idx_3 = 1; 91 | 92 | buttons = g_alloca (DEFAULT_PTR_MAP_SIZE); 93 | n_buttons = XGetPointerMapping (dpy, buttons, DEFAULT_PTR_MAP_SIZE); 94 | if (n_buttons > DEFAULT_PTR_MAP_SIZE) 95 | { 96 | buttons = g_alloca (n_buttons); 97 | n_buttons = XGetPointerMapping (dpy, buttons, n_buttons); 98 | } 99 | 100 | for (i = 0; i < n_buttons; i++) 101 | { 102 | if (buttons[i] == 1) 103 | idx_1 = i; 104 | else if (buttons[i] == ((n_buttons < 3) ? 2 : 3)) 105 | idx_3 = i; 106 | } 107 | 108 | if ((mouse_left_handed && idx_1 < idx_3) || 109 | (!mouse_left_handed && idx_1 > idx_3)) 110 | { 111 | buttons[idx_1] = ((n_buttons < 3) ? 2 : 3); 112 | buttons[idx_3] = 1; 113 | XSetPointerMapping (dpy, buttons, n_buttons); 114 | } 115 | } 116 | 117 | static void configure_input(GKeyFile* kf) 118 | { 119 | XKeyboardControl values; 120 | 121 | /* Mouse settings */ 122 | int accel_factor, accel_threshold, delay, interval; 123 | gboolean left_handed, beep; 124 | 125 | accel_factor = g_key_file_get_integer(kf, "Mouse", "AccFactor", NULL); 126 | accel_threshold = g_key_file_get_integer(kf, "Mouse", "AccThreshold", NULL); 127 | if( accel_factor || accel_threshold ) 128 | { 129 | XChangePointerControl(dpy, accel_factor != 0, accel_threshold != 0, 130 | accel_factor, 10, accel_threshold); 131 | } 132 | 133 | left_handed = g_key_file_get_integer(kf, "Mouse", "LeftHanded", NULL); 134 | set_left_handed_mouse(left_handed); 135 | 136 | /* Keyboard settings */ 137 | if(XkbGetAutoRepeatRate(dpy, XkbUseCoreKbd, (unsigned int*) &delay, (unsigned int*) &interval)) 138 | { 139 | int val; 140 | val = g_key_file_get_integer(kf, "Keyboard", "Delay", NULL); 141 | if(val > 0) 142 | delay = val; 143 | val = g_key_file_get_integer(kf, "Keyboard", "Interval", NULL); 144 | if(val > 0) 145 | interval = val; 146 | if( val > 0 ) 147 | { 148 | XkbSetAutoRepeatRate(dpy, XkbUseCoreKbd, delay, interval); 149 | } 150 | } 151 | 152 | beep = g_key_file_get_integer(kf, "Keyboard", "Beep", NULL); 153 | values.bell_percent = beep ? -1 : 0; 154 | XChangeKeyboardControl(dpy, KBBellPercent, &values); 155 | } 156 | 157 | static void load_settings( GKeyFile* kf ) 158 | { 159 | GString* buf; 160 | char* str; 161 | int val; 162 | 163 | int i; 164 | const char group[] = "GTK"; 165 | char** keys, **key; 166 | 167 | /* Mouse cursor (does this work?) */ 168 | str = g_key_file_get_string( kf, group, "sGtk/CursorThemeName", NULL); 169 | val = g_key_file_get_integer(kf, group, "iGtk/CursorThemeSize", NULL); 170 | if(str || val > 0) 171 | { 172 | buf = g_string_sized_new(100); 173 | if(str) 174 | { 175 | if(*str) 176 | g_string_append_printf(buf, "Xcursor.theme:%s\n", str); 177 | g_free(str); 178 | } 179 | g_string_append(buf, "Xcursor.theme_core:true\n"); 180 | if(val > 0) 181 | g_string_append_printf(buf, "Xcursor.size:%d\n", val); 182 | merge_xrdb( buf->str, buf->len ); 183 | g_string_free(buf, TRUE); 184 | } 185 | 186 | /* Load mouse and keyboard settings */ 187 | configure_input(kf); 188 | 189 | /* Load GTK+ settings */ 190 | if ( (keys = g_key_file_get_keys( kf, group, NULL, NULL )) == NULL ) 191 | return; 192 | 193 | for( key = keys; *key; ++key ) 194 | { 195 | const char* name = *key + 1; 196 | 197 | switch( **key ) 198 | { 199 | case 's': /* string */ 200 | { 201 | str = g_key_file_get_string( kf, group, *key, NULL ); 202 | if( str ) 203 | { 204 | for( i = 0; managers[i]; ++i ) 205 | xsettings_manager_set_string( managers [i], name, str ); 206 | g_free( str ); 207 | } 208 | else 209 | { 210 | for( i = 0; managers[i]; ++i ) 211 | xsettings_manager_delete_setting( managers[i], name ); 212 | } 213 | break; 214 | } 215 | case 'i': /* integer */ 216 | { 217 | val = g_key_file_get_integer( kf, group, *key, NULL ); 218 | for( i = 0; managers[i]; ++i ) 219 | xsettings_manager_set_int( managers [i], name, val ); 220 | break; 221 | } 222 | case 'c': /* color */ 223 | { 224 | gsize len = 0; 225 | int* vals = g_key_file_get_integer_list( kf, group, *key, &len, NULL ); 226 | if( vals && len >= 3 ) 227 | { 228 | XSettingsColor color; 229 | color.red = (gushort)vals[0]; 230 | color.green = (gushort)vals[1]; 231 | color.blue = (gushort)vals[2]; 232 | color.alpha = (gushort)( len >3 ? vals[3] : 65535 ); 233 | for( i = 0; managers[i]; ++i ) 234 | xsettings_manager_set_color( managers [i], name, &color ); 235 | } 236 | else 237 | { 238 | for( i = 0; managers[i]; ++i ) 239 | xsettings_manager_delete_setting( managers[i], name ); 240 | } 241 | g_free( vals ); 242 | break; 243 | } 244 | } 245 | } 246 | 247 | for( i = 0; managers[i]; ++i ) 248 | xsettings_manager_notify( managers [i] ); 249 | } 250 | 251 | static gboolean create_xsettings_managers() 252 | { 253 | int n_screens = ScreenCount(dpy); 254 | int i; 255 | gboolean terminated = FALSE; 256 | 257 | if (xsettings_manager_check_running( dpy, n_screens) ) 258 | { 259 | g_error ("You can only run one xsettings manager at a time; exiting\n"); 260 | return FALSE; 261 | } 262 | 263 | managers = g_new (XSettingsManager *, n_screens + 1); 264 | for( i = 0; i < n_screens; ++i ) 265 | { 266 | Screen *screen; 267 | screen = ScreenOfDisplay( dpy, i ); 268 | managers [i] = xsettings_manager_new ( dpy, i, terminate_cb, &terminated); 269 | if(!managers [i]) 270 | { 271 | g_error("Could not create xsettings manager for screen %d!\n", i); 272 | return FALSE; 273 | } 274 | XSelectInput( dpy, RootWindow(dpy, i), SubstructureNotifyMask | PropertyChangeMask ); 275 | } 276 | managers [i] = NULL; 277 | 278 | return TRUE; 279 | } 280 | 281 | gboolean settings_daemon_start(GKeyFile* kf) 282 | { 283 | /* initialize X-related stuff and connect to X Display */ 284 | if( G_UNLIKELY(! xevent_init() ) ) 285 | return FALSE; 286 | 287 | if( ! create_xsettings_managers() ) 288 | return FALSE; 289 | 290 | load_settings(kf); 291 | 292 | /* sync with X11 to prevent some racing conditions: 293 | * For example: if gtk+ applications are started before 294 | * XSETTINGS properties are properly set on root window, 295 | * they cannot correctly use settings from Xsettings daemon. */ 296 | XSync(dpy, FALSE); 297 | 298 | return TRUE; 299 | } 300 | 301 | void settings_manager_selection_clear( XEvent* evt ) 302 | { 303 | XSettingsManager**mgr; 304 | for( mgr = managers; *mgr; ++mgr ) 305 | { 306 | if( xsettings_manager_get_window( *mgr ) == evt->xany.window ) 307 | xsettings_manager_process_event( *mgr, evt ); 308 | } 309 | } 310 | 311 | void settings_daemon_reload(GKeyFile* kf) 312 | { 313 | if(kf) 314 | { 315 | load_settings(kf); 316 | } 317 | } 318 | -------------------------------------------------------------------------------- /lxsettings-daemon/settings-daemon.h: -------------------------------------------------------------------------------- 1 | /* 2 | * settings-daemon.h - LXDE settings daemon 3 | * 4 | * Copyright 2009 PCMan 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 19 | * MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __SETTINGS_DAEMON_H__ 23 | #define __SETTINGS_DAEMON_H__ 24 | 25 | #include 26 | #include 27 | 28 | gboolean settings_daemon_start(GKeyFile* kf); 29 | 30 | void settings_daemon_reload(GKeyFile* kf); 31 | 32 | /* called by x11_event_dispatch() */ 33 | void settings_manager_selection_clear( XEvent* evt ); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /lxsettings-daemon/xevent.c: -------------------------------------------------------------------------------- 1 | /* 2 | * xevent.c 3 | * 4 | * Copyright 2009 PCMan 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 19 | * MA 02110-1301, USA. 20 | */ 21 | 22 | #include "xevent.h" 23 | 24 | #include 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #include "settings-daemon.h" 32 | 33 | Display* dpy = NULL; 34 | 35 | static Atom CMD_ATOM; /* for private client message */ 36 | static GSource* source = NULL; /* main loop event source for X11 events */ 37 | 38 | typedef struct _X11Source 39 | { 40 | GSource source; 41 | GPollFD poll_fd; 42 | }X11Source; 43 | 44 | static gboolean x11_event_prepare(GSource *source, gint *timeout); 45 | static gboolean x11_event_check(GSource *source); 46 | static gboolean x11_event_dispatch(GSource *source, GSourceFunc callback, gpointer user_data); 47 | 48 | static GSourceFuncs event_funcs = 49 | { 50 | x11_event_prepare, 51 | x11_event_check, 52 | x11_event_dispatch, 53 | NULL 54 | }; 55 | 56 | void send_internal_command( int cmd ) 57 | { 58 | Window root = DefaultRootWindow(dpy); 59 | XEvent ev; 60 | 61 | memset(&ev, 0, sizeof(ev) ); 62 | ev.xclient.type = ClientMessage; 63 | ev.xclient.window = root; 64 | ev.xclient.message_type = CMD_ATOM; 65 | ev.xclient.format = 8; 66 | 67 | ev.xclient.data.l[0] = cmd; 68 | 69 | XSendEvent(dpy, root, False, 70 | SubstructureRedirectMask|SubstructureNotifyMask, &ev); 71 | XSync(dpy, False); 72 | } 73 | 74 | gboolean xevent_init() 75 | { 76 | X11Source* xsource; 77 | int fd; 78 | 79 | dpy = XOpenDisplay( g_getenv("DISPLAY") ); 80 | if( ! dpy ) 81 | return FALSE; 82 | 83 | /* according to the spec, private Atoms should prefix their names with _. */ 84 | CMD_ATOM = XInternAtom( dpy, "_LXSESSION", False ); 85 | 86 | fd = ConnectionNumber(dpy); /* fd of XDisplay connection */ 87 | if( G_UNLIKELY(fd == -1) ) 88 | return FALSE; 89 | 90 | /* set up main loop event source for XDisplay */ 91 | source = g_source_new (&event_funcs, sizeof(X11Source)); 92 | xsource = (X11Source*)source; 93 | xsource->poll_fd.fd = fd; 94 | xsource->poll_fd.events = G_IO_IN; 95 | 96 | g_source_add_poll(source, &xsource->poll_fd); 97 | g_source_set_can_recurse(source, TRUE); 98 | g_source_attach(source, NULL); 99 | 100 | return TRUE; 101 | } 102 | 103 | gboolean single_instance_check() 104 | { 105 | /* NOTE: this is a hack to do single instance */ 106 | XGrabServer( dpy ); 107 | if( XGetSelectionOwner( dpy, CMD_ATOM ) ) 108 | { 109 | XUngrabServer( dpy ); 110 | XCloseDisplay( dpy ); 111 | return FALSE; 112 | } 113 | XSetSelectionOwner( dpy, CMD_ATOM, DefaultRootWindow( dpy ), CurrentTime ); 114 | XUngrabServer( dpy ); 115 | return TRUE; 116 | } 117 | 118 | gboolean x11_event_prepare(GSource *source, gint *timeout) 119 | { 120 | *timeout = -1; 121 | return XPending(dpy) ? TRUE : FALSE; 122 | } 123 | 124 | gboolean x11_event_check(GSource *source) 125 | { 126 | X11Source *xsource = (X11Source*)source; 127 | if(xsource->poll_fd.revents & G_IO_IN) 128 | return XPending(dpy) ? TRUE : FALSE; 129 | return FALSE; 130 | } 131 | 132 | gboolean x11_event_dispatch(GSource *source, GSourceFunc callback, gpointer user_data) 133 | { 134 | while( XPending(dpy) ) 135 | { 136 | XEvent evt; 137 | XNextEvent( dpy, &evt ); 138 | if( evt.type == ClientMessage ) 139 | { 140 | if(evt.xproperty.atom == CMD_ATOM) 141 | { 142 | int cmd = evt.xclient.data.b[0]; 143 | switch( cmd ) 144 | { 145 | case LXS_RELOAD: /* reload all settings */ 146 | /* TODO Replace this by Dbus 147 | settings_deamon_reload(); 148 | */ 149 | break; 150 | case LXS_EXIT: 151 | /* TODO Replace this by Dbus 152 | lxsession_quit(); 153 | */ 154 | break; 155 | } 156 | } 157 | } 158 | else if( evt.type == SelectionClear ) 159 | { 160 | settings_manager_selection_clear( &evt ); 161 | } 162 | } 163 | return TRUE; 164 | } 165 | 166 | void xevent_finalize() 167 | { 168 | if(source) 169 | { 170 | g_source_destroy(source); 171 | g_source_unref(source); 172 | } 173 | 174 | XGrabServer( dpy ); 175 | XSetSelectionOwner( dpy, CMD_ATOM, DefaultRootWindow( dpy ), None ); 176 | XUngrabServer( dpy ); 177 | 178 | XCloseDisplay( dpy ); 179 | } 180 | 181 | -------------------------------------------------------------------------------- /lxsettings-daemon/xevent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * xevent.h 3 | * 4 | * Copyright 2009 PCMan 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 19 | * MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __XEVENT_H__ 23 | #define __XEVENT_H__ 24 | 25 | #include 26 | #include 27 | 28 | G_BEGIN_DECLS 29 | 30 | extern Display* dpy; 31 | 32 | typedef enum{ 33 | LXS_RELOAD, 34 | LXS_EXIT, 35 | LXS_LAST_CMD 36 | }LXS_CMD; 37 | 38 | gboolean xevent_init(); 39 | gboolean single_instance_check(); 40 | void xevent_finalize(); 41 | 42 | void send_internal_command( int cmd ); 43 | 44 | G_END_DECLS 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /lxsettings-daemon/xsettings-common.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2001 Red Hat, Inc. 3 | * 4 | * Permission to use, copy, modify, distribute, and sell this software and its 5 | * documentation for any purpose is hereby granted without fee, provided that 6 | * the above copyright notice appear in all copies and that both that 7 | * copyright notice and this permission notice appear in supporting 8 | * documentation, and that the name of Red Hat not be used in advertising or 9 | * publicity pertaining to distribution of the software without specific, 10 | * written prior permission. Red Hat makes no representations about the 11 | * suitability of this software for any purpose. It is provided "as is" 12 | * without express or implied warranty. 13 | * 14 | * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL 15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT 16 | * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 17 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 18 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 19 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 20 | * 21 | * Author: Owen Taylor, Red Hat, Inc. 22 | */ 23 | #include "string.h" 24 | #include "stdlib.h" 25 | 26 | #include 27 | #include /* For CARD32 */ 28 | 29 | #include "xsettings-common.h" 30 | 31 | XSettingsSetting * 32 | xsettings_setting_copy (XSettingsSetting *setting) 33 | { 34 | XSettingsSetting *result; 35 | size_t str_len; 36 | 37 | result = malloc (sizeof *result); 38 | if (!result) 39 | return NULL; 40 | 41 | str_len = strlen (setting->name); 42 | result->name = malloc (str_len + 1); 43 | if (!result->name) 44 | goto err; 45 | 46 | memcpy (result->name, setting->name, str_len + 1); 47 | 48 | result->type = setting->type; 49 | 50 | switch (setting->type) 51 | { 52 | case XSETTINGS_TYPE_INT: 53 | result->data.v_int = setting->data.v_int; 54 | break; 55 | case XSETTINGS_TYPE_COLOR: 56 | result->data.v_color = setting->data.v_color; 57 | break; 58 | case XSETTINGS_TYPE_STRING: 59 | str_len = strlen (setting->data.v_string); 60 | result->data.v_string = malloc (str_len + 1); 61 | if (!result->data.v_string) 62 | goto err; 63 | 64 | memcpy (result->data.v_string, setting->data.v_string, str_len + 1); 65 | break; 66 | } 67 | 68 | result->last_change_serial = setting->last_change_serial; 69 | 70 | return result; 71 | 72 | err: 73 | if (result->name) 74 | free (result->name); 75 | free (result); 76 | 77 | return NULL; 78 | } 79 | 80 | XSettingsList * 81 | xsettings_list_copy (XSettingsList *list) 82 | { 83 | XSettingsList *new = NULL; 84 | XSettingsList *old_iter = list; 85 | XSettingsList *new_iter = NULL; 86 | 87 | while (old_iter) 88 | { 89 | XSettingsList *new_node; 90 | 91 | new_node = malloc (sizeof *new_node); 92 | if (!new_node) 93 | goto error; 94 | 95 | new_node->setting = xsettings_setting_copy (old_iter->setting); 96 | if (!new_node->setting) 97 | { 98 | free (new_node); 99 | goto error; 100 | } 101 | 102 | if (new_iter) 103 | new_iter->next = new_node; 104 | else 105 | new = new_node; 106 | 107 | new_iter = new_node; 108 | 109 | old_iter = old_iter->next; 110 | } 111 | 112 | return new; 113 | 114 | error: 115 | xsettings_list_free (new); 116 | return NULL; 117 | } 118 | 119 | int 120 | xsettings_setting_equal (XSettingsSetting *setting_a, 121 | XSettingsSetting *setting_b) 122 | { 123 | if (setting_a->type != setting_b->type) 124 | return 0; 125 | 126 | if (strcmp (setting_a->name, setting_b->name) != 0) 127 | return 0; 128 | 129 | switch (setting_a->type) 130 | { 131 | case XSETTINGS_TYPE_INT: 132 | return setting_a->data.v_int == setting_b->data.v_int; 133 | case XSETTINGS_TYPE_COLOR: 134 | return (setting_a->data.v_color.red == setting_b->data.v_color.red && 135 | setting_a->data.v_color.green == setting_b->data.v_color.green && 136 | setting_a->data.v_color.blue == setting_b->data.v_color.blue && 137 | setting_a->data.v_color.alpha == setting_b->data.v_color.alpha); 138 | case XSETTINGS_TYPE_STRING: 139 | return strcmp (setting_a->data.v_string, setting_b->data.v_string) == 0; 140 | } 141 | 142 | return 0; 143 | } 144 | 145 | void 146 | xsettings_setting_free (XSettingsSetting *setting) 147 | { 148 | if (setting->type == XSETTINGS_TYPE_STRING) 149 | free (setting->data.v_string); 150 | 151 | if (setting->name) 152 | free (setting->name); 153 | 154 | free (setting); 155 | } 156 | 157 | void 158 | xsettings_list_free (XSettingsList *list) 159 | { 160 | while (list) 161 | { 162 | XSettingsList *next = list->next; 163 | 164 | xsettings_setting_free (list->setting); 165 | free (list); 166 | 167 | list = next; 168 | } 169 | } 170 | 171 | XSettingsResult 172 | xsettings_list_insert (XSettingsList **list, 173 | XSettingsSetting *setting) 174 | { 175 | XSettingsList *node; 176 | XSettingsList *iter; 177 | XSettingsList *last = NULL; 178 | 179 | node = malloc (sizeof *node); 180 | if (!node) 181 | return XSETTINGS_NO_MEM; 182 | node->setting = setting; 183 | 184 | iter = *list; 185 | while (iter) 186 | { 187 | int cmp = strcmp (setting->name, iter->setting->name); 188 | 189 | if (cmp < 0) 190 | break; 191 | else if (cmp == 0) 192 | { 193 | free (node); 194 | return XSETTINGS_DUPLICATE_ENTRY; 195 | } 196 | 197 | last = iter; 198 | iter = iter->next; 199 | } 200 | 201 | if (last) 202 | last->next = node; 203 | else 204 | *list = node; 205 | 206 | node->next = iter; 207 | 208 | return XSETTINGS_SUCCESS; 209 | } 210 | 211 | XSettingsResult 212 | xsettings_list_delete (XSettingsList **list, 213 | const char *name) 214 | { 215 | XSettingsList *iter; 216 | XSettingsList *last = NULL; 217 | 218 | iter = *list; 219 | while (iter) 220 | { 221 | if (strcmp (name, iter->setting->name) == 0) 222 | { 223 | if (last) 224 | last->next = iter->next; 225 | else 226 | *list = iter->next; 227 | 228 | xsettings_setting_free (iter->setting); 229 | free (iter); 230 | 231 | return XSETTINGS_SUCCESS; 232 | } 233 | 234 | last = iter; 235 | iter = iter->next; 236 | } 237 | 238 | return XSETTINGS_FAILED; 239 | } 240 | 241 | XSettingsSetting * 242 | xsettings_list_lookup (XSettingsList *list, 243 | const char *name) 244 | { 245 | XSettingsList *iter; 246 | 247 | iter = list; 248 | while (iter) 249 | { 250 | if (strcmp (name, iter->setting->name) == 0) 251 | return iter->setting; 252 | 253 | iter = iter->next; 254 | } 255 | 256 | return NULL; 257 | } 258 | 259 | char 260 | xsettings_byte_order (void) 261 | { 262 | CARD32 myint = 0x01020304; 263 | return (*(char *)&myint == 1) ? MSBFirst : LSBFirst; 264 | } 265 | -------------------------------------------------------------------------------- /lxsettings-daemon/xsettings-common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2001 Red Hat, Inc. 3 | * 4 | * Permission to use, copy, modify, distribute, and sell this software and its 5 | * documentation for any purpose is hereby granted without fee, provided that 6 | * the above copyright notice appear in all copies and that both that 7 | * copyright notice and this permission notice appear in supporting 8 | * documentation, and that the name of Red Hat not be used in advertising or 9 | * publicity pertaining to distribution of the software without specific, 10 | * written prior permission. Red Hat makes no representations about the 11 | * suitability of this software for any purpose. It is provided "as is" 12 | * without express or implied warranty. 13 | * 14 | * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL 15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT 16 | * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 17 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 18 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 19 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 20 | * 21 | * Author: Owen Taylor, Red Hat, Inc. 22 | */ 23 | #ifndef XSETTINGS_COMMON_H 24 | #define XSETTINGS_COMMON_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif /* __cplusplus */ 29 | 30 | typedef struct _XSettingsBuffer XSettingsBuffer; 31 | typedef struct _XSettingsColor XSettingsColor; 32 | typedef struct _XSettingsList XSettingsList; 33 | typedef struct _XSettingsSetting XSettingsSetting; 34 | 35 | /* Types of settings possible. Enum values correspond to 36 | * protocol values. 37 | */ 38 | typedef enum 39 | { 40 | XSETTINGS_TYPE_INT = 0, 41 | XSETTINGS_TYPE_STRING = 1, 42 | XSETTINGS_TYPE_COLOR = 2 43 | } XSettingsType; 44 | 45 | typedef enum 46 | { 47 | XSETTINGS_SUCCESS, 48 | XSETTINGS_NO_MEM, 49 | XSETTINGS_ACCESS, 50 | XSETTINGS_FAILED, 51 | XSETTINGS_NO_ENTRY, 52 | XSETTINGS_DUPLICATE_ENTRY 53 | } XSettingsResult; 54 | 55 | struct _XSettingsBuffer 56 | { 57 | char byte_order; 58 | size_t len; 59 | unsigned char *data; 60 | unsigned char *pos; 61 | }; 62 | 63 | struct _XSettingsColor 64 | { 65 | unsigned short red, green, blue, alpha; 66 | }; 67 | 68 | struct _XSettingsList 69 | { 70 | XSettingsSetting *setting; 71 | XSettingsList *next; 72 | }; 73 | 74 | struct _XSettingsSetting 75 | { 76 | char *name; 77 | XSettingsType type; 78 | 79 | union { 80 | int v_int; 81 | char *v_string; 82 | XSettingsColor v_color; 83 | } data; 84 | 85 | unsigned long last_change_serial; 86 | }; 87 | 88 | XSettingsSetting *xsettings_setting_copy (XSettingsSetting *setting); 89 | void xsettings_setting_free (XSettingsSetting *setting); 90 | int xsettings_setting_equal (XSettingsSetting *setting_a, 91 | XSettingsSetting *setting_b); 92 | 93 | void xsettings_list_free (XSettingsList *list); 94 | XSettingsList *xsettings_list_copy (XSettingsList *list); 95 | XSettingsResult xsettings_list_insert (XSettingsList **list, 96 | XSettingsSetting *setting); 97 | XSettingsSetting *xsettings_list_lookup (XSettingsList *list, 98 | const char *name); 99 | XSettingsResult xsettings_list_delete (XSettingsList **list, 100 | const char *name); 101 | 102 | char xsettings_byte_order (void); 103 | 104 | #define XSETTINGS_PAD(n,m) ((n + m - 1) & (~(m-1))) 105 | 106 | #ifdef __cplusplus 107 | } 108 | #endif /* __cplusplus */ 109 | 110 | #endif /* XSETTINGS_COMMON_H */ 111 | -------------------------------------------------------------------------------- /lxsettings-daemon/xsettings-manager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2001 Red Hat, Inc. 3 | * 4 | * Permission to use, copy, modify, distribute, and sell this software and its 5 | * documentation for any purpose is hereby granted without fee, provided that 6 | * the above copyright notice appear in all copies and that both that 7 | * copyright notice and this permission notice appear in supporting 8 | * documentation, and that the name of Red Hat not be used in advertising or 9 | * publicity pertaining to distribution of the software without specific, 10 | * written prior permission. Red Hat makes no representations about the 11 | * suitability of this software for any purpose. It is provided "as is" 12 | * without express or implied warranty. 13 | * 14 | * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL 15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT 16 | * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 17 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 18 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 19 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 20 | * 21 | * Author: Owen Taylor, Red Hat, Inc. 22 | */ 23 | #ifndef XSETTINGS_MANAGER_H 24 | #define XSETTINGS_MANAGER_H 25 | 26 | #include 27 | #include "xsettings-common.h" 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif /* __cplusplus */ 32 | 33 | typedef struct _XSettingsManager XSettingsManager; 34 | 35 | typedef void (*XSettingsTerminateFunc) (void *cb_data); 36 | 37 | Bool xsettings_manager_check_running (Display *display, 38 | int screen); 39 | 40 | XSettingsManager *xsettings_manager_new (Display *display, 41 | int screen, 42 | XSettingsTerminateFunc terminate, 43 | void *cb_data); 44 | 45 | void xsettings_manager_destroy (XSettingsManager *manager); 46 | Window xsettings_manager_get_window (XSettingsManager *manager); 47 | Bool xsettings_manager_process_event (XSettingsManager *manager, 48 | XEvent *xev); 49 | 50 | XSettingsResult xsettings_manager_delete_setting (XSettingsManager *manager, 51 | const char *name); 52 | XSettingsResult xsettings_manager_set_setting (XSettingsManager *manager, 53 | XSettingsSetting *setting); 54 | XSettingsResult xsettings_manager_set_int (XSettingsManager *manager, 55 | const char *name, 56 | int value); 57 | XSettingsResult xsettings_manager_set_string (XSettingsManager *manager, 58 | const char *name, 59 | const char *value); 60 | XSettingsResult xsettings_manager_set_color (XSettingsManager *manager, 61 | const char *name, 62 | XSettingsColor *value); 63 | XSettingsResult xsettings_manager_notify (XSettingsManager *manager); 64 | 65 | 66 | 67 | #ifdef __cplusplus 68 | } 69 | #endif /* __cplusplus */ 70 | 71 | #endif /* XSETTINGS_MANAGER_H */ 72 | -------------------------------------------------------------------------------- /lxsettings-daemon/xutils.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2004 Red Hat, Inc. 3 | * 4 | * Permission to use, copy, modify, distribute, and sell this software and its 5 | * documentation for any purpose is hereby granted without fee, provided that 6 | * the above copyright notice appear in all copies and that both that 7 | * copyright notice and this permission notice appear in supporting 8 | * documentation, and that the name of Red Hat not be used in advertising or 9 | * publicity pertaining to distribution of the software without specific, 10 | * written prior permission. Red Hat makes no representations about the 11 | * suitability of this software for any purpose. It is provided "as is" 12 | * without express or implied warranty. 13 | * 14 | * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL 15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT 16 | * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 17 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 18 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 19 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 20 | * 21 | * Author: Matthias Clasen, Red Hat, Inc. 22 | */ 23 | 24 | #include 25 | 26 | #include "xutils.h" 27 | 28 | Atom XA_ATOM_PAIR; 29 | Atom XA_CLIPBOARD_MANAGER; 30 | Atom XA_CLIPBOARD; 31 | Atom XA_DELETE; 32 | Atom XA_INCR; 33 | Atom XA_INSERT_PROPERTY; 34 | Atom XA_INSERT_SELECTION; 35 | Atom XA_MANAGER; 36 | Atom XA_MULTIPLE; 37 | Atom XA_NULL; 38 | Atom XA_SAVE_TARGETS; 39 | Atom XA_TARGETS; 40 | Atom XA_TIMESTAMP; 41 | 42 | unsigned long SELECTION_MAX_SIZE = 0; 43 | 44 | 45 | void 46 | init_atoms (Display *display) 47 | { 48 | unsigned long max_request_size; 49 | 50 | if (SELECTION_MAX_SIZE > 0) 51 | return; 52 | 53 | XA_ATOM_PAIR = XInternAtom (display, "ATOM_PAIR", False); 54 | XA_CLIPBOARD_MANAGER = XInternAtom (display, "CLIPBOARD_MANAGER", False); 55 | XA_CLIPBOARD = XInternAtom (display, "CLIPBOARD", False); 56 | XA_DELETE = XInternAtom (display, "DELETE", False); 57 | XA_INCR = XInternAtom (display, "INCR", False); 58 | XA_INSERT_PROPERTY = XInternAtom (display, "INSERT_PROPERTY", False); 59 | XA_INSERT_SELECTION = XInternAtom (display, "INSERT_SELECTION", False); 60 | XA_MANAGER = XInternAtom (display, "MANAGER", False); 61 | XA_MULTIPLE = XInternAtom (display, "MULTIPLE", False); 62 | XA_NULL = XInternAtom (display, "NULL", False); 63 | XA_SAVE_TARGETS = XInternAtom (display, "SAVE_TARGETS", False); 64 | XA_TARGETS = XInternAtom (display, "TARGETS", False); 65 | XA_TIMESTAMP = XInternAtom (display, "TIMESTAMP", False); 66 | 67 | max_request_size = XExtendedMaxRequestSize (display); 68 | if (max_request_size == 0) 69 | max_request_size = XMaxRequestSize (display); 70 | 71 | SELECTION_MAX_SIZE = max_request_size - 100; 72 | if (SELECTION_MAX_SIZE > 262144) 73 | SELECTION_MAX_SIZE = 262144; 74 | } 75 | 76 | typedef struct 77 | { 78 | Window window; 79 | Atom timestamp_prop_atom; 80 | } TimeStampInfo; 81 | 82 | static Bool 83 | timestamp_predicate (Display *display, 84 | XEvent *xevent, 85 | XPointer arg) 86 | { 87 | TimeStampInfo *info = (TimeStampInfo *)arg; 88 | 89 | if (xevent->type == PropertyNotify && 90 | xevent->xproperty.window == info->window && 91 | xevent->xproperty.atom == info->timestamp_prop_atom) 92 | return True; 93 | 94 | return False; 95 | } 96 | 97 | Time 98 | get_server_time (Display *display, 99 | Window window) 100 | { 101 | unsigned char c = 'a'; 102 | XEvent xevent; 103 | TimeStampInfo info; 104 | 105 | info.timestamp_prop_atom = XInternAtom (display, "_TIMESTAMP_PROP", False); 106 | info.window = window; 107 | 108 | XChangeProperty (display, window, 109 | info.timestamp_prop_atom, info.timestamp_prop_atom, 110 | 8, PropModeReplace, &c, 1); 111 | 112 | XIfEvent (display, &xevent, 113 | timestamp_predicate, (XPointer)&info); 114 | 115 | return xevent.xproperty.time; 116 | } 117 | 118 | -------------------------------------------------------------------------------- /lxsettings-daemon/xutils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2004 Red Hat, Inc. 3 | * 4 | * Permission to use, copy, modify, distribute, and sell this software and its 5 | * documentation for any purpose is hereby granted without fee, provided that 6 | * the above copyright notice appear in all copies and that both that 7 | * copyright notice and this permission notice appear in supporting 8 | * documentation, and that the name of Red Hat not be used in advertising or 9 | * publicity pertaining to distribution of the software without specific, 10 | * written prior permission. Red Hat makes no representations about the 11 | * suitability of this software for any purpose. It is provided "as is" 12 | * without express or implied warranty. 13 | * 14 | * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL 15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT 16 | * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 17 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 18 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 19 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 20 | * 21 | * Author: Matthias Clasen, Red Hat, Inc. 22 | */ 23 | #ifndef X_UTILS_H 24 | #define X_UTILS_H 25 | 26 | #include 27 | 28 | 29 | extern Atom XA_ATOM_PAIR; 30 | extern Atom XA_CLIPBOARD_MANAGER; 31 | extern Atom XA_CLIPBOARD; 32 | extern Atom XA_DELETE; 33 | extern Atom XA_INCR; 34 | extern Atom XA_INSERT_PROPERTY; 35 | extern Atom XA_INSERT_SELECTION; 36 | extern Atom XA_MANAGER; 37 | extern Atom XA_MULTIPLE; 38 | extern Atom XA_NULL; 39 | extern Atom XA_SAVE_TARGETS; 40 | extern Atom XA_TARGETS; 41 | extern Atom XA_TIMESTAMP; 42 | 43 | extern unsigned long SELECTION_MAX_SIZE; 44 | 45 | void init_atoms (Display *display); 46 | 47 | Time get_server_time (Display *display, 48 | Window window); 49 | 50 | #endif /* X_UTILS_H */ 51 | -------------------------------------------------------------------------------- /man/Makefile.am: -------------------------------------------------------------------------------- 1 | man_MANS = \ 2 | lxsession.1 \ 3 | lxsession-logout.1 \ 4 | lxclipboard.1 \ 5 | lxlock.1 \ 6 | lxsession-default.1 \ 7 | lxsession-default-terminal.1 \ 8 | lxsession-default-apps.1 \ 9 | lxsettings-daemon.1 \ 10 | lxpolkit.1 \ 11 | lxsession-edit.1 \ 12 | lxsession-db.1 \ 13 | lxsession-xdg-autostart.1 14 | 15 | man_XMANS = \ 16 | lxsession.xml \ 17 | lxsession-logout.xml 18 | 19 | EXTRA_DIST = \ 20 | $(man_MANS) \ 21 | $(man_XMANS) 22 | 23 | 24 | if ENABLE_REGENERATE_MAN 25 | 26 | lxsession.1: lxsession.xml 27 | $(XSLTPROC) -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< 28 | 29 | lxsession-logout.1: lxsession-logout.xml 30 | $(XSLTPROC) -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< 31 | 32 | CLEANFILES = lxsession.1 \ 33 | lxsession-logout.1 34 | 35 | endif 36 | 37 | 38 | -------------------------------------------------------------------------------- /man/lxclipboard.1: -------------------------------------------------------------------------------- 1 | .TH "lxclipboard" 1 2 | .SH NAME 3 | lxclipboard \- clipboard utility for LXSession and LXDE 4 | .SH SYNOPSIS 5 | .B lxclipboard 6 | 7 | .SH DESCRIPTION 8 | 9 | .B lxclipboard 10 | is a clipboard utility, to be able to do copy/paste operation between GTK+ 11 | applications. 12 | lxcliboard is only useful when lxsession is not compile with clipboard 13 | build-in support. If lxsession is compile with clipboard build-in lxclipboard 14 | functionality will be automatically launched, without the need to launch 15 | lxclipboard. 16 | 17 | .SH AUTHORS 18 | William Jon McCann 19 | 20 | Matthias Clasen 21 | 22 | Anders Carlsson 23 | 24 | Rodrigo Moya 25 | 26 | Nick Schermer 27 | 28 | Julien Lavergne (gilir@ubuntu.com) 29 | 30 | Man page written to conform with Debian by Julien Lavergne. 31 | -------------------------------------------------------------------------------- /man/lxlock.1: -------------------------------------------------------------------------------- 1 | .TH "lxlock" 1 2 | .SH NAME 3 | lxlock \- locking utility for LXDE 4 | .SH SYNOPSIS 5 | .B lxlock 6 | 7 | .SH DESCRIPTION 8 | 9 | .B lxlock 10 | is a simple script to lock the session, using third party applications. 11 | It currently uses one of these applications, in this order (and tries the next 12 | one if the application is not available): 13 | light-locker, 14 | xscreensaver, 15 | gnome-screensaver, 16 | slock, 17 | xlock, 18 | i3lock, 19 | slimlock, 20 | xtrlock, 21 | xsecurelock. 22 | 23 | .SH AUTHORS 24 | Olivier Fourdan (fourdan@xfce.org) 25 | 26 | Julien Lavergne (gilir@ubuntu.com) 27 | 28 | Jarno Suni (8@iki.fi) 29 | 30 | Man page written to conform with Debian by Julien Lavergne. 31 | -------------------------------------------------------------------------------- /man/lxpolkit.1: -------------------------------------------------------------------------------- 1 | .\" Process this file with 2 | .\" groff -man -Tascii lxhotkey.1 3 | .\" 4 | .TH "lxpolkit" 1 5 | .SH NAME 6 | lxpolkit \- PolicyKit agent for LXDE 7 | 8 | .SH SYNOPSIS 9 | .B lxpolkit 10 | 11 | .SH DESCRIPTION 12 | .B lxpolkit 13 | is a PolicyKit agent which interacts with PolicyKit daemon to provide 14 | extended privileges to applications. 15 | 16 | .SH OPTIONS 17 | .B lxpolkit 18 | does not support any options. 19 | 20 | .SH AUTHORS 21 | This manual page is written by Andriy Grytsenko . 22 | -------------------------------------------------------------------------------- /man/lxsession-db.1: -------------------------------------------------------------------------------- 1 | .TH "lxsession-db" 1 2 | .SH NAME 3 | lxsession-db \- lxsession database updater 4 | .SH DESCRIPTION 5 | This program is for internal usage by lxsession. Never run it manually. 6 | -------------------------------------------------------------------------------- /man/lxsession-default-apps.1: -------------------------------------------------------------------------------- 1 | .TH "lxsession-default-apps" 1 2 | .SH NAME 3 | lxsession-default-apps \- Configure default applications for LXSession 4 | .SH SYNOPSIS 5 | .B lxsession-default-apps 6 | 7 | .SH DESCRIPTION 8 | 9 | .B lxsession-default-apps 10 | is an utility to set up default applications and other options for LXSession. 11 | 12 | .SH AUTHORS 13 | Julien Lavergne (gilir@ubuntu.com) 14 | 15 | Man page written to conform with Debian by Julien Lavergne. 16 | -------------------------------------------------------------------------------- /man/lxsession-default-terminal.1: -------------------------------------------------------------------------------- 1 | .TH "lxsession-default-terminal" 1 2 | .SH NAME 3 | lxsession-default-terminal \- Launching default terminal set by LXSession 4 | .SH SYNOPSIS 5 | .B lxsession-default-terminal 6 | 7 | .SH DESCRIPTION 8 | 9 | .B lxsession-default-terminal 10 | is a wrapper around LXSession D-Bus interface, which launch default 11 | terminal set by LXsession. It's equivalent to lxsession-default terminal, but 12 | it can be used if an application can't use lxsesison-default. 13 | 14 | Applications launched will be the one define for terminal_manager/command set 15 | in desktop.conf. 16 | 17 | .SH AUTHORS 18 | Julien Lavergne 19 | 20 | Man page written to conform with Debian by Julien Lavergne. 21 | -------------------------------------------------------------------------------- /man/lxsession-default.1: -------------------------------------------------------------------------------- 1 | .TH "lxsession-default" 1 2 | .SH NAME 3 | lxsession-default \- Launching default applications set by LXSession 4 | .SH SYNOPSIS 5 | .B lxsession-default 6 | [COMMAND] 7 | [OPTIONS] 8 | 9 | .SH DESCRIPTION 10 | 11 | .B lxsession-default 12 | is a wrapper around LXSession D-Bus interface, which launch default 13 | applications set by LXsession. 14 | 15 | COMMAND is the application you want to launch, and the ones available are 16 | define in desktop.conf.examples. 17 | 18 | OPTIONS are available if the COMMAND accept it. 19 | 20 | Example : 21 | To launch file_manager/command set in desktop.conf, use : 22 | lxsession-default file_manager 23 | 24 | .SH AUTHORS 25 | Julien Lavergne 26 | 27 | Man page written to conform with Debian by Julien Lavergne. 28 | -------------------------------------------------------------------------------- /man/lxsession-edit.1: -------------------------------------------------------------------------------- 1 | .\" Process this file with 2 | .\" groff -man -Tascii lxhotkey.1 3 | .\" 4 | .TH "lxsession-edit" 1 5 | .SH NAME 6 | lxsession-edit \- a simple session editor GUI for LXDE which follows 7 | autostart specs from FreeDesktop.Org 8 | .SH SYNOPSIS 9 | .B lxsession-edit 10 | [ DE ] 11 | .SH DESCRIPTION 12 | .B lxsession-edit 13 | is an application to change list of applications which will be ran on 14 | session start. Session name may be retrieved from command line, from 15 | environment variables \fIXDG_CURRENT_DESKTOP\fP or \fIDESKTOP_SESSION\fP, 16 | otherwise "\fBLXDE\fP" is assumed. 17 | .SH OPTIONS 18 | .TP 10 19 | .B DE 20 | provide desktop session name to edit autostart list 21 | .SH ENVIRONMENT 22 | .PD 0 23 | .TP 24 | .I XDG_CURRENT_DESKTOP 25 | default variable to get session name 26 | .TP 27 | .I DESKTOP_SESSION 28 | fallback variable to get session name 29 | 30 | .SH AUTHORS 31 | This manual page is written by Andriy Grytsenko . 32 | -------------------------------------------------------------------------------- /man/lxsession-logout.1: -------------------------------------------------------------------------------- 1 | '\" t 2 | .\" Title: LXSESSION 3 | .\" Author: Ying-Chun Liu 4 | .\" Generator: DocBook XSL Stylesheets v1.79.1 5 | .\" Date: March 2, 2008 6 | .\" Manual: http://LXDE.org 7 | .\" Source: http://LXDE.org 8 | .\" Language: English 9 | .\" 10 | .TH "LXSESSION" "1" "March 2, 2008" "http://LXDE\&.org" "http://LXDE.org" 11 | .\" ----------------------------------------------------------------- 12 | .\" * Define some portability stuff 13 | .\" ----------------------------------------------------------------- 14 | .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 15 | .\" http://bugs.debian.org/507673 16 | .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html 17 | .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 18 | .ie \n(.g .ds Aq \(aq 19 | .el .ds Aq ' 20 | .\" ----------------------------------------------------------------- 21 | .\" * set default formatting 22 | .\" ----------------------------------------------------------------- 23 | .\" disable hyphenation 24 | .nh 25 | .\" disable justification (adjust text to left margin only) 26 | .ad l 27 | .\" ----------------------------------------------------------------- 28 | .\" * MAIN CONTENT STARTS HERE * 29 | .\" ----------------------------------------------------------------- 30 | .SH "NAME" 31 | lxsession-logout \- program to logout from LXSession 32 | .SH "SYNOPSIS" 33 | .HP \w'\fBlxsession\-logout\fR\ 'u 34 | \fBlxsession\-logout\fR [\fBoptions\fR...] 35 | .SH "DESCRIPTION" 36 | .PP 37 | This manual page documents briefly the 38 | \fBlxsession\-logout\fR 39 | command\&. 40 | .PP 41 | \fBlxsession\-logout\fR 42 | is a program that to logout from LXSession\&. It gives a good\-looking logout dialog\&. 43 | .SH "OPTIONS" 44 | .PP 45 | These programs follow the usual 46 | GNU 47 | command line syntax, with long options starting with two dashes (`\-\*(Aq)\&. A summary of options is included below\&. 48 | .PP 49 | \fB\-\-prompt \fR\fB\fIYour custom message\fR\fR 50 | .RS 4 51 | Customize the logout message\&. 52 | .RE 53 | .PP 54 | \fB\-\-banner \fR\fB\fIYour logo\fR\fR 55 | .RS 4 56 | Customize the logout logo\&. 57 | .RE 58 | .PP 59 | \fB\-\-side left|top|right|bottom\fR 60 | .RS 4 61 | The position of the logo\&. 62 | .RE 63 | .SH "SEE ALSO" 64 | .PP 65 | lxsession (1)\&. 66 | .SH "AUTHOR" 67 | .PP 68 | This manual page was written by paulliu 69 | 70 | for the 71 | Debian 72 | system (but may be used by others)\&. Permission is granted to copy, distribute and/or modify this document under the terms of the 73 | GNU 74 | General Public License, Version 2 any later version published by the Free Software Foundation\&. 75 | .PP 76 | On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common\-licenses/GPL\&. 77 | .SH "AUTHOR" 78 | .PP 79 | \fBYing\-Chun Liu\fR 80 | .RS 4 81 | Author. 82 | .RE 83 | .SH "COPYRIGHT" 84 | .br 85 | Copyright \(co 2008 paulliu 86 | .br 87 | -------------------------------------------------------------------------------- /man/lxsession-logout.xml: -------------------------------------------------------------------------------- 1 | 2 |
grandpaul@gmail.com 3 |
4 | Ying-Chun 5 | Liu 6 | 7 | 2008 8 | paulliu 9 | 10 | March 2, 2008 11 |
12 | LXSESSION 13 | http://LXDE.org 14 | 15 | 1 16 | 17 | lxsession-logout 18 | 19 | program to logout from LXSession 20 | 21 | lxsession-logout 22 | 23 | 24 | 25 | DESCRIPTION 26 | 27 | This manual page documents briefly the 28 | lxsession-logout command. 29 | 30 | lxsession-logout is a program that to logout 31 | from LXSession. It gives a good-looking logout dialog. 32 | 33 | 34 | 35 | 36 | OPTIONS 37 | 38 | These programs follow the usual GNU command line syntax, 39 | with long options starting with two dashes (`-'). A summary of 40 | options is included below. 41 | 42 | 43 | 44 | 45 | Customize the logout message. 46 | 47 | 48 | 49 | 50 | Customize the logout logo. 51 | 52 | 53 | 54 | 55 | The position of the logo. 56 | 57 | 58 | 59 | 60 | 61 | 62 | SEE ALSO 63 | 64 | lxsession (1). 65 | 66 | 67 | AUTHOR 68 | 69 | This manual page was written by paulliu grandpaul@gmail.com for 70 | the Debian system (but may be used by others). Permission is 71 | granted to copy, distribute and/or modify this document under 72 | the terms of the GNU General Public License, Version 2 any 73 | later version published by the Free Software Foundation. 74 | 75 | On Debian systems, the complete text of the GNU General Public 76 | License can be found in /usr/share/common-licenses/GPL. 77 | 78 | 79 |
80 | -------------------------------------------------------------------------------- /man/lxsession-xdg-autostart.1: -------------------------------------------------------------------------------- 1 | .TH "lxsession-xdg-autostart" 1 2 | .SH NAME 3 | lxsession-xdg-autostart \- lxsession's autostart runner 4 | .SH DESCRIPTION 5 | This program is for internal usage by lxsession. Never run it manually. 6 | -------------------------------------------------------------------------------- /man/lxsession.1: -------------------------------------------------------------------------------- 1 | '\" t 2 | .\" Title: LXSESSION 3 | .\" Author: Ying-Chun Liu 4 | .\" Generator: DocBook XSL Stylesheets v1.79.1 5 | .\" Date: March 2, 2008 6 | .\" Manual: http://LXDE.org 7 | .\" Source: http://LXDE.org 8 | .\" Language: English 9 | .\" 10 | .TH "LXSESSION" "1" "March 2, 2008" "http://LXDE\&.org" "http://LXDE.org" 11 | .\" ----------------------------------------------------------------- 12 | .\" * Define some portability stuff 13 | .\" ----------------------------------------------------------------- 14 | .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 15 | .\" http://bugs.debian.org/507673 16 | .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html 17 | .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 18 | .ie \n(.g .ds Aq \(aq 19 | .el .ds Aq ' 20 | .\" ----------------------------------------------------------------- 21 | .\" * set default formatting 22 | .\" ----------------------------------------------------------------- 23 | .\" disable hyphenation 24 | .nh 25 | .\" disable justification (adjust text to left margin only) 26 | .ad l 27 | .\" ----------------------------------------------------------------- 28 | .\" * MAIN CONTENT STARTS HERE * 29 | .\" ----------------------------------------------------------------- 30 | .SH "NAME" 31 | lxsession \- a lightweight X session manager 32 | .SH "SYNOPSIS" 33 | .HP \w'\fBlxsession\fR\ 'u 34 | \fBlxsession\fR 35 | .SH "DESCRIPTION" 36 | .PP 37 | This manual page documents briefly the 38 | \fBlxsession\fR 39 | command\&. 40 | .PP 41 | \fBlxsession\fR 42 | is a program that provides a X11 session manager\&. It is the default X11 session manager of LXDE\&. 43 | .PP 44 | A session manager is used to automatically start a set of applications and set up a working desktop environment\&. Moreover, when the user logout, it remembers the applications in use, and restart them the next time you login\&. 45 | .SH "SEE ALSO" 46 | .PP 47 | lxpanel (1), lxsession\-logout(1)\&. 48 | .SH "AUTHOR" 49 | .PP 50 | This manual page was written by paulliu 51 | 52 | for the 53 | Debian 54 | system (but may be used by others)\&. Permission is granted to copy, distribute and/or modify this document under the terms of the 55 | GNU 56 | General Public License, Version 2 any later version published by the Free Software Foundation\&. 57 | .PP 58 | On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common\-licenses/GPL\&. 59 | .SH "AUTHOR" 60 | .PP 61 | \fBYing\-Chun Liu\fR 62 | .RS 4 63 | Author. 64 | .RE 65 | .SH "COPYRIGHT" 66 | .br 67 | Copyright \(co 2008 paulliu 68 | .br 69 | -------------------------------------------------------------------------------- /man/lxsession.xml: -------------------------------------------------------------------------------- 1 | 2 |
grandpaul@gmail.com 3 |
4 | Ying-Chun 5 | Liu 6 | 7 | 2008 8 | paulliu 9 | 10 | March 2, 2008 11 |
12 | LXSESSION 13 | http://LXDE.org 14 | 15 | 1 16 | 17 | lxsession 18 | 19 | a lightweight X session manager 20 | 21 | lxsession 22 | 23 | 24 | DESCRIPTION 25 | 26 | This manual page documents briefly the 27 | lxsession command. 28 | 29 | lxsession is a program that provides a X11 30 | session manager. It is the default X11 session manager of LXDE. 31 | 32 | 33 | A session manager is used to automatically start a set of 34 | applications and 35 | set up a working desktop environment. Moreover, when 36 | the user logout, it 37 | remembers the applications in use, and restart them 38 | the next time you login. 39 | 40 | 41 | 42 | SEE ALSO 43 | 44 | lxpanel (1), lxsession-logout(1). 45 | 46 | 47 | AUTHOR 48 | 49 | This manual page was written by paulliu grandpaul@gmail.com for 50 | the Debian system (but may be used by others). Permission is 51 | granted to copy, distribute and/or modify this document under 52 | the terms of the GNU General Public License, Version 2 any 53 | later version published by the Free Software Foundation. 54 | 55 | On Debian systems, the complete text of the GNU General Public 56 | License can be found in /usr/share/common-licenses/GPL. 57 | 58 | 59 |
60 | -------------------------------------------------------------------------------- /man/lxsettings-daemon.1: -------------------------------------------------------------------------------- 1 | .TH "lxsettings-daemon" "1" 2 | .SH "NAME" 3 | lxsettings-daemon \(em lightweight XSettings daemon for LXDE 4 | .SH "SYNOPSIS" 5 | .PP 6 | .B lxsettings-daemon 7 | \-f 8 | .I file 9 | .PP 10 | This manual page documents briefly the 11 | \fBlxsettings-daemon\fR command. 12 | .SH "DESCRIPTION" 13 | .PP 14 | \fBlxsettings-daemon\fR is a program that provides 15 | XSettings daemon. The daemon handles the session settings for applications. 16 | 17 | \fBlxsettings-daemon\fR is a part of the LXDE project. 18 | .SH "OPTIONS" 19 | .PP 20 | .TP 25 21 | .BI \-f " file" "\fR,\fP \-\^\-file=" file 22 | path to the configuration \fIfile\fP 23 | .SH "AUTHOR" 24 | .PP 25 | This manual page was written by paulliu for 26 | the \fBDebian\fP system (but may be used by others). Permission is 27 | granted to copy, distribute and/or modify this document under 28 | the terms of the GNU General Public License, Version 2 any 29 | later version published by the Free Software Foundation. 30 | 31 | On Debian systems, the complete text of the GNU General Public 32 | License can be found in /usr/share/common-licenses/GPL. 33 | -------------------------------------------------------------------------------- /po/ChangeLog: -------------------------------------------------------------------------------- 1 | 2009-03-12 Og Maciel 2 | 3 | * LINGUAS: Added. 4 | * pt_BR.po: Updated Brazilian Portuguese translation by 5 | Henrique P Machado. 6 | 7 | 2009-01-26 Ming-Ting Wei 8 | 9 | * ar.po: Added Arabic translation 10 | 11 | -------------------------------------------------------------------------------- /po/POTFILES.in: -------------------------------------------------------------------------------- 1 | lxsession-logout/lxsession-logout.c 2 | lxsession-edit/lxsession-edit.c 3 | lxsession-edit/lxsession-edit-common.c 4 | lxpolkit/lxpolkit.c 5 | lxpolkit/main.vala 6 | lxpolkit/lxpolkit-listener.c 7 | [type: gettext/glade]data/ui/lxsession-edit.ui 8 | [type: gettext/glade]data/ui/lxpolkit.ui 9 | [type: gettext/glade]data/ui/lxsession-default-apps.ui 10 | data/lxsession-edit.desktop.in 11 | data/lxsession-default-apps.desktop.in 12 | data/lxpolkit.desktop.in.in 13 | lxsession-default-apps/main.vala 14 | lxsession-default-apps/combobox.vala 15 | lxsession/app.vala 16 | -------------------------------------------------------------------------------- /po/POTFILES.skip: -------------------------------------------------------------------------------- 1 | # Autogenerated files with translatable strings. 2 | lxsession-default-apps/main.c 3 | lxsession-default-apps/combobox.c 4 | # This is a source file for configure, output will be translated instead. 5 | data/lxpolkit.desktop.in.in 6 | # bug of intltool with automake 1.15 7 | sub/data/lxpolkit.desktop.in 8 | -------------------------------------------------------------------------------- /vapi/config.vapi: -------------------------------------------------------------------------------- 1 | [CCode (cprefix = "", lower_case_cprefix = "", cheader_filename = "config.h")] 2 | namespace Config 3 | { 4 | public const string GETTEXT_PACKAGE; 5 | public const string RELEASE_NAME; 6 | public const string VERSION; 7 | public const string LOCALEDIR; 8 | } 9 | -------------------------------------------------------------------------------- /vapi/lxclipboard.vapi: -------------------------------------------------------------------------------- 1 | [CCode (cprefix = "LxsessionClipboard", cheader_filename = "lxclipboard/clipboard.h")] 2 | 3 | public static void clipboard_start (); 4 | public static void clipboard_stop (); 5 | -------------------------------------------------------------------------------- /vapi/lxpolkit.vapi: -------------------------------------------------------------------------------- 1 | [CCode (cprefix = "LxsessionPolkit", cheader_filename = "lxpolkit/lxpolkit.h")] 2 | 3 | public static bool policykit_agent_init(); 4 | public static void policykit_agent_finalize(); 5 | -------------------------------------------------------------------------------- /vapi/lxsession-edit.vapi: -------------------------------------------------------------------------------- 1 | [CCode (cprefix = "LxsessionEdit", cheader_filename = "lxsession-edit/lxsession-edit-common.h")] 2 | 3 | public static void init_list_view( Gtk.TreeView *view ); 4 | public static void load_autostart(string *session_name); 5 | public Gtk.ListStore get_autostart_list (); 6 | -------------------------------------------------------------------------------- /vapi/lxsettings-daemon.vapi: -------------------------------------------------------------------------------- 1 | [CCode (cprefix = "LxsessionSD", cheader_filename = "lxsettings-daemon/settings-daemon.h")] 2 | 3 | public static bool settings_daemon_start(GLib.KeyFile kf); 4 | public static void settings_daemon_reload(GLib.KeyFile kf); 5 | -------------------------------------------------------------------------------- /vapi/xdg-autostart.vapi: -------------------------------------------------------------------------------- 1 | [CCode (cprefix = "LxsessionXA", cheader_filename = "xdg-autostart/xdg-autostart.h")] 2 | 3 | public static void xdg_autostart(string *de_name ); 4 | -------------------------------------------------------------------------------- /xdg-autostart/main.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Julien Lavergne 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; if not, write to the Free Software 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 17 | * MA 02110-1301, USA. 18 | */ 19 | namespace Lxsession 20 | { 21 | public class Main: GLib.Object 22 | { 23 | static string desktop_environnement = null; 24 | 25 | const OptionEntry[] option_entries = { 26 | { "desktop_environnement", 'd', 0, OptionArg.STRING, ref desktop_environnement, "Desktop environment to use for desktop files, like LXDE, KDE ... Default to LXDE", "NAME" }, 27 | { null } 28 | }; 29 | 30 | public static int main(string[] args) 31 | { 32 | try 33 | { 34 | var options_args = new OptionContext("- Lxsession autostart utility"); 35 | options_args.set_help_enabled(true); 36 | options_args.add_main_entries(option_entries, null); 37 | options_args.parse(ref args); 38 | } 39 | catch (OptionError e) 40 | { 41 | critical ("Option parsing failed: %s\n", e.message); 42 | return -1; 43 | } 44 | 45 | if (desktop_environnement == null) 46 | { 47 | xdg_autostart("LXDE"); 48 | return 0; 49 | } 50 | else 51 | { 52 | xdg_autostart(desktop_environnement); 53 | return 0; 54 | } 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /xdg-autostart/xdg-autostart.c: -------------------------------------------------------------------------------- 1 | /* 2 | * autostart.c - Handle autostart spec of freedesktop.org 3 | * 4 | * Copyright 2008 PCMan 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 19 | * MA 02110-1301, USA. 20 | */ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | #include "xdg-autostart.h" 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | static const char DesktopEntry[] = "Desktop Entry"; 33 | const char* de_name = NULL; 34 | 35 | #if 0 36 | /* 37 | * Parse Exec command line of app desktop file, and translate 38 | * it into a real command which can be passed to g_spawn_command_line_async(). 39 | * file_list is a null-terminated file list containing full 40 | * paths of the files passed to app. 41 | * returned char* should be freed when no longer needed. 42 | */ 43 | static char* translate_app_exec_to_command_line( VFSAppDesktop* app, 44 | GList* file_list ) 45 | { 46 | const char* pexec = vfs_app_desktop_get_exec( app ); 47 | char* file; 48 | GList* l; 49 | gchar *tmp; 50 | GString* cmd = g_string_new(""); 51 | gboolean add_files = FALSE; 52 | 53 | for( ; *pexec; ++pexec ) 54 | { 55 | if( *pexec == '%' ) 56 | { 57 | ++pexec; 58 | switch( *pexec ) 59 | { 60 | case 'U': 61 | for( l = file_list; l; l = l->next ) 62 | { 63 | tmp = g_filename_to_uri( (char*)l->data, NULL, NULL ); 64 | file = g_shell_quote( tmp ); 65 | g_free( tmp ); 66 | g_string_append( cmd, file ); 67 | g_string_append_c( cmd, ' ' ); 68 | g_free( file ); 69 | } 70 | add_files = TRUE; 71 | break; 72 | case 'u': 73 | if( file_list && file_list->data ) 74 | { 75 | file = (char*)file_list->data; 76 | tmp = g_filename_to_uri( file, NULL, NULL ); 77 | file = g_shell_quote( tmp ); 78 | g_free( tmp ); 79 | g_string_append( cmd, file ); 80 | g_free( file ); 81 | add_files = TRUE; 82 | } 83 | break; 84 | case 'F': 85 | case 'N': 86 | for( l = file_list; l; l = l->next ) 87 | { 88 | file = (char*)l->data; 89 | tmp = g_shell_quote( file ); 90 | g_string_append( cmd, tmp ); 91 | g_string_append_c( cmd, ' ' ); 92 | g_free( tmp ); 93 | } 94 | add_files = TRUE; 95 | break; 96 | case 'f': 97 | case 'n': 98 | if( file_list && file_list->data ) 99 | { 100 | file = (char*)file_list->data; 101 | tmp = g_shell_quote( file ); 102 | g_string_append( cmd, tmp ); 103 | g_free( tmp ); 104 | add_files = TRUE; 105 | } 106 | break; 107 | case 'D': 108 | for( l = file_list; l; l = l->next ) 109 | { 110 | tmp = g_path_get_dirname( (char*)l->data ); 111 | file = g_shell_quote( tmp ); 112 | g_free( tmp ); 113 | g_string_append( cmd, file ); 114 | g_string_append_c( cmd, ' ' ); 115 | g_free( file ); 116 | } 117 | add_files = TRUE; 118 | break; 119 | case 'd': 120 | if( file_list && file_list->data ) 121 | { 122 | tmp = g_path_get_dirname( (char*)file_list->data ); 123 | file = g_shell_quote( tmp ); 124 | g_free( tmp ); 125 | g_string_append( cmd, file ); 126 | g_free( tmp ); 127 | add_files = TRUE; 128 | } 129 | break; 130 | case 'c': 131 | g_string_append( cmd, vfs_app_desktop_get_disp_name( app ) ); 132 | break; 133 | case 'i': 134 | /* Add icon name */ 135 | if( vfs_app_desktop_get_icon_name( app ) ) 136 | { 137 | g_string_append( cmd, "--icon " ); 138 | g_string_append( cmd, vfs_app_desktop_get_icon_name( app ) ); 139 | } 140 | break; 141 | case 'k': 142 | /* Location of the desktop file */ 143 | break; 144 | case 'v': 145 | /* Device name */ 146 | break; 147 | case '%': 148 | g_string_append_c ( cmd, '%' ); 149 | break; 150 | case '\0': 151 | goto _finish; 152 | break; 153 | } 154 | } 155 | else /* not % escaped part */ 156 | { 157 | g_string_append_c ( cmd, *pexec ); 158 | } 159 | } 160 | _finish: 161 | if( ! add_files ) 162 | { 163 | g_string_append_c ( cmd, ' ' ); 164 | for( l = file_list; l; l = l->next ) 165 | { 166 | file = (char*)l->data; 167 | tmp = g_shell_quote( file ); 168 | g_string_append( cmd, tmp ); 169 | g_string_append_c( cmd, ' ' ); 170 | g_free( tmp ); 171 | } 172 | } 173 | 174 | return g_string_free( cmd, FALSE ); 175 | } 176 | #endif 177 | 178 | static void launch_autostart_file( const char* desktop_id, const char* desktop_file, GKeyFile* kf) 179 | { 180 | if( g_key_file_load_from_file( kf, desktop_file, 0, NULL ) ) 181 | { 182 | char* exec; 183 | char** only_show_in, **not_show_in; 184 | gsize n; 185 | 186 | if( g_key_file_get_boolean( kf, DesktopEntry, "Hidden", NULL ) ) 187 | return; 188 | 189 | /* check if this desktop entry is desktop-specific */ 190 | only_show_in = g_key_file_get_string_list( kf, DesktopEntry, "OnlyShowIn", &n, NULL ); 191 | if( only_show_in ) 192 | { 193 | /* The format of this list is like: OnlyShowIn=GNOME;XFCE */ 194 | gsize i = 0; 195 | for( i = 0; i < n; ++i ) 196 | { 197 | /* Only start this program if we are in the "OnlyShowIn" list */ 198 | if( 0 == strcmp( de_name, only_show_in[ i ] ) ) 199 | break; 200 | } 201 | if( i >= n ) /* our session name is not found in the list */ 202 | { 203 | g_strfreev( only_show_in ); 204 | return; /* read next desktop file */ 205 | } 206 | g_strfreev( only_show_in ); 207 | } 208 | else /* OnlyShowIn and NotShowIn cannot be set at the same time. */ 209 | { 210 | /* check if this desktop entry is not allowed in our session */ 211 | not_show_in = g_key_file_get_string_list( kf, DesktopEntry, "NotShowIn", &n, NULL ); 212 | if( not_show_in ) 213 | { 214 | /* The format of this list is like: NotShowIn=KDE;IceWM */ 215 | gsize i = 0; 216 | for( i = 0; i < n; ++i ) 217 | { 218 | /* Only start this program if we are in the "OnlyShowIn" list */ 219 | if( 0 == strcmp( de_name, not_show_in[ i ] ) ) 220 | break; 221 | } 222 | if( i < n ) /* our session name is found in the "NotShowIn" list */ 223 | { 224 | g_strfreev( not_show_in ); 225 | return; /* read next desktop file */ 226 | } 227 | g_strfreev( not_show_in ); 228 | } 229 | } 230 | 231 | exec = g_key_file_get_string( kf, DesktopEntry, "TryExec", NULL ); 232 | if( G_UNLIKELY(exec) ) /* If we are asked to tryexec first */ 233 | { 234 | if( ! g_path_is_absolute( exec ) ) 235 | { 236 | char* full = g_find_program_in_path( exec ); 237 | g_free( exec ); 238 | exec = full; 239 | } 240 | /* If we cannot match the TryExec key with an installed executable program */ 241 | if( ! g_file_test( exec, G_FILE_TEST_IS_EXECUTABLE ) ) 242 | { 243 | g_free( exec ); 244 | return; /* bypass this desktop file, and read next */ 245 | } 246 | g_free( exec ); 247 | } 248 | 249 | /* get the real command line */ 250 | exec = g_key_file_get_string( kf, DesktopEntry, "Exec", NULL ); 251 | if( G_LIKELY(exec) ) 252 | { 253 | /* according to the spec, the Exec command line should be translated 254 | * with some rules, but that's normally for file managers who needs to 255 | * pass selected file as arguments. The probability we need this is 256 | * very low, so just omit it. 257 | */ 258 | 259 | /* FIXME: Exec key should be handled correctly */ 260 | 261 | /* launch the program */ 262 | if( g_spawn_command_line_async( exec, NULL ) ) 263 | { 264 | } 265 | } 266 | } 267 | } 268 | 269 | static void get_autostart_files_in_dir( GHashTable* hash, const char* base_dir ) 270 | { 271 | char* dir_path = g_build_filename( base_dir, "autostart", NULL ); 272 | GDir* dir = g_dir_open( dir_path, 0, NULL ); 273 | 274 | if( dir ) 275 | { 276 | char *path; 277 | const char *name; 278 | 279 | while( (name = g_dir_read_name( dir )) != NULL ) 280 | { 281 | if(g_str_has_suffix(name, ".desktop")) 282 | { 283 | if (g_hash_table_contains( hash, name)) 284 | { 285 | /* desktop file already exist in a higher directory, do nothing */ 286 | } 287 | else 288 | { 289 | path = g_build_filename( dir_path, name, NULL ); 290 | // printf("%s\n", path); 291 | g_hash_table_replace( hash, g_strdup(name), path ); 292 | } 293 | } 294 | } 295 | g_dir_close( dir ); 296 | } 297 | g_free( dir_path ); 298 | } 299 | 300 | void xdg_autostart( const char* de_name_arg ) 301 | { 302 | const char* const *dirs = g_get_system_config_dirs(); 303 | const char* const *dir; 304 | GHashTable* hash = g_hash_table_new_full( g_str_hash, g_str_equal, g_free, g_free ); 305 | de_name = de_name_arg; 306 | 307 | /* get user-specific autostart files */ 308 | get_autostart_files_in_dir( hash, g_get_user_config_dir() ); 309 | 310 | /* get system-wide autostart files */ 311 | for( dir = dirs; *dir; ++dir ) 312 | get_autostart_files_in_dir( hash, *dir ); 313 | 314 | if( g_hash_table_size( hash ) > 0 ) 315 | { 316 | GKeyFile* kf = g_key_file_new(); 317 | g_hash_table_foreach( hash, (GHFunc)launch_autostart_file, kf); 318 | g_key_file_free( kf ); 319 | } 320 | 321 | g_hash_table_destroy( hash ); 322 | } 323 | -------------------------------------------------------------------------------- /xdg-autostart/xdg-autostart.h: -------------------------------------------------------------------------------- 1 | /* 2 | * autostart.h - Handle autostart spec of freedesktop.org 3 | * 4 | * Copyright 2008 PCMan 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 19 | * MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef _XDG_AUTOSTART_H_ 23 | #define _XDG_AUTOSTART_H_ 24 | 25 | void xdg_autostart( const char* session_name ); 26 | 27 | #endif 28 | --------------------------------------------------------------------------------