Created
March 10, 2016 11:53
-
-
Save miguel-negrao/fd00f718b6a5958f50e9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE OverloadedStrings #-} | |
| module Main (main) where | |
| import Turtle hiding (x) | |
| import Prelude hiding (FilePath) | |
| import qualified Data.Text as T | |
| import qualified Data.Text.IO as TIO | |
| import Filesystem.Path.CurrentOS (encodeString) | |
| main :: IO () | |
| main = do | |
| let a = "/tmp/lcd_backlight_last_value" :: Turtle.FilePath | |
| exists <- testfile a | |
| if exists then do | |
| v <- TIO.readFile $ encodeString a | |
| proc "xbacklight" ["-set", v] empty | |
| rm a | |
| else do | |
| output a (inproc "xbacklight" ["-get"] empty) | |
| void $ proc "xbacklight" ["-set", "0"] empty |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment