Package: awesome
Version: 4.2-4
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu bionic ubuntu-patch

Dear Maintainer,

In the 4.2 release of Awesome, it can take more than 10 seconds to restart 
Awesome.
It was tracked down to the following discussion on the projects Github:

    https://github.com/awesomeWM/awesome/issues/1496 and
    https://github.com/awesomeWM/awesome/pull/2112

It is arguable if this patch truly fixes a bug, to the best of my judgement I 
find this a bug, since a very
simple use-case, like changing Awesome's config and reloading becomes arduous.


Thanks for considering the patch.


-- System Information:
Debian Release: buster/sid
  APT prefers bionic
  APT policy: (500, 'bionic')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.15.0-12-generic (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru awesome-4.2/debian/patches/deprecate_menubar.icon_theme.patch 
awesome-4.2/debian/patches/deprecate_menubar.icon_theme.patch
--- awesome-4.2/debian/patches/deprecate_menubar.icon_theme.patch       
1970-01-01 01:00:00.000000000 +0100
+++ awesome-4.2/debian/patches/deprecate_menubar.icon_theme.patch       
2018-03-15 20:45:16.000000000 +0100
@@ -0,0 +1,76 @@
+From 0b0b466705b8f8e4f4cc3a2a4ad353fc0e544b82 Mon Sep 17 00:00:00 2001
+From: Uli Schlachter <psyc...@znc.in>
+Date: Thu, 16 Nov 2017 13:12:59 +0100
+Subject: [PATCH] Deprecate menubar.icon_theme
+
+The code in menubar.icon_theme naively implements the algorithm from the
+base dir specification. This is a problem: On this system,
+/usr/share/icons/{Adwaita,hicolor}/index.theme list 91, respectively 649
+subdirectories. Since we check for three file extensions (png, svg,
+xpm), this means that a failing icon lookup for the Adwaita theme checks
+for (91+649)*3 = 2220 files (in practice it might be a bit better since
+the directories have specific meanings, but still). That's insane.
+
+Since we only use this code for looking up category icons anyway, just
+deprecate this mess. Category icons are now looked up in the same way
+that icons for individual applications are looked up.
+
+Since menubar.init does not require("menubar.icon_theme"), this means
+that menubar.icon_theme is no longer actually loaded. That's bad.
+
+(Hopefully) Fixes: https://github.com/awesomeWM/awesome/issues/1496
+Signed-off-by: Uli Schlachter <psyc...@znc.in>
+---
+ lib/menubar/icon_theme.lua | 4 +++-
+ lib/menubar/menu_gen.lua   | 3 +--
+ 2 files changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/lib/menubar/icon_theme.lua b/lib/menubar/icon_theme.lua
+index 7dcc44b02b..358f00737c 100644
+--- a/lib/menubar/icon_theme.lua
++++ b/lib/menubar/icon_theme.lua
+@@ -1,5 +1,5 @@
+ ---------------------------------------------------------------------------
+---- Class module for icon lookup for menubar
++--- (Deprecated) class module for icon lookup for menubar
+ --
+ -- @author Kazunobu Kuriyama
+ -- @copyright 2015 Kazunobu Kuriyama
+@@ -78,6 +78,7 @@ local icon_theme = { mt = {} }
+ local index_theme_cache = {}
+ 
+ --- Class constructor of `icon_theme`
++-- @deprecated menubar.icon_theme.new
+ -- @tparam string icon_theme_name Internal name of icon theme
+ -- @tparam table base_directories Paths used for lookup
+ -- @treturn table An instance of the class `icon_theme`
+@@ -218,6 +219,7 @@ local lookup_fallback_icon = function(self, icon_name)
+ end
+ 
+ ---  Look up an image file based on a given icon name and/or a preferable 
size.
++-- @deprecated menubar.icon_theme:find_icon_path
+ -- @tparam string icon_name Icon name to be looked up
+ -- @tparam number icon_size Prefereable icon size
+ -- @treturn string Absolute path to the icon file, or nil if not found
+diff --git a/lib/menubar/menu_gen.lua b/lib/menubar/menu_gen.lua
+index 519629c7d4..0be0b6967f 100644
+--- a/lib/menubar/menu_gen.lua
++++ b/lib/menubar/menu_gen.lua
+@@ -10,7 +10,6 @@
+ local gtable = require("gears.table")
+ local gfilesystem = require("gears.filesystem")
+ local utils = require("menubar.utils")
+-local icon_theme = require("menubar.icon_theme")
+ local pairs = pairs
+ local ipairs = ipairs
+ local table = table
+@@ -59,7 +58,7 @@ menu_gen.all_categories = {
+ --- Find icons for category entries.
+ function menu_gen.lookup_category_icons()
+     for _, v in pairs(menu_gen.all_categories) do
+-        v.icon = icon_theme():find_icon_path(v.icon_name)
++        v.icon = utils.lookup_icon(v.icon_name)
+     end
+ end
+ 
+
diff -Nru awesome-4.2/debian/patches/deprecate_menubar.index_theme.patch 
awesome-4.2/debian/patches/deprecate_menubar.index_theme.patch
--- awesome-4.2/debian/patches/deprecate_menubar.index_theme.patch      
1970-01-01 01:00:00.000000000 +0100
+++ awesome-4.2/debian/patches/deprecate_menubar.index_theme.patch      
2018-03-15 20:45:08.000000000 +0100
@@ -0,0 +1,54 @@
+From 5363225217a174a800b56c528f153186022981b7 Mon Sep 17 00:00:00 2001
+From: Uli Schlachter <psyc...@znc.in>
+Date: Thu, 16 Nov 2017 13:58:25 +0100
+Subject: [PATCH] Deprecate menubar.index_theme
+
+The previous commit deprecated its only user.
+
+Signed-off-by: Uli Schlachter <psyc...@znc.in>
+---
+ lib/menubar/index_theme.lua | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/lib/menubar/index_theme.lua b/lib/menubar/index_theme.lua
+index 633964af73..b0d9f2e979 100644
+--- a/lib/menubar/index_theme.lua
++++ b/lib/menubar/index_theme.lua
+@@ -1,5 +1,5 @@
+ ---------------------------------------------------------------------------
+---- Class module for parsing an index.theme file
++--- (Deprecated) class module for parsing an index.theme file
+ --
+ -- @author Kazunobu Kuriyama
+ -- @copyright 2015 Kazunobu Kuriyama
+@@ -31,6 +31,7 @@ local THRESHOLD = "Threshold"
+ local index_theme = { mt = {} }
+ 
+ --- Class constructor of `index_theme`
++-- @deprecated menubar.index_theme.new
+ -- @tparam table cls Metatable that will be used. Should always be 
`index_theme.mt`.
+ -- @tparam string icon_theme_name Internal name of icon theme
+ -- @tparam table base_directories Paths used for lookup
+@@ -132,18 +133,21 @@ index_theme.new = function(cls, icon_theme_name, 
base_directories)
+ end
+ 
+ --- Table of the values of the `Directories` key
++-- @deprecated menubar.index_theme:get_subdirectories
+ -- @treturn table Values of the `Directories` key
+ index_theme.get_subdirectories = function(self)
+     return self[DIRECTORIES]
+ end
+ 
+ --- Table of the values of the `Inherits` key
++-- @deprecated menubar.index_theme:get_inherits
+ -- @treturn table Values of the `Inherits` key
+ index_theme.get_inherits = function(self)
+     return self[INHERITS]
+ end
+ 
+ --- Query (part of) per-directory keys of a given subdirectory name.
++-- @deprecated menubar.index_theme:get_per_directory_keys
+ -- @tparam table subdirectory Icon theme's subdirectory
+ -- @treturn[1] string Value of the `Type` key
+ -- @treturn[2] number Value of the `Size` key
+
diff -Nru awesome-4.2/debian/patches/series awesome-4.2/debian/patches/series
--- awesome-4.2/debian/patches/series   2017-12-27 15:08:58.000000000 +0100
+++ awesome-4.2/debian/patches/series   2018-03-15 20:45:16.000000000 +0100
@@ -8,3 +8,5 @@
 npe-keyboardlayout.patch
 autopkgtest-overrides.patch
 freedesktop-menu.patch
+deprecate_menubar.icon_theme.patch
+deprecate_menubar.index_theme.patch

Reply via email to