Add brightness control script and keybindings
This commit is contained in:
parent
e1bee7739b
commit
bb80bd064d
2 changed files with 64 additions and 20 deletions
|
@ -27,10 +27,13 @@ let
|
|||
launcher = "${pkgs.walker}/bin/walker --modules applications,ssh";
|
||||
pactl = lib.getExe' pkgs.pulseaudio "pactl";
|
||||
terminal = exec (import ./scripts/terminal.nix { inherit pkgs; });
|
||||
brightness = exec (import ./scripts/brightness.nix { inherit pkgs; });
|
||||
|
||||
## Long ass keys ##
|
||||
lowerVol = "XF86AudioLowerVolume";
|
||||
raiseVol = "XF86AudioRaiseVolume";
|
||||
brightUp = "XF86MonBrightnessUp";
|
||||
brightDown = "XF86MonBrightnessDown";
|
||||
|
||||
## Keybinds & Submaps ##
|
||||
|
||||
|
@ -64,9 +67,12 @@ let
|
|||
# "SUPER, L, exec, ${lockscreen}"
|
||||
"SUPER, Q, killactive,"
|
||||
"CTRL_ALT, Delete, exit,"
|
||||
", ${brightUp}, exec, ${brightness} + 10"
|
||||
", ${brightDown}, exec, ${brightness} - 10"
|
||||
|
||||
## Window Management ##
|
||||
"SUPER_SHIFT, F, fullscreen, 0"
|
||||
"SUPER_ALT, F, fullscreenstate, 0 3"
|
||||
# "SUPER, F, exec, ${notify} 'Fullscreen Mode'"
|
||||
"SUPER, Backspace, togglefloating,"
|
||||
"SUPER, Backspace, centerwindow,"
|
||||
|
|
38
home/toph/common/optional/hyprland/scripts/brightness.nix
Normal file
38
home/toph/common/optional/hyprland/scripts/brightness.nix
Normal file
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
pkgs.writeScript "brightness-control" ''
|
||||
#!/usr/bin/env fish
|
||||
|
||||
# Usage:
|
||||
# brightness-control --up 10
|
||||
# brightness-control + 10
|
||||
# brightness-control --down 15
|
||||
# brightness-control - 15
|
||||
|
||||
if test (count $argv) -ne 2
|
||||
echo "Usage: $argv[0] [--up|+|--down|-] <INTEGER>"
|
||||
exit 1
|
||||
end
|
||||
|
||||
set option $argv[1]
|
||||
set value $argv[2]
|
||||
|
||||
if test "$option" = "--up" -o "$option" = "+"
|
||||
set op "+"
|
||||
else if test "$option" = "--down" -o "$option" = "-"
|
||||
set op "-"
|
||||
else
|
||||
echo "Invalid option. Use --up | + or --down | -"
|
||||
exit 1
|
||||
end
|
||||
|
||||
# Hardcoded bus numbers from ddcutil detect. Adjust if necessary.
|
||||
set buses 10 11
|
||||
|
||||
for bus in $buses
|
||||
echo "Changing brightness on bus $bus: ddcutil setvcp 10 $op $value --bus $bus"
|
||||
ddcutil setvcp 10 $op $value --bus $bus
|
||||
end
|
||||
''
|
Loading…
Add table
Reference in a new issue