1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

hyprlandの設定ファイルをLua形式へ(hyprland v0.55~)

1
Posted at

内容

HyprlandはLinux用のウィンドウマネージャーで、タイル型、Wayland用なのが特徴です。0.55から、推奨される設定ファイルの形式がLua形式になったようです。0.57から完全移行のようです。自分の設定をconfからluaへ変更したので、ログとして残します。誰かの参考になればと思います。

調査

設定ファイルのサンプルファイルへのリンクです。

動作確認したHyprlandのバージョンです。

hyprland --version
# Hyprland 0.56.1 built from branch v0.56.1 at commit 5c9377c15f85c50648f35ca5a213754f95b93ca0 clean (version: bump to 0.56.1).
# Date: Mon Jul 27 16:33:49 2026
# Tag: v0.56.1, commits: 7643
# 
# Libraries:
# Hyprgraphics: built against 0.5.1, system has 0.5.1
# Hyprutils: built against 0.14.0, system has 0.14.0
# Hyprcursor: built against 0.1.13, system has 0.1.13
# Hyprlang: built against 0.6.8, system has 0.6.8
# Aquamarine: built against 0.14.0, system has 0.14.0
# 
# Version ABI string: 5c9377c15f85c50648f35ca5a213754f95b93ca0_aq_0.14_hu_0.14_hg_0.5_hc_0.1_hlg_0.6
# no flags were set

設定ファイルの切り替え手順(hyprland.conf -> hyprland.lua)

hyprland.confとhyprland.luaが両方存在する場合や、同一ディレクトリ内に設定ファイルが残っていると、ファイル監視機能が以前のconf側を読み続けたり競合したりすることがあります。旧ファイルを~/.config/hypr/hyprland.conf.bakなど拡張子変更で無効化するかディレクトリ外へ退避し再ログインを行ってください。

# 既存の hyprland.conf を退避
mv ~/.config/hypr/hyprland.conf ~/.config/hypr/hyprland.conf.bak

# Githubのリポジトリから、デフォルトのhyprland.luaを取得し設置
curl -sSL "https://raw.githubusercontent.com/hyprwm/Hyprland/refs/heads/main/example/hyprland.lua" -o ~/.config/hypr/hyprland.lua

# この後hyprlandの再起動

lua形式に変更

以下、hyprland.confの各セクションごとにLua形式に変更したコードを示します。
私の設定ファイルのカスタム事情としては以下があげられます。

  • デュアルディスプレイ
    • 1.25倍スケールアップ
    • WorkspaceはMonitor2は1~5、Monitor1は6~0番を割り当て

その他はキー設定を少々追加するぐらいで、ほとんどデフォルトで設定しています。

MONITORS

デュアルディスプレイの設定です。4kディスプレイのため等倍は見にくく、1.25倍にスケールアップしています。

################
### MONITORS ###
################

# See https://wiki.hypr.land/Configuring/Monitors/
# monitor=,preferred,auto,auto
# 3840 / 1.25 = 3072
monitor=DP-1, 3840x2160@60, 0x0, 1.25
monitor=DP-2, 3840x2160@60, -3072x0, 1.25

↓Lua形式に変更

------------------
---- MONITORS ----
------------------

-- See https://wiki.hypr.land/Configuring/Basics/Monitors/
hl.monitor({
    output   = "DP-1",
    mode     = "3840x2160@60",
    position = "0x0",
    scale    = "1.25",
})
hl.monitor({
    output   = "DP-2",
    mode     = "3840x2160@60",
    position = "-3072x0",
    scale    = "1.25",
})

MY PROGRAMS

ターミナル、GUIファイルマネージャー、アプリケーションランチャーの定義です。ghosttyを使っているのですが、wayland上で起動させるには一癖あるようです。GTK_IM_MODULE=fcitxを入れないとfcitx(Linuxで動作するIME)が起動しません。その他、ファイルマネージャーはdolphin、ランチャーはwofiです。

###################
### MY PROGRAMS ###
###################

# See https://wiki.hypr.land/Configuring/Keywords/

# Set programs that you use
$terminal = GTK_IM_MODULE=fcitx ghostty
$fileManager = dolphin
$menu = wofi -i --show drun

↓Lua形式に変更

---------------------
---- MY PROGRAMS ----
---------------------

-- Set programs that you use
local terminal    = "GTK_IM_MODULE=fcitx ghostty"
local fileManager = "dolphin"
local menu        = "wofi -i --show drun"

AUTOSTART

hyprlandにログインしたときに同時に起動させるものを設定します。

#################
### AUTOSTART ###
#################

# Autostart necessary processes (like notifications daemons, status bars, etc.)
# Or execute your favorite apps at launch like this:
exec-once = hyprpaper & waybar & dunst & hypridle & kbuildsycoca6
exec-once = easyeffects --hide-window --service-mode
exec-once = /usr/bin/fcitx5 -d
exec-once = hyprland-autoname-workspaces

↓Lua形式に変更

-------------------
---- AUTOSTART ----
-------------------

-- See https://wiki.hypr.land/Configuring/Basics/Autostart/

-- Autostart necessary processes (like notifications daemons, status bars, etc.)
-- Or execute your favorite apps at launch like this:
hl.on("hyprland.start", function () 
  hl.exec_cmd("hyprpaper & waybar & dunst & hypridle & kbuildsycoca6")
  hl.exec_cmd("easyeffects --hide-window --service-mode")
  hl.exec_cmd("/usr/bin/fcitx5 -d")
  hl.exec_cmd("hyprland-autoname-workspaces")
end)

ENVIRONMENT VARIABLES

環境変数設定です。

#############################
### ENVIRONMENT VARIABLES ###
#############################

# See https://wiki.hypr.land/Configuring/Environment-variables/

env = CURSOR_FLAGS,1
env = XCURSOR_SIZE,34
env = HYPRCURSOR_SIZE,24

env = QT_QPA_PLATFORMTHEME,kde  # KDEの設定(テーマやフォント)を引き継ぐ
env = XDG_CURRENT_DESKTOP,Hyprland
env = XDG_SESSION_DESKTOP,Hyprland
env = XDG_MENU_PREFIX,arch-
env = XMODIFIERS, @im=fcitx

↓Lua形式に変更

-------------------------------
---- ENVIRONMENT VARIABLES ----
-------------------------------

-- See https://wiki.hypr.land/Configuring/Advanced-and-Cool/Environment-variables/

hl.env("CURSOR_FLAGS", "1")
hl.env("XCURSOR_SIZE", "24")
hl.env("HYPRCURSOR_SIZE", "24")

hl.env("QT_QPA_PLATFORMTHEME", "kde") -- KDEの設定(テーマやフォント)を引き継ぐ
hl.env("XDG_CURRENT_DESKTOP", "Hyprland")
hl.env("XDG_SESSION_DESKTOP", "Hyprland")
hl.env("XDG_MENU_PREFIX", "arch-")
hl.env("env = XMODIFIERS", "@im=fcitx")

PERMISSIONS

これは特に設定していません。

###################
### PERMISSIONS ###
###################

# See https://wiki.hypr.land/Configuring/Permissions/
# Please note permission changes here require a Hyprland restart and are not applied on-the-fly
# for security reasons

# ecosystem {
#   enforce_permissions = 1
# }

# permission = /usr/(bin|local/bin)/grim, screencopy, allow
# permission = /usr/(lib|libexec|lib64)/xdg-desktop-portal-hyprland, screencopy, allow
# permission = /usr/(bin|local/bin)/hyprpm, plugin, allow

↓Lua形式に変更

-----------------------
----- PERMISSIONS -----
-----------------------

-- See https://wiki.hypr.land/Configuring/Advanced-and-Cool/Permissions/
-- Please note permission changes here require a Hyprland restart and are not applied on-the-fly
-- for security reasons

-- hl.config({
--   ecosystem = {
--     enforce_permissions = true,
--   },
-- })

-- hl.permission("/usr/(bin|local/bin)/grim", "screencopy", "allow")
-- hl.permission("/usr/(lib|libexec|lib64)/xdg-desktop-portal-hyprland", "screencopy", "allow")
-- hl.permission("/usr/(bin|local/bin)/hyprpm", "plugin", "allow")

LOOK AND FEEL

デフォルトから若干変更しています。枠を小さくしたり、ウィンドウ同士の隙間をなくしたりしています。

#####################
### LOOK AND FEEL ###
#####################

# Refer to https://wiki.hypr.land/Configuring/Variables/

# https://wiki.hypr.land/Configuring/Variables/#general
general {
    gaps_in = 0
    gaps_out = 0
    border_size = 1

    # https://wiki.hypr.land/Configuring/Variables/#variable-types for info about colors
    col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg
    col.inactive_border = rgba(595959aa)

    # Set to true enable resizing windows by clicking and dragging on borders and gaps
    resize_on_border = false

    # Please see https://wiki.hypr.land/Configuring/Tearing/ before you turn this on
    allow_tearing = false

    layout = dwindle
}

# https://wiki.hypr.land/Configuring/Variables/#decoration
decoration {
    rounding = 0

    # 角丸
    # rounding = 10
    # rounding_power = 2

    # Change transparency of focused and unfocused windows
    active_opacity = 1.0
    inactive_opacity = 1.0

    shadow {
        enabled = true
        range = 4
        render_power = 3
        color = rgba(1a1a1aee)
    }

    # https://wiki.hypr.land/Configuring/Variables/#blur
    blur {
        enabled = true
        size = 3
        passes = 1

        vibrancy = 0.1696
        # special = true
    }
    # dim_special = 0.5
}

group {
    # グループ全体の境界線の色(アクティブ/非アクティブ)
    col.border_active = rgba(33ccffee)
    col.border_inactive = rgba(595959aa)

    # タブバー(上部のバー)の設定
    groupbar {
        enabled = true          # falseにするとバーが消え、隙間も最小化されます
        font_size = 10
        gradients = true        # グラデーションの有無
        height = 2             # この高さを小さくすると隙間が減ります
        render_titles = false    # タイトルを表示するか
        col.active = rgba(33ccffee)
        col.inactive = rgba(595959aa)
    }
}

windowrule = match:workspace special:magic, border_color rgb(ff0000)

# https://wiki.hypr.land/Configuring/Variables/#animations
animations {
    enabled = yes, please :)

    # Default curves, see https://wiki.hypr.land/Configuring/Animations/#curves
    #        NAME,           X0,   Y0,   X1,   Y1
    bezier = easeOutQuint,   0.23, 1,    0.32, 1
    bezier = easeInOutCubic, 0.65, 0.05, 0.36, 1
    bezier = linear,         0,    0,    1,    1
    bezier = almostLinear,   0.5,  0.5,  0.75, 1
    bezier = quick,          0.15, 0,    0.1,  1

    # Default animations, see https://wiki.hypr.land/Configuring/Animations/
    #           NAME,          ONOFF, SPEED, CURVE,        [STYLE]
    animation = global,        1,     10,    default
    animation = border,        1,     5.39,  easeOutQuint
    animation = windows,       1,     4.79,  easeOutQuint
    animation = windowsIn,     1,     4.1,   easeOutQuint, popin 87%
    animation = windowsOut,    1,     1.49,  linear,       popin 87%
    animation = fadeIn,        1,     1.73,  almostLinear
    animation = fadeOut,       1,     1.46,  almostLinear
    animation = fade,          1,     3.03,  quick
    animation = layers,        1,     3.81,  easeOutQuint
    animation = layersIn,      1,     4,     easeOutQuint, fade
    animation = layersOut,     1,     1.5,   linear,       fade
    animation = fadeLayersIn,  1,     1.79,  almostLinear
    animation = fadeLayersOut, 1,     1.39,  almostLinear
    animation = workspaces,    1,     1.94,  almostLinear, fade
    animation = workspacesIn,  1,     1.21,  almostLinear, fade
    animation = workspacesOut, 1,     1.94,  almostLinear, fade
    animation = zoomFactor,    1,     7,     quick

}

animations {
    enabled = yes
    # Special Workspace 専用のアニメーション設定
    # 第1引数は workspace、第2引数は 1 (有効)、第3引数は速度、第4引数はカーブ、第5引数はスタイル
    animation = specialWorkspace, 1, 2.0, default, slidevert
}

# Ref https://wiki.hypr.land/Configuring/Workspace-Rules/
# "Smart gaps" / "No gaps when only"
# uncomment all if you wish to use that.
# workspace = w[tv1], gapsout:0, gapsin:0
# workspace = f[1], gapsout:0, gapsin:0
# windowrule {
#     name = no-gaps-wtv1
#     match:float = false
#     match:workspace = w[tv1]
#
#     border_size = 0
#     rounding = 0
# }
#
# windowrule {
#     name = no-gaps-f1
#     match:float = false
#     match:workspace = f[1]
#
#     border_size = 0
#     rounding = 0
# }

# See https://wiki.hypr.land/Configuring/Dwindle-Layout/ for more
dwindle {
    preserve_split = true # You probably want this
}

# See https://wiki.hypr.land/Configuring/Master-Layout/ for more
master {
    new_status = master
}

# https://wiki.hypr.land/Configuring/Variables/#misc
misc {
    force_default_wallpaper = 2 # Set to 0 or 1 to disable the anime mascot wallpapers
    disable_hyprland_logo = false # If true disables the random hyprland logo / anime girl background. :(
}

↓Lua形式に変更

-----------------------
---- LOOK AND FEEL ----
-----------------------

-- Refer to https://wiki.hypr.land/Configuring/Basics/Variables/
hl.config({
    general = {
        gaps_in  = 5,
        gaps_out = 20,

        border_size = 2,

        col = {
            active_border   = { colors = {"rgba(33ccffee)", "rgba(00ff99ee)"}, angle = 45 },
            inactive_border = "rgba(595959aa)",
        },

        -- Set to true to enable resizing windows by clicking and dragging on borders and gaps
        resize_on_border = false,

        -- Please see https://wiki.hypr.land/Configuring/Advanced-and-Cool/Tearing/ before you turn this on
        allow_tearing = false,

        layout = "dwindle",
    },

    decoration = {
        rounding       = 10,
        rounding_power = 2,

        -- Change transparency of focused and unfocused windows
        active_opacity   = 1.0,
        inactive_opacity = 1.0,

        shadow = {
            enabled      = true,
            range        = 4,
            render_power = 3,
            color        = 0xee1a1a1a,
        },

        blur = {
            enabled   = true,
            size      = 3,
            passes    = 1,
            vibrancy  = 0.1696,
        },
    },

    animations = {
        enabled = true,
    },
})

