add brightness script
This commit is contained in:
parent
cc18e93b19
commit
025bf318ce
|
@ -1,2 +1,47 @@
|
|||
#!/usr/bin/env python
|
||||
list = []
|
||||
import subprocess
|
||||
import argparse
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("brightnesschange")
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
def get_brightness() -> str:
|
||||
return str(
|
||||
(
|
||||
int(
|
||||
subprocess.check_output(
|
||||
["cat", "/sys/class/backlight/intel_backlight/brightness"]
|
||||
)
|
||||
)
|
||||
/ int(
|
||||
subprocess.check_output(
|
||||
["cat", "/sys/class/backlight/intel_backlight/max_brightness"]
|
||||
)
|
||||
)
|
||||
* 100
|
||||
).__round__()
|
||||
)
|
||||
|
||||
|
||||
subprocess.check_output(
|
||||
[
|
||||
"brightnessctl",
|
||||
"set",
|
||||
args.brightnesschange,
|
||||
]
|
||||
)
|
||||
|
||||
print(get_brightness())
|
||||
|
||||
subprocess.call(
|
||||
[
|
||||
"dunstify",
|
||||
"brightness",
|
||||
"-h",
|
||||
"int:value:" + get_brightness(),
|
||||
"-r",
|
||||
"294893284",
|
||||
]
|
||||
)
|
||||
|
|
|
@ -9,48 +9,48 @@ let
|
|||
color_indicator = "#af3a03";
|
||||
color_evil = "#9d0006";
|
||||
in
|
||||
{
|
||||
modifier = mod;
|
||||
terminal = term;
|
||||
menu = "exec rofi -combi-modi window#drun#ssh -show-icons -show combi -modi combi";
|
||||
fonts = {
|
||||
names = [ "CaskaydiaCove Nerd Font" ];
|
||||
size = 11.0;
|
||||
};
|
||||
{
|
||||
modifier = mod;
|
||||
terminal = term;
|
||||
menu = "exec rofi -combi-modi window#drun#ssh -show-icons -show combi -modi combi";
|
||||
fonts = {
|
||||
names = [ "CaskaydiaCove Nerd Font" ];
|
||||
size = 11.0;
|
||||
};
|
||||
|
||||
colors = {
|
||||
background = color_bg;
|
||||
focused = {
|
||||
colors = {
|
||||
background = color_bg;
|
||||
border = color_active;
|
||||
childBorder = color_active;
|
||||
indicator = color_indicator;
|
||||
text = color_fg;
|
||||
focused = {
|
||||
background = color_bg;
|
||||
border = color_active;
|
||||
childBorder = color_active;
|
||||
indicator = color_indicator;
|
||||
text = color_fg;
|
||||
};
|
||||
focusedInactive = {
|
||||
background = color_bg;
|
||||
border = color_inactive;
|
||||
childBorder = color_inactive;
|
||||
indicator = color_indicator;
|
||||
text = color_fg;
|
||||
};
|
||||
unfocused = {
|
||||
background = color_bg;
|
||||
border = color_inactive;
|
||||
childBorder = color_inactive;
|
||||
indicator = color_indicator;
|
||||
text = color_fg;
|
||||
};
|
||||
urgent = {
|
||||
background = color_bg;
|
||||
border = color_evil;
|
||||
childBorder = color_evil;
|
||||
indicator = color_indicator;
|
||||
text = color_fg;
|
||||
};
|
||||
};
|
||||
focusedInactive = {
|
||||
background = color_bg;
|
||||
border = color_inactive;
|
||||
childBorder = color_inactive;
|
||||
indicator = color_indicator;
|
||||
text = color_fg;
|
||||
};
|
||||
unfocused = {
|
||||
background = color_bg;
|
||||
border = color_inactive;
|
||||
childBorder = color_inactive;
|
||||
indicator = color_indicator;
|
||||
text = color_fg;
|
||||
};
|
||||
urgent = {
|
||||
background = color_bg;
|
||||
border = color_evil;
|
||||
childBorder = color_evil;
|
||||
indicator = color_indicator;
|
||||
text = color_fg;
|
||||
};
|
||||
};
|
||||
|
||||
keybindings = lib.mkOptionDefault {
|
||||
keybindings = lib.mkOptionDefault {
|
||||
# launch things
|
||||
## calculator
|
||||
"${mod}+c" = "exec rofi -show calc";
|
||||
|
@ -76,8 +76,8 @@ in
|
|||
|
||||
# control values
|
||||
## brightness
|
||||
"XF86MonBrightnessUp" = "exec brightnessctl set 2%+";
|
||||
"XF86MonBrightnessDown" = "exec brightnessctl set 2%-";
|
||||
"XF86MonBrightnessUp" = "exec /etc/nixos/i3/brightness.py 100+";
|
||||
"XF86MonBrightnessDown" = "exec /etc/nixos/i3/brightness.py 100-";
|
||||
};
|
||||
|
||||
modes = {
|
||||
|
|
Loading…
Reference in New Issue