Add focus action to libnotify alerts

This commit is contained in:
eriedaberrie 2023-04-09 14:27:14 -07:00
parent 90e4eb03b4
commit 29efeadcd3
3 changed files with 15 additions and 0 deletions

2
.gitignore vendored
View file

@ -4,6 +4,8 @@
!.gitmodules !.gitmodules
!early-init.el !early-init.el
!init.el !init.el
!scripts
!scripts/**
!snippets !snippets
!snippets/** !snippets/**

View file

@ -437,6 +437,13 @@
:config :config
(dirvish-override-dired-mode)) (dirvish-override-dired-mode))
(use-package alert
:ensure nil
:custom
(alert-default-style 'libnotify)
(alert-libnotify-command (expand-file-name "scripts/emacs-hyprland-notify"
user-emacs-directory)))
(use-package pdf-tools (use-package pdf-tools
:mode ("\\.pdf\\'" . pdf-view-mode) :mode ("\\.pdf\\'" . pdf-view-mode)
:bind (:map pdf-view-mode-map ("/" . #'isearch-forward)) :bind (:map pdf-view-mode-map ("/" . #'isearch-forward))

6
scripts/emacs-hyprland-notify Executable file
View file

@ -0,0 +1,6 @@
#!/bin/sh
exec nohup sh -s -- "$@" <<-'EOF' >/dev/null 2>&1 &
STATUS="$(notify-send --action='focusEmacs,Focus EmacsClient' "$@")"
[ "$STATUS" = 0 ] && exec hyprctl dispatch focuswindow '^(emacs)$'
EOF