-- Default curves and animations, see https://wiki.hypr.land/Configuring/Advanced-and-Cool/Animations/
hl.curve("easeOutQuint",   { type = "bezier", points = { {0.23, 1},    {0.32, 1}    } })
hl.curve("easeInOutCubic", { type = "bezier", points = { {0.65, 0.05}, {0.36, 1}    } })
hl.curve("linear",         { type = "bezier", points = { {0, 0},       {1, 1}       } })
hl.curve("almostLinear",   { type = "bezier", points = { {0.5, 0.5},   {0.75, 1}    } })
hl.curve("quick",          { type = "bezier", points = { {0.15, 0},    {0.1, 1}     } })

-- Default springs
hl.curve("easy",           { type = "spring", mass = 1, stiffness = 71.2633, dampening = 15.8273644 })

hl.animation({ leaf = "global",        enabled = true,  speed = 10,   bezier = "default" })
hl.animation({ leaf = "border",        enabled = true,  speed = 5.39, bezier = "easeOutQuint" })
hl.animation({ leaf = "windows",       enabled = true,  speed = 4.79, spring = "easy" })
hl.animation({ leaf = "windowsIn",     enabled = true,  speed = 4.1,  spring = "easy",         style = "popin 87%" })
hl.animation({ leaf = "windowsOut",    enabled = true,  speed = 1.49, bezier = "linear",       style = "popin 87%" })
hl.animation({ leaf = "fadeIn",        enabled = true,  speed = 1.73, bezier = "almostLinear" })
hl.animation({ leaf = "fadeOut",       enabled = true,  speed = 1.46, bezier = "almostLinear" })
hl.animation({ leaf = "fade",          enabled = true,  speed = 3.03, bezier = "quick" })
hl.animation({ leaf = "layers",        enabled = true,  speed = 3.81, bezier = "easeOutQuint" })
hl.animation({ leaf = "layersIn",      enabled = true,  speed = 4,    bezier = "easeOutQuint", style = "fade" })
hl.animation({ leaf = "layersOut",     enabled = true,  speed = 1.5,  bezier = "linear",       style = "fade" })
hl.animation({ leaf = "fadeLayersIn",  enabled = true,  speed = 1.79, bezier = "almostLinear" })
hl.animation({ leaf = "fadeLayersOut", enabled = true,  speed = 1.39, bezier = "almostLinear" })
hl.animation({ leaf = "workspaces",    enabled = true,  speed = 1.94, bezier = "almostLinear", style = "fade" })
hl.animation({ leaf = "workspacesIn",  enabled = true,  speed = 1.21, bezier = "almostLinear", style = "fade" })
hl.animation({ leaf = "workspacesOut", enabled = true,  speed = 1.94, bezier = "almostLinear", style = "fade" })
hl.animation({ leaf = "zoomFactor",    enabled = true,  speed = 7,    bezier = "quick" })

-- Ref https://wiki.hypr.land/Configuring/Basics/Workspace-Rules/
-- "Smart gaps" / "No gaps when only"
-- uncomment all if you wish to use that.
-- hl.workspace_rule({ workspace = "w[tv1]", gaps_out = 0, gaps_in = 0 })
-- hl.workspace_rule({ workspace = "f[1]",   gaps_out = 0, gaps_in = 0 })
-- hl.window_rule({
--     name  = "no-gaps-wtv1",
--     match = { float = false, workspace = "w[tv1]" },
--     border_size = 0,
--     rounding    = 0,
-- })
-- hl.window_rule({
--     name  = "no-gaps-f1",
--     match = { float = false, workspace = "f[1]" },
--     border_size = 0,
--     rounding    = 0,
-- })

-- See https://wiki.hypr.land/Configuring/Layouts/Dwindle-Layout/ for more
hl.config({
    dwindle = {
        preserve_split = true, -- You probably want this
    },
})

-- See https://wiki.hypr.land/Configuring/Layouts/Master-Layout/ for more
hl.config({
    master = {
        new_status = "master",
    },
})

-- See https://wiki.hypr.land/Configuring/Layouts/Scrolling-Layout/ for more
hl.config({
    scrolling = {
        fullscreen_on_one_column = true,
    },
})
----------------
----  MISC  ----
----------------

