dotfiles

My PC Dotfiles & Website
commit 0db709fcf5ac89ac0ff39daad072e427473a594e
parent 332ff28a4b9fc9295cbda30efe08dc2989bcccbb
Author: maydayv7 <maydayv7@gmail.com>
Date:   Thu, 14 Dec 2023 22:27:22 +0530

feat: Add Laptop Audio Tweaks

Diffstat:

Mmodules/apps/office.nix | 6+++++-
Mmodules/hardware/laptop.nix | 14++++++++++++++
Ascripts/audio.sh | 28++++++++++++++++++++++++++++
3 files changed, 47 insertions(+), 1 deletion(-)

diff --git a/modules/apps/office.nix b/modules/apps/office.nix @@ -13,7 +13,6 @@ in { config = lib.mkIf enable { # Applications - programs.onlyoffice.enable = true; environment.systemPackages = with pkgs; [ # Productivity easyeffects @@ -31,6 +30,11 @@ in { zoom-us ]; + programs.onlyoffice = { + enable = true; + package = pkgs.onlyoffice-bin_latest; + }; + # Dictionaries environment = { pathsToLink = ["/share/hunspell" "/share/myspell" "/share/hyphen"]; diff --git a/modules/hardware/laptop.nix b/modules/hardware/laptop.nix @@ -1,6 +1,8 @@ { config, lib, + pkgs, + files, ... }: let enable = builtins.elem "laptop" config.hardware.support; @@ -13,6 +15,18 @@ in { HandleLidSwitchExternalPower=lock ''; + # Audio + user.home.home.file.".config/autostart/audio-tweaks.desktop".text = '' + [Desktop Entry] + Type=Application + Name=audio-tweaks + Exec=${pkgs.writeShellApplication { + name = "audio"; + text = files.scripts.audio; + runtimeInputs = with pkgs; [glib playerctl]; + }}/bin/audio + ''; + # Touchpad services.xserver.libinput = { enable = true; diff --git a/scripts/audio.sh b/scripts/audio.sh @@ -0,0 +1,28 @@ +#! /usr/bin/env nix +#! nix shell nixpkgs#bash nixpkgs#glib nixpkgs#playerctl -c bash + +# Audio Tweaks # + +# Pause playback on Screen Lock +gdbus monitor -y -d org.freedesktop.login1 | grep LockedHint --line-buffered | + while read -r line + do + case "$line" in + *"<true>"*) + if playerctl status | grep Playing + then + PLAY=true + else + PLAY=false + fi + playerctl pause + ;; + *"<false>"*) + if $PLAY + then + playerctl play-pause + fi + ;; + esac + done +exit