refactor(home:hyprland): move volume, brightness, powermenu --> tools
This commit is contained in:
parent
a6d5e892a1
commit
09504dbc89
9 changed files with 124 additions and 57 deletions
45
home/modules/desktop/tools/ookbrightness.nix
Normal file
45
home/modules/desktop/tools/ookbrightness.nix
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
{ lib, osConfig, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
inherit (builtins) elem;
|
||||
features = osConfig.ooknet.host.hardware.features;
|
||||
ookbrightness = pkgs.writeShellApplication {
|
||||
name = "ookbrightness";
|
||||
runtimeInputs = with pkgs; [brillo libnotify];
|
||||
text = /* bash */ ''
|
||||
BRIGHTNESS=$(brillo -G | awk -F'.' '{print$1}')
|
||||
notify() {
|
||||
notify-send --app-name="system-notify" -h string:x-canonical-private-synchronous:sys-notify " $BRIGHTNESS%"
|
||||
}
|
||||
option() {
|
||||
case "$1" in
|
||||
up)
|
||||
brillo -q -u 30000 -A 5
|
||||
;;
|
||||
down)
|
||||
brillo -q -u 30000 -U 5
|
||||
;;
|
||||
*)
|
||||
echo "Invalid argument"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
main() {
|
||||
option "$@"
|
||||
notify
|
||||
}
|
||||
main "$@"
|
||||
'';
|
||||
};
|
||||
in
|
||||
|
||||
{
|
||||
config = mkIf (elem "backlight" features) {
|
||||
home.packages = [ ookbrightness ];
|
||||
ooknet.binds.brightness = {
|
||||
up = "ookbrightness up";
|
||||
down = "ookbrightness down";
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue