「Hyprland」の版間の差分
(Hyperland wikiのFAQページへのリンク切れを修正) |
(→ヒントとテクニック: 同期) |
||
| (6人の利用者による、間の51版が非表示) | |||
| 6行目: | 6行目: | ||
{{Related articles end}} |
{{Related articles end}} |
||
| − | + | [https://hyprland.org/ Hyprland] は C++ で書かれた、独立したタイリング [[Wayland#コンポジタ|Wayland コンポジタ]] です。Hyprland の特筆すべき点は、ダイナミックタイリング、タブ付きウィンドウ、クリーンで読みやすい C++ コードベース、ウィンドウアニメーションや角丸、透明ウィンドウでの Dual-Kawase Blur を提供するカスタムレンダラーなどです。一般的な使い方や設定方法は、 [https://wiki.hyprland.org/ Hyprland Wiki] に詳しく書かれています。 |
|
== インストール == |
== インストール == |
||
| − | + | 次のいずれかをインストールします: |
|
| + | * {{Pkg|hyprland}} - 最新のアップストリームリリース。 |
||
| − | Hyprland は独自のバージョンの wlroots をバンドルしており、{{AUR|wlroots-git}} に忠実に準拠しています。これは安定性を高め、他の wlroots ベースのコンポジターとの依存関係の衝突を避けることができます。 |
||
| + | * {{AUR|hyprland-git}} - master ブランチへの最新のコミット。 |
||
| + | [https://github.com/hyprwm/Hyprland/pull/6608 #6608] の時点で、Hyprland は独自のレンダリングバックエンドライブラリとして [https://github.com/hyprwm/aquamarine aquamarine] を使用しています。以前は、{{AUR|wlroots-git}} に密接に従った独自のバージョンの {{Pkg|wlroots}} がバンドルされていました。 |
||
| − | === AUR から === |
||
| + | {{Note| |
||
| − | {{AUR|hyprland}}、{{AUR|hyprland-bin}} または {{AUR|hyprland-git}} パッケージをインストールします。 |
||
| + | * [[NVIDIA]] GPU ユーザーは、Hyprland を起動する前に、[https://wiki.hyprland.org/Nvidia 上流 Wiki] のNVIDIA専用ページにも必ず従ってください。これを怠ると、ログインできない、ウィンドウが点滅する、CPU使用率が高いなど、多くのバグが発生する可能性があります。 |
||
| + | * Hyprland での NVIDIA GPU の使用はサポートされていません。問題が起きても全て自己責任でお願いします。 |
||
| + | * また、[[Polkit]] パッケージも必ずインストールしてください、これがないと Hyprland が起動できなくなります。({{ic|logind missing permissions}}). |
||
| + | }} |
||
| + | |||
| + | == 設定 == |
||
| + | |||
| + | {{Note|リストされているオプションのほとんど (およびその他) は、[https://wiki.hyprland.org/Cconfiguring/Variables/upstream Wiki] の変数ページで詳しく説明されています。}} |
||
| + | |||
| + | 設定は 1 つの設定ファイル、[https://github.com/vaxerski/Hyprland/blob/main/example/hyprland.conf hyprland.conf] を通して行われます。パッケージマネージャで Hyprland をインストールした場合、おそらく /usr/share/hyprland/hyprland.conf にあります。ソースからインストールした場合は、Hyprland をクローンしたレポジトリにあります。hyprland.conf を {{ic|~/.config/hypr/hyprland.conf}} にコピーしてください。 |
||
| + | |||
| + | {{ic|hyprland.conf}} には、デバイス (モニタ、キーボード、マウス、トラックパッド) を設定するディレクティブと、アニメーション、装飾、レイアウトなどの設定が含まれています。キーバインディングやウィンドウのルールを設定したり、コマンドを実行したりできます (一度だけ、あるいはコンフィグが再読み込みされるたびに) |
||
| + | |||
| + | ファイルを更新するたびに設定が自動的にリロードされます。同じ効果を得るために {{ic|hyprctl reload}} を使うこともできます。いくつかの設定(特に入力設定)については、Hyprland セッションを再起動する必要があるかもしれません。 |
||
| + | |||
| + | 設定は {{ic|hyprctl}} を使用してその場で変更することもできますが、保存されません。 |
||
| + | |||
| + | === キーボード === |
||
| − | === |
+ | ==== キーマップ ==== |
| + | デフォルトでは、Hyprland は {{ic|US Qwerty}} を使用します。次のように設定できます: |
||
| − | Hyprland は非常に活発なリポジトリです。現時点では、通常1日に数回のコミットがあります。 |
||
| + | {{hc|~/.config/hypr/hyprland.conf|2= |
||
| − | {{bc|1= |
||
| + | # German Colemark layout |
||
| − | $ git clone --recursive https://github.com/vaxerski/Hyprland |
||
| + | input { |
||
| − | $ cd Hyprland |
||
| + | ... |
||
| − | # make install |
||
| + | kb_layout = de |
||
| + | kb_variant = colemark |
||
| + | ... |
||
| + | } |
||
}} |
}} |
||
| + | 利用可能なすべてのオプションについては、[https://wiki.hyprland.org/Configuring/Variables/#input 上流 Wiki] を参照してください。 |
||
| − | {{ic|recursive}} フラグは適切なバージョンの wlroots を取り出し、Hyprland のためにローカルにビルドします。 |
||
| + | |||
| + | {{Note|Hyprland は [[ロケール]] 定義をオーバーライドするため、{{ic|US}} レイアウトキーボードを使用しない場合はキーマップを変更する必要があります。}} |
||
| + | |||
| + | ==== 典型的な遅延と速度 ==== |
||
| + | |||
| + | Xorg ユーザーはこの設定を [[Xorg/キーボード設定#オートリピートの遅延と速度の調整|サーバーレベルで定義]] で使用することに慣れていますが、Wayland では各コンポジターがそれを独自に処理します。 |
||
| + | |||
| + | {{hc|~/.config/hypr/hyprland.conf|2= |
||
| + | # Repeat rate and delay |
||
| + | input { |
||
| + | ... |
||
| + | repeat_rate = 25 |
||
| + | repeat_delay = 600 |
||
| + | ... |
||
| + | } |
||
| + | }} |
||
| + | |||
| + | ==== キーボードのバックライト ==== |
||
| + | |||
| + | 他の照明コントロールとは異なり、キーボードバックライトには {{ic|XF86}} キーシムがないため、従来のバインドを行う必要があります。 |
||
| + | |||
| + | {{Pkg|brightnessctl}} を [[インストール]] します、次のバインドを追加します。 |
||
| + | |||
| + | {{hc|~/.config/hypr/hyprland.conf|2= |
||
| + | # Keyboard backlight |
||
| + | bind = SUPER, F3, exec, brightnessctl -d *::kbd_backlight set +33% |
||
| + | bind = SUPER, F2, exec, brightnessctl -d *::kbd_backlight set 33%- |
||
| + | }} |
||
| + | |||
| + | 変更が行われたときに [[Hyprland#画面上の通知|画面上の通知]] を実行することもできます。 |
||
| + | |||
| + | {{Note|ラップトップにハードウェアキーボードバックライトコントロール (キーボードの {{ic|Fn}} キーを使用) がある場合、追加の手順なしで機能するはずです。}} |
||
| + | |||
| + | ==== メディアキー ==== |
||
| + | |||
| + | Hyprland でキーボードメディアコントロールを使用するには、{{ic|XF86Audio}} キーシムと、{{Pkg|pavucontrol}} または {{Pkg|pamixer}} や [[MPRIS#Playerctl|playerctl]] などの外部アプリケーションを利用することで可能です。 |
||
| + | |||
| + | {{hc|~/.config/hypr/hyprland.conf|2= |
||
| + | # Volume and Media Control |
||
| + | bind = , XF86AudioRaiseVolume, exec, pamixer -i 5 |
||
| + | bind = , XF86AudioLowerVolume, exec, pamixer -d 5 |
||
| + | bind = , XF86AudioMicMute, exec, pamixer --default-source -m |
||
| + | bind = , XF86AudioMute, exec, pamixer -t |
||
| + | bind = , XF86AudioPlay, exec, playerctl play-pause |
||
| + | bind = , XF86AudioPause, exec, playerctl play-pause |
||
| + | bind = , XF86AudioNext, exec, playerctl next |
||
| + | bind = , XF86AudioPrev, exec, playerctl previous |
||
| + | }} |
||
| + | |||
| + | 変更が行われたときに [[Hyprland#画面上の通知|通知]] を実行することもできます。 |
||
| + | |||
| + | === タッチパッドのジェスチャ === |
||
| + | |||
| + | [[Wayland]] コンポジタである Hyprland はタッチパッドジェスチャを完全にサポートしていますが、デフォルトでは無効になっています。それらを有効にするには、次を編集します: |
||
| + | |||
| + | {{hc|~/.config/hypr/hyprland.conf|2= |
||
| + | # Enable touchpad gestures |
||
| + | gestures { |
||
| + | workspace_swipe = true |
||
| + | workspace_swipe_fingers = 3 |
||
| + | } |
||
| + | }} |
||
| + | |||
| + | 利用可能なすべてのオプションについては、[https://wiki.hyprland.org/Configuring/Variables/#gestures 上流 Wiki] を参照してください。 |
||
| + | |||
| + | === ディスプレイの設定 === |
||
| + | |||
| + | ==== 画面共有 ==== |
||
| + | |||
| + | [https://wiki.hyprland.org/Useful-Utilities/Screen-Sharing/ Screen-sharing] を参照してください。 |
||
| + | |||
| + | wlroots ベースのコンポジタとして、Hyprland は {{Pkg|xdg-desktop-portal-wlr}} を利用して、[[xdg-desktop-portal]] 経由でさまざまなアプリケーションで画面キャプチャを有効にすることができます。 |
||
| + | |||
| + | Hyprland は、領域共有、ウィンドウ共有、グラフィカルピッカーユーティリティなどの機能を追加した wlr ポータルのフォークである {{Pkg|xdg-desktop-portal-hyprland}} も保守しています。ポータルの使用法については、[https://wiki.hyprland.org/Useful-Utilities/Hyprland-desktop-portal/ Hyprland wiki] で詳しく説明されています。 |
||
| + | |||
| + | ==== 画面解像度の設定 ==== |
||
| + | |||
| + | Hyprland は画面解像度を自動的に検出しようとしますが、複数の画面が存在する場合やハイブリッドラップトップを使用している場合は、場合によっては失敗し、デフォルトでフェールセーフが設定されます。画面上のすべてが大きい場合は、デフォルトのモニターと解像度を設定する必要があります。 |
||
| + | |||
| + | まず、''hyprctl'' を使用してデフォルトのモニターを見つけます: |
||
| + | |||
| + | {{hc|$ hyprctl monitors|2= |
||
| + | Monitor '''eDP-1''' (ID 0): |
||
| + | '''1920x1080@144'''.003006 at '''0x0''' |
||
| + | description: Chimei Innolux Corporation 0x153C (eDP-1) |
||
| + | ... |
||
| + | }} |
||
| + | |||
| + | 次に、モニターを設定に追加します: |
||
| + | |||
| + | {{hc|~/.config/hypr/hyprland.conf|2= |
||
| + | ... |
||
| + | # Monitor details |
||
| + | monitor=eDP-1,1920x1080@144,0x0,1 |
||
| + | ...}} |
||
| + | |||
| + | {{ic|0x0}} はマルチスクリーン設定に使用される位置オフセットで、最後の {{ic|1}} は画面のスケーリング係数です。 |
||
| + | |||
| + | ==== 画面のバックライト ==== |
||
| + | |||
| + | {{Pkg|brightnessctl}} を [[インストール]] して、次のバインドを追加します。 |
||
| + | |||
| + | {{hc|~/.config/hypr/hyprland.conf|2= |
||
| + | # Screen brightness |
||
| + | bind = , XF86MonBrightnessUp, exec, brightnessctl -s +5% |
||
| + | bind = , XF86MonBrightnessDown, exec, brightnessctl -s 5%- |
||
| + | }} |
||
| + | |||
| + | 変更が行われたときに [[Hyprland#画面上の通知|通知]] を実行することもできます。 |
||
== 使用方法 == |
== 使用方法 == |
||
| 34行目: | 166行目: | ||
=== 起動 === |
=== 起動 === |
||
| + | ==== Universal Wayland Session Manager ==== |
||
| − | 現在、Hyprland は TTY から起動することを推奨しています。 |
||
| + | |||
| + | [[Universal Wayland Session Manager|Uwsm]] は、[https://wiki.hyprland.org/Useful-Utilities/Systemd-start/ systemdを使用するディストリビューション(特に Arch Linux) で Hyprland セッションを開始する推奨方法] です。これは、Hyprland と適切に設定されたアプリケーションやデーモンを systemd ユニットファイルを通じてラップし、''systemctl'' を使用して管理できるようにします。 |
||
| + | |||
| + | TTY 上で Hyprland を起動するには、以下のスクリプトを {{ic|~/.profile}} に追加します。 |
||
| + | |||
| + | {{bc|if uwsm check may-start && uwsm select; then |
||
| + | exec systemd-cat -t uwsm_start uwsm start default |
||
| + | fi}} |
||
| + | |||
| + | {{Note| {{ic|uwsm check may-start}} は、Wayland セッションを開始できるかどうか(特にログインシェルから実行されているか)を確認します。ただし、{{ic|.bashrc}} やその他の非ログインシェルでも読み込まれるファイル内で使用することは避けてください。}} |
||
| + | |||
| + | {{Tip|コンポジター選択メニューをバイパスし、直接 Hyprland を起動したい場合は、代わりに以下のコードをシェルのプロファイルに追加してください。 |
||
| + | |||
| + | {{bc| |
||
| + | if uwsm check may-start; then |
||
| + | exec uwsm start hyprland.desktop |
||
| + | fi |
||
| + | }}}} |
||
| + | |||
| + | デスクトップマネージャー経由で起動する場合は、{{ic|hyprland-uwsm.desktop}} エントリを使用するか、デスクトップマネージャー内で ''hyprland (uwsm-managed)'' を選択してください。 |
||
| + | |||
| + | {{Warning|''uwsm'' を使用して Hyprland を起動する場合は、設定を適切に調整する必要があります。特に以下の点に注意してください: |
||
| + | * '''{{ic|exit}} ディスパッチャーを使用したり、Hyprland プロセスを直接終了したりしないでください。''' これは正常なシャットダウン処理を妨げる可能性があります。その代わりに、例えば {{ic|uwsm stop}} または {{ic|loginctl terminate-user ""}} を使用して Hyprland を終了し、ユーザーセッションを終了してください。 |
||
| + | {{hc|1=~/.config/hypr/hyprland.conf|2= bind = $mainMod, M, exec, uwsm stop}} |
||
| + | * 環境変数を {{ic|hyprland.conf}} に記述せず、代わりに ''uwsm'' の設定ファイルを使用してください。uwsm が管理するすべてのグラフィカルセッション (GTK、Qt、xcursor など) に共通の環境変数は {{ic|/.config/uwsm/env}} に、Hyprland 専用の環境変数 (例えば {{ic|HYPR*}} や {{ic|AQ_*}} など) は {{ic|/.config/uwsm/env-hyprland}} に記述してください。これらのファイルのフォーマットは、各行に {{ic|1=export ''KEY''=''VALUE''}} を記述し、コメントは入れないようにします。 |
||
| + | 複数の GPU を使用している場合、他のコンポジターとの競合を避けるため、{{ic|AQ_DRM_DEVICES}} 環境変数を {{ic|env-hyprland}} に記述することを強く推奨します。 |
||
| + | |||
| + | uwsm を使用した設定の詳細については、[https://wiki.hyprland.org/Useful-Utilities/Systemd-start/ Hyprland の公式 Wiki の関連ページ] を参照してください。}} |
||
| + | |||
| + | ==== ターミナル ==== |
||
| + | |||
| + | TTYから以下のコマンドでHyprlandを起動できます。 |
||
$ Hyprland |
$ Hyprland |
||
| + | ==== ディスプレイマネージャー ==== |
||
| − | You can also execute a script of your own, e.g. setting [[環境変数]], that finishes with {{ic|exec Hyprland}}, '''for instance''' (adapt to your needs): |
||
| + | [[ディスプレイマネージャ]] からの起動は公式にはサポートされていませんが、[[GDM]]、[[SDDM]] などからの起動に成功したという報告があります。[https://wiki.hyprland.org/Getting-Started/Master-Tutorial/#launching-hyprland upstream wiki] では、ディスプレイマネージャーとの互換性リストを公開しています。 |
||
| − | {{bc|1= |
||
| + | {{Pkg|hyprland}} パッケージにはディスプレイマネージャーのエントリが含まれており、すべての Hyprland AUR パッケージも自動で生成します。 |
||
| + | |||
| + | どちらの方法でも同じ結果が得られますが、環境変数やサービスの違いが若干ある場合があります。 |
||
| + | |||
| + | ==== 自動ログイン ==== |
||
| + | |||
| + | ユーザーは[[ディスプレイマネージャ]]を使用するか、[[xinit#ログイン時に X を自動起動]] で紹介されている方法を適用することで、自動ログインを設定できます。 |
||
| + | |||
| + | === hyprctl と IPC === |
||
| + | |||
| + | ''hyprctl'' は、Hyprland に付属するコマンドラインユーティリティで、ディスプレイサーバーと通信するために使用されます。 |
||
| + | これを使用すると、サーバーにコマンドを送信 (設定ファイルのコマンドと同様ですが、少し異なる構文を持ちます)、キーワードを設定、クエリの送信、情報の取得ができます。 |
||
| + | 詳細は [https://wiki.hyprland.org/Configuring/Using-hyprctl 公式ドキュメント] を参照してください。 |
||
| + | |||
| + | また、Hyprland は [https://wiki.hyprland.org/IPC/ 2 つの UNIX ソケット] を公開しており、コードやコマンドラインユーティリティを介して Hyprland を制御したり、情報を取得したりできます。 |
||
| + | これらのソケットは、ウィンドウ・ワークスペース・モニターのフォーカス変更、ウィンドウやワークスペースの作成などのイベントをブロードキャストします。 |
||
| + | |||
| + | ''hyprctl'' と IPC ソケットの両方を活用すれば、スクリプトで Hyprland を制御し、複雑なタスクを実行することが可能です。 |
||
| + | |||
| + | === exec と exec-once の違い === |
||
| + | |||
| + | アプリケーションを起動する際は、適切なディスパッチャーを使用することが重要です。{{ic|exec}} を誤って使用すると、アプリケーションが複数回起動し、システムリソースを消費したり、最悪の場合は競合 (レースコンディション) を引き起こし、システムがクラッシュする可能性があります。 |
||
| + | |||
| + | {{Note|[[#設定]] で述べたように、Hyprland は '''設定ファイル ({{ic|hyprland.conf}}) の変更が保存されるたびに自動的にパースします''' そのため、すべてに {{ic|exec}} を使用しないようにしてください。 |
||
| + | |||
| + | 通常、アプリケーションやデーモンの起動には {{ic|exec-once}} を使用すべきです。このコマンドは再読み込み時には再実行されません。逆に、'''再読み込みのたびにコマンドを実行する必要がある場合のみ''' {{ic|exec}} を使用してください。}} |
||
| + | |||
| + | {{Tip|Hyprland を Universal Wayland Session Manager (uwsm) 経由で起動しており、起動したいアプリケーションが systemd ユニットを提供している場合は、それを [[有効化]] することで、Hyprland の準備が整った際に自動的に起動できます。そうでない場合は、{{ic|uwsm app}} にアプリケーションを引数として渡すことで、''uwsm'' によって管理できます。 |
||
| + | |||
| + | 例えば: {{hc|1=~/.config/hypr/hyprland.conf|2=exec-once = uwsm app -- mycommand --arg1 --arg2 |
||
| + | bind = SUPER, E, exec, uwsm app -- pcmanfm-qt.desktop}}}} |
||
| + | |||
| + | === 環境変数の設定 === |
||
| + | |||
| + | [[環境変数]] は、{{ic|hyprland.conf}} 内で ''env'' キーワードを使用して直接設定できます。ただし、''env'' の構文は、シェルで使用される UNIX コマンド ''env'' とは異なります。 |
||
| + | |||
| + | この違いについては、[https://wiki.hyprland.org/Configuring/Environment-variables/ 上流の Wiki] で説明されています。 |
||
| + | |||
| + | == Hypr-Ecosystem == |
||
| + | |||
| + | {{Warning|以下のセクションで紹介されているツールの一部はまだ開発中であり、バグが発生する可能性があります。そのため、完全な手順や具体例は安定するまで省略されています。詳細な使用方法については、[https://wiki.hyprland.org/Hypr-Ecosystem/ Wiki] を参照してください。}} |
||
| + | |||
| + | Hyprland 開発チームは、Hyprland 専用のアプリケーションエコシステムを構築しています。これらのツールには、スクリプトに頼ることなく、{{ic|hyprctl}} を使用して制御できるディスパッチャーが含まれます。 |
||
| + | |||
| + | 現在、このエコシステムには以下のツールが含まれています。 |
||
| + | |||
| + | === Hyprpaper === |
||
| + | |||
| + | Hyprpaperは壁紙管理ツールです。{{Pkg|hyprpaper}} パッケージでインストールできます。 |
||
| + | |||
| + | === Hyprpicker=== |
||
| + | |||
| + | Hyprpicker はデスクトップ上の色を取得するためのユーティリティです。{{Pkg|hyprpicker}} パッケージでインストールできます。 |
||
| + | |||
| + | === Hypridle === |
||
| + | |||
| + | Hypridle はアイドル管理デーモンです。{{Pkg|hypridle}} パッケージでインストールできます。 |
||
| + | |||
| + | === Hyprlock === |
||
| + | |||
| + | Hyprlock はスクリーンロックマネージャーです。{{Pkg|hyprlock}} パッケージでインストールできます。 |
||
| + | |||
| + | === Hyprcursor === |
||
| + | |||
| + | Hyprcursorは、新しいカーソル管理フォーマットを提供するツールで、従来の方法に比べて多くの改善をもたらします。{{Pkg|hyprcursor}} パッケージでインストールできます。 |
||
| + | |||
| + | ==== Hyprcursor themes ==== |
||
| + | |||
| + | {{Tip|Hyprcursor をインストールしても、テーマをインストールしない場合は、従来のカーソル設定が適用されます。}} |
||
| + | |||
| + | カーソルテーマは [[AUR]] からインストールできます。例えば、以下のようなものがあります: |
||
| + | |||
| + | * {{AUR|sweet-cursors-hyprcursor-git}} |
||
| + | * {{AUR|nordzy-hyprcursors}} |
||
| + | * {{AUR|xcursor-pro-hyprcursor}} |
||
| + | * {{AUR|hyprcursor-dracula-kde-git}} |
||
| + | |||
| + | 既存のテーマを Hyprcursor 用に移植する方法については、[https://github.com/hyprwm/hyprcursor/tree/main/docs 上流の GitHub リポジトリ] に記載されています。 |
||
| + | |||
| + | === xdg-desktop-portal-hyprland === |
||
| + | |||
| + | Hyprland 独自の [[XDG デスクトップ ポータル|XDG Desktop Portal]] 実装です。他の {{Pkg|wlroots}} ベースのコンポジターとも互換性がありますが、Hyprland 上で使用すると追加機能が利用できます。{{Pkg|xdg-desktop-portal-hyprland}} パッケージで入手可能です。 |
||
| + | |||
| + | == ヒントとテクニック == |
||
| + | |||
| + | {{Note| |
||
| + | * 以下のすべてのセクションでは、通常、同様の結果を達成する方法が複数あります。ここで提供するものはすべて基本的な例です。 |
||
| + | * 代替手段の包括的なリストについては、[[アプリケーション一覧]] を参照してください。Hyprland 固有のリストは、[https://wiki.hyprland.org/Useful-Utilities/ 上流 Wiki] にあります。 |
||
| + | }} |
||
| + | |||
| + | === ファイルマネージャー === |
||
| + | |||
| + | グラフィカルなファイル管理が必要な場合、Hyprland には Wayland 互換の外部アプリケーションが必要です。例として {{Pkg|thunar}} を使用すると、次のようにキーバインドを割り当てるだけで済みます。 |
||
| + | |||
| + | {{hc|~/.config/hypr/hyprland.conf|2= |
||
| + | ... |
||
| + | bind = SUPER, E, exec, thunar |
||
| + | ... |
||
| + | }} |
||
| + | |||
| + | === アプリケーションランチャー === |
||
| + | |||
| + | Hyprland では、アプリケーションを起動するために Wayland と互換性のある外部アプリケーションが必要です。例として {{Pkg|wofi}} を使用すると、次のようにキーバインドを割り当てるだけで済みます。 |
||
| + | |||
| + | {{hc|~/.config/hypr/hyprland.conf|2= |
||
| + | ... |
||
| + | bind = SUPER, F, exec, wofi |
||
| + | ... |
||
| + | }} |
||
| + | |||
| + | === アイドル状態 === |
||
| + | |||
| + | Hyprland には、Wayland 互換の外部アイドル管理デーモンが必要です。最も一般的なセットアップは、{{Pkg|swayidle}} と {{Pkg|swaylock}} です。次のようにバインドを使用して画面を手動でロックできます。 |
||
| + | |||
| + | {{hc|~/.config/hypr/hyprland.conf|2= |
||
| + | ... |
||
| + | bind = SUPER, L, exec, swaylock -f -c 000000 |
||
| + | ... |
||
| + | }} |
||
| + | |||
| + | ==== 自動画面ロックとサスペンド ==== |
||
| + | |||
| + | 次のスクリプトを作成します: |
||
| + | |||
| + | {{hc|~/.config/hypr/scripts/sleep.sh|2= |
||
| + | swayidle -w timeout 300 'swaylock -f -c 000000' \ |
||
| + | timeout 600 'systemctl suspend' \ |
||
| + | before-sleep 'swaylock -f -c 000000' & |
||
| + | }} |
||
| + | |||
| + | {{Tip| |
||
| + | * 数値を編集することでタイムアウト期間を秒単位で調整できます。300 は 5 分、600 は 10 分などです。 |
||
| + | * スクリプトは [[ヘルプ:読み方#実行可能属性の付与|実行可能ファイル]] である必要があります。 |
||
| + | }} |
||
| + | |||
| + | 次に、それを呼び出します: |
||
| + | |||
| + | {{hc|~/.config/hypr/hyprland.conf|2= |
||
| + | ... |
||
| + | exec-once = ~/.config/hypr/scripts/sleep.sh |
||
| + | ... |
||
| + | }} |
||
| + | |||
| + | ==== タイムアウト期間後に DPMS を使用して画面をオフにする ==== |
||
| + | |||
| + | Hyprland には DPMS リクエストを処理する組み込みディスパッチャがありますが、これを直接キーバインドとして使用することはお勧めできません。使用すると、画面を再びオンにできなくなり、再起動が必要になります。 |
||
| + | |||
| + | 上記のスクリプトを編集して次のように変更します: |
||
| + | |||
| + | {{hc|~/.config/hypr/scripts/sleep.sh|2= |
||
| + | swayidle -w timeout 300 'swaylock -f -c 000000' \ |
||
| + | timeout 600 'hyprctl dispatch dpms off' \ |
||
| + | resume 'hyprctl dispatch dpms on' \ |
||
| + | timeout 900 'systemctl suspend' \ |
||
| + | before-sleep 'swaylock -f -c 000000' & |
||
| + | }} |
||
| + | |||
| + | {{Tip|''resume'' コマンドは前のコマンドにリンクされているため、正しく機能するには、{{ic|hyprctldispatch dpms on}} コマンドをスクリプト内の {{ic|hyprctldispatch dpms off}} コマンドの直後に指定する必要があります。}} |
||
| + | |||
| + | ===== アプリケーションの使用中に DPMS を停止する ===== |
||
| + | |||
| + | 上記の設定を行うと、ゲームをプレイしたり、ビデオを見たり、音楽を聴いたりするなど、タイムアウト期間を超えてシステムに触らない可能性のある作業を行っているときにモニターの電源がオフになります。 |
||
| + | |||
| + | これを修正するには、{{ic|idleinhibit}} ルールを持つ [https://wiki.hyprland.org/Cconfiguring/Window-Rules#window-rules-v2 Window Rules V2] 関数に組み込まれた Hyprlands を使用するか、{{AUR|idlehack-git}} または {{AUR|sway-audio-idle-inhibit-git}} のいずれかをインストールします。前者は、[[Firefox]] または [[Chromium]] がオーディオ/ビデオを再生しているときは常に [[D-Bus]] を使用して Swayidle リクエストを防止します。後者は、アプリケーションがオーディオを再生しているときは常に Swayidle リクエストを阻止します。 |
||
| + | |||
| + | スクリーンセーバーを一時停止するために {{ic|org.freedesktop.ScreenSaver.inhibit}} を使うプログラムについては、{{AUR|wscreensaver-bridge-git}} をインストールすることで Hyprland (または {{ic|idle-inhibit}} プロトコルをサポートする Wayland コンポジター) に実装することができます。 |
||
| + | |||
| + | === ステータスバー === |
||
| + | |||
| + | Hyprland でステータス バーを表示するには、Wayland 互換の外部アプリケーションが必要です。例として {{Pkg|waybar}} を使用すると、次のように呼び出すだけで済みます: |
||
| + | |||
| + | {{hc|~/.config/hypr/hyprland.conf|2= |
||
| + | ... |
||
| + | exec-once = waybar -c ~/.config/waybar/waybar.conf |
||
| + | ... |
||
| + | }} |
||
| + | |||
| + | ==== ワークスペースの概要 ==== |
||
| + | |||
| + | {{Pkg|waybar}} には、Hyprland ワークスペースの切り替えをネイティブにサポートする、完全にカスタマイズ可能なモジュールが組み込まれています。 |
||
| + | |||
| + | 詳細については、waybar Wiki [https://github.com/Alexays/Waybar/wiki/Module:-Workspaces] を参照してください。 |
||
| + | |||
| + | === Polkit 認証 === |
||
| + | |||
| + | [[Polkit]] 認証には、外部 [[Polkit#Authentication エージェント|認証エージェント]] の使用が必要です。Hyprland では {{Pkg|polkit-kde-agent}} の使用を推奨していますが、どれでも機能するはずです。 |
||
| + | |||
| + | 次のように呼び出します: |
||
| + | |||
| + | {{hc|~/.config/hypr/hyprland.conf|2= |
||
| + | ... |
||
| + | exec-once = /usr/lib/polkit-kde-authentication-agent-1 |
||
| + | ... |
||
| + | }} |
||
| + | |||
| + | === デスクトップの壁紙 === |
||
| + | |||
| + | Hyprland では、デスクトップの壁紙を管理するために、Wayland と互換性のある外部アプリケーションが必要です。例として {{AUR|swww}} を使用すると、次のように呼び出すだけで済みます: |
||
| + | |||
| + | {{hc|~/.config/hypr/hyprland.conf|2= |
||
| + | ... |
||
| + | exec-once = swww init |
||
| + | exec-once = swww img ''path/to/image'' |
||
| + | ... |
||
| + | }} |
||
| + | |||
| + | ==== スクリプトを使用して X 分ごとに壁紙を変更する ==== |
||
| + | |||
| + | 次のスクリプトを作成し、[[ヘルプ:読み方#実行可能属性の付与|実行可能ファイル]] であることを確認します: |
||
| + | |||
| + | {{hc|~/.config/hypr/scripts/swww-random|2=<nowiki> |
||
#!/bin/bash |
#!/bin/bash |
||
| + | |||
| − | export SDL_VIDEODRIVER=wayland |
||
| + | # This script will randomly go through the files of a directory, setting it |
||
| − | export MOZ_ENABLE_WAYLAND=1 |
||
| + | # up as the wallpaper at regular intervals |
||
| − | export GTK_THEME=Catppuccin-blue:dark |
||
| + | # |
||
| − | exec Hyprland |
||
| + | # NOTE: this script uses bash (not POSIX shell) for the RANDOM variable |
||
| + | |||
| + | if [[ $# -lt 1 ]] || [[ ! -d $1 ]]; then |
||
| + | echo "Usage: |
||
| + | $0 <dir containing images>" |
||
| + | exit 1 |
||
| + | fi |
||
| + | |||
| + | # Edit below to control the images transition |
||
| + | export SWWW_TRANSITION_FPS=144 |
||
| + | export SWWW_TRANSITION_STEP=2 |
||
| + | export SWWW_TRANSITION_TYPE=random |
||
| + | |||
| + | # This controls (in seconds) when to switch to the next image |
||
| + | INTERVAL=300 |
||
| + | |||
| + | while true; do |
||
| + | find "$1" \ |
||
| + | | while read -r img; do |
||
| + | echo "$((RANDOM % 1000)):$img" |
||
| + | done \ |
||
| + | | sort -n | cut -d':' -f2- \ |
||
| + | | while read -r img; do |
||
| + | swww img "$img" |
||
| + | sleep $INTERVAL |
||
| + | done |
||
| + | done |
||
| + | </nowiki> |
||
}} |
}} |
||
| + | 次に、背景画像を保存する新しいフォルダーを作成します。{{ic|~/.config/hypr/backgrounds}} のようなフォルダーを作成し、そこに必要な画像を追加します。 |
||
| − | While launching from a [[ディスプレイマネージャ]] is not officially supported, users have reported success launching from [[GDM]], [[SDDM]], and others. All Hyprland AUR packages will generate a display manager entry automatically. If manually installing from source, an example {{ic|Hyprland.desktop}} file is provided in the example directory of the source code, which may be copied to {{ic|/usr/share/wayland-sessions/}} to provide a display manager entry. |
||
| + | 最後にスクリプトを呼び出します: |
||
| − | Both methods provide identical results, plus or minus a few environment variables and services. |
||
| + | {{hc|~/.config/hypr/hyprland.conf|2= |
||
| − | === hyprctl and IPC === |
||
| + | ... |
||
| + | exec-once = swww init |
||
| + | exec-once = ~/.config/hypr/scripts/swww-random ~/.config/hypr/background |
||
| + | ... |
||
| + | }} |
||
| + | === 画面上の通知 === |
||
| − | ''hyprctl'' is a command line utility that comes installed with Hyprland to communicate with the display server. It allows you to dispatch commands to the server (equivalent to commands in the configuration file, but with a slightly different syntax), set keywords, send queries and request information. See the [https://github.com/vaxerski/Hyprland/wiki/Using-hyprctl full documentation]. |
||
| + | 外部通知デーモンを使用すると、明るさや音量の変更などのアクションを画面上で通知できます。これは非常に複雑なトピックなので、完全に説明することはこのページの範囲を超えています。むしろ、このセクションでは {{Pkg|mako}} に焦点を当てますので、[[インストール]] してください。 |
||
| − | Hyprland also exposes [https://github.com/vaxerski/Hyprland/wiki/IPC 2 UNIX Sockets], for controlling and getting information about Hyprland via code or command-line utilities. These sockets broadcast events on focus change (windows, workspaces, monitors), creation of windows/workspace, and so on. |
||
| + | 詳細な手順については [[デスクトップ通知]] を、代替手段のリストについては [[デスクトップ通知#スタンドアロン]] を参照してください。 |
||
| − | Both ''hyprctl'' and the IPC sockets can be effectively used in scripts to control Hyprland for complex tasks. |
||
| + | {{Note| |
||
| − | == 設定 == |
||
| + | * ここで提供されるすべてのスクリプトは例であり、セットアップに合わせて調整する必要があります。 |
||
| + | * このセクションのすべてのスクリプトは [[ヘルプ:読み方#実行可能属性の付与|実行可能ファイル]] である必要があります。 |
||
| + | }} |
||
| + | ==== Mako ==== |
||
| − | 設定は 1 つの設定ファイル、[https://github.com/vaxerski/Hyprland/blob/main/example/hyprland.conf hyprland.conf] を通して行われます。パッケージマネージャで Hyprland をインストールした場合、おそらく /usr/share/hyprland/hyprland.conf にあります。ソースからインストールした場合は、Hyprland をクローンしたレポジトリにあります。hyprland.conf を {{ic|~/.config/hypr/hyprland.conf}} にコピーしてください。 |
||
| + | Mako は軽量の通知デーモンです。詳細については、{{man|5|mako}} を参照してください。設定ファイルは {{ic|~/.config/mako/config}} で、OSD に使用されるアイコンは {{ic|~/.config/mako/icons/}} に保存されており、PNG 形式である必要があります。 |
||
| − | {{ic|hyprland.conf}} には、デバイス (モニタ、キーボード、マウス、トラックパッド) を設定するディレクティブと、アニメーション、装飾、レイアウトなどの設定が含まれています。キーバインディングやウィンドウのルールを設定したり、コマンドを実行したりできます (一度だけ、あるいはコンフィグが再読み込みされるたびに)。 |
||
| + | このセクションの残りの部分では、スクリプトで使用されるすべてのイメージは [https://github.com/SolDoesTech/HyprV4/tree/main/HyprV/mako/icons この GitHub フォルダー] から入手できます。 |
||
| − | ファイルを更新するたびに設定が自動的にリロードされます。同じ効果を得るために {{ic|hyprctl reload}} を使うこともできます。いくつかの設定(特に入力設定)については、Hyprland セッションを再起動する必要があるかもしれません。 |
||
| + | ===== キーボードのバックライト通知 ===== |
||
| − | 設定は {{ic|hyprctl}} を使用してその場で変更することもできますが、保存されません。 |
||
| + | |||
| + | まず次のスクリプトを作成します: |
||
| + | |||
| + | {{hc|~/.config/hypr/scripts/kbbacklight|2= |
||
| + | <nowiki> |
||
| + | #!/usr/bin/env bash |
||
| + | |||
| + | iDIR="$HOME/.config/mako/icons" |
||
| + | |||
| + | # Get brightness |
||
| + | get_backlight() { |
||
| + | LIGHT="$(cat /sys/class/leds/*::kbd_backlight/brightness)" |
||
| + | echo "${LIGHT}" |
||
| + | } |
||
| + | |||
| + | # Get icons |
||
| + | get_icon() { |
||
| + | current="$(cat /sys/class/leds/*::kbd_backlight/brightness)" |
||
| + | |||
| + | if [[ ("$current" -ge "0") && ("$current" -le "1") ]]; then |
||
| + | icon="$iDIR/brightness-20.png" |
||
| + | elif [[ ("$current" -ge "1") && ("$current" -le "2") ]]; then |
||
| + | icon="$iDIR/brightness-60.png" |
||
| + | elif [[ ("$current" -ge "2") && ("$current" -le "3") ]]; then |
||
| + | icon="$iDIR/brightness-100.png" |
||
| + | fi |
||
| + | } |
||
| + | |||
| + | # Notify |
||
| + | notify_user() { |
||
| + | notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$icon" "Keyboard Brightness : $(brightnessctl -d '*::kbd_backlight' g)" |
||
| + | } |
||
| + | |||
| + | # Increase brightness |
||
| + | inc_backlight() { |
||
| + | brightnessctl -d *::kbd_backlight set 33%+ && get_icon && notify_user |
||
| + | } |
||
| + | |||
| + | # Decrease brightness |
||
| + | dec_backlight() { |
||
| + | brightnessctl -d *::kbd_backlight set 33%- && get_icon && notify_user |
||
| + | } |
||
| + | |||
| + | # Zero brightness |
||
| + | zero_backlight() { |
||
| + | brightnessctl -d *::kbd_backlight s 0% |
||
| + | } |
||
| + | |||
| + | # Full brightness |
||
| + | full_backlight() { |
||
| + | brightnessctl -d *::kbd_backlight s 100% |
||
| + | } |
||
| + | |||
| + | # Execute accordingly |
||
| + | if [[ "$1" == "--get" ]]; then |
||
| + | brightnessctl -d '*::kbd_backlight' g |
||
| + | elif [[ "$1" == "--inc" ]]; then |
||
| + | inc_backlight |
||
| + | elif [[ "$1" == "--dec" ]]; then |
||
| + | dec_backlight |
||
| + | elif [[ "$1" == "--zero" ]]; then |
||
| + | zero_backlight |
||
| + | elif [[ "$1" == "--full" ]]; then |
||
| + | full_backlight |
||
| + | |||
| + | else |
||
| + | get_backlight |
||
| + | fi |
||
| + | </nowiki> |
||
| + | }} |
||
| + | |||
| + | 次に、以下を追加します (または既存のバインドを編集します): |
||
| + | |||
| + | {{hc|~/.config/hypr/hyprland.conf|2= |
||
| + | # Keyboard brightness |
||
| + | bind = SUPER, F2, exec, ~/.config/hypr/scripts/kbbacklight --dec |
||
| + | bind = SUPER, F3, exec, ~/.config/hypr/scripts/kbbacklight --inc |
||
| + | }} |
||
| + | |||
| + | ===== メディアキーの通知 ===== |
||
| + | |||
| + | まず次のスクリプトを作成します: |
||
| + | |||
| + | {{hc|~/.config/hypr/scripts/volume|2=<nowiki> |
||
| + | #!/usr/bin/env bash |
||
| + | |||
| + | iDIR="$HOME/.config/mako/icons" |
||
| + | |||
| + | # Get Volume |
||
| + | get_volume() { |
||
| + | volume=$(pamixer --get-volume) |
||
| + | echo "$volume" |
||
| + | } |
||
| + | |||
| + | # Get icons |
||
| + | get_icon() { |
||
| + | current=$(get_volume) |
||
| + | if [[ "$current" -eq "0" ]]; then |
||
| + | echo "$iDIR/volume-mute.png" |
||
| + | elif [[ ("$current" -ge "0") && ("$current" -le "30") ]]; then |
||
| + | echo "$iDIR/volume-low.png" |
||
| + | elif [[ ("$current" -ge "30") && ("$current" -le "60") ]]; then |
||
| + | echo "$iDIR/volume-mid.png" |
||
| + | elif [[ ("$current" -ge "60") && ("$current" -le "100") ]]; then |
||
| + | echo "$iDIR/volume-high.png" |
||
| + | fi |
||
| + | } |
||
| + | |||
| + | # Notify |
||
| + | notify_user() { |
||
| + | notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$(get_icon)" "Volume : $(get_volume) %" |
||
| + | } |
||
| + | |||
| + | # Increase Volume |
||
| + | inc_volume() { |
||
| + | pamixer -i 5 && notify_user |
||
| + | } |
||
| + | |||
| + | # Decrease Volume |
||
| + | dec_volume() { |
||
| + | pamixer -d 5 && notify_user |
||
| + | } |
||
| + | |||
| + | # Toggle Mute |
||
| + | toggle_mute() { |
||
| + | if [ "$(pamixer --get-mute)" == "false" ]; then |
||
| + | pamixer -m && notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$iDIR/volume-mute.png" "Volume Switched OFF" |
||
| + | elif [ "$(pamixer --get-mute)" == "true" ]; then |
||
| + | pamixer -u && notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$(get_icon)" "Volume Switched ON" |
||
| + | fi |
||
| + | } |
||
| + | |||
| + | # Toggle Mic |
||
| + | toggle_mic() { |
||
| + | if [ "$(pamixer --default-source --get-mute)" == "false" ]; then |
||
| + | pamixer --default-source -m && notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$iDIR/microphone-mute.png" "Microphone Switched OFF" |
||
| + | elif [ "$(pamixer --default-source --get-mute)" == "true" ]; then |
||
| + | pamixer -u --default-source u && notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$iDIR/microphone.png" "Microphone Switched ON" |
||
| + | fi |
||
| + | } |
||
| + | # Get icons |
||
| + | get_mic_icon() { |
||
| + | current=$(pamixer --default-source --get-volume) |
||
| + | if [[ "$current" -eq "0" ]]; then |
||
| + | echo "$iDIR/microphone.png" |
||
| + | elif [[ ("$current" -ge "0") && ("$current" -le "30") ]]; then |
||
| + | echo "$iDIR/microphone.png" |
||
| + | elif [[ ("$current" -ge "30") && ("$current" -le "60") ]]; then |
||
| + | echo "$iDIR/microphone.png" |
||
| + | elif [[ ("$current" -ge "60") && ("$current" -le "100") ]]; then |
||
| + | echo "$iDIR/microphone.png" |
||
| + | fi |
||
| + | } |
||
| + | # Notify |
||
| + | notify_mic_user() { |
||
| + | notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$(get_mic_icon)" "Mic-Level : $(pamixer --default-source --get-volume) %" |
||
| + | } |
||
| + | |||
| + | # Increase MIC Volume |
||
| + | inc_mic_volume() { |
||
| + | pamixer --default-source -i 5 && notify_mic_user |
||
| + | } |
||
| + | |||
| + | # Decrease MIC Volume |
||
| + | dec_mic_volume() { |
||
| + | pamixer --default-source -d 5 && notify_mic_user |
||
| + | } |
||
| + | |||
| + | # Execute accordingly |
||
| + | if [[ "$1" == "--get" ]]; then |
||
| + | get_volume |
||
| + | elif [[ "$1" == "--inc" ]]; then |
||
| + | inc_volume |
||
| + | elif [[ "$1" == "--dec" ]]; then |
||
| + | dec_volume |
||
| + | elif [[ "$1" == "--toggle" ]]; then |
||
| + | toggle_mute |
||
| + | elif [[ "$1" == "--toggle-mic" ]]; then |
||
| + | toggle_mic |
||
| + | elif [[ "$1" == "--get-icon" ]]; then |
||
| + | get_icon |
||
| + | elif [[ "$1" == "--get-mic-icon" ]]; then |
||
| + | get_mic_icon |
||
| + | elif [[ "$1" == "--mic-inc" ]]; then |
||
| + | inc_mic_volume |
||
| + | elif [[ "$1" == "--mic-dec" ]]; then |
||
| + | dec_mic_volume |
||
| + | else |
||
| + | get_volume |
||
| + | fi |
||
| + | </nowiki>}} |
||
| + | |||
| + | 次に、以下を追加します (または既存のバインドを編集します): |
||
| + | |||
| + | {{hc|~/.config/hypr/hyprland.conf|2= |
||
| + | # Volume |
||
| + | bind = , XF86AudioRaiseVolume, exec, ~/.config/hypr/scripts/volume --inc |
||
| + | bind = , XF86AudioLowerVolume, exec, ~/.config/hypr/scripts/volume --dec |
||
| + | bind = , XF86AudioMicMute, exec, ~/.config/hypr/scripts/volume --toggle-mic |
||
| + | bind = , XF86AudioMute, exec, ~/.config/hypr/scripts/volume --toggle |
||
| + | }} |
||
| + | |||
| + | ===== 画面のバックライト通知 ===== |
||
| + | |||
| + | まず次のスクリプトを作成します: |
||
| + | |||
| + | {{hc|~/.config/hypr/scripts/backlight|2=<nowiki> |
||
| + | !/usr/bin/env bash |
||
| + | |||
| + | iDIR="$HOME/.config/mako/icons" |
||
| + | |||
| + | # Get brightness |
||
| + | get_backlight() { |
||
| + | LIGHT=$(printf "%.0f\n" $(brightnessctl g)) |
||
| + | echo "${LIGHT}" |
||
| + | } |
||
| + | |||
| + | # Get icons |
||
| + | get_icon() { |
||
| + | current="$(get_backlight)" |
||
| + | if [[ ("$current" -ge "0") && ("$current" -le "19200") ]]; then |
||
| + | icon="$iDIR/brightness-20.png" |
||
| + | elif [[ ("$current" -ge "19200") && ("$current" -le "38400") ]]; then |
||
| + | icon="$iDIR/brightness-40.png" |
||
| + | elif [[ ("$current" -ge "38400") && ("$current" -le "57600") ]]; then |
||
| + | icon="$iDIR/brightness-60.png" |
||
| + | elif [[ ("$current" -ge "57600") && ("$current" -le "76800") ]]; then |
||
| + | icon="$iDIR/brightness-80.png" |
||
| + | elif [[ ("$current" -ge "76800") && ("$current" -le "96000") ]]; then |
||
| + | icon="$iDIR/brightness-100.png" |
||
| + | fi |
||
| + | } |
||
| + | |||
| + | # Notify |
||
| + | notify_user() { |
||
| + | notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$icon" "Brightness : $(get_backlight)" |
||
| + | } |
||
| + | |||
| + | # Increase brightness |
||
| + | inc_backlight() { |
||
| + | brightnessctl s +5% && get_icon && notify_user |
||
| + | } |
||
| + | |||
| + | # Decrease brightness |
||
| + | dec_backlight() { |
||
| + | brightnessctl s 5%- && get_icon && notify_user |
||
| + | } |
||
| + | |||
| + | # Execute accordingly |
||
| + | if [[ "$1" == "--get" ]]; then |
||
| + | get_backlight |
||
| + | elif [[ "$1" == "--inc" ]]; then |
||
| + | inc_backlight |
||
| + | elif [[ "$1" == "--dec" ]]; then |
||
| + | dec_backlight |
||
| + | else |
||
| + | get_backlight |
||
| + | fi |
||
| + | </nowiki>}} |
||
| + | |||
| + | 次に、以下を追加します (または既存のバインドを編集します): |
||
| + | |||
| + | {{hc|~/.config/hypr/hyprland.conf|2= |
||
| + | # Screen brightness |
||
| + | bind = , XF86MonBrightnessUp, exec, ~/.config/hypr/scripts/backlight --inc |
||
| + | bind = , XF86MonBrightnessDown, exec, ~/.config/hypr/scripts/backlight --dec |
||
| + | }} |
||
| + | |||
| + | ===== キーボード言語の通知 ===== |
||
| + | |||
| + | このスクリプトを実行するには、コマンドライン JSON プロセッサ {{AUR|gojq}} が必要です。 |
||
| + | |||
| + | まず次のスクリプトを作成します: |
||
| + | |||
| + | {{hc|~/.config/hypr/scripts/lang|2=<nowiki> |
||
| + | #!/usr/bin/env bash |
||
| + | |||
| + | icon="$HOME/.config/mako/icons/language.png" |
||
| + | |||
| + | # Get language |
||
| + | get_lang() { |
||
| + | lang=$(hyprctl devices -j | gojq -r '.keyboards[] | select(.name == "at-translated-set-2-keyboard") | .active_keymap' | cut -c 1-2 | tr 'A-Z' 'a-z') |
||
| + | case $lang in |
||
| + | en) |
||
| + | lang="English language" |
||
| + | ;; |
||
| + | ru) |
||
| + | lang="Русский язык" |
||
| + | ;; |
||
| + | uk) |
||
| + | lang="Українська мова" |
||
| + | ;; |
||
| + | esac |
||
| + | echo $lang |
||
| + | } |
||
| + | |||
| + | # Notify |
||
| + | notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$icon" "$(get_lang)" |
||
| + | </nowiki>}} |
||
| + | |||
| + | 次に、以下を追加します (または既存のバインドを編集します): |
||
| + | |||
| + | {{hc|~/.config/hypr/hyprland.conf|2= |
||
| + | device:at-translated-set-2-keyboard { |
||
| + | kb_layout = us,ru,ua |
||
| + | kb_variant = lang |
||
| + | kb_options = grp:win_space_toggle |
||
| + | } |
||
| + | |||
| + | # Language |
||
| + | bind = SUPER, SPACE, exec, ~/.config/hypr/scripts/lang |
||
| + | }} |
||
| + | |||
| + | === 電源制御 === |
||
| + | |||
| + | Hyprland では、電源制御のために Wayland 互換の外部アプリケーションが必要です。例として {{AUR|nwg-bar}} を使用すると、次のようにバインドするだけで済みます: |
||
| + | |||
| + | {{hc|~/.config/hypr/hyprland.conf|2= |
||
| + | ... |
||
| + | bind = SUPER, ESCAPE, exec, nwg-bar |
||
| + | ... |
||
| + | }} |
||
| + | |||
| + | === クリップボード === |
||
| + | |||
| + | [[Wayland]] クリップボードの動作により、コピー元のアプリケーションを閉じるとデータが削除されます。他のデスクトップ環境では、専用のクリップボードマネージャーを使用することでこの問題を回避できますが、Hyprland には互換性のある選択肢が複数あります。詳細については、[https://wiki.hyprland.org/Useful-Utilities/Clipboard-Managers/ 上流 Wiki] を参照してください。 |
||
| + | |||
| + | このセクションでは、テキストだけでなく画像のコピーもサポートしている {{Pkg|cliphist}} について説明します。まず、次の行を追加します: |
||
| + | |||
| + | {{hc|~/.config/hypr/hyprland.conf|2= |
||
| + | ... |
||
| + | exec-once = wl-paste --type text --watch cliphist store |
||
| + | exec-once = wl-paste --type image --watch cliphist store |
||
| + | ... |
||
| + | }} |
||
| + | |||
| + | 次に、選択した [[Hyprland#アプリケーションランチャー|アプリケーションランチャー]] の履歴を呼び出すバインドを作成します: |
||
| + | |||
| + | {{hc|~/.config/hypr/hyprland.conf|2= |
||
| + | ... |
||
| + | bind = SUPER, V, exec, cliphist list {{!}} wofi --dmenu {{!}} cliphist decode {{!}} wl-copy |
||
| + | ... |
||
| + | }} |
||
| + | |||
| + | {{ic|Super+v}} を押すと、{{ic|wofi}} ウィンドウが開き、クリップボード履歴リストが表示されます。 |
||
| + | |||
| + | === デバイスの有効化/無効化 === |
||
| + | |||
| + | デバイス(例:タッチパッド)を有効化または無効化するには、まず |
||
| + | $ hyprctl devices |
||
| + | を使用してデバイスの名前を調べます。 |
||
| + | |||
| + | 以下のコード行を設定ファイルに追加し(上記で照会したデバイス名で<device_name>を置き換えて)、デバイスをオン/オフにします: |
||
| + | |||
| + | {{hc|~/.config/hypr/hyprland.conf|2= |
||
| + | |||
| + | device:<device_name> { |
||
| + | enabled = {true/false} |
||
| + | } |
||
| + | |||
| + | }} |
||
| + | |||
| + | デバイスを動的にオン/オフするには、hyprctlを使用します: |
||
| + | |||
| + | $ hyprctl keyword "device:<device_name>:enabled" {true|false} |
||
| + | |||
| + | また、キーバインドを作成することもできます。例えば: |
||
| + | {{hc|~/.config/hypr/hyprland.conf|2= |
||
| + | ... |
||
| + | bind = $mainMod, t, exec, hyprctl keyword "device:pixa3854:00-093a:0274-touchpad:enabled" false |
||
| + | bind = $mainMod Shift, t, exec, hyprctl keyword "device:pixa3854:00-093a:0274-touchpad:enabled" true |
||
| + | ... |
||
| + | }} |
||
| + | |||
| + | === 別の dconf プロファイルを使用する === |
||
| + | |||
| + | 他の GTK ベースのデスクトップ環境 (DE) の設定を汚染したくない場合は、個別の {{ic|dconf}} プロファイルを使用できます。例えば、以下の手順で設定できます。 |
||
| + | |||
| + | 新しいグローバル dconf プロファイルを宣言します: |
||
| + | {{hc|/etc/dconf/profile/hyprland|2= |
||
| + | user-db:hyprland |
||
| + | }} |
||
| + | |||
| + | {{hc|~/.config/hypr/hyprland.conf|2= |
||
| + | ... |
||
| + | env = DCONF_PROFILE, hyprland |
||
| + | ... |
||
| + | }} |
||
| + | |||
| + | これで、''gsettings'' を使用しても他のデスクトップ環境に影響を与えず、Hyprland 用の独立した設定を管理できます。 |
||
| + | |||
| + | == トラブルシューティング == |
||
| + | |||
| + | === xdg-desktop-portal-hyprland が大量の CPU を使用する === |
||
| + | |||
| + | これは既知のバグ [https://github.com/hyprwm/xdg-desktop-portal-hyprland/issues/103] であり、最新の [[Git]] ビルドでは解決されているはずです。これを回避するには、[https://wiki.hyprland.org/Useful-Utilities/Hyprland-desktop-portal/#usage こちら] Hyprland wiki で説明されているように、スクリプトを {{ic|hyprland.conf}} ファイルで呼び出すことで回避できます。 |
||
| + | |||
| + | === NVIDIA 環境でのネイティブ (Wayland) Electron アプリのちらつき問題 === |
||
| + | |||
| + | Hyprland を使用している NVIDIA ユーザーの間で広く報告されている問題です ([https://github.com/hyprwm/Hyprland/issues/6701]、[https://github.com/hyprwm/Hyprland/issues/6703]) |
||
| + | これは、Hyprland における明示的同期 (explicit sync) のサポート不足が原因とされています ([https://github.com/hyprwm/Hyprland/issues/4857]) |
||
| + | この問題の推奨される一時的な対策として、該当するアプリケーションを X11 (XWayland) で動作させる方法があります。 |
||
| − | 設定方法は [https://github.com/vaxerski/Hyprland/wiki Hyprland wiki] に記載されています。 |
||
| + | 具体的には、アプリケーションの起動時に {{ic|1=--ozone-platform-hint=x11}} を指定するか、すべての Electron アプリを XWayland で動作させるために、{{ic|~/.config/hypr/hyprland.conf}} 内で {{ic|1=env = ELECTRON_OZONE_PLATFORM_HINT,x11}} を環境変数に設定してください。 |
||
== 参照 == |
== 参照 == |
||
| − | * [https:// |
+ | * [https://hyprland.org/ Hyprland Web サイト] |
| + | * [https://wiki.hyprland.org/ 公式ドキュメント] |
||
| + | * [https://github.com/hyprwm/Hyprland/ Hyprland Github Page] |
||
| + | * [https://github.com/hyprland-community/awesome-hyprland コミュニティが管理するツール、プラグイン、拡張機能のリスト] |
||
| + | * [https://github.com/SolDoesTech/HyprV4 SolDoesTech - Github リポジトリ 通知スクリプト] |
||
| − | {{TranslationStatus|Hyprland| |
+ | {{TranslationStatus|Hyprland|2024-06-13|810346}} |
2025年2月23日 (日) 06:32時点における最新版
関連記事
Hyprland は C++ で書かれた、独立したタイリング Wayland コンポジタ です。Hyprland の特筆すべき点は、ダイナミックタイリング、タブ付きウィンドウ、クリーンで読みやすい C++ コードベース、ウィンドウアニメーションや角丸、透明ウィンドウでの Dual-Kawase Blur を提供するカスタムレンダラーなどです。一般的な使い方や設定方法は、 Hyprland Wiki に詳しく書かれています。
目次
インストール
次のいずれかをインストールします:
- hyprland - 最新のアップストリームリリース。
- hyprland-gitAUR - master ブランチへの最新のコミット。
#6608 の時点で、Hyprland は独自のレンダリングバックエンドライブラリとして aquamarine を使用しています。以前は、wlroots-gitAUR に密接に従った独自のバージョンの wlroots がバンドルされていました。
設定
設定は 1 つの設定ファイル、hyprland.conf を通して行われます。パッケージマネージャで Hyprland をインストールした場合、おそらく /usr/share/hyprland/hyprland.conf にあります。ソースからインストールした場合は、Hyprland をクローンしたレポジトリにあります。hyprland.conf を ~/.config/hypr/hyprland.conf にコピーしてください。
hyprland.conf には、デバイス (モニタ、キーボード、マウス、トラックパッド) を設定するディレクティブと、アニメーション、装飾、レイアウトなどの設定が含まれています。キーバインディングやウィンドウのルールを設定したり、コマンドを実行したりできます (一度だけ、あるいはコンフィグが再読み込みされるたびに)
ファイルを更新するたびに設定が自動的にリロードされます。同じ効果を得るために hyprctl reload を使うこともできます。いくつかの設定(特に入力設定)については、Hyprland セッションを再起動する必要があるかもしれません。
設定は hyprctl を使用してその場で変更することもできますが、保存されません。
キーボード
キーマップ
デフォルトでは、Hyprland は US Qwerty を使用します。次のように設定できます:
~/.config/hypr/hyprland.conf
# German Colemark layout
input {
...
kb_layout = de
kb_variant = colemark
...
}
利用可能なすべてのオプションについては、上流 Wiki を参照してください。
典型的な遅延と速度
Xorg ユーザーはこの設定を サーバーレベルで定義 で使用することに慣れていますが、Wayland では各コンポジターがそれを独自に処理します。
~/.config/hypr/hyprland.conf
# Repeat rate and delay
input {
...
repeat_rate = 25
repeat_delay = 600
...
}
キーボードのバックライト
他の照明コントロールとは異なり、キーボードバックライトには XF86 キーシムがないため、従来のバインドを行う必要があります。
brightnessctl を インストール します、次のバインドを追加します。
~/.config/hypr/hyprland.conf
# Keyboard backlight bind = SUPER, F3, exec, brightnessctl -d *::kbd_backlight set +33% bind = SUPER, F2, exec, brightnessctl -d *::kbd_backlight set 33%-
変更が行われたときに 画面上の通知 を実行することもできます。
メディアキー
Hyprland でキーボードメディアコントロールを使用するには、XF86Audio キーシムと、pavucontrol または pamixer や playerctl などの外部アプリケーションを利用することで可能です。
~/.config/hypr/hyprland.conf
# Volume and Media Control bind = , XF86AudioRaiseVolume, exec, pamixer -i 5 bind = , XF86AudioLowerVolume, exec, pamixer -d 5 bind = , XF86AudioMicMute, exec, pamixer --default-source -m bind = , XF86AudioMute, exec, pamixer -t bind = , XF86AudioPlay, exec, playerctl play-pause bind = , XF86AudioPause, exec, playerctl play-pause bind = , XF86AudioNext, exec, playerctl next bind = , XF86AudioPrev, exec, playerctl previous
変更が行われたときに 通知 を実行することもできます。
タッチパッドのジェスチャ
Wayland コンポジタである Hyprland はタッチパッドジェスチャを完全にサポートしていますが、デフォルトでは無効になっています。それらを有効にするには、次を編集します:
~/.config/hypr/hyprland.conf
# Enable touchpad gestures
gestures {
workspace_swipe = true
workspace_swipe_fingers = 3
}
利用可能なすべてのオプションについては、上流 Wiki を参照してください。
ディスプレイの設定
画面共有
Screen-sharing を参照してください。
wlroots ベースのコンポジタとして、Hyprland は xdg-desktop-portal-wlr を利用して、xdg-desktop-portal 経由でさまざまなアプリケーションで画面キャプチャを有効にすることができます。
Hyprland は、領域共有、ウィンドウ共有、グラフィカルピッカーユーティリティなどの機能を追加した wlr ポータルのフォークである xdg-desktop-portal-hyprland も保守しています。ポータルの使用法については、Hyprland wiki で詳しく説明されています。
画面解像度の設定
Hyprland は画面解像度を自動的に検出しようとしますが、複数の画面が存在する場合やハイブリッドラップトップを使用している場合は、場合によっては失敗し、デフォルトでフェールセーフが設定されます。画面上のすべてが大きい場合は、デフォルトのモニターと解像度を設定する必要があります。
まず、hyprctl を使用してデフォルトのモニターを見つけます:
$ hyprctl monitors
Monitor eDP-1 (ID 0):
1920x1080@144.003006 at 0x0
description: Chimei Innolux Corporation 0x153C (eDP-1)
...
次に、モニターを設定に追加します:
~/.config/hypr/hyprland.conf
... # Monitor details monitor=eDP-1,1920x1080@144,0x0,1 ...
0x0 はマルチスクリーン設定に使用される位置オフセットで、最後の 1 は画面のスケーリング係数です。
画面のバックライト
brightnessctl を インストール して、次のバインドを追加します。
~/.config/hypr/hyprland.conf
# Screen brightness bind = , XF86MonBrightnessUp, exec, brightnessctl -s +5% bind = , XF86MonBrightnessDown, exec, brightnessctl -s 5%-
変更が行われたときに 通知 を実行することもできます。
使用方法
起動
Universal Wayland Session Manager
Uwsm は、systemdを使用するディストリビューション(特に Arch Linux) で Hyprland セッションを開始する推奨方法 です。これは、Hyprland と適切に設定されたアプリケーションやデーモンを systemd ユニットファイルを通じてラップし、systemctl を使用して管理できるようにします。
TTY 上で Hyprland を起動するには、以下のスクリプトを ~/.profile に追加します。
if uwsm check may-start && uwsm select; then exec systemd-cat -t uwsm_start uwsm start default fi
デスクトップマネージャー経由で起動する場合は、hyprland-uwsm.desktop エントリを使用するか、デスクトップマネージャー内で hyprland (uwsm-managed) を選択してください。
ターミナル
TTYから以下のコマンドでHyprlandを起動できます。
$ Hyprland
ディスプレイマネージャー
ディスプレイマネージャ からの起動は公式にはサポートされていませんが、GDM、SDDM などからの起動に成功したという報告があります。upstream wiki では、ディスプレイマネージャーとの互換性リストを公開しています。 hyprland パッケージにはディスプレイマネージャーのエントリが含まれており、すべての Hyprland AUR パッケージも自動で生成します。
どちらの方法でも同じ結果が得られますが、環境変数やサービスの違いが若干ある場合があります。
自動ログイン
ユーザーはディスプレイマネージャを使用するか、xinit#ログイン時に X を自動起動 で紹介されている方法を適用することで、自動ログインを設定できます。
hyprctl と IPC
hyprctl は、Hyprland に付属するコマンドラインユーティリティで、ディスプレイサーバーと通信するために使用されます。 これを使用すると、サーバーにコマンドを送信 (設定ファイルのコマンドと同様ですが、少し異なる構文を持ちます)、キーワードを設定、クエリの送信、情報の取得ができます。 詳細は 公式ドキュメント を参照してください。
また、Hyprland は 2 つの UNIX ソケット を公開しており、コードやコマンドラインユーティリティを介して Hyprland を制御したり、情報を取得したりできます。 これらのソケットは、ウィンドウ・ワークスペース・モニターのフォーカス変更、ウィンドウやワークスペースの作成などのイベントをブロードキャストします。
hyprctl と IPC ソケットの両方を活用すれば、スクリプトで Hyprland を制御し、複雑なタスクを実行することが可能です。
exec と exec-once の違い
アプリケーションを起動する際は、適切なディスパッチャーを使用することが重要です。exec を誤って使用すると、アプリケーションが複数回起動し、システムリソースを消費したり、最悪の場合は競合 (レースコンディション) を引き起こし、システムがクラッシュする可能性があります。
環境変数の設定
環境変数 は、hyprland.conf 内で env キーワードを使用して直接設定できます。ただし、env の構文は、シェルで使用される UNIX コマンド env とは異なります。
この違いについては、上流の Wiki で説明されています。
Hypr-Ecosystem
Hyprland 開発チームは、Hyprland 専用のアプリケーションエコシステムを構築しています。これらのツールには、スクリプトに頼ることなく、hyprctl を使用して制御できるディスパッチャーが含まれます。
現在、このエコシステムには以下のツールが含まれています。
Hyprpaper
Hyprpaperは壁紙管理ツールです。hyprpaper パッケージでインストールできます。
Hyprpicker
Hyprpicker はデスクトップ上の色を取得するためのユーティリティです。hyprpicker パッケージでインストールできます。
Hypridle
Hypridle はアイドル管理デーモンです。hypridle パッケージでインストールできます。
Hyprlock
Hyprlock はスクリーンロックマネージャーです。hyprlock パッケージでインストールできます。
Hyprcursor
Hyprcursorは、新しいカーソル管理フォーマットを提供するツールで、従来の方法に比べて多くの改善をもたらします。hyprcursor パッケージでインストールできます。
Hyprcursor themes
カーソルテーマは AUR からインストールできます。例えば、以下のようなものがあります:
- sweet-cursors-hyprcursor-gitAUR
- nordzy-hyprcursorsAUR
- xcursor-pro-hyprcursorAUR
- hyprcursor-dracula-kde-gitAUR
既存のテーマを Hyprcursor 用に移植する方法については、上流の GitHub リポジトリ に記載されています。
xdg-desktop-portal-hyprland
Hyprland 独自の XDG Desktop Portal 実装です。他の wlroots ベースのコンポジターとも互換性がありますが、Hyprland 上で使用すると追加機能が利用できます。xdg-desktop-portal-hyprland パッケージで入手可能です。
ヒントとテクニック
ファイルマネージャー
グラフィカルなファイル管理が必要な場合、Hyprland には Wayland 互換の外部アプリケーションが必要です。例として thunar を使用すると、次のようにキーバインドを割り当てるだけで済みます。
~/.config/hypr/hyprland.conf
... bind = SUPER, E, exec, thunar ...
アプリケーションランチャー
Hyprland では、アプリケーションを起動するために Wayland と互換性のある外部アプリケーションが必要です。例として wofi を使用すると、次のようにキーバインドを割り当てるだけで済みます。
~/.config/hypr/hyprland.conf
... bind = SUPER, F, exec, wofi ...
アイドル状態
Hyprland には、Wayland 互換の外部アイドル管理デーモンが必要です。最も一般的なセットアップは、swayidle と swaylock です。次のようにバインドを使用して画面を手動でロックできます。
~/.config/hypr/hyprland.conf
... bind = SUPER, L, exec, swaylock -f -c 000000 ...
自動画面ロックとサスペンド
次のスクリプトを作成します:
~/.config/hypr/scripts/sleep.sh
swayidle -w timeout 300 'swaylock -f -c 000000' \
timeout 600 'systemctl suspend' \
before-sleep 'swaylock -f -c 000000' &
次に、それを呼び出します:
~/.config/hypr/hyprland.conf
... exec-once = ~/.config/hypr/scripts/sleep.sh ...
タイムアウト期間後に DPMS を使用して画面をオフにする
Hyprland には DPMS リクエストを処理する組み込みディスパッチャがありますが、これを直接キーバインドとして使用することはお勧めできません。使用すると、画面を再びオンにできなくなり、再起動が必要になります。
上記のスクリプトを編集して次のように変更します:
~/.config/hypr/scripts/sleep.sh
swayidle -w timeout 300 'swaylock -f -c 000000' \
timeout 600 'hyprctl dispatch dpms off' \
resume 'hyprctl dispatch dpms on' \
timeout 900 'systemctl suspend' \
before-sleep 'swaylock -f -c 000000' &
アプリケーションの使用中に DPMS を停止する
上記の設定を行うと、ゲームをプレイしたり、ビデオを見たり、音楽を聴いたりするなど、タイムアウト期間を超えてシステムに触らない可能性のある作業を行っているときにモニターの電源がオフになります。
これを修正するには、idleinhibit ルールを持つ Window Rules V2 関数に組み込まれた Hyprlands を使用するか、idlehack-gitAUR または sway-audio-idle-inhibit-gitAUR のいずれかをインストールします。前者は、Firefox または Chromium がオーディオ/ビデオを再生しているときは常に D-Bus を使用して Swayidle リクエストを防止します。後者は、アプリケーションがオーディオを再生しているときは常に Swayidle リクエストを阻止します。
スクリーンセーバーを一時停止するために org.freedesktop.ScreenSaver.inhibit を使うプログラムについては、wscreensaver-bridge-gitAUR をインストールすることで Hyprland (または idle-inhibit プロトコルをサポートする Wayland コンポジター) に実装することができます。
ステータスバー
Hyprland でステータス バーを表示するには、Wayland 互換の外部アプリケーションが必要です。例として waybar を使用すると、次のように呼び出すだけで済みます:
~/.config/hypr/hyprland.conf
... exec-once = waybar -c ~/.config/waybar/waybar.conf ...
ワークスペースの概要
waybar には、Hyprland ワークスペースの切り替えをネイティブにサポートする、完全にカスタマイズ可能なモジュールが組み込まれています。
詳細については、waybar Wiki [1] を参照してください。
Polkit 認証
Polkit 認証には、外部 認証エージェント の使用が必要です。Hyprland では polkit-kde-agent の使用を推奨していますが、どれでも機能するはずです。
次のように呼び出します:
~/.config/hypr/hyprland.conf
... exec-once = /usr/lib/polkit-kde-authentication-agent-1 ...
デスクトップの壁紙
Hyprland では、デスクトップの壁紙を管理するために、Wayland と互換性のある外部アプリケーションが必要です。例として swwwAUR を使用すると、次のように呼び出すだけで済みます:
~/.config/hypr/hyprland.conf
... exec-once = swww init exec-once = swww img path/to/image ...
スクリプトを使用して X 分ごとに壁紙を変更する
次のスクリプトを作成し、実行可能ファイル であることを確認します:
~/.config/hypr/scripts/swww-random
#!/bin/bash # This script will randomly go through the files of a directory, setting it # up as the wallpaper at regular intervals # # NOTE: this script uses bash (not POSIX shell) for the RANDOM variable if [[ $# -lt 1 ]] || [[ ! -d $1 ]]; then echo "Usage: $0 <dir containing images>" exit 1 fi # Edit below to control the images transition export SWWW_TRANSITION_FPS=144 export SWWW_TRANSITION_STEP=2 export SWWW_TRANSITION_TYPE=random # This controls (in seconds) when to switch to the next image INTERVAL=300 while true; do find "$1" \ | while read -r img; do echo "$((RANDOM % 1000)):$img" done \ | sort -n | cut -d':' -f2- \ | while read -r img; do swww img "$img" sleep $INTERVAL done done
次に、背景画像を保存する新しいフォルダーを作成します。~/.config/hypr/backgrounds のようなフォルダーを作成し、そこに必要な画像を追加します。
最後にスクリプトを呼び出します:
~/.config/hypr/hyprland.conf
... exec-once = swww init exec-once = ~/.config/hypr/scripts/swww-random ~/.config/hypr/background ...
画面上の通知
外部通知デーモンを使用すると、明るさや音量の変更などのアクションを画面上で通知できます。これは非常に複雑なトピックなので、完全に説明することはこのページの範囲を超えています。むしろ、このセクションでは mako に焦点を当てますので、インストール してください。
詳細な手順については デスクトップ通知 を、代替手段のリストについては デスクトップ通知#スタンドアロン を参照してください。
Mako
Mako は軽量の通知デーモンです。詳細については、mako(5) を参照してください。設定ファイルは ~/.config/mako/config で、OSD に使用されるアイコンは ~/.config/mako/icons/ に保存されており、PNG 形式である必要があります。
このセクションの残りの部分では、スクリプトで使用されるすべてのイメージは この GitHub フォルダー から入手できます。
キーボードのバックライト通知
まず次のスクリプトを作成します:
~/.config/hypr/scripts/kbbacklight
#!/usr/bin/env bash
iDIR="$HOME/.config/mako/icons"
# Get brightness
get_backlight() {
LIGHT="$(cat /sys/class/leds/*::kbd_backlight/brightness)"
echo "${LIGHT}"
}
# Get icons
get_icon() {
current="$(cat /sys/class/leds/*::kbd_backlight/brightness)"
if [[ ("$current" -ge "0") && ("$current" -le "1") ]]; then
icon="$iDIR/brightness-20.png"
elif [[ ("$current" -ge "1") && ("$current" -le "2") ]]; then
icon="$iDIR/brightness-60.png"
elif [[ ("$current" -ge "2") && ("$current" -le "3") ]]; then
icon="$iDIR/brightness-100.png"
fi
}
# Notify
notify_user() {
notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$icon" "Keyboard Brightness : $(brightnessctl -d '*::kbd_backlight' g)"
}
# Increase brightness
inc_backlight() {
brightnessctl -d *::kbd_backlight set 33%+ && get_icon && notify_user
}
# Decrease brightness
dec_backlight() {
brightnessctl -d *::kbd_backlight set 33%- && get_icon && notify_user
}
# Zero brightness
zero_backlight() {
brightnessctl -d *::kbd_backlight s 0%
}
# Full brightness
full_backlight() {
brightnessctl -d *::kbd_backlight s 100%
}
# Execute accordingly
if [[ "$1" == "--get" ]]; then
brightnessctl -d '*::kbd_backlight' g
elif [[ "$1" == "--inc" ]]; then
inc_backlight
elif [[ "$1" == "--dec" ]]; then
dec_backlight
elif [[ "$1" == "--zero" ]]; then
zero_backlight
elif [[ "$1" == "--full" ]]; then
full_backlight
else
get_backlight
fi
次に、以下を追加します (または既存のバインドを編集します):
~/.config/hypr/hyprland.conf
# Keyboard brightness bind = SUPER, F2, exec, ~/.config/hypr/scripts/kbbacklight --dec bind = SUPER, F3, exec, ~/.config/hypr/scripts/kbbacklight --inc
メディアキーの通知
まず次のスクリプトを作成します:
~/.config/hypr/scripts/volume
#!/usr/bin/env bash
iDIR="$HOME/.config/mako/icons"
# Get Volume
get_volume() {
volume=$(pamixer --get-volume)
echo "$volume"
}
# Get icons
get_icon() {
current=$(get_volume)
if [[ "$current" -eq "0" ]]; then
echo "$iDIR/volume-mute.png"
elif [[ ("$current" -ge "0") && ("$current" -le "30") ]]; then
echo "$iDIR/volume-low.png"
elif [[ ("$current" -ge "30") && ("$current" -le "60") ]]; then
echo "$iDIR/volume-mid.png"
elif [[ ("$current" -ge "60") && ("$current" -le "100") ]]; then
echo "$iDIR/volume-high.png"
fi
}
# Notify
notify_user() {
notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$(get_icon)" "Volume : $(get_volume) %"
}
# Increase Volume
inc_volume() {
pamixer -i 5 && notify_user
}
# Decrease Volume
dec_volume() {
pamixer -d 5 && notify_user
}
# Toggle Mute
toggle_mute() {
if [ "$(pamixer --get-mute)" == "false" ]; then
pamixer -m && notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$iDIR/volume-mute.png" "Volume Switched OFF"
elif [ "$(pamixer --get-mute)" == "true" ]; then
pamixer -u && notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$(get_icon)" "Volume Switched ON"
fi
}
# Toggle Mic
toggle_mic() {
if [ "$(pamixer --default-source --get-mute)" == "false" ]; then
pamixer --default-source -m && notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$iDIR/microphone-mute.png" "Microphone Switched OFF"
elif [ "$(pamixer --default-source --get-mute)" == "true" ]; then
pamixer -u --default-source u && notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$iDIR/microphone.png" "Microphone Switched ON"
fi
}
# Get icons
get_mic_icon() {
current=$(pamixer --default-source --get-volume)
if [[ "$current" -eq "0" ]]; then
echo "$iDIR/microphone.png"
elif [[ ("$current" -ge "0") && ("$current" -le "30") ]]; then
echo "$iDIR/microphone.png"
elif [[ ("$current" -ge "30") && ("$current" -le "60") ]]; then
echo "$iDIR/microphone.png"
elif [[ ("$current" -ge "60") && ("$current" -le "100") ]]; then
echo "$iDIR/microphone.png"
fi
}
# Notify
notify_mic_user() {
notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$(get_mic_icon)" "Mic-Level : $(pamixer --default-source --get-volume) %"
}
# Increase MIC Volume
inc_mic_volume() {
pamixer --default-source -i 5 && notify_mic_user
}
# Decrease MIC Volume
dec_mic_volume() {
pamixer --default-source -d 5 && notify_mic_user
}
# Execute accordingly
if [[ "$1" == "--get" ]]; then
get_volume
elif [[ "$1" == "--inc" ]]; then
inc_volume
elif [[ "$1" == "--dec" ]]; then
dec_volume
elif [[ "$1" == "--toggle" ]]; then
toggle_mute
elif [[ "$1" == "--toggle-mic" ]]; then
toggle_mic
elif [[ "$1" == "--get-icon" ]]; then
get_icon
elif [[ "$1" == "--get-mic-icon" ]]; then
get_mic_icon
elif [[ "$1" == "--mic-inc" ]]; then
inc_mic_volume
elif [[ "$1" == "--mic-dec" ]]; then
dec_mic_volume
else
get_volume
fi
次に、以下を追加します (または既存のバインドを編集します):
~/.config/hypr/hyprland.conf
# Volume bind = , XF86AudioRaiseVolume, exec, ~/.config/hypr/scripts/volume --inc bind = , XF86AudioLowerVolume, exec, ~/.config/hypr/scripts/volume --dec bind = , XF86AudioMicMute, exec, ~/.config/hypr/scripts/volume --toggle-mic bind = , XF86AudioMute, exec, ~/.config/hypr/scripts/volume --toggle
画面のバックライト通知
まず次のスクリプトを作成します:
~/.config/hypr/scripts/backlight
!/usr/bin/env bash
iDIR="$HOME/.config/mako/icons"
# Get brightness
get_backlight() {
LIGHT=$(printf "%.0f\n" $(brightnessctl g))
echo "${LIGHT}"
}
# Get icons
get_icon() {
current="$(get_backlight)"
if [[ ("$current" -ge "0") && ("$current" -le "19200") ]]; then
icon="$iDIR/brightness-20.png"
elif [[ ("$current" -ge "19200") && ("$current" -le "38400") ]]; then
icon="$iDIR/brightness-40.png"
elif [[ ("$current" -ge "38400") && ("$current" -le "57600") ]]; then
icon="$iDIR/brightness-60.png"
elif [[ ("$current" -ge "57600") && ("$current" -le "76800") ]]; then
icon="$iDIR/brightness-80.png"
elif [[ ("$current" -ge "76800") && ("$current" -le "96000") ]]; then
icon="$iDIR/brightness-100.png"
fi
}
# Notify
notify_user() {
notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$icon" "Brightness : $(get_backlight)"
}
# Increase brightness
inc_backlight() {
brightnessctl s +5% && get_icon && notify_user
}
# Decrease brightness
dec_backlight() {
brightnessctl s 5%- && get_icon && notify_user
}
# Execute accordingly
if [[ "$1" == "--get" ]]; then
get_backlight
elif [[ "$1" == "--inc" ]]; then
inc_backlight
elif [[ "$1" == "--dec" ]]; then
dec_backlight
else
get_backlight
fi
次に、以下を追加します (または既存のバインドを編集します):
~/.config/hypr/hyprland.conf
# Screen brightness bind = , XF86MonBrightnessUp, exec, ~/.config/hypr/scripts/backlight --inc bind = , XF86MonBrightnessDown, exec, ~/.config/hypr/scripts/backlight --dec
キーボード言語の通知
このスクリプトを実行するには、コマンドライン JSON プロセッサ gojqAUR が必要です。
まず次のスクリプトを作成します:
~/.config/hypr/scripts/lang
#!/usr/bin/env bash
icon="$HOME/.config/mako/icons/language.png"
# Get language
get_lang() {
lang=$(hyprctl devices -j | gojq -r '.keyboards[] | select(.name == "at-translated-set-2-keyboard") | .active_keymap' | cut -c 1-2 | tr 'A-Z' 'a-z')
case $lang in
en)
lang="English language"
;;
ru)
lang="Русский язык"
;;
uk)
lang="Українська мова"
;;
esac
echo $lang
}
# Notify
notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$icon" "$(get_lang)"
次に、以下を追加します (または既存のバインドを編集します):
~/.config/hypr/hyprland.conf
device:at-translated-set-2-keyboard {
kb_layout = us,ru,ua
kb_variant = lang
kb_options = grp:win_space_toggle
}
# Language
bind = SUPER, SPACE, exec, ~/.config/hypr/scripts/lang
電源制御
Hyprland では、電源制御のために Wayland 互換の外部アプリケーションが必要です。例として nwg-barAUR を使用すると、次のようにバインドするだけで済みます:
~/.config/hypr/hyprland.conf
... bind = SUPER, ESCAPE, exec, nwg-bar ...
クリップボード
Wayland クリップボードの動作により、コピー元のアプリケーションを閉じるとデータが削除されます。他のデスクトップ環境では、専用のクリップボードマネージャーを使用することでこの問題を回避できますが、Hyprland には互換性のある選択肢が複数あります。詳細については、上流 Wiki を参照してください。
このセクションでは、テキストだけでなく画像のコピーもサポートしている cliphist について説明します。まず、次の行を追加します:
~/.config/hypr/hyprland.conf
... exec-once = wl-paste --type text --watch cliphist store exec-once = wl-paste --type image --watch cliphist store ...
次に、選択した アプリケーションランチャー の履歴を呼び出すバインドを作成します:
~/.config/hypr/hyprland.conf
... bind = SUPER, V, exec, cliphist list | wofi --dmenu | cliphist decode | wl-copy ...
Super+v を押すと、wofi ウィンドウが開き、クリップボード履歴リストが表示されます。
デバイスの有効化/無効化
デバイス(例:タッチパッド)を有効化または無効化するには、まず
$ hyprctl devices
を使用してデバイスの名前を調べます。
以下のコード行を設定ファイルに追加し(上記で照会したデバイス名で<device_name>を置き換えて)、デバイスをオン/オフにします:
~/.config/hypr/hyprland.conf
device:<device_name> {
enabled = {true/false}
}
デバイスを動的にオン/オフするには、hyprctlを使用します:
$ hyprctl keyword "device:<device_name>:enabled" {true|false}
また、キーバインドを作成することもできます。例えば:
~/.config/hypr/hyprland.conf
... bind = $mainMod, t, exec, hyprctl keyword "device:pixa3854:00-093a:0274-touchpad:enabled" false bind = $mainMod Shift, t, exec, hyprctl keyword "device:pixa3854:00-093a:0274-touchpad:enabled" true ...
別の dconf プロファイルを使用する
他の GTK ベースのデスクトップ環境 (DE) の設定を汚染したくない場合は、個別の dconf プロファイルを使用できます。例えば、以下の手順で設定できます。
新しいグローバル dconf プロファイルを宣言します:
/etc/dconf/profile/hyprland
user-db:hyprland
~/.config/hypr/hyprland.conf
... env = DCONF_PROFILE, hyprland ...
これで、gsettings を使用しても他のデスクトップ環境に影響を与えず、Hyprland 用の独立した設定を管理できます。
トラブルシューティング
xdg-desktop-portal-hyprland が大量の CPU を使用する
これは既知のバグ [2] であり、最新の Git ビルドでは解決されているはずです。これを回避するには、こちら Hyprland wiki で説明されているように、スクリプトを hyprland.conf ファイルで呼び出すことで回避できます。
NVIDIA 環境でのネイティブ (Wayland) Electron アプリのちらつき問題
Hyprland を使用している NVIDIA ユーザーの間で広く報告されている問題です ([3]、[4]) これは、Hyprland における明示的同期 (explicit sync) のサポート不足が原因とされています ([5])
この問題の推奨される一時的な対策として、該当するアプリケーションを X11 (XWayland) で動作させる方法があります。
具体的には、アプリケーションの起動時に --ozone-platform-hint=x11 を指定するか、すべての Electron アプリを XWayland で動作させるために、~/.config/hypr/hyprland.conf 内で env = ELECTRON_OZONE_PLATFORM_HINT,x11 を環境変数に設定してください。