From 4142a7aa82e938afc7e948c3744ba2b0e520e495 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 1 Mar 2013 10:50:19 -0300 Subject: Adding command_previous_server() and command_next_server() --- awesompd.lua | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/awesompd.lua b/awesompd.lua index faf1253..362b6d8 100644 --- a/awesompd.lua +++ b/awesompd.lua @@ -386,6 +386,38 @@ function awesompd:command_open_in_browser(link) end end +--- Change to the previous server. +function awesompd:command_previous_server() + return function() + servers = table.getn(self.servers) + if servers == 1 or servers == nil then + return + else + if self.current_server > 1 then + self:change_server(self.current_server - 1) + else + self:change_server(servers) + end + end + end +end + +--- Change to the previous server. +function awesompd:command_next_server() + return function() + servers = table.getn(self.servers) + if servers == 1 or servers == nil then + return + else + if self.current_server < servers then + self:change_server(self.current_server + 1) + else + self:change_server(1) + end + end + end +end + -- /// End of mpc command functions /// -- /// Menu generation functions /// -- cgit v1.2.3