fzdwx

fzdwx

Hello , https://github.com/fzdwx

Wayland下のウィンドウマネージャ: Hyprland

今日は簡単に Hyprland を試してみました。機能は DWM + picom の組み合わせに似ています。ざっと試してみたところ、いくつかの問題がありました:

  1. 分割画面のとき、拡張スクリーンのカーソルが表示されない
    • WLR_NO_HARDWARE_CURSORS=1 を設定すれば解決します
  2. 拡張スクリーンに時々黒いブロックがちらつく
    • インストールパッケージを hyprland-nvidia-git に置き換えれば解決します
  3. waybar が少し使いにくい、作業スペースが各スクリーンで独立していない(DWM のタグ機能)

もちろん、いくつかの利点もあります:

  1. 何のパッチも当てずに良好な可用性
  2. 一部のアニメーション効果が内蔵されています
  3. 設定ファイルのホットロード(変更するたびに即座に反映されます)
    • これは高評価です。DWM は設定を変更するたびに再度 make する必要があります

しかし、私は引き続き DWM を使用することを選びました。切り替える必然性がなく、私がよく使う機能が Hyprland では代替が見つからなかったからです。さらに、私の DWM の設定も安定してきており、クリック可能なステータスバーも追加されました(Hyprland で waybar を使用するとこの機能が実現できます)。

{{<block type="details" title="関連コード">}}

インストールスクリプト:

# hyperland をインストール
yay -S hyprland-nvidia-git
# waybar をインストール
yay -S waybar-hyprland-git
# hyprland share をインストール
yay -S xdg-desktop-portal-hyprland-git
# wayland 用の rofi をインストール
yay -S rofi-lbonn-wayland-git

# 壁紙切り替えをインストール
git clone https://github.com/Horus645xx/swww
cd swww
cargo build --release
cp /target/release/swww /usr/bin
cp /target/release/swww-daemon /usr/bin
swww init 
swww img --transition-type left  ~/Pictures/bg/0494e945880511ebb6edd017c2d2eca2.png

参考用の起動スクリプト:

export LIBVA_DRIVER_NAME=nvidia
export XDG_SESSION_TYPE=wayland
export GBM_BACKEND=nvidia-drm
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export WLR_NO_HARDWARE_CURSORS=1 # カーソルを修正

# IME サポートの例:fcitx5
export GTK_IM_MODULE=fcitx5
export QT_IM_MODULE=fcitx5
export XMODIFIERS=@im=fcitx5
export SDL_IM_MODULE=fcitx5
export GLFW_IM_MODULE=ibus

exec Hyprland

~/.config/hypr/hyprland.conf:

########################################################################################
AUTOGENERATED HYPR CONFIG.
PLEASE USE THE CONFIG PROVIDED IN THE GIT REPO /examples/hypr.conf AND EDIT IT,
OR EDIT THIS ONE ACCORDING TO THE WIKI INSTRUCTIONS.
########################################################################################

#
# 利用可能なすべての設定/オプションがここに設定されているわけではありません。
# 完全なリストについては、ウィキを参照してください
#

# https://wiki.hyprland.org/Configuring/Monitors/ を参照
monitor=,preferred,auto,auto
#monitor=eDP-1-1, 1920x1080@144, 1920x0, 1
#monitor=HDMI-0, 1920x1080@60, 0x0, 1

# https://wiki.hyprland.org/Configuring/Keywords/ を参照

# 起動時にお気に入りのアプリを実行
# exec-once = waybar & hyprpaper & firefox

exec-once = fcitx5
exec-once = flameshot
exec-once = /opt/clash/cfw
exec-once = waybar
#exec-once = dunst

# ファイルをソースする(マルチファイル設定)
# source = ~/.config/hypr/myColors.conf

#misc {
#    no_vfr = 1
#}
# すべてのカテゴリについては、https://wiki.hyprland.org/Configuring/Variables/ を参照
input {
    kb_layout = us
    kb_variant =
    kb_model =
    kb_options =
    kb_rules =

    follow_mouse = 1

    touchpad {
        natural_scroll = no
    }

    sensitivity = 0 # -1.0 - 1.0、0は変更なし。
}

general {
    # https://wiki.hyprland.org/Configuring/Variables/ を参照

    gaps_in = 5
    gaps_out = 20
    border_size = 2
    col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg
    col.inactive_border = rgba(595959aa)

    layout = dwindle
}

decoration {
    # https://wiki.hyprland.org/Configuring/Variables/ を参照

    rounding = 10
    blur = yes
    blur_size = 3
    blur_passes = 1
    blur_new_optimizations = on

    drop_shadow = yes
    shadow_range = 4
    shadow_render_power = 3
    col.shadow = rgba(1a1a1aee)
}

animations {
    enabled = yes

    # 一部のデフォルトアニメーション、詳細は https://wiki.hyprland.org/Configuring/Animations/ を参照

    bezier = myBezier, 0.05, 0.9, 0.1, 1.05

    animation = windows, 1, 7, myBezier
    animation = windowsOut, 1, 7, default, popin 80%
    animation = border, 1, 10, default
    animation = fade, 1, 7, default
    animation = workspaces, 1, 6, default
}

