LXDE: lxsession-0.5.5

This commit is contained in:
4fury-c3440d8
2022-04-16 02:42:49 +03:00
parent 6bc448ff6a
commit 58d4aff0d1
3 changed files with 157 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file https://www.gnu.org/licenses/gpl-3.0.txt
from pisi.actionsapi import autotools, pisitools, get
def setup():
pisitools.cflags.add("-Wno-deprecated-declarations")
pisitools.unlink("*.stamp")
autotools.autoreconf("-fiv")
autotools.configure("--enable-gtk3 --enable-buildin-polkit --enable-buildin-clipboard")
def build():
autotools.make()
def install():
autotools.rawInstall("DESTDIR=%s" % get.installDIR())
pisitools.dodoc("AUTHORS", "ChangeLog", "COPYING", "NEWS", "README")
@@ -0,0 +1,69 @@
From c398fd6db61bc084679759096bde5747e5616eca Mon Sep 17 00:00:00 2001
From: Jann Horn <jann@thejh.net>
Date: Sun, 18 Apr 2021 16:37:16 +0200
Subject: [PATCH] lxsession-logout: Avoid costly lsb_release invocation
Having the name of the distribution in the LXDE prompt looks kinda nice,
but `lsb_release -r -s` is fairly costly (or at least the version on
Debian is): It spins up a python interpreter, then runs `apt-cache policy`
(which in turn, among other things, runs
`/usr/bin/dpkg --print-foreign-architectures` twice).
On a desktop machine with a proper Haswell CPU, `lsb_release -r -s` takes
"only" around 105ms (around 79ms of that are for `apt-cache policy`);
but on an old Intel NUC with a 5-years-old mobile Intel Pentium with a TDP
of 6W, it takes roughly between 500ms and 1000ms.
As suggested by ZanderBrown, use glib's g_get_os_info() instead if
available. If that doesn't exist, it's probably better to omit the OS name
instead of potentially spending up to a second on figuring out what it is.
---
lxsession-logout/lxsession-logout.c | 33 ++++++-----------------------
1 file changed, 6 insertions(+), 27 deletions(-)
diff --git a/lxsession-logout/lxsession-logout.c b/lxsession-logout/lxsession-logout.c
index 489e6e3..f06e61d 100644
--- a/lxsession-logout/lxsession-logout.c
+++ b/lxsession-logout/lxsession-logout.c
@@ -716,35 +716,14 @@ int main(int argc, char * argv[])
if (session_name == NULL)
session_name = "LXDE";
- gchar *output = NULL;
-
- if (g_find_program_in_path("lsb_release"))
- {
- const gchar *command_line = "lsb_release -r -s";
- GError *error;
- if (!g_spawn_command_line_sync( command_line,
- &output,
- NULL,
- NULL,
- &error))
- {
-
- fprintf (stderr, "Error: %s\n", error->message);
- g_error_free (error);
-
- }
- }
+ gchar *os_name = NULL;
+#if GLIB_CHECK_VERSION(2, 64, 0)
+ os_name = g_get_os_info(G_OS_INFO_KEY_PRETTY_NAME);
+#endif
- if (output == NULL)
- {
- output = "";
- }
- else
- {
- output[strlen ( output ) - 1] = '\0';
- }
+ prompt = g_strdup_printf(_("<b><big>Logout %s %s session ?</big></b>"), session_name, os_name ? os_name : "");
- prompt = g_strdup_printf(_("<b><big>Logout %s %s session ?</big></b>"), session_name, output);
+ g_free(os_name);
}
gtk_label_set_markup(GTK_LABEL(label), prompt);
gtk_box_pack_start(GTK_BOX(controls), label, FALSE, FALSE, 4);
+66
View File
@@ -0,0 +1,66 @@
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "https://pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
<Source>
<Name>lxsession</Name>
<Homepage>https://www.lxde.org/</Homepage>
<Packager>
<Name>fury</Name>
<Email>uglyside@yandex.ru</Email>
</Packager>
<License>GPL-2</License>
<IsA>app</IsA>
<PartOf>desktop.lxde</PartOf>
<Summary>LXDE session manager.</Summary>
<Description>lxsession is the default X11 session manager of LXDE.</Description>
<Archive sha1sum="93f495f3afff0300de3c7b9aacce0ef29eb86bab" type="tarxz">
mirrors://sourceforge/lxde/lxsession-0.5.5.tar.xz
</Archive>
<BuildDependencies>
<Dependency>intltool</Dependency>
<Dependency>vala-devel</Dependency>
<Dependency>gtk3-devel</Dependency>
<Dependency>glib2-devel</Dependency>
<Dependency>polkit-devel</Dependency>
<Dependency>elogind-devel</Dependency>
<Dependency>gettext-devel</Dependency>
<Dependency>libnotify-devel</Dependency>
<Dependency>gdk-pixbuf-devel</Dependency>
</BuildDependencies>
<Patches>
<Patch level="1">Avoid_costly_lsb_release_invocation.patch</Patch>
</Patches>
</Source>
<Package>
<Name>lxsession</Name>
<RuntimeDependencies>
<Dependency>gtk3</Dependency>
<Dependency>glib2</Dependency>
<Dependency>cairo</Dependency>
<Dependency>polkit</Dependency>
<Dependency>libX11</Dependency>
<Dependency>gdk-pixbuf</Dependency>
</RuntimeDependencies>
<Files>
<Path fileType="config">/etc/xdg</Path>
<Path fileType="executable">/usr/bin</Path>
<Path fileType="executable">/usr/libexec</Path>
<Path fileType="data">/usr/share</Path>
<Path fileType="localedata">/usr/share/locale</Path>
<Path fileType="man">/usr/share/man</Path>
<Path fileType="doc">/usr/share/doc</Path>
</Files>
</Package>
<History>
<Update release="1">
<Date>2022-04-14</Date>
<Version>0.5.5</Version>
<Comment>First build.</Comment>
<Name>fury</Name>
<Email>uglyside@yandex.ru</Email>
</Update>
</History>
</PISI>