Skip to content

Instantly share code, notes, and snippets.

@yshui
Last active July 16, 2017 02:29
Show Gist options
  • Select an option

  • Save yshui/7218e0ca03e47519f856ec3f3fd34b98 to your computer and use it in GitHub Desktop.

Select an option

Save yshui/7218e0ca03e47519f856ec3f3fd34b98 to your computer and use it in GitHub Desktop.
Key bindings with deai
xc = di.xorg.connect()
o = get_output("eDP1")
xc.key.new(nil, "xf86monbrightnessup", false).on("pressed", function()
o.backlight = math.min(math.ceil(o.backlight+o.max_backlight/10),o.max_backlight)
print("up", o.backlight)
end)
xc.key.new(nil, "xf86monbrightnessdown", false).on("pressed", function()
o.backlight = math.max(math.floor(o.backlight-o.max_backlight/10),0)
print("down",o.backlight)
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment