Compare commits
3 commits
83ed99151f
...
7a396ada3b
Author | SHA1 | Date | |
---|---|---|---|
Joseph DiGiovanni | 7a396ada3b | ||
Joseph DiGiovanni | c723d2d1fb | ||
Joseph DiGiovanni | bc0445a41b |
|
@ -1,16 +1,17 @@
|
|||
{ inputs, pkgs, system, ... }:
|
||||
|
||||
let
|
||||
customPkgs = final: prev: {
|
||||
adwaita-for-steam = pkgs.callPackage ./adwaita-for-steam.nix { };
|
||||
customPkgs = final: prev: with pkgs;{
|
||||
adwaita-for-steam = callPackage ./adwaita-for-steam.nix { };
|
||||
|
||||
gnomeExtensions = prev.gnomeExtensions // {
|
||||
rounded-window-corners-reborn = pkgs.callPackage ./gnomeExtensions/rounded-window-corners-reborn.nix { };
|
||||
monitor-brightness-and-volume = callPackage ./gnomeExtensions/monitor-brightness-and-volume.nix { };
|
||||
rounded-window-corners-reborn = callPackage ./gnomeExtensions/rounded-window-corners-reborn.nix { };
|
||||
};
|
||||
|
||||
gpu-screen-recorder = final.unstable.gpu-screen-recorder;
|
||||
icoextract = final.unstable.icoextract; #TODO: remove in next release
|
||||
mkvextract-gtk = pkgs.callPackage ./mkvextract-gtk.nix { };
|
||||
mkvextract-gtk = callPackage ./mkvextract-gtk.nix { };
|
||||
};
|
||||
|
||||
unstableOverlay = final: prev: {
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
{ lib, stdenv, fetchurl, unzip, glib }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "gnome-shell-extension-monitor-brightness-volume";
|
||||
version = "7";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://extensions.gnome.org/extension-data/monitor-brightness-volumeailin.nemui.v${version}.shell-extension.zip";
|
||||
hash = "sha256-NrFZZdQTgnMyYk2Yp2l3RiXM2C+/NHhIPv/Fo/KrXt8=";
|
||||
};
|
||||
|
||||
sourceRoot = ".";
|
||||
|
||||
nativeBuildInputs = [ unzip glib ];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/share/gnome-shell/extensions/monitor-brightness-volume@ailin.nemui
|
||||
mv * $out/share/gnome-shell/extensions/monitor-brightness-volume@ailin.nemui
|
||||
glib-compile-schemas $out/share/gnome-shell/extensions/monitor-brightness-volume@ailin.nemui/schemas
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "GNOME Shell extension to control monitor brightness and volume.";
|
||||
homepage = "https://extensions.gnome.org/extension/1292/monitor-brightness-and-volume/";
|
||||
license = licenses.gpl2;
|
||||
platforms = platforms.linux;
|
||||
maintainers = with maintainers; [ jdig78 ];
|
||||
};
|
||||
}
|
18
flake.lock
18
flake.lock
|
@ -232,11 +232,11 @@
|
|||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1722388556,
|
||||
"narHash": "sha256-90/qzsfqtXbHk3vshBQkJdymG/IY7S6RqqYpQU2GB8Y=",
|
||||
"lastModified": 1722648499,
|
||||
"narHash": "sha256-GRZDqWF+q3hFiVv4+B5uxAoxhyoGipagt8jiUOtJFkY=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nix-vscode-extensions",
|
||||
"rev": "af75b047c7e12cbd5484190900e6216b5ebe68e2",
|
||||
"rev": "a6df283f4762b079b4d09b25acb1d9bd95f6a472",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -279,11 +279,11 @@
|
|||
},
|
||||
"nixpkgs-unstable": {
|
||||
"locked": {
|
||||
"lastModified": 1722185531,
|
||||
"narHash": "sha256-veKR07psFoJjINLC8RK4DiLniGGMgF3QMlS4tb74S6k=",
|
||||
"lastModified": 1722421184,
|
||||
"narHash": "sha256-/DJBI6trCeVnasdjUo9pbnodCLZcFqnVZiLUfqLH4jA=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "52ec9ac3b12395ad677e8b62106f0b98c1f8569d",
|
||||
"rev": "9f918d616c5321ad374ae6cb5ea89c9e04bf3e58",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -311,11 +311,11 @@
|
|||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1722221733,
|
||||
"narHash": "sha256-sga9SrrPb+pQJxG1ttJfMPheZvDOxApFfwXCFO0H9xw=",
|
||||
"lastModified": 1722519197,
|
||||
"narHash": "sha256-VEdJmVU2eLFtLqCjTYJd1J7+Go8idAcZoT11IewFiRg=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "12bf09802d77264e441f48e25459c10c93eada2e",
|
||||
"rev": "05405724efa137a0b899cce5ab4dde463b4fd30b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
dconf.settings = {
|
||||
"org/gnome/Console" =
|
||||
let
|
||||
fontSize = 10;
|
||||
fontWidth = fontSize * 0.8;
|
||||
lineSpacing = fontSize * 0.4 * 2; # Each line has a space of 0.4em above and below it
|
||||
fontSize = 12;
|
||||
fontWidth = 8;
|
||||
lineSpacing = 2 * 2; # Each line has a space above and below it
|
||||
|
||||
terminalMode = {
|
||||
# Based on VT100 video modes
|
||||
|
@ -19,11 +19,11 @@
|
|||
terminalSize = terminalMode.extended;
|
||||
in
|
||||
{
|
||||
custom-font = "Source Code Pro " + toString fontSize;
|
||||
custom-font = "Unifont " + toString fontSize;
|
||||
|
||||
last-window-size = with builtins; lib.hm.gvariant.mkTuple [
|
||||
(ceil ((elemAt terminalSize 0 * fontWidth) + 12))
|
||||
(ceil ((elemAt terminalSize 1 * (fontSize + lineSpacing)) + 48))
|
||||
(ceil (((elemAt terminalSize 1 + .5) * (fontSize + lineSpacing)) + 48))
|
||||
];
|
||||
|
||||
theme = "night";
|
||||
|
|
|
@ -3,5 +3,6 @@
|
|||
{
|
||||
imports = [
|
||||
./custom-wallpaper
|
||||
./extensions
|
||||
];
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./monitor-brightness-and-volume.nix
|
||||
];
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
UUID = "monitor-brightness-volume@ailin.nemui";
|
||||
lightModeBrightness = 50;
|
||||
darkModeBrightness = 20;
|
||||
in
|
||||
{
|
||||
dconf.settings = {
|
||||
"org/gnome/shell".enabled-extensions = [ UUID ];
|
||||
|
||||
"org/gnome/shell/extensions/monitor-brightness-volume".show-volume = false;
|
||||
};
|
||||
|
||||
systemd.user.services.ddcutil-auto-brightness-gnome = {
|
||||
Install.WantedBy = [ "default.target" ];
|
||||
|
||||
Service = {
|
||||
ExecStart = pkgs.writeShellScript "ddcutil-auto-brightness-gnome" ''
|
||||
${pkgs.glib}/bin/gsettings monitor org.gnome.desktop.interface color-scheme | while read -r line; do
|
||||
${pkgs.gnome.gnome-shell}/bin/gnome-extensions disable ${UUID} # Reload the extension to detect the brightness change
|
||||
if [[ "$line" == *"prefer-dark"* ]]; then
|
||||
${pkgs.ddcutil}/bin/ddcutil setvcp 10 ${toString darkModeBrightness}
|
||||
else
|
||||
${pkgs.ddcutil}/bin/ddcutil setvcp 10 ${toString lightModeBrightness}
|
||||
fi
|
||||
# Reload the extension to apply the brightness change
|
||||
${pkgs.gnome.gnome-shell}/bin/gnome-extensions enable ${UUID}
|
||||
done
|
||||
'';
|
||||
Restart = "always";
|
||||
RestartSec = 10;
|
||||
};
|
||||
|
||||
Unit = {
|
||||
After = [ "graphical-session.target" ];
|
||||
Description = "ddcutil auto brightness service for GNOME";
|
||||
};
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [ gnomeExtensions.monitor-brightness-and-volume ];
|
||||
}
|
|
@ -2,11 +2,9 @@
|
|||
|
||||
{
|
||||
config = lib.mkIf config.hardware.monitor-control.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
ddcutil
|
||||
];
|
||||
|
||||
boot.kernelModules = [ "i2c-dev" ];
|
||||
environment.systemPackages = with pkgs; [ ddcutil ];
|
||||
hardware.i2c.enable = true;
|
||||
users.groups."i2c".members = builtins.attrNames config.users.users;
|
||||
};
|
||||
|
||||
options.hardware.monitor-control.enable = lib.mkEnableOption "enable support for controlling monitor settings.";
|
||||
|
|
Loading…
Reference in a new issue