Skip to content

Instantly share code, notes, and snippets.

@stduhpf
stduhpf / muteoof.py
Last active May 3, 2024 16:36
Force mute out of focus Windows app
# This code is licensed under the terms of the MIT license
# This script is made to force some Windows app to stop outputting sound when not focused.
# Requirements: - Windows operating system (tested on Windows 10 22H2)
# - python 3
# - pycaw (Python Core Audio Windows Library): `pip install pycaw`
# Acknowledgments:
# - Most of the credit goes to superuser.com user steve0: https://superuser.com/a/1796210
# - Refactoring and improved UX by stduhpf, with the help of a local llama-3 8B (4bit) instance
@stduhpf
stduhpf / tada.ps1
Created March 31, 2023 14:37
Play notification sound from powershell script
Add-Type @"
using System;
using System.Runtime.InteropServices;
public class SoundPlayer {
[DllImport("winmm.dll")]
public static extern bool PlaySound(string pszSound, IntPtr hmod, uint fdwSound);
}
"@
# You can change the path to any wav file you want to play