From c548501d5246e41351d234091caaece86677d656 Mon Sep 17 00:00:00 2001 From: Tibo De Peuter Date: Fri, 25 Sep 2026 11:12:00 +0200 Subject: [PATCH 1/2] fix(hyprland): custom battery to avoid battery spam --- scripts/battery.sh | 21 +++++++++++++++++++++ stow/waybar/.config/waybar/modules.json | 8 +++++++- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 scripts/battery.sh diff --git a/scripts/battery.sh b/scripts/battery.sh new file mode 100644 index 0000000..0ba93e5 --- /dev/null +++ b/scripts/battery.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +capacity="$(cat /sys/class/power_supply/BAT0/capacity)" +status="$(cat /sys/class/power_supply/BAT0/status)" + +if [ "${status}" = "Charging" ]; then + icon="\ue55b" +elif [ "${capacity}" -ge 90 ]; then + icon="\uf240" +elif [ "${capacity}" -ge 75 ]; then + icon="\uf241" +elif [ "${capacity}" -ge 50 ]; then + icon="\uf242" +elif [ "${capacity}" -ge 25 ]; then + icon="\uf243" +else + icon="\uf244" +fi + +printf '{"text": "%s%% %s", "tooltip": "Status: %s", "class": "%s"}\n' \ + "${capacity}" "${icon}" "${status}" "${status}" diff --git a/stow/waybar/.config/waybar/modules.json b/stow/waybar/.config/waybar/modules.json index 683d70b..b0f0592 100644 --- a/stow/waybar/.config/waybar/modules.json +++ b/stow/waybar/.config/waybar/modules.json @@ -77,6 +77,12 @@ } }, + "custom/battery": { + "exec": "bash ${SCRIPT_DIR}/battery.sh", + "return-type": "json", + "interval": 60 + }, + "custom/control-center": { "format": "\uf085", /*  */ "tooltip": false @@ -263,7 +269,7 @@ "orientation": "inherit", "modules": [ /* Preview */ - "battery", + /* "battery", */ "custom/battery", /* Most-left */ "custom/system-shutdown", "custom/system-reboot", From 603659b77d067f380532f02d600e388cc0edfdbf Mon Sep 17 00:00:00 2001 From: Tibo De Peuter Date: Fri, 25 Sep 2026 11:12:59 +0200 Subject: [PATCH 2/2] fix(nvidia): fix flickering on sway --- nixos/modules/desktop/sway/default.nix | 15 +++++---------- nixos/modules/hardware/nvidia/default.nix | 7 +++---- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/nixos/modules/desktop/sway/default.nix b/nixos/modules/desktop/sway/default.nix index b9a8003..9b474b6 100644 --- a/nixos/modules/desktop/sway/default.nix +++ b/nixos/modules/desktop/sway/default.nix @@ -40,10 +40,8 @@ let # gsettings set $gnome_schema gtk-theme 'Dracula' # https://github.com/crispyricepc/sway-nvidia/blob/2101a18698151a61266740f1297158119bf660ac/wlroots-env-nvidia.sh - # Hardware cursors not yet working on wlroots - export WLR_NO_HARDWARE_CURSORS=1 - # Set wlroots renderer to Vulkan to avoid flickering - export WLR_RENDERER=vulkan + # Intel primary, NVIDIA secondary + export WLR_DRM_DEVICES=/dev/dri/card1:/dev/dri/card0 # General wayland environment variables export XDG_SESSION_TYPE=wayland export QT_QPA_PLATFORM=wayland @@ -52,10 +50,8 @@ let export MOZ_ENABLE_WAYLAND=1 export MOZ_USE_XINPUT2=1 # OpenGL Variables - export GBM_BACKEND=nvidia-drm export __GL_GSYNC_ALLOWED=0 export __GL_VRR_ALLOWED=0 - export __GLX_VENDOR_LIBRARY_NAME=nvidia # Xwayland compatibility export XWAYLAND_NO_GLAMOR=1 ''; @@ -105,7 +101,7 @@ in { noto-fonts noto-fonts-cjk-sans noto-fonts-cjk-serif - noto-fonts-emoji + noto-fonts-color-emoji ]; hardware.graphics.enable = true; @@ -115,9 +111,8 @@ in { dbus.enable = true; displayManager.ly.enable = true; gnome.gnome-keyring.enable = true; - power-profiles-daemon.enable = true; - xserver.videoDrivers = [ "nouveau" ]; - # xserver.videoDrivers = [ "nvidia" ]; + # xserver.videoDrivers = [ "nouveau" ]; + xserver.videoDrivers = [ "nvidia" ]; }; xdg.portal = { diff --git a/nixos/modules/hardware/nvidia/default.nix b/nixos/modules/hardware/nvidia/default.nix index 5104dec..8c722b9 100644 --- a/nixos/modules/hardware/nvidia/default.nix +++ b/nixos/modules/hardware/nvidia/default.nix @@ -25,6 +25,8 @@ in { }; config = lib.mkIf cfg.enable { + boot.kernelParams = [ "nvidia_drm.fbdev=1" ]; + hardware = { graphics = { enable = true; @@ -44,7 +46,7 @@ in { open = false; branch = "stable"; # To override the default package set by the branch: - #package = config.boot.kernelPackages.nvidiaPackages.stable; + package = config.boot.kernelPackages.nvidiaPackages.latest; # Modesetting is required. modesetting.enable = true; nvidiaSettings = cfg.gui-settings; @@ -53,9 +55,6 @@ in { finegrained = do-offloading; }; - # Avoid flickering - forceFullCompositionPipeline = true; - prime = lib.mkMerge [ (lib.mkIf do-offloading { offload = {