hl.config({
    misc = {
        force_default_wallpaper = -1,    -- Set to 0 or 1 to disable the anime mascot wallpapers
        disable_hyprland_logo   = false, -- If true disables the random hyprland logo / anime girl background. :(
    },
})

INPUT

操作デバイスの設定です。主にキーボード、マウスの設定です。ペンタブの設定もここでやっています。マウス加速は切っています。

#############
### INPUT ###
#############

# https://wiki.hypr.land/Configuring/Variables/#input
input {
    kb_layout = jp
    kb_variant =
    kb_model = jp106
    kb_options =
    kb_rules =
    repeat_delay = 300

    follow_mouse = 1

    sensitivity = 1.0 # -1.0 - 1.0, 0 means no modification.
    accel_profile = flat

    touchpad {
        natural_scroll = false
    }
}

cursor {
    inactive_timeout = 5.0
    hide_on_key_press = true
}

# See https://wiki.hypr.land/Configuring/Gestures
gesture = 3, horizontal, workspace

# Example per-device config
# See https://wiki.hypr.land/Configuring/Keywords/#per-device-input-configs for more
# device {
#     name = epic-mouse-v1
#     sensitivity = -0.5
# }
device {
    name = logitech-g304-1
    sensitivity = -0.25
    accel_profile = flat
}
device {
    name = hhkb-studio3-mouse
    sensitivity = -0.25
    accel_profile = flat
}
device {
    name = wacom-intuos-pro-m-pen
    output = current
}

↓Lua形式に変更

---------------
---- INPUT ----
---------------

hl.config({
    input = {
        kb_layout  = "jp",
        kb_variant = "",
        kb_model   = "jp106",
        kb_options = "",
        kb_rules   = "",
        repeat_delay = 300, -- これは有効?

        follow_mouse = 1,

        sensitivity = 1.0, -- -1.0 - 1.0, 0 means no modification.
        accel_profile = "flat", -- これは有効?

        touchpad = {
            natural_scroll = false,
        },
    },
})
hl.cursor({
    inactive_timeout = 5.0,
    hide_on_key_press = true,
})
hl.gesture({
    fingers = 3,
    direction = "horizontal",
    action = "workspace"
})

-- Example per-device config
-- See https://wiki.hypr.land/Configuring/Advanced-and-Cool/Devices/ for more
hl.device({
    name        = "logitech-g304-1",
    sensitivity = -0.25,
    accel_profile = "flat",
})
hl.device({
    name        = "hhkb-studio3-mouse",
    sensitivity = -0.25,
    accel_profile = "flat",
})
hl.device({
    name        = "wacom-intuos-pro-m-pen",
    output = "current",
})

KEYBINDINGS

ワークスペースやウィンドウ操作の設定です。キー定義一覧はこちら libxkbcommon/include/xkbcommon/xkbcommon-keysyms.h at master · xkbcommon/libxkbcommon 。

###################
### KEYBINDINGS ###
###################

# See https://wiki.hypr.land/Configuring/Keywords/
$mainMod = SUPER # Sets "Windows" key as main modifier

# Example binds, see https://wiki.hypr.land/Configuring/Binds/ for more
bind = $mainMod, Q, exec, $terminal
bind = $mainMod SHIFT, Q, killactive,
bind = $mainMod SHIFT, C, exec, hyprctl kill
bind = $mainMod SHIFT, M, exec, command -v hyprshutdown >/dev/null 2>&1 && hyprshutdown || hyprctl dispatch exit
bind = $mainMod, E, exec, $fileManager
bind = $mainMod, V, togglefloating,
bind = $mainMod, R, exec, $menu
bind = Alt, Space, exec, $menu
bind = $mainMod, P, pseudo, # dwindle
# bind = $mainMod, J, layoutmsg, togglesplit # dwindle

# (empty first = no modifier)
bind = SHIFT, Print, exec, grim -g "$(slurp)" - | swappy -f -

# グループ(タブ)にまとめる
bind = $mainMod, G, togglegroup
bind = $mainMod SHIFT, G, moveoutofgroup
bind = $mainMod, T, changegroupactive, f
bind = $mainMod, Tab, changegroupactive, f
bind = $mainMod, B, changegroupactive, b
bind = $mainMod SHIFT, Tab, changegroupactive, b

# Move focus with mainMod + arrow keys
bind = $mainMod, left, movefocus, l
bind = $mainMod, right, movefocus, r
bind = $mainMod, up, movefocus, u
bind = $mainMod, down, movefocus, d
bind = $mainMod, H, movefocus, l
bind = $mainMod, L, movefocus, r
bind = $mainMod, K, movefocus, u
bind = $mainMod, J, movefocus, d
bind = $mainMod SHIFT, left, movewindow, l
bind = $mainMod SHIFT, right, movewindow, r
bind = $mainMod SHIFT, up, movewindow, u
bind = $mainMod SHIFT, down, movewindow, d
bind = $mainMod SHIFT, h, movewindow, l
bind = $mainMod SHIFT, l, movewindow, r
bind = $mainMod SHIFT, k, movewindow, u
bind = $mainMod SHIFT, j, movewindow, d

# Switch workspaces with mainMod + [0-9]
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
bind = Alt, Tab, workspace, previous

# Move active window to a workspace with mainMod + 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
bind = $mainMod CTRL_L SHIFT, 1, movetoworkspacesilent, 1
bind = $mainMod CTRL_L SHIFT, 2, movetoworkspacesilent, 2
bind = $mainMod CTRL_L SHIFT, 3, movetoworkspacesilent, 3
bind = $mainMod CTRL_L SHIFT, 4, movetoworkspacesilent, 4
bind = $mainMod CTRL_L SHIFT, 5, movetoworkspacesilent, 5
bind = $mainMod CTRL_L SHIFT, 6, movetoworkspacesilent, 6
bind = $mainMod CTRL_L SHIFT, 7, movetoworkspacesilent, 7
bind = $mainMod CTRL_L SHIFT, 8, movetoworkspacesilent, 8
bind = $mainMod CTRL_L SHIFT, 9, movetoworkspacesilent, 9
bind = $mainMod CTRL_L SHIFT, 0, movetoworkspacesilent, 10
bind = Alt SHIFT, Tab, movetoworkspace, previous

# Example special workspace (scratchpad)
bind = $mainMod, S, togglespecialworkspace, magic
bind = $mainMod SHIFT, S, movetoworkspace, special:magic

# Scroll through existing workspaces with mainMod + scroll
bind = $mainMod, mouse_down, workspace, e+1
bind = $mainMod, mouse_up, workspace, e-1

# Move/resize windows with mainMod + LMB/RMB and dragging
bindm = $mainMod, mouse:272, movewindow
bindm = $mainMod, mouse:273, resizewindow

# Laptop multimedia keys for volume and LCD brightness
bindel = ,XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+
bindel = ,XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
bindel = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
bindel = ,XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle
bindel = ,XF86MonBrightnessUp, exec, brightnessctl -e4 -n2 set 5%+
bindel = ,XF86MonBrightnessDown, exec, brightnessctl -e4 -n2 set 5%-

# Requires playerctl
bindl = , XF86AudioNext, exec, playerctl next
bindl = , XF86AudioPause, exec, playerctl play-pause
bindl = , XF86AudioPlay, exec, playerctl play-pause
bindl = , XF86AudioPrev, exec, playerctl previous

# Layout
bind = $mainMod, Space, layoutmsg, togglesplit
# bind = $mainMod_CTRL, Space, submap, preselect_layout
# submap = preselect_layout
# bind = , H, layoutmsg, preselect l
# bind = , L, layoutmsg, preselect r
# bind = , K, layoutmsg, preselect u
# bind = , J, layoutmsg, preselect d
# bind = , escape, submap, reset

↓Lua形式に変更

---------------------
---- KEYBINDINGS ----
---------------------

local mainMod = "SUPER" -- Sets "Windows" key as main modifier

-- Example binds, see https://wiki.hypr.land/Configuring/Basics/Binds/ for more
hl.bind(mainMod .. " + Q", hl.dsp.exec_cmd(terminal))
local closeWindowBind = hl.bind(mainMod .. " + SHIFT + C", hl.dsp.window.close())
-- closeWindowBind:set_enabled(false)
hl.bind(mainMod .. " + SHIFT + M", hl.dsp.exec_cmd("command -v hyprshutdown >/dev/null 2>&1 && hyprshutdown || hyprctl dispatch 'hl.dsp.exit()'"))
hl.bind(mainMod .. " + E", hl.dsp.exec_cmd(fileManager))
hl.bind(mainMod .. " + V", hl.dsp.window.float({ action = "toggle" }))
hl.bind(mainMod .. " + R", hl.dsp.exec_cmd(menu))
hl.bind("Alt + Space", hl.dsp.exec_cmd(menu))

hl.bind(mainMod .. " + P", hl.dsp.window.pseudo())
hl.bind(mainMod .. " + J", hl.dsp.layout("togglesplit"))    -- dwindle only

hl.bind("SHIFT + Print",  hl.dsp.exec_cmd([[grim -g "$(slurp)" - | swappy -f -]]))
-- Luaでは [[ ... ]] を使うことで、内部のダブルクォーテーションをエスケープせずに文字列として扱えます)

