diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 7121bd5..7732574 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -17,6 +17,7 @@ jobs: - hyprprop - try_swap_workspace - hdrop + - hyprosd-mako steps: - uses: actions/checkout@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md index d6b6c0c..3ff43c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +### 2025-12-07 +hyprosd-mako: add OSD scripts for volume, brightness, and microphone + ### 2025-11-29 grimblast: remove superfluous use of external commands on test setup diff --git a/README.md b/README.md index ac09aaa..a0259dd 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ Community scripts and utilities for Hypr projects | [try_swap_workspace](./try_swap_workspace) | Binding to mimic the 'arbitrary workspace on arbitrary monitor' behavior | @schievel1 | | [scratchpad](./scratchpad) | A Bash script that instantly sends focused window to a special workspace named `scratchpad` and makes it easier to retrieve the window back to the current workspace | @niksingh710 | | [hdrop](./hdrop) | Run, show and hide programs via keybind. Emulates [tdrop](https://github.com/noctuid/tdrop) in Hyprland | @Schweber | +| [hyprosd-mako](./hyprosd-mako) | Lightweight Mako-based OSD scripts for volume, brightness, and microphone state | @KevynValladares21 | # Installing diff --git a/flake.nix b/flake.nix index f49795e..533d70c 100644 --- a/flake.nix +++ b/flake.nix @@ -16,6 +16,7 @@ overlays.default = _: prev: { grimblast = prev.callPackage ./grimblast {hyprland = null;}; hdrop = prev.callPackage ./hdrop {hyprland = null;}; + hyprosd-mako = prev.callPackage ./hyprosd-mako {}; hyprprop = prev.callPackage ./hyprprop {}; scratchpad = prev.callPackage ./scratchpad {hyprland = null;}; shellevents = prev.callPackage ./shellevents {hyprland = null;}; diff --git a/hyprosd-mako/Makefile b/hyprosd-mako/Makefile new file mode 100644 index 0000000..aaf62a7 --- /dev/null +++ b/hyprosd-mako/Makefile @@ -0,0 +1,21 @@ +DESTDIR ?= / +PREFIX ?= $(DESTDIR)usr/local +EXEC_PREFIX ?= $(PREFIX) +DATAROOTDIR ?= $(PREFIX)/share +BINDIR ?= $(EXEC_PREFIX)/bin + +SCRIPTS = brightness-notify mic-notify volume-notify + +all: + @echo "Nothing to build." + +install: + @for s in $(SCRIPTS); do \ + install -v -D -m 0755 $$s "$(BINDIR)/$$s"; \ + done + +uninstall: + @for s in $(SCRIPTS); do \ + rm -v "$(BINDIR)/$$s"; \ + done + diff --git a/hyprosd-mako/README.md b/hyprosd-mako/README.md new file mode 100644 index 0000000..76ac06d --- /dev/null +++ b/hyprosd-mako/README.md @@ -0,0 +1,48 @@ +# hyprosd-mako + +Lightweight OSD (On-Screen Display) notifications for Hyprland using Mako. + +Provides: +- Volume change OSD (`volume-notify`) +- Brightness change OSD (`brightness-notify`) +- Microphone mute/unmute OSD (`mic-notify`) + +## Dependencies +- mako + makoctl +- notify-send +- PipeWire (`wpctl`) +- brightnessctl + +## Installation +``` +make +sudo make install +``` + +## Uninstall +``` +sudo make uninstall +``` + +## Usage (Hyprland binds) +Add these to your Hyprland config: + +``` +# Volume +bindel = ,XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+ && volume-notify +bindel = ,XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- && volume-notify +bindel = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle && volume-notify +# Brightness +bindel = ,XF86MonBrightnessUp, exec, brightnessctl set +5% && brightness-notify +bindel = ,XF86MonBrightnessDown, exec, brightnessctl set 5%- && brightness-notify +# Microphone +bindel = $mainMod, M, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle && mic-notify +``` + +## Why this helps +Hyprland has no built-in OSD with Mako. +This provides a minimal, fast, Wayland-native alternative with almost no dependencies. + +## Notes +Tested on Arch Linux with Hyprland and Mako. +Should work on any distribution with the required dependencies. diff --git a/hyprosd-mako/brightness-notify b/hyprosd-mako/brightness-notify new file mode 100755 index 0000000..5b59287 --- /dev/null +++ b/hyprosd-mako/brightness-notify @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +CUR=$(brightnessctl g) +MAX=$(brightnessctl m) +PCT=$((CUR * 100 / MAX)) + +makoctl list | awk '/Brightness/ {id=$2; sub(":", "", id); system("makoctl dismiss " id)}' + +notify-send -u low "Brightness" "${PCT}%" --hint=int:value:"$PCT" + +# Optional icons (requires a Nerd Font) +# BRIGHTNESS_ICONS=("" "" "") diff --git a/hyprosd-mako/default.nix b/hyprosd-mako/default.nix new file mode 100644 index 0000000..262e57e --- /dev/null +++ b/hyprosd-mako/default.nix @@ -0,0 +1,45 @@ +{ + lib, + stdenvNoCC, + makeWrapper, + brightnessctl, + coreutils, + libnotify, + mako, + wireplumber, +}: +stdenvNoCC.mkDerivation { + pname = "hyprosd-mako"; + version = "0.1"; + + src = ./.; + + nativeBuildInputs = [ + makeWrapper + ]; + + makeFlags = [ "PREFIX=$(out)" ]; + + postInstall = '' + for i in {volume,brightness,mic}; do + wrapProgram "$out/bin/$i-notify" --prefix PATH ':' \ + "${ + lib.makeBinPath ([ + coreutils + mako + wireplumber + brightnessctl + libnotify + ]) + }" + done + ''; + + meta = with lib; { + description = "Lightweight OSD notifications for Hyprland using Mako"; + license = licenses.mit; + platforms = platforms.unix; + maintainers = with maintainers; [ ]; + mainProgram = "volume-notify"; + }; +} diff --git a/hyprosd-mako/mic-notify b/hyprosd-mako/mic-notify new file mode 100755 index 0000000..9a20fe1 --- /dev/null +++ b/hyprosd-mako/mic-notify @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +STATE=$(wpctl get-volume @DEFAULT_AUDIO_SOURCE@ | grep -o MUTED) + +makoctl list | awk '/Microphone/ {id=$2; sub(":", "", id); system("makoctl dismiss " id)}' + +if [ "$STATE" ]; then + notify-send -u low "Microphone" "Muted" --hint=int:value:0 +else + notify-send -u low "Microphone" "Unmuted" --hint=int:value:100 +fi + +# Optional icons (requires a Nerd Font) +# MICROPHONE_ICONS=("","") diff --git a/hyprosd-mako/volume-notify b/hyprosd-mako/volume-notify new file mode 100755 index 0000000..127e485 --- /dev/null +++ b/hyprosd-mako/volume-notify @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +VOL_INFO=$(wpctl get-volume @DEFAULT_AUDIO_SINK@) +VOL=$(echo "$VOL_INFO" | awk '{print int($2*100)}') +MUTED=$(echo "$VOL_INFO" | grep -o MUTED) + +makoctl list | awk '/Volume/ {id=$2; sub(":", "", id); system("makoctl dismiss " id)}' + +if [ "$MUTED" ]; then + notify-send -u low "Volume" "Muted" --hint=int:value:0 +else + notify-send -u low "Volume" "${VOL}%" --hint=int:value:"$VOL" +fi + +# Optional icons (requires a Nerd Font) +# VOLUME_ICONS=("" "" "")