dwindle {
    # 詳細は https://wiki.hyprland.org/Configuring/Dwindle-Layout/ を参照
    pseudotile = yes # 擬似タイルのマスタースイッチ。有効にするには、以下のキーバインドセクションで mainMod + P にバインドします
    preserve_split = yes # おそらくこれが必要です
}

master {
    # 詳細は https://wiki.hyprland.org/Configuring/Master-Layout/ を参照
    new_is_master = true
}

gestures {
    # 詳細は https://wiki.hyprland.org/Configuring/Variables/ を参照
    workspace_swipe = off
}

# デバイスごとの設定の例
# 詳細は https://wiki.hyprland.org/Configuring/Keywords/#executing を参照
device:epic mouse V1 {
    sensitivity = -0.5
}

# ウィンドウルール v1 の例
# windowrule = float, ^(kitty)$
# ウィンドウルール v2 の例
# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$
# 詳細は https://wiki.hyprland.org/Configuring/Window-Rules/ を参照
#
# class が float のものはすべて初期状態で float で起動
windowrulev2 = float,class:^(float)$
windowrulev2 = noborder,class:^(noborder)$

# 詳細は https://wiki.hyprland.org/Configuring/Keywords/ を参照
$mainMod = SUPER
$term = wezterm
$term_float = wezterm start --class float
$rofi = rofi -show window -show-icons

# ターミナルを起動
bind = $mainMod,       Return,       exec, $term
# 浮動ターミナルを起動
bind = $mainMod,   minus,        exec, $term_float
# ランチャーを起動
bind = ALT,        SPACE,        exec, $rofi

# ウィンドウを閉じる
bind = $mainMod, Q, killactive,
bind = $mainMod, P, pseudo, # dwindle
bind = $mainMod, J, togglesplit, # dwindle
# super + f フルスクリーンウィンドウ
bind=$mainMod,F,fullscreen,0
# super + space ウィンドウを浮動に切り替え
bind=$mainMod,SPACE,togglefloating,active

# フォーカスウィンドウを切り替え
bind=SUPER,left,movefocus,l
bind=SUPER,right,movefocus,r
bind=SUPER,up,movefocus,u
bind=SUPER,down,movefocus,d

# 現在のウィンドウを移動 ずっと移動可能
bind=SUPERSHIFT,left,movewindow,l
bind=SUPERSHIFT,right,movewindow,r
bind=SUPERSHIFT,up,movewindow,u
bind=SUPERSHIFT,down,movewindow,d

# 作業スペースを切り替え
bind=SUPER,TAB,workspace,previous
bind = $mainMod, 1, workspace, 1
bind = $mainMod, 2, workspace, 2
bind = $mainMod, 3, workspace, 3
bind = $mainMod, 4, workspace, 4
bind = $mainMod, 5, workspace, 5
bind = $mainMod, 6, workspace, 6
bind = $mainMod, 7, workspace, 7
bind = $mainMod, 8, workspace, 8
bind = $mainMod, 9, workspace, 9
bind = $mainMod, 0, workspace, 10

# alt+super + 矢印キーでウィンドウサイズを制御
bind=$mainMod,comma,resizeactive,-20 0
bind=$mainMod,period,resizeactive,20 0
bind=ALT_SUPER,up,resizeactive,0 -20
bind=ALT_SUPER,down,resizeactive,0 20

# アクティブウィンドウをメインモッド + SHIFT + [0-9] で作業スペースに移動
bind = $mainMod SHIFT, 1, movetoworkspace, 1
bind = $mainMod SHIFT, 2, movetoworkspace, 2
bind = $mainMod SHIFT, 3, movetoworkspace, 3
bind = $mainMod SHIFT, 4, movetoworkspace, 4
bind = $mainMod SHIFT, 5, movetoworkspace, 5
bind = $mainMod SHIFT, 6, movetoworkspace, 6
bind = $mainMod SHIFT, 7, movetoworkspace, 7
bind = $mainMod SHIFT, 8, movetoworkspace, 8
bind = $mainMod SHIFT, 9, movetoworkspace, 9
bind = $mainMod SHIFT, 0, movetoworkspace, 10

# shift + super + left/right でウィンドウを次のまたは前の作業スペースに移動
bind = $mainMod SHIFT,Left,movetoworkspace,e-1
bind = $mainMod SHIFT,right,movetoworkspace,e+1

# mainMod + スクロールで既存の作業スペースをスクロール
bind = $mainMod, mouse_down, workspace, e+1
bind = $mainMod, mouse_up, workspace, e-1

# mainMod + LMB/RMB とドラッグでウィンドウを移動/サイズ変更
bindm = $mainMod, mouse:272, movewindow
bindm = $mainMod, mouse:273, resizewindow

{{< /block >}}

読み込み中...
文章は、創作者によって署名され、ブロックチェーンに安全に保存されています。