-- グループ(タブ)にまとめる
hl.bind(mainMod .. " + G", hl.dsp.group.toggle())
hl.bind(mainMod .. " + SHIFT + G", hl.dsp.window({out_of_group = true}))
hl.bind(mainMod .. " + T", hl.dsp.group.next())
hl.bind(mainMod .. " + Tab", hl.dsp.group.next())
hl.bind(mainMod .. " + B", hl.dsp.group.prev())
hl.bind(mainMod .. " + SHIFT + Tab", hl.dsp.group.prev())

-- Move focus with mainMod + arrow keys
hl.bind(mainMod .. " + left",  hl.dsp.focus({ direction = "left" }))
hl.bind(mainMod .. " + right", hl.dsp.focus({ direction = "right" }))
hl.bind(mainMod .. " + up",    hl.dsp.focus({ direction = "up" }))
hl.bind(mainMod .. " + down",  hl.dsp.focus({ direction = "down" }))
hl.bind(mainMod .. " + H",  hl.dsp.focus({ direction = "left" }))
hl.bind(mainMod .. " + L", hl.dsp.focus({ direction = "right" }))
hl.bind(mainMod .. " + K",    hl.dsp.focus({ direction = "up" }))
hl.bind(mainMod .. " + J",  hl.dsp.focus({ direction = "down" }))

