Bugzilla – Bug 1216537
xdg-utils perl requirement
Last modified: 2024-06-19 10:45:08 UTC
xdg-utils requires perl via /usr/bin/xdg-screensaver. On minimal systems we'd like to avoid any extra script interpreters. Any chance to avoid using perl there?
(In reply to Ludwig Nussel from comment #0) > xdg-utils requires perl via /usr/bin/xdg-screensaver. On minimal systems > we'd like to avoid any extra script interpreters. Any chance to avoid using > perl there? Longer term I could be convinced to replace it with python, given that's the plan for some of the other more complex code. Having said that my primary question now is the same one I had when this was last bought up a few years back which is why do we consider xdg-utils required on a minimal system anyway? and can we address that instead. Really unless you have a desktop installed (Gnome / IceWM for SLE) or really the X11 pattern for anything openSUSE you shouldn't need xdg-utils installed. So likely the first starting point is what is requiring it anyway?
https://github.com/openSUSE/openSUSEway/issues/126
(In reply to Simon Lees from comment #1) > Longer term I could be convinced to replace it with python, given that's the > plan for some of the other more complex code. > > Having said that my primary question now is the same one I had when this was > last bought up a few years back which is why do we consider xdg-utils > required on a minimal system anyway? and can we address that instead. Really > unless you have a desktop installed (Gnome / IceWM for SLE) or really the > X11 pattern for anything openSUSE you shouldn't need xdg-utils installed. So > likely the first starting point is what is requiring it anyway? https://sr.ht/~mcepl/moldavite/ is MicroOS-based minimal system running sway (actually, NOT openSUSEWay). I am trying to eliminate possibly all interpreters on the host system (e.g., https://todo.sr.ht/~mcepl/moldavite/9 or I have created bash pinentry GUI prompt https://git.cepl.eu/cgit/rofi/pinentry-rofi/about/), especially the ones like Python and Perl, which have tendency to pull in large amount of additional libraries.
The whole dependency is caused by this micro-embedded script, right? use strict; use warnings; use Encode qw(decode); use IO::File; use Net::DBus; use X11::Protocol; my ($window_id, $screensaver_file, $dbus_service, $dbus_path) = @ARGV; # Find window name to pass to session manager. my $x = X11::Protocol->new(); my $named_window_id = hex($window_id); my $window_name; while (1) { ($window_name) = $x->GetProperty($named_window_id, $x->atom("WM_NAME"), $x->atom("STRING"), 0, 1000, 0); last if defined($window_name) && $window_name ne ""; (undef, $named_window_id) = $x->QueryTree($named_window_id); if (!defined($named_window_id)) { $window_name = "?"; last; } } # Replace any invalid unicode characters with U+FFFD, so we dont crash when we # pass them over to D-Bus $window_name = decode("utf8", $window_name, Encode::FB_DEFAULT); # Inhibit idle detection (flags = 8) with window name and ID. # We have no reason so just send the window name again. my $bus = Net::DBus->session(); my $sm_svc = $bus->get_service($dbus_service); my $sm = $sm_svc->get_object($dbus_path, $dbus_service); $sm->Inhibit($window_name, hex($window_id), $window_name, 8); # Wait until removed from the status file. while (1) { sleep(10); my $status = new IO::File($screensaver_file, "r") or exit 0; my $found; while (<$status>) { if (/^$window_id:/) { $found = 1; last; } } exit 0 unless $found; }