GNU Emacs 32.0.50 (9008bf64c3) のマニュアルを PLaMo 翻訳で機械翻訳したものです。誤訳を含むことがあります。原文: https://www.gnu.org/software/emacs/manual/html_node/elisp/System-Taskbar.html ・ emacs-doc.conao3.com

43.20 システムGUIタスクバー機能の制御

概要および設定については、The GNU Emacs Manualのシステムタスクバーを参照してください。

関数: system-taskbar-badge &optional count

この関数は、システムのタスクバーにあるEmacsアイコンにオーバーレイとしてcountを表示します。

countが整数であれば、それを表示する。

count が文字列をサポートするバックエンドで文字列である場合は、それを表示してください。文字列は短くしてください。

文字列をサポートしていないバックエンドでは、count を整数に、それが失敗した場合は nil に変換します。

count が nil または空文字列の場合、カウンタまたは短い文字列を削除する。

count に設定されたシステムタスクバーのアイコンバッジを表示します。count が nil の場合は、バッジをクリアします。count は通常、整数です。

count が文字列の場合、GNU/Linux D-Bus など文字列バッジをサポートしていないシステムでは整数に変換され、文字列が無効な整数表現である場合はバッジがクリアされます。macOS/GNUstep や MS-Windows など文字列をサポートするシステムでは、バッジに文字列が設定されて表示され、システムが割り当てた表示領域に合わせて切り詰められる場合があります。いずれの場合も、文字列が空であればバッジをクリアします。

関数: system-taskbar-attention &optional urgency timeout

この関数は、ユーザーに通知するため、システムのタスクバーにあるEmacsアイコンおよび/またはそのフレームを点滅またはバウンドさせます。

urgencyは、記号informationalまたはcriticalのいずれかになり得ます。

urgencyがnilの場合、アテンションインジケーターをクリアする。

アテンションインジケーターは、Emacs GUIがフォーカスされた時点、またはtimeout秒後のいずれか早い方でクリアされます。timeoutがnilである場合は、システムGUIの動作が優先されます。

一部のバックエンドでは、criticalはinformationalと同じ効果を持ちます。

一部のバックエンドでは、現在フォーカスされているアプリケーションがEmacsでない場合にのみ、アテンションが表示されます。

関数: system-taskbar-progress &optional progress

この関数は、システムのタスクバーにあるEmacsアイコンに進捗インジケーターのオーバーレイを表示します。

progress は 0.0 から 1.0 の範囲の浮動小数点数です。progress が nil の場合、進捗インジケーターを削除してください。

組み込みの進捗報告機能を利用すると便利です。system-taskbar-mode を有効にすると、デフォルトで system-taskbar-progress と連携します。操作進捗の報告 を参照してください。

システムタスクバー機能の例:

;; Enable and initialize system-taskbar-mode before calling its
;; package functions.
(system-taskbar-mode)

;; Display a badge integer on the taskbar icon.
(system-taskbar-badge emacs-major-version)

;; A string representation of an integer is converted to an
;; integer on GNU/Linux.
(system-taskbar-badge "31")

;; Short strings are displayed on macOS/GNUstep and MS-Windows.
(system-taskbar-badge "Test")

;; Clear the badge.
(system-taskbar-badge)

;; Get the user's attention and clear the request after 3 seconds.
(system-taskbar-attention 'informational 3)

;; Get the user's attention and clear when Emacs is focused.
(system-taskbar-attention 'critical)

;; Clear the attention request.
(system-taskbar-attention)

;; Make sure system taskbar is integrated with progress-reporter.
(setopt system-taskbar-use-progress-reporter t) ; t is the default
(system-taskbar-mode)

;; Report `dotimes` progress on the taskbar icon.
(dotimes-with-progress-reporter
    (i 10)
    "Counting from 1 to 10..."
  (sleep-for 1))

;; Report `dolist` progress on the taskbar icon.
(dolist-with-progress-reporter
    (i (make-list 10 t))
    "Progress from 1 to 10 elements..."
  (sleep-for 1))