hl.bind(mainMod .. " + left",  hl.dsp.focus({ direction = "left" }))

hl.bind(mainMod .. " + SHIFT + left", hl.dsp.window.swap({ direction = "left" }))
hl.bind(mainMod .. " + SHIFT + right", hl.dsp.window.swap({ direction = "right" }))
hl.bind(mainMod .. " + SHIFT + up", hl.dsp.window.swap({ direction = "up" }))
hl.bind(mainMod .. " + SHIFT + down", hl.dsp.window.swap({ direction = "down" }))
hl.bind(mainMod .. " + SHIFT + H", hl.dsp.window.swap({ direction = "left" }))
hl.bind(mainMod .. " + SHIFT + L", hl.dsp.window.swap({ direction = "right" }))
hl.bind(mainMod .. " + SHIFT + K", hl.dsp.window.swap({ direction = "up" }))
hl.bind(mainMod .. " + SHIFT + J", hl.dsp.window.swap({ direction = "down" }))

-- Switch workspaces with mainMod + [0-9]
-- Move active window to a workspace with mainMod + SHIFT + [0-9]
for i = 1, 10 do
    local key = i % 10 -- 10 maps to key 0
    hl.bind(mainMod .. " + " .. key,                  hl.dsp.focus({ workspace = i}))
    hl.bind(mainMod .. " + SHIFT + " .. key,          hl.dsp.window.move({ workspace = i }))
    hl.bind(mainMod .. " + CTRL_L + SHIFT + " .. key, hl.dsp.window.move({ workspace = i, follow = false }))
end

hl.bind("ALT + SHIFT + Tab", hl.dsp.focus({ last = true }))

-- Example special workspace (scratchpad)
hl.bind(mainMod .. " + S",         hl.dsp.workspace.toggle_special("magic"))
hl.bind(mainMod .. " + SHIFT + S", hl.dsp.window.move({ workspace = "special:magic" }))

-- Scroll through existing workspaces with mainMod + scroll
hl.bind(mainMod .. " + mouse_down", hl.dsp.focus({ workspace = "e+1" }))
hl.bind(mainMod .. " + mouse_up",   hl.dsp.focus({ workspace = "e-1" }))

-- Move/resize windows with mainMod + LMB/RMB and dragging
hl.bind(mainMod .. " + mouse:272", hl.dsp.window.drag(),   { mouse = true })
hl.bind(mainMod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true })

