From 6da53927c00c504ee54744dea0ef68f15eac239c Mon Sep 17 00:00:00 2001 From: Rmys Date: Mon, 13 Dec 2021 13:16:16 +0300 Subject: [PATCH] openbox rebuild --- x11/wm/openbox/actions.py | 3 +- x11/wm/openbox/files/menu.xml | 39 +++++- .../files/openbox-3.5.2-gnome-session.patch | 14 ++ .../openbox/files/openbox-3.6.1-py3-xdg.patch | 126 ++++++++++++++++++ x11/wm/openbox/files/openbox-python3.patch | 113 ++++++++++++++++ x11/wm/openbox/files/terminals.menu | 16 +++ x11/wm/openbox/files/xdg-menu | 108 +++++++++++++++ x11/wm/openbox/pspec.xml | 16 ++- 8 files changed, 427 insertions(+), 8 deletions(-) mode change 100755 => 100644 x11/wm/openbox/files/menu.xml create mode 100644 x11/wm/openbox/files/openbox-3.5.2-gnome-session.patch create mode 100644 x11/wm/openbox/files/openbox-3.6.1-py3-xdg.patch create mode 100644 x11/wm/openbox/files/openbox-python3.patch create mode 100644 x11/wm/openbox/files/terminals.menu create mode 100644 x11/wm/openbox/files/xdg-menu diff --git a/x11/wm/openbox/actions.py b/x11/wm/openbox/actions.py index 73e793e9fd..b78db8f33f 100644 --- a/x11/wm/openbox/actions.py +++ b/x11/wm/openbox/actions.py @@ -11,6 +11,7 @@ from pisi.actionsapi import shelltools def setup(): + shelltools.export("PYTHON", "/usr/bin/python3") shelltools.export("AUTOPOINT", "true") autotools.autoreconf("-fiv") autotools.configure("--disable-static \ @@ -18,7 +19,7 @@ def setup(): --with-x \ --enable-nls \ --sysconfdir=/etc \ - --libexecdir=/usr/libexec/openbox \ + --libexecdir=/usr/libexec \ --enable-startup-notification \ --docdir=/%s/%s" % (get.docDIR(), get.srcNAME())) diff --git a/x11/wm/openbox/files/menu.xml b/x11/wm/openbox/files/menu.xml old mode 100755 new mode 100644 index 1327f02c38..c1bb46358f --- a/x11/wm/openbox/files/menu.xml +++ b/x11/wm/openbox/files/menu.xml @@ -1,6 +1,33 @@ - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + yes + + + + + + yes + + + + + diff --git a/x11/wm/openbox/files/openbox-3.5.2-gnome-session.patch b/x11/wm/openbox/files/openbox-3.5.2-gnome-session.patch new file mode 100644 index 0000000000..10406af33c --- /dev/null +++ b/x11/wm/openbox/files/openbox-3.5.2-gnome-session.patch @@ -0,0 +1,14 @@ +Index: openbox-3.5.2/data/xsession/openbox-gnome-session.in +=================================================================== +--- openbox-3.5.2.orig/data/xsession/openbox-gnome-session.in ++++ openbox-3.5.2/data/xsession/openbox-gnome-session.in +@@ -18,6 +18,9 @@ VER=$(gnome-session --version 2>/dev/nul + MAJOR=$(echo $VER | cut -d . -f 1) + MINOR=$(echo $VER | cut -d . -f 2) + ++# use gnome menus (gentoo bug #291965) ++export XDG_MENU_PREFIX=gnome- ++ + # run GNOME with Openbox as its window manager + + if test $MAJOR -lt 2 || (test $MAJOR = 2 && test $MINOR -le 22); then diff --git a/x11/wm/openbox/files/openbox-3.6.1-py3-xdg.patch b/x11/wm/openbox/files/openbox-3.6.1-py3-xdg.patch new file mode 100644 index 0000000000..d28b536d64 --- /dev/null +++ b/x11/wm/openbox/files/openbox-3.6.1-py3-xdg.patch @@ -0,0 +1,126 @@ +diff --git a/data/autostart/openbox-xdg-autostart b/data/autostart/openbox-xdg-autostart +index 04a17a199..f2c75bbdd 100755 +--- a/data/autostart/openbox-xdg-autostart ++++ b/data/autostart/openbox-xdg-autostart +@@ -19,6 +19,8 @@ + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + # GNU General Public License for more details. + ++from __future__ import print_function ++ + ME="openbox-xdg-autostart" + VERSION="1.1" + +@@ -28,9 +30,9 @@ try: + from xdg.DesktopEntry import DesktopEntry + from xdg.Exceptions import ParsingError + except ImportError: +- print +- print >>sys.stderr, "ERROR:", ME, "requires PyXDG to be installed" +- print ++ print() ++ print("ERROR:", ME, "requires PyXDG to be installed", file=sys.stderr) ++ print() + sys.exit(1) + + def main(argv=sys.argv): +@@ -51,7 +53,7 @@ def main(argv=sys.argv): + try: + autofile = AutostartFile(path) + except ParsingError: +- print "Invalid .desktop file: " + path ++ print("Invalid .desktop file: " + path) + else: + if not autofile in files: + files.append(autofile) +@@ -99,9 +101,9 @@ class AutostartFile: + + def _alert(self, str, info=False): + if info: +- print "\t ", str ++ print("\t ", str) + else: +- print "\t*", str ++ print("\t*", str) + + def _showInEnvironment(self, envs, verbose=False): + default = not self.de.getOnlyShowIn() +@@ -146,14 +148,14 @@ class AutostartFile: + + def display(self, envs): + if self._shouldRun(envs): +- print "[*] " + self.de.getName() ++ print("[*] " + self.de.getName()) + else: +- print "[ ] " + self.de.getName() ++ 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 ++ print() + + def run(self, envs): + here = os.getcwd() +@@ -165,34 +167,34 @@ class AutostartFile: + 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. 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 ++ 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. 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 ++ print(ME, VERSION) ++ print("Copyright (c) 2008 Dana Jansens") ++ print() + + if __name__ == "__main__": + sys.exit(main()) diff --git a/x11/wm/openbox/files/openbox-python3.patch b/x11/wm/openbox/files/openbox-python3.patch new file mode 100644 index 0000000000..f17bef3f0b --- /dev/null +++ b/x11/wm/openbox/files/openbox-python3.patch @@ -0,0 +1,113 @@ +diff -up openbox-3.6.1/data/autostart/openbox-xdg-autostart.python3 openbox-3.6.1/data/autostart/openbox-xdg-autostart +--- openbox-3.6.1/data/autostart/openbox-xdg-autostart.python3 2013-04-17 14:27:27.000000000 +0200 ++++ openbox-3.6.1/data/autostart/openbox-xdg-autostart 2018-04-17 15:52:23.849765020 +0200 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/python3 + + # openbox-xdg-autostart runs things based on the XDG autostart specification + # Copyright (C) 2008 Dana Jansens +@@ -28,9 +28,9 @@ try: + from xdg.DesktopEntry import DesktopEntry + from xdg.Exceptions import ParsingError + except ImportError: +- print +- print >>sys.stderr, "ERROR:", ME, "requires PyXDG to be installed" +- print ++ print() ++ print("ERROR:", ME, "requires PyXDG to be installed", file=sys.stderr) ++ print() + sys.exit(1) + + def main(argv=sys.argv): +@@ -51,7 +51,7 @@ def main(argv=sys.argv): + try: + autofile = AutostartFile(path) + except ParsingError: +- print "Invalid .desktop file: " + path ++ print("Invalid .desktop file: " + path) + else: + if not autofile in files: + files.append(autofile) +@@ -99,9 +99,9 @@ class AutostartFile: + + def _alert(self, str, info=False): + if info: +- print "\t ", str ++ print("\t ", str) + else: +- print "\t*", str ++ print("\t*", str) + + def _showInEnvironment(self, envs, verbose=False): + default = not self.de.getOnlyShowIn() +@@ -146,9 +146,9 @@ class AutostartFile: + + def display(self, envs): + if self._shouldRun(envs): +- print "[*] " + self.de.getName() ++ print("[*] " + self.de.getName()) + else: +- print "[ ] " + self.de.getName() ++ print("[ ] " + self.de.getName()) + self._alert("File: " + self.path, info=True) + if self.de.getExec(): + self._alert("Executes: " + self.de.getExec(), info=True) +@@ -165,33 +165,33 @@ class AutostartFile: + 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. 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("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. 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(ME, VERSION) ++ print("Copyright (c) 2008 Dana Jansens") + print + + if __name__ == "__main__": diff --git a/x11/wm/openbox/files/terminals.menu b/x11/wm/openbox/files/terminals.menu new file mode 100644 index 0000000000..450543ee90 --- /dev/null +++ b/x11/wm/openbox/files/terminals.menu @@ -0,0 +1,16 @@ + + + + Terminals + + + + + + + + + TerminalEmulator + + diff --git a/x11/wm/openbox/files/xdg-menu b/x11/wm/openbox/files/xdg-menu new file mode 100644 index 0000000000..ccd0efdbb3 --- /dev/null +++ b/x11/wm/openbox/files/xdg-menu @@ -0,0 +1,108 @@ +#!/usr/bin/python3 +# +# Copyright (C) 2008 Red Hat, Inc. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Author(s): Luke Macken +# Miroslav Lichvar +# Edward Sheldrake + + +import xdg.Menu, xdg.DesktopEntry, xdg.Config +import re, sys, os +from xml.sax.saxutils import escape + +icons = True +try: + import gi + gi.require_version('Gtk', '3.0') + from gi.repository import Gtk +except ImportError: + icons = False + +def icon_attr(entry): + if icons is False: + return '' + + name = entry.getIcon() + + if os.path.exists(name): + return ' icon="' + name + '"' + + # work around broken .desktop files + # unless the icon is a full path it should not have an extension + name = re.sub('\..{3,4}$', '', name) + + # imlib2 cannot load svg + iconinfo = theme.lookup_icon(name, 22, Gtk.IconLookupFlags.NO_SVG) + if iconinfo: + iconfile = iconinfo.get_filename() + if hasattr(iconinfo, 'free'): + iconinfo.free() + if iconfile: + return ' icon="' + iconfile + '"' + return '' + +def escape_utf8(s): + if sys.version_info[0] < 3 and isinstance(s, unicode): + s = s.encode('utf-8', 'xmlcharrefreplace') + return escape(s) + +def entry_name(entry): + return escape_utf8(entry.getName()) + +def walk_menu(entry): + if isinstance(entry, xdg.Menu.Menu) and entry.Show is True: + print('' \ + % (entry_name(entry), + entry_name(entry), + escape_utf8(icon_attr(entry)))) + list(map(walk_menu, entry.getEntries())) + print('') + elif isinstance(entry, xdg.Menu.MenuEntry) and entry.Show is True: + name = entry_name(entry.DesktopEntry) + print(' ' % (name.replace('"', ''), + escape_utf8(icon_attr(entry.DesktopEntry)))) + command = re.sub(' -caption "%c"| -caption %c', + ' -caption "%s"' % name, + escape_utf8(entry.DesktopEntry.getExec())) + command = re.sub(' [^ ]*%[fFuUdDnNickvm]', '', command) + if entry.DesktopEntry.getTerminal(): + command = 'xterm -title "%s" -e %s' % (name, command) + print(' ' + \ + '%s' % command) + print(' ') + +if len(sys.argv) > 1: + menufile = sys.argv[1] + '.menu' +else: + menufile = 'applications.menu' + +lang = os.environ.get('LANG') +if lang: + xdg.Config.setLocale(lang) + +# lie to get the same menu as in GNOME +xdg.Config.setWindowManager('GNOME') + +if icons: + theme = Gtk.IconTheme.get_default() + +menu = xdg.Menu.parse(menufile) + +print('') +print('') +list(map(walk_menu, menu.getEntries())) +print('') diff --git a/x11/wm/openbox/pspec.xml b/x11/wm/openbox/pspec.xml index dea238dfcd..f39025b078 100644 --- a/x11/wm/openbox/pspec.xml +++ b/x11/wm/openbox/pspec.xml @@ -33,6 +33,10 @@ openbox-3.5.0-which-2.20.patch openbox-3.5.0-title-matching.patch openbox-default-theme.patch + + openbox-3.5.2-gnome-session.patch + openbox-3.6.1-py3-xdg.patch + @@ -76,8 +80,11 @@ obmenu-generator schema.pl menu.xml - autostart + kedicik.png + + xdg-menu + terminals.menu @@ -100,6 +107,13 @@ + + 2021-12-13 + 3.6.1 + Rebuild. + Mustafa Cinasal + muscnsl@gmail.com + 2020-01-25 3.6.1