mirror of
https://github.com/Theaninova/TheaninovOS.git
synced 2025-12-12 03:26:17 +00:00
feat: fv43u brightness control
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
lib,
|
||||
config,
|
||||
username,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
@@ -19,7 +20,8 @@ in
|
||||
hardware.gbmonctl.enable = true;
|
||||
boot.kernelParams = [ "video=3840x2160@120" ];
|
||||
|
||||
home-manager.users.${username}.wayland.windowManager.hyprland.settings = {
|
||||
home-manager.users.${username} = {
|
||||
wayland.windowManager.hyprland.settings = {
|
||||
general.layout = "master";
|
||||
master = {
|
||||
orientation = "center";
|
||||
@@ -34,6 +36,52 @@ in
|
||||
misc.vrr = 2; # VA suffers from VRR flicker
|
||||
};
|
||||
|
||||
programs.waybar.settings.mainBar."custom/brightness" =
|
||||
let
|
||||
tmpFile = "${config.home-manager.users.${username}.xdg.configHome}/gbmonctl-brightness";
|
||||
in
|
||||
{
|
||||
return-type = "json";
|
||||
exec = pkgs.writeShellScript "waybar-brightness" ''
|
||||
BRIGHTNESS=$(cat ${tmpFile} || echo "0")
|
||||
if [ "$BRIGHTNESS" -lt ${toString (100 / 7 * 1)} ]; then
|
||||
ICON=""
|
||||
elif [ "$BRIGHTNESS" -lt ${toString (100 / 7 * 2)} ]; then
|
||||
ICON=""
|
||||
elif [ "$BRIGHTNESS" -lt ${toString (100 / 7 * 3)} ]; then
|
||||
ICON=""
|
||||
elif [ "$BRIGHTNESS" -lt ${toString (100 / 7 * 4)} ]; then
|
||||
ICON=""
|
||||
elif [ "$BRIGHTNESS" -lt ${toString (100 / 7 * 5)} ]; then
|
||||
ICON=""
|
||||
elif [ "$BRIGHTNESS" -lt ${toString (100 / 7 * 6)} ]; then
|
||||
ICON=""
|
||||
else
|
||||
ICON=""
|
||||
fi
|
||||
|
||||
echo "{\"text\": \"$ICON $BRIGHTNESS%\"}"
|
||||
'';
|
||||
on-scroll-up = pkgs.writeShellScript "waybar-brightness-up" ''
|
||||
BRIGHTNESS=$(cat ${tmpFile} || echo "0")
|
||||
BRIGHTNESS=$((BRIGHTNESS + 5))
|
||||
BRIGHTNESS=$((BRIGHTNESS > 100 ? 100 : BRIGHTNESS))
|
||||
echo $BRIGHTNESS > ${tmpFile}
|
||||
${pkgs.gbmonctl}/bin/gbmonctl -prop brightness -val $BRIGHTNESS
|
||||
'';
|
||||
on-scroll-down = pkgs.writeShellScript "waybar-brightness-up" ''
|
||||
BRIGHTNESS=$(cat ${tmpFile} || echo "0")
|
||||
BRIGHTNESS=$((BRIGHTNESS - 5))
|
||||
BRIGHTNESS=$((BRIGHTNESS < 0 ? 0 : BRIGHTNESS))
|
||||
echo $BRIGHTNESS > ${tmpFile}
|
||||
${pkgs.gbmonctl}/bin/gbmonctl -prop brightness -val $BRIGHTNESS
|
||||
'';
|
||||
exec-on-event = true;
|
||||
exec-if = "sleep 0.1";
|
||||
interval = "once";
|
||||
};
|
||||
};
|
||||
|
||||
programs.steam.gamescopeSession = {
|
||||
env = {
|
||||
SCREEN_WIDTH = "3840";
|
||||
|
||||
@@ -23,6 +23,9 @@ in
|
||||
reload_style_on_change = true;
|
||||
exclusive = true;
|
||||
|
||||
modules-left = [
|
||||
# "hyprland/workspaces"
|
||||
];
|
||||
modules-center = [
|
||||
"clock"
|
||||
"systemd-failed-units"
|
||||
@@ -31,14 +34,27 @@ in
|
||||
"privacy"
|
||||
"gamemode"
|
||||
"tray"
|
||||
"custom/brightness"
|
||||
"custom/theme"
|
||||
#"network"
|
||||
#"pulseaudio"
|
||||
#"bluetooth"
|
||||
];
|
||||
|
||||
"hyprland/workspaces" = {
|
||||
format = "{windows}";
|
||||
window-rewrite = {
|
||||
"class<firefox>" = "";
|
||||
"class<thunderbird>" = "";
|
||||
"class<neovide>" = "";
|
||||
"class<kitty>" = "";
|
||||
"class<OrcaSlicer>" = "";
|
||||
"class<blender>" = "";
|
||||
"class<steam>" = "";
|
||||
};
|
||||
window-rewrite-default = "";
|
||||
};
|
||||
|
||||
"custom/theme" = {
|
||||
return-type = "json";
|
||||
exec-on-event = true;
|
||||
exec = pkgs.writeShellScript "waybar-theme" ''
|
||||
if [ $(theme mode) = "dark" ]; then
|
||||
echo '{"text": "", "tooltip": "Switch to light theme"}'
|
||||
@@ -46,6 +62,8 @@ in
|
||||
echo '{"text": "", "tooltip": "Switch to dark theme"}'
|
||||
fi
|
||||
'';
|
||||
exec-if = "sleep 1";
|
||||
interval = "once";
|
||||
on-click = "theme toggle";
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user