-- Laptop multimedia keys for volume and LCD brightness
hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+"), { locked = true, repeating = true })
hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"),      { locked = true, repeating = true })
hl.bind("XF86AudioMute",        hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"),     { locked = true, repeating = true })
hl.bind("XF86AudioMicMute",     hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"),   { locked = true, repeating = true })
hl.bind("XF86MonBrightnessUp",  hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%+"),                  { locked = true, repeating = true })
hl.bind("XF86MonBrightnessDown",hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%-"),                  { locked = true, repeating = true })

-- Requires playerctl
hl.bind("XF86AudioNext",  hl.dsp.exec_cmd("playerctl next"),       { locked = true })
hl.bind("XF86AudioPause", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true })
hl.bind("XF86AudioPlay",  hl.dsp.exec_cmd("playerctl play-pause"), { locked = true })
hl.bind("XF86AudioPrev",  hl.dsp.exec_cmd("playerctl previous"),   { locked = true })

WINDOWS AND WORKSPACES

ウィンドウやワークスペースのルール設定です。デュアルディスプレイ環境なので、ワークスペース1~5はDP2に固定、ワークスペース6~0はDP1に固定して使っています。

##############################
### WINDOWS AND WORKSPACES ###
##############################

# See https://wiki.hypr.land/Configuring/Window-Rules/ for more
# See https://wiki.hypr.land/Configuring/Workspace-Rules/ for workspace rules

# Example windowrules that are useful

windowrule {
    # Ignore maximize requests from all apps. You'll probably like this.
    name = suppress-maximize-events
    match:class = .*

    suppress_event = maximize
}

windowrule {
    # Fix some dragging issues with XWayland
    name = fix-xwayland-drags
    match:class = ^$
    match:title = ^$
    match:xwayland = true
    match:float = true
    match:fullscreen = false
    match:pin = false

    no_focus = true
}

# Hyprland-run windowrule
windowrule {
    name = move-hyprland-run

    match:class = hyprland-run

    move = 20 monitor_h-120
    float = yes
}

# メインディスプレイ (DP-1) に 1~5 を固定
workspace = 1, monitor:DP-2, default:true
workspace = 2, monitor:DP-2, default:true
workspace = 3, monitor:DP-2, default:true
workspace = 4, monitor:DP-2, default:true
workspace = 5, monitor:DP-2, default:true

# サブディスプレイ (HDMI-A-1) に 6~10 を固定
workspace = 6, monitor:DP-1, default:true
workspace = 7, monitor:DP-1, default:true
workspace = 8, monitor:DP-1, default:true
workspace = 9, monitor:DP-1, default:true
workspace = 10, monitor:DP-1, default:true

↓Lua形式に変更

--------------------------------
---- WINDOWS AND WORKSPACES ----
--------------------------------

-- See https://wiki.hypr.land/Configuring/Basics/Window-Rules/
-- and https://wiki.hypr.land/Configuring/Basics/Workspace-Rules/

-- Example window rules that are useful

local suppressMaximizeRule = hl.window_rule({
    -- Ignore maximize requests from all apps. You'll probably like this.
    name  = "suppress-maximize-events",
    match = { class = ".*" },

    suppress_event = "maximize",
})
-- suppressMaximizeRule:set_enabled(false)

hl.window_rule({
    -- Fix some dragging issues with XWayland
    name  = "fix-xwayland-drags",
    match = {
        class      = "^$",
        title      = "^$",
        xwayland   = true,
        float      = true,
        fullscreen = false,
        pin        = false,
    },

    no_focus = true,
})

-- Layer rules also return a handle.
-- local overlayLayerRule = hl.layer_rule({
--     name  = "no-anim-overlay",
--     match = { namespace = "^my-overlay$" },
--     no_anim = true,
-- })
-- overlayLayerRule:set_enabled(false)

-- Hyprland-run windowrule
hl.window_rule({
    name  = "move-hyprland-run",
    match = { class = "hyprland-run" },

    move  = "20 monitor_h-120",
    float = true,
})

-- メインディスプレイに1~5、サブディスプレイに6~10を固定
hl.workspace_rule({ workspace = "1",  monitor = "DP-2", default = true })
hl.workspace_rule({ workspace = "2",  monitor = "DP-2", default = true })
hl.workspace_rule({ workspace = "3",  monitor = "DP-2", default = true })
hl.workspace_rule({ workspace = "4",  monitor = "DP-2", default = true })
hl.workspace_rule({ workspace = "5",  monitor = "DP-2", default = true })
hl.workspace_rule({ workspace = "6",  monitor = "DP-1", default = true })
hl.workspace_rule({ workspace = "7",  monitor = "DP-1", default = true })
hl.workspace_rule({ workspace = "8",  monitor = "DP-1", default = true })
hl.workspace_rule({ workspace = "9",  monitor = "DP-1", default = true })
hl.workspace_rule({ workspace = "10", monitor = "DP-1", default = true })

-- unscale XWayland
hl.config({
  xwayland = {
    force_zero_scaling = true
  }
})

HiDPI XWayland

4kディスプレイなので、スケールの設定をしています。そのまま100%の表示では文字が小さすぎます。ただ、xwayland(wayland上でxwindow専用アプリを表示する機能)はこのスケールを考慮しますが、100%で描画された映像をそのまま拡大処理するだけなのでピンぼけてしまいます。そのため、xwindow用アプリは、基本的に100%で描画してもらい、アプリ自体の設定(あれば)でスケールアップします。xwindow用アプリとしてはsteamなどが上げられます。

######################
### HiDPI XWayland ###
######################

xwayland {
    # XWaylandアプリのスケーリングを無効化する。ぼやけ防止
    force_zero_scaling = true
}

↓Lua形式に変更

----------------------
--- HiDPI XWayland ---
----------------------

-- https://wiki.hypr.land/Configuring/Advanced-and-Cool/XWayland/
-- unscale XWayland
hl.config({
  xwayland = {
    force_zero_scaling = true
  }
})
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?