From 86a95d84401562b628a570f34baaad8e8d03487b Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Fri, 8 Feb 2008 10:22:57 +0100 Subject: [PATCH 1/5] Don't bother setting screen_last_desktop here, it's inited in screen_startup anyway. --- openbox/screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openbox/screen.c b/openbox/screen.c index 73429bc9..da490778 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -59,7 +59,7 @@ static void screen_fallback_focus(void); guint screen_num_desktops; guint screen_num_monitors; guint screen_desktop; -guint screen_last_desktop = 1; +guint screen_last_desktop; gboolean screen_showing_desktop; ObDesktopLayout screen_desktop_layout; gchar **screen_desktop_names; From afb9e641003e62a3d969e4b4f3ca812ba80a444e Mon Sep 17 00:00:00 2001 From: Martin Sova Date: Sat, 9 Feb 2008 09:38:28 +0100 Subject: [PATCH 2/5] Update czech translation. --- po/cs.po | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/po/cs.po b/po/cs.po index 7b8d2f98..c78d7383 100644 --- a/po/cs.po +++ b/po/cs.po @@ -5,10 +5,10 @@ # msgid "" msgstr "" -"Project-Id-Version: Openbox 3.4.3\n" +"Project-Id-Version: Openbox 3.4.6\n" "Report-Msgid-Bugs-To: http://bugzilla.icculus.org\n" -"POT-Creation-Date: 2008-02-02 11:51-0500\n" -"PO-Revision-Date: 2007-07-21 00:15+0200\n" +"POT-Creation-Date: 2008-02-09 09:34+0100\n" +"PO-Revision-Date: 2008-02-09 09:33+0100\n" "Last-Translator: tezlo \n" "Language-Team: Czech \n" "MIME-Version: 1.0\n" @@ -32,33 +32,33 @@ msgstr "Nepodařilo se spustit '%s': %s" #: openbox/client.c:1988 openbox/client.c:2020 msgid "Killing..." -msgstr "" +msgstr "Ukončování..." #: openbox/client.c:1990 openbox/client.c:2022 msgid "Not Responding" -msgstr "" +msgstr "Neodpovídá" #: openbox/client_list_combined_menu.c:91 openbox/client_list_menu.c:94 msgid "Go there..." msgstr "Jdi tam..." -#: openbox/client_list_combined_menu.c:97 +#: openbox/client_list_combined_menu.c:98 msgid "Manage desktops" msgstr "Spravovat plochy" -#: openbox/client_list_combined_menu.c:98 openbox/client_list_menu.c:157 +#: openbox/client_list_combined_menu.c:99 openbox/client_list_menu.c:158 msgid "_Add new desktop" msgstr "_Přidat novou plochu" -#: openbox/client_list_combined_menu.c:99 openbox/client_list_menu.c:158 +#: openbox/client_list_combined_menu.c:100 openbox/client_list_menu.c:159 msgid "_Remove last desktop" msgstr "_Odstranit poslední plochu" -#: openbox/client_list_combined_menu.c:151 +#: openbox/client_list_combined_menu.c:153 msgid "Windows" msgstr "Okna" -#: openbox/client_list_menu.c:204 +#: openbox/client_list_menu.c:206 msgid "Desktops" msgstr "Plochy" @@ -122,7 +122,7 @@ msgstr "Oz_dobit/Odzdobit" msgid "_Close" msgstr "_Zavřít" -#: openbox/config.c:750 +#: openbox/config.c:754 #, c-format msgid "Invalid button '%s' specified in config file" msgstr "Neplatné tlačítko '%s' v konfiguračním souboru" @@ -255,7 +255,7 @@ msgstr " --restart Restartovat Openbox\n" #: openbox/openbox.c:507 msgid " --exit Exit Openbox\n" -msgstr "" +msgstr " --exit Ukončit Openbox\n" #: openbox/openbox.c:508 msgid "" @@ -290,11 +290,11 @@ msgstr "" "\n" "Prosím hlašte chyby na %s\n" -#: openbox/openbox.c:583 +#: openbox/openbox.c:582 msgid "--config-file requires an argument\n" -msgstr "" +msgstr "--config-file vyžaduje argument\n" -#: openbox/openbox.c:626 +#: openbox/openbox.c:625 #, c-format msgid "Invalid command line argument '%s'\n" msgstr "Neplatný argument příkazové řádky '%s'\n" @@ -320,6 +320,8 @@ msgid "" "Openbox is configured for %d desktops, but the current session has %d. " "Overriding the Openbox configuration." msgstr "" +"Openbox je konfigurován pro %d ploch, ale současné sezení má %d. " +"KOnfigurace Openboxu bude změněna." #: openbox/screen.c:1169 #, c-format From e5f21a4a87509da1d807350e01d2052e16a47152 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Sat, 9 Feb 2008 09:42:31 +0100 Subject: [PATCH 3/5] Update swedish translation. NB: using 3.4.6.1 to mean the --config-file translation is included and 3.4.6 for everything before that. --- po/sv.po | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/po/sv.po b/po/sv.po index 337ecd13..1c4ad1d3 100644 --- a/po/sv.po +++ b/po/sv.po @@ -5,10 +5,10 @@ # msgid "" msgstr "" -"Project-Id-Version: Openbox 3.4.6\n" +"Project-Id-Version: Openbox 3.4.6.1\n" "Report-Msgid-Bugs-To: http://bugzilla.icculus.org\n" -"POT-Creation-Date: 2008-02-02 11:51-0500\n" -"PO-Revision-Date: 2008-01-25 03:52+0100\n" +"POT-Creation-Date: 2008-02-09 09:34+0100\n" +"PO-Revision-Date: 2008-02-09 09:41+0100\n" "Last-Translator: Mikael Magnusson \n" "Language-Team: None\n" "MIME-Version: 1.0\n" @@ -42,23 +42,23 @@ msgstr "Svarar Inte" msgid "Go there..." msgstr "G dit..." -#: openbox/client_list_combined_menu.c:97 +#: openbox/client_list_combined_menu.c:98 msgid "Manage desktops" msgstr "Hantera skrivbord" -#: openbox/client_list_combined_menu.c:98 openbox/client_list_menu.c:157 +#: openbox/client_list_combined_menu.c:99 openbox/client_list_menu.c:158 msgid "_Add new desktop" msgstr "_Lgg till nytt skrivbord" -#: openbox/client_list_combined_menu.c:99 openbox/client_list_menu.c:158 +#: openbox/client_list_combined_menu.c:100 openbox/client_list_menu.c:159 msgid "_Remove last desktop" msgstr "_Ta bort sista skrivbordet" -#: openbox/client_list_combined_menu.c:151 +#: openbox/client_list_combined_menu.c:153 msgid "Windows" msgstr "Fnster" -#: openbox/client_list_menu.c:204 +#: openbox/client_list_menu.c:206 msgid "Desktops" msgstr "Skrivbord" @@ -122,7 +122,7 @@ msgstr "_Dekorationer" msgid "_Close" msgstr "Stn_g" -#: openbox/config.c:750 +#: openbox/config.c:754 #, c-format msgid "Invalid button '%s' specified in config file" msgstr "Ogiltig knapp '%s' angiven i konfigurationsfilen" @@ -230,7 +230,7 @@ msgstr " --replace Ers #: openbox/openbox.c:502 msgid " --config-file FILE Specify the path to the config file to use\n" -msgstr "" +msgstr " --config-file FIL Ange skvgen till konfigurationsfil att anvnda\n" #: openbox/openbox.c:503 msgid " --sm-disable Disable connection to the session manager\n" @@ -289,11 +289,11 @@ msgstr "" "\n" "Rapportera buggar till %s\n" -#: openbox/openbox.c:583 +#: openbox/openbox.c:582 msgid "--config-file requires an argument\n" msgstr "" -#: openbox/openbox.c:626 +#: openbox/openbox.c:625 #, c-format msgid "Invalid command line argument '%s'\n" msgstr "Ogiltigt kommandoradsargument '%s'\n" From 11408575b38c71600193f51c08514d0412b6f586 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sat, 9 Feb 2008 18:14:18 -0500 Subject: [PATCH 4/5] make an xdg-autostart script. it is very fancy. --- Makefile.am | 3 + data/autostart.sh | 7 ++ tools/xdg-autostart/xdg-autostart | 192 ++++++++++++++++++++++++++++++ 3 files changed, 202 insertions(+) create mode 100755 tools/xdg-autostart/xdg-autostart diff --git a/Makefile.am b/Makefile.am index b7710247..9781ca84 100644 --- a/Makefile.am +++ b/Makefile.am @@ -31,6 +31,9 @@ bin_PROGRAMS = \ openbox/openbox \ tools/gnome-panel-control/gnome-panel-control +bin_SCRIPTS = \ + tools/xdg-autostart/xdg-autostart + nodist_bin_SCRIPTS = \ data/xsession/openbox-session \ data/xsession/openbox-gnome-session \ diff --git a/data/autostart.sh b/data/autostart.sh index 4c635202..ab542841 100644 --- a/data/autostart.sh +++ b/data/autostart.sh @@ -30,3 +30,10 @@ fi if which start_kdeinit >/dev/null; then LD_BIND_NOW=true start_kdeinit --new-startup +kcminit_startup & fi + +# Run XDG autostart things. By default don't run anything desktop-specific +# See xdg-autostart --help more info +DESKTOP_ENV="" +if which xdg-autostart; then + xdg-autostart $DESKTOP_ENV +fi diff --git a/tools/xdg-autostart/xdg-autostart b/tools/xdg-autostart/xdg-autostart new file mode 100755 index 00000000..6cee1342 --- /dev/null +++ b/tools/xdg-autostart/xdg-autostart @@ -0,0 +1,192 @@ +#!/usr/bin/env python + +# xdg-autostart runs things based on the XDG autostart specification +# Copyright (C) 2008 Dana Jansens +# +# XDG autostart specification can be found here: +# http://standards.freedesktop.org/autostart-spec/ +# +# +# +# LICENSE: +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +ME="xdg-autostart" +VERSION="1.0" + +from xdg import BaseDirectory +from xdg.DesktopEntry import DesktopEntry +from xdg.Exceptions import ParsingError +import os, glob, sys + +def main(argv=sys.argv): + if "--help" in argv[1:]: + show_help() + return 0 + if "--version" in argv[1:]: + show_version() + return 0 + + # get the autostart directories + autodirs = BaseDirectory.load_config_paths("autostart") + + # find all the autostart files + files = [] + for dir in autodirs: + for path in glob.glob(os.path.join(dir, '*.desktop')): + try: + autofile = AutostartFile(path) + except ParsingError: + print "Invalid .desktop file: " + path + else: + if not autofile in files: + files.append(autofile) + + list = False + if "--list" in argv[1:]: + list = True + argv.remove("--list") + + # run them ! + environments = argv[1:] + for autofile in files: + if list: autofile.list(environments) + else: autofile.run(environments) + +class AutostartFile(): + def __init__(self, path): + self.path = path + self.filename = os.path.basename(path) + self.dirname = os.path.dirname(path) + self.de = DesktopEntry(path) + + def __eq__(self, other): + return self.filename == other.filename + + def __str__(self): + return self.path + " : " + self.de.getName() + + def isexecfile(path): + return os.access(path, os.X_OK) + + def findFile(self, path, search, match_func): + # check empty path + if not path: return None + # check absolute path + if path[0] == '/': + if match_func(path): return path + else: return None + # check relative path + for dirname in search.split(os.pathsep): + if dirname != "": + candidate = os.path.join(dirname, path) + if (match_func(candidate)): return candidate + + def alert(self, str, info=False): + if info: + print "\t ", str + else: + print "\t*", str + + def showInEnvironment(self, envs, verbose=False): + default = not self.de.getOnlyShowIn() + noshow = False + force = False + for i in self.de.getOnlyShowIn(): + if i in envs: force = True + for i in self.de.getNotShowIn(): + if i in envs: noshow = True + + if verbose: + if not default and not force: + s = "" + for i in self.de.getOnlyShowIn(): + if s: s += ", " + s += i + self.alert("Excluded by: OnlyShowIn (" + s + ")") + if default and noshow and not force: + s = "" + for i in self.de.getOnlyShowIn(): + if s: s += ", " + s += i + self.alert("Excluded by: NotShowIn (" + s + ")") + return (default and not noshow) or force + + def shouldRun(self, envs, verbose=False): + if not self.de.getExec(): + if verbose: self.alert("Excluded by: Missing Exec field") + return False + if self.de.getHidden(): + if verbose: self.alert("Excluded by: Hidden") + return False + if self.de.getTryExec(): + if not self.findFile(self.de.getTryExec(), os.getenv("PATH"), + self.isexecfile): + if verbose: self.alert("Excluded by: TryExec (" + + self.de.getTryExec() + ")") + return False + if not self.showInEnvironment(envs, verbose): + return False + return True + + def list(self, envs): + running = False + if self.shouldRun(envs): + print "[*] " + self.de.getName() + else: + print "[ ] " + self.de.getName() + self.alert("File: " + self.path, info=True) + if self.de.getExec(): + self.alert("Executes: " + self.de.getExec(), info=True) + self.shouldRun(envs, True) + print + + def run(self, envs): + here = os.getcwd() + if self.de.getPath(): + os.chdir(self.de.getPath()) + if self.shouldRun(envs): + print "Running autostart file: " + self.path + os.system(self.de.getExec()); + os.chdir(here) + +def show_help(): + print "Usage:", ME, "[OPTION]... [ENVIRONMENT]..." + print + print "This tool will run xdg autostart .desktop files" + print + print "OPTIONS" + print " --list Show a list of the files which would be run" + print " Files which would be run are marked with an asterix" + print " symbol [*]. For files which would not be run," + print " information is given for why they are excluded" + print " --help Show this help and exit" + print " --version Show version and copyright information" + print + print "ENVIRONMENT specifies a list of environments for which to run autostart" + print "applications for. If none are specified, only applications which do not " + print "limit themselves to certain environments will be run." + print + print "ENVIRONMENT can be one or more of:" + print " GNOME Gnome Desktop" + print " KDE KDE Desktop" + print " ROX ROX Desktop" + print " XFCE XFCE Desktop" + print " Old Legacy systems" + print + +def show_version(): + print ME, VERSION + print "Copyright (c) 2008 Dana Jansens" + print + +if __name__ == "__main__": + sys.exit(main()) From b2e52c7b48ee64213b4d9e3fbab0d35f66410122 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sat, 9 Feb 2008 18:26:15 -0500 Subject: [PATCH 5/5] make xdg-autostart check for PyXDG and print a better error than a backtrace. and make the executing actually work --- tools/xdg-autostart/xdg-autostart | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tools/xdg-autostart/xdg-autostart b/tools/xdg-autostart/xdg-autostart index 6cee1342..daa9117d 100755 --- a/tools/xdg-autostart/xdg-autostart +++ b/tools/xdg-autostart/xdg-autostart @@ -22,10 +22,16 @@ ME="xdg-autostart" VERSION="1.0" -from xdg import BaseDirectory -from xdg.DesktopEntry import DesktopEntry -from xdg.Exceptions import ParsingError import os, glob, sys +try: + from xdg import BaseDirectory + from xdg.DesktopEntry import DesktopEntry + from xdg.Exceptions import ParsingError +except ImportError: + print + print "ERROR:", ME, "requires PyXDG to be installed" + print + sys.exit(1) def main(argv=sys.argv): if "--help" in argv[1:]: @@ -154,8 +160,8 @@ class AutostartFile(): if self.de.getPath(): os.chdir(self.de.getPath()) if self.shouldRun(envs): - print "Running autostart file: " + self.path - os.system(self.de.getExec()); + args = ["/bin/sh", "-c", "exec " + self.de.getExec()] + os.spawnv(os.P_NOWAIT, args[0], args); os.chdir(here) def show_help():