From 024075a376b997d83afde66e77eb444462976016 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Wed, 26 Jun 2019 13:26:43 +0200 Subject: [PATCH 1/3] xrandr.lua: Switch from awful.util.table to gears.table gears.table exists already long enough that it is time for this recipe to start using it. Signed-off-by: Uli Schlachter --- recipes/xrandr.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/recipes/xrandr.lua b/recipes/xrandr.lua index bd90c19..2808d43 100644 --- a/recipes/xrandr.lua +++ b/recipes/xrandr.lua @@ -1,5 +1,6 @@ --- Separating Multiple Monitor functions as a separeted module (taken from awesome wiki) +local gtable = require("gears.table") local awful = require("awful") local naughty = require("naughty") @@ -37,12 +38,12 @@ local function arrange(out) local new = {} for _, p in pairs(previous) do for _, o in pairs(out) do - if not awful.util.table.hasitem(p, o) then - new[#new + 1] = awful.util.table.join(p, {o}) + if not gtable.hasitem(p, o) then + new[#new + 1] = gtable.join(p, {o}) end end end - choices = awful.util.table.join(choices, new) + choices = gtable.join(choices, new) previous = new end @@ -66,7 +67,7 @@ local function menu() end -- Disabled outputs for _, o in pairs(out) do - if not awful.util.table.hasitem(choice, o) then + if not gtable.hasitem(choice, o) then cmd = cmd .. " --output " .. o .. " --off" end end From c75b355d50f7084a0a6f15c909083c781a7155ea Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Wed, 26 Jun 2019 13:29:33 +0200 Subject: [PATCH 2/3] xrandr.lua: Switch from awful.util.spawn to awful.spawn It's been almost four years since this code was moved around. Signed-off-by: Uli Schlachter --- recipes/xrandr.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/recipes/xrandr.lua b/recipes/xrandr.lua index 2808d43..59bf69e 100644 --- a/recipes/xrandr.lua +++ b/recipes/xrandr.lua @@ -1,8 +1,8 @@ --- Separating Multiple Monitor functions as a separeted module (taken from awesome wiki) -local gtable = require("gears.table") -local awful = require("awful") -local naughty = require("naughty") +local gtable = require("gears.table") +local spawn = require("awful.spawn") +local naughty = require("naughty") -- A path to a fancy icon local icon_path = "" @@ -96,7 +96,7 @@ local function naughty_destroy_callback(reason) reason == naughty.notificationClosedReason.dismissedByUser then local action = state.index and state.menu[state.index - 1][2] if action then - awful.util.spawn(action, false) + spawn(action, false) state.index = nil end end From 33506582c671e24d707ecc46c5bccbd44e41c2d2 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Wed, 26 Jun 2019 13:29:42 +0200 Subject: [PATCH 3/3] xrandr.lua: Remove useless use of unpack() This code would have to check if unpack or table.unpack is the function to use. Instead of adding this check, this commit just removes the trivial use of unpack. Fixes: https://github.com/awesomeWM/awesome/issues/2802 Signed-off-by: Uli Schlachter --- recipes/xrandr.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/xrandr.lua b/recipes/xrandr.lua index 59bf69e..1149910 100644 --- a/recipes/xrandr.lua +++ b/recipes/xrandr.lua @@ -118,7 +118,7 @@ local function xrandr() label = "Keep the current configuration" state.index = nil else - label, action = unpack(next) + label, action = next[1], next[2] end state.cid = naughty.notify({ text = label, icon = icon_path,