Skip to content

Commit

Permalink
Clean up debug
Browse files Browse the repository at this point in the history
  • Loading branch information
ojv committed Mar 8, 2017
1 parent df979b0 commit 2cf683b
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 47 deletions.
12 changes: 1 addition & 11 deletions common-constants.lua
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
-- luacheck: globals CONKY_DEBUG
local COMMON_NAME = "org.awesomewm"
local CONKY_NAME = COMMON_NAME .. ".conky"
local AWESOME_NAME = COMMON_NAME .. ".awful"

local HOME = os.getenv("HOME")

local CONKY_LAUNCH = HOME .. "/.config/awesome/conky/conky-awesome-launch"

if CONKY_DEBUG then
CONKY_NAME = "org.awesomewm.test.conky"
CONKY_LAUNCH = CONKY_LAUNCH .. " --debug"
end

local constants = {
CONKY_LAUNCH = CONKY_LAUNCH,
CONKY_LAUNCH = "conky",
DELIMITER = "", -- <C-D>
DBUS_PATH = "/",
CONKY_NAME = CONKY_NAME,
Expand Down
14 changes: 0 additions & 14 deletions conky-awesome-launch

This file was deleted.

3 changes: 2 additions & 1 deletion conky-dbus.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

package.path = os.getenv("HOME") .. "/.config/awesome/conky/?.lua;" .. package.path

if os.getenv("CONKY_DEBUG") == "true" then
print("conky-dbus running in debug mode")
rawset(_G, "CONKY_DEBUG", true)
Expand All @@ -14,7 +16,6 @@ local previous_request = 0
function conky_update_awesome() -- luacheck: ignore
conky_string = listen() or conky_string


if conky_string then
send(conky_parse(conky_string))
elseif os.time() > previous_request + 10 then
Expand Down
13 changes: 1 addition & 12 deletions dbus-common.lua
Original file line number Diff line number Diff line change
@@ -1,27 +1,19 @@
-- INIT -- {{{1

-- luacheck: globals CONKY_DEBUG
local ldbus = require("ldbus")
local CONST = require("common-constants")
local dbus = {}

local fnoop = function() end

-- TODO: some actual error handling

function dbus.setup(name) -- {{{1
-- returns a set of functions,
-- one for emitting signals, and one for checking for them
--
-- NOTE: including this module returns this function
if not (name == "conky" or name == "awesome") then
print("Must be conky or awesome, got:", name)
return
end

local conn = assert(ldbus.bus.get("session"))
--if not pcall(dbus.request_name(conn, name)) then
--return fnoop, fnoop, fnoop
--end
dbus.request_name(conn, name)

if name == "conky" then
Expand All @@ -36,7 +28,6 @@ end

function dbus.listener_for(conn, signal_type) -- {{{1
-- returns a function that checks if the specified signal has been emitted
--local conn = conn
if CONKY_DEBUG then
print("setting up listener for signal: " .. signal_type)
end
Expand All @@ -56,8 +47,6 @@ end

function dbus.emitter_for(conn, signal_type, member) -- {{{1
-- returns a function that emits the specified signal
--local conn = conn
--local signal_type = signal_type
local last_message = nil

if CONKY_DEBUG then
Expand Down
4 changes: 0 additions & 4 deletions dbus-send
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
#!/usr/bin/env lua
if arg[1] == "debug" then
rawset(_G, "CONKY_DEBUG", true)
table.remove(arg, 1)
end

print(require("common-constants")("CONKY_NAME"))

Expand Down
6 changes: 1 addition & 5 deletions monitor
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#!/usr/bin/env lua
if arg[1] == "debug" then
rawset(_G, "CONKY_DEBUG", true)
end

local CONST = require("common-constants")

Expand Down Expand Up @@ -41,8 +38,7 @@ local awk = table.concat({

local cmd = mon .. " | " .. awk

-- luacheck: globals CONKY_DEBUG
if CONKY_DEBUG then
if arg[1] == "-v" then
print("running with command:")
print(cmd)
end
Expand Down

0 comments on commit 2cf683b

Please sign in to comment.