chore: format using 'black'
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
DEFAULT_TEMPERATURE = 3500
|
||||
|
||||
try:
|
||||
with open('/tmp/temperature', 'r') as temp_file:
|
||||
with open("/tmp/temperature", "r") as temp_file:
|
||||
current_temperature = int(temp_file.read())
|
||||
except FileNotFoundError:
|
||||
current_temperature = DEFAULT_TEMPERATURE
|
||||
@@ -16,7 +16,8 @@ if len(sys.argv) == 1:
|
||||
print(current_temperature)
|
||||
sys.exit(0)
|
||||
elif len(sys.argv) != 2:
|
||||
print("""
|
||||
print(
|
||||
"""
|
||||
Usage:
|
||||
|
||||
screen-temperature
|
||||
@@ -27,7 +28,8 @@ Usage:
|
||||
|
||||
screen-temperature <+|-><temperature>
|
||||
increase or decrease screen temperature by <temperature>
|
||||
""")
|
||||
"""
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
temperature_change = sys.argv[1]
|
||||
@@ -41,11 +43,10 @@ else:
|
||||
|
||||
try:
|
||||
subprocess.run(["redshift", "-O", str(new_temperature), "-P"], check=True)
|
||||
with open('/tmp/temperature', 'w') as temp_file:
|
||||
temp_file.write(str(new_temperature) + '\n')
|
||||
with open("/tmp/temperature", "w") as temp_file:
|
||||
temp_file.write(str(new_temperature) + "\n")
|
||||
# Send notification
|
||||
subprocess.run(
|
||||
["notify-send", str(new_temperature) + "K"])
|
||||
subprocess.run(["notify-send", str(new_temperature) + "K"])
|
||||
except subprocess.CalledProcessError:
|
||||
print("Error: could not set screen temperature.")
|
||||
sys.exit(1)
|
||||
|
||||
Reference in New Issue
Block a user