Refactoring
This commit is contained in:
@@ -22,26 +22,3 @@ hl.monitor {
|
||||
|
||||
hl.monitor { output = '', mode = 'preferred', position = 'auto', scale = 1 }
|
||||
|
||||
local function is_lid_closed()
|
||||
local file = io.open('/proc/acpi/button/lid/LID0/state', 'r')
|
||||
|
||||
if not file then
|
||||
file = io.open('/proc/acpi/button/lid/LID/state', 'r')
|
||||
end
|
||||
|
||||
if file then
|
||||
local state = file:read '*a'
|
||||
file:close()
|
||||
return string.find(state, 'closed') ~= nil
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
function toggleLaptopMonitor()
|
||||
hl.monitor {
|
||||
output = 'desc:BOE NE160QDM-NZ6',
|
||||
disabled = not is_lid_closed(),
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user