Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notification DND keybind #46

Open
different-name opened this issue Jul 28, 2024 · 3 comments
Open

Notification DND keybind #46

different-name opened this issue Jul 28, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@different-name
Copy link
Owner

No description provided.

@different-name different-name added the enhancement New feature or request label Jul 28, 2024
@different-name
Copy link
Owner Author

Mako modes enable disabling notifications via makoctl
https://www.github.com/emersion/mako/issues/335

@different-name
Copy link
Owner Author

Created a script as a proof of concept using makoctl and a do-not-disturb mode

#! /usr/bin/env nix-shell
#! nix-shell -i sh -p socat mako pipewire

# handle screencast events
handle_screencast() {
    event_data="$1" # event data e.g. "screencast>>1,0"
    echo "Hyprland screencast event: \"$event_data\""

    data="${event_data#screencast>>}" # trim "screencast>>"

    # janky way to check if there's currently a screencast client
    echo "Checking for current screencast clients"
    if pw-cli info all | grep -q '.xdg-desktop-portal-hyprland-wrapped:capture'; then
        echo "Hiding notifications"
        makoctl mode -a do-not-disturb # hide notifications
    else
        echo "Displaying notifications"
        makoctl mode -r do-not-disturb # show notifications
    fi
}

# listening for hyprland events
# https://wiki.hyprland.org/IPC/#how-to-use-socket2-with-bash

SOCKET_PATH="$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock"

socat -U - UNIX-CONNECT:$SOCKET_PATH | while read -r line; do
    case "$line" in
        screencast*) handle_screencast "$line" ;;
        *);;
    esac
done
services.mako.extraConfig = ''
  [mode=do-not-disturb]
  invisible=1
'';

Would like to create a c application that interfaces with the pipewire api, this is what waybar does (though cpp)

I'd like to use c as that's what mako uses, and might be cool to adapt this into a pull request for a config option or something

https://github.com/Alexays/Waybar/blob/21906f07b312d56f51ce7cd2b26925cd12880ada/src/util/pipewire/pipewire_backend.cpp

@different-name different-name changed the title Disable Mako while sharing screen Notification DND keybind Nov 13, 2024
@different-name
Copy link
Owner Author

I think a simple toggle bind would be far more effective and easier

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant