summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-08-14 05:17:54 +0800
committer魏曹先生 <1992414357@qq.com>2026-08-14 05:17:54 +0800
commitbc8a5889c4bb52405f2ac73d18a42ab43e93e867 (patch)
tree02eef02c4ce2de03d841e605440e0890f1ec8f9e
parent25c5e0b1704b7d7cc4a37619a508c592f6a794c0 (diff)
feat: add Lua config modules for Hyprland
Split the monolithic Hyprland config into modular Lua files covering appearance, input, keybindings, monitors, startup, window rules, and workspace settings.
-rw-r--r--appearance.lua120
-rw-r--r--env.lua13
-rw-r--r--hyprland.lua383
-rw-r--r--input.lua51
-rw-r--r--keybind.lua102
-rw-r--r--monitor.lua30
-rw-r--r--permissions.lua13
-rw-r--r--startup.lua38
-rw-r--r--variables.lua16
-rw-r--r--window-rules.lua108
-rw-r--r--workspace.lua10
11 files changed, 521 insertions, 363 deletions
diff --git a/appearance.lua b/appearance.lua
new file mode 100644
index 0000000..45a5240
--- /dev/null
+++ b/appearance.lua
@@ -0,0 +1,120 @@
+-- 外观设置(对应 appearance.conf)
+-- 参考 https://wiki.hypr.land/Configuring/Basics/Variables/
+
+hl.config({
+ general = {
+ -- 边距
+ gaps_in = 4,
+ gaps_out = { top = 0, right = 8, bottom = 8, left = 8 },
+ -- gaps_out = { top = 0, right = 0, bottom = 0, left = 0 },
+
+ -- 边框
+ border_size = 2,
+
+ -- 边框颜色
+ col = {
+ active_border = { colors = { "rgba(EFEFEF32)" }, angle = 45 },
+ inactive_border = "rgba(2A4A7400)",
+ },
+
+ -- 拖动窗口边缘缩放
+ resize_on_border = false,
+
+ -- 允许撕裂
+ allow_tearing = false,
+
+ -- 布局
+ layout = "dwindle", -- dwindle, master
+
+ -- no_focus_fallback = false
+ },
+
+ decoration = {
+ -- 圆角
+ rounding = 4,
+ rounding_power = 5,
+
+ -- 窗口透明度
+ active_opacity = 1.0,
+ inactive_opacity = 1.0,
+
+ -- 阴影
+ shadow = {
+ enabled = true,
+ range = 4,
+ render_power = 4, -- 合法范围 1-4,旧 conf 中的 5 已超出(原值被旧解析器忽略校验)
+ color = "rgba(1a1a1aee)",
+ },
+
+ -- 模糊
+ blur = {
+ enabled = true,
+ size = 4,
+ passes = 3,
+ vibrancy = 0.1696,
+ },
+ },
+
+ -- 动画主开关
+ animations = {
+ enabled = true,
+ },
+
+ dwindle = {
+ -- pseudotile = true -- 伪平铺的主开关,键绑定部分另有绑定
+ preserve_split = true, -- 您可能想要这个
+ },
+
+ -- 参考 https://wiki.hypr.land/Configuring/Master-Layout/
+ master = {
+ new_status = "master",
+ },
+
+ -- 参考 https://wiki.hypr.land/Configuring/Variables/#misc
+ misc = {
+ force_default_wallpaper = -1, -- 设置为 0 或 1 以禁用动漫吉祥物壁纸
+ disable_hyprland_logo = true, -- 如果为 true,则禁用随机的 hyprland 标志 / 动漫女孩背景
+ },
+})
+
+-- 曲线(对应 appearance.conf 中的 bezier)
+-- 参考 https://wiki.hypr.land/Configuring/Advanced-and-Cool/Animations/#curves
+-- 名称, X0, Y0, X1, Y1
+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 } } })
+
+-- 动画(对应 appearance.conf 中的 animation)
+-- 参考 https://wiki.hypr.land/Configuring/Advanced-and-Cool/Animations/
+-- 名称, 开关, 速度, 曲线, [样式]
+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, bezier = "easeOutQuint" })
+hl.animation({ leaf = "windowsIn", enabled = true, speed = 4.1, bezier = "easeOutQuint", style = "popin 87%" })
+hl.animation({ leaf = "windowsOut", enabled = true, speed = 3.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 = "easeInOutCubic", style = "slide" })
+hl.animation({ leaf = "workspacesIn", enabled = true, speed = 3, bezier = "easeInOutCubic", style = "slide" })
+hl.animation({ leaf = "workspacesOut", enabled = true, speed = 3, bezier = "easeInOutCubic", style = "slide" })
+hl.animation({ leaf = "zoomFactor", enabled = true, speed = 7, bezier = "quick" })
+
+-- 图层规则(对应 appearance.conf 中的 layerrule)
+hl.layer_rule({
+ name = "blur-waybar",
+ match = { namespace = "waybar" },
+ blur = true,
+})
+hl.layer_rule({
+ name = "blur-wofi",
+ match = { namespace = "wofi" },
+ blur = true,
+})
diff --git a/env.lua b/env.lua
new file mode 100644
index 0000000..80597ef
--- /dev/null
+++ b/env.lua
@@ -0,0 +1,13 @@
+-- 系统环境变量设置(对应 env.conf)
+-- 参考 https://wiki.hypr.land/Configuring/Advanced-and-Cool/Environment-variables/
+
+hl.env("XCURSOR_SIZE", "24")
+hl.env("HYPRCURSOR_SIZE", "24")
+
+-------------------
+-- FCITX5 配置
+-------------------
+hl.env("QT_IM_MODULE", "fcitx")
+hl.env("XMODIFIERS", "@im=fcitx")
+hl.env("SDL_IM_MODULE", "fcitx")
+hl.env("GLFW_IM_MODULE", "ibus")
diff --git a/hyprland.lua b/hyprland.lua
index 72c7a90..51f3f2d 100644
--- a/hyprland.lua
+++ b/hyprland.lua
@@ -1,363 +1,20 @@
-
--- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
--- AUTOGENERATED HYPRLAND CONFIG. --
--- EDIT THIS CONFIG ACCORDING TO THE WIKI INSTRUCTIONS. --
--- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-
-
--- This is an example Hyprland Lua config file.
--- Refer to the wiki for more information.
--- https://wiki.hypr.land/Configuring/Start/
-
--- Please note not all available settings / options are set here.
--- For a full list, see the wiki
-
--- You can (and should!!) split this configuration into multiple files
--- Create your files separately and then require them like this:
--- require("myColors")
-
-
-------------------
----- MONITORS ----
-------------------
-
--- See https://wiki.hypr.land/Configuring/Basics/Monitors/
-hl.monitor({
- output = "",
- mode = "preferred",
- position = "auto",
- scale = "auto",
-})
-
-
----------------------
----- MY PROGRAMS ----
----------------------
-
--- Set programs that you use
-local terminal = "kitty"
-local fileManager = "dolphin"
-local menu = "hyprlauncher"
-
-
--------------------
----- 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(terminal)
--- hl.exec_cmd("nm-applet")
--- hl.exec_cmd("waybar & hyprpaper & firefox")
--- end)
-
-
--------------------------------
----- ENVIRONMENT VARIABLES ----
--------------------------------
-
--- See https://wiki.hypr.land/Configuring/Advanced-and-Cool/Environment-variables/
-
-hl.env("XCURSOR_SIZE", "24")
-hl.env("HYPRCURSOR_SIZE", "24")
-
-
------------------------
------ 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 ----
------------------------
-
--- 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 = 238.1191, dampening = 24.21279333 })
-
-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 ----
----------------
-
-hl.config({
- input = {
- kb_layout = "us",
- kb_variant = "",
- kb_model = "",
- kb_options = "",
- kb_rules = "",
-
- follow_mouse = 1,
-
- sensitivity = 0, -- -1.0 - 1.0, 0 means no modification.
-
- touchpad = {
- natural_scroll = false,
- },
- },
-})
-
-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 = "epic-mouse-v1",
- sensitivity = -0.5,
-})
-
-
----------------------
----- 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 .. " + C", hl.dsp.window.close())
--- closeWindowBind:set_enabled(false)
-hl.bind(mainMod .. " + 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(mainMod .. " + P", hl.dsp.window.pseudo())
-hl.bind(mainMod .. " + J", hl.dsp.layout("togglesplit")) -- dwindle only
-
--- 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" }))
-
--- 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 }))
-end
-
--- 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 ----
---------------------------------
-
--- 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,
-})
+-- Hyprland 主配置文件 (Lua 版本, 对应 hyprland.conf)
+-- 通过 require 引入各分模块
+-- 参考 https://wiki.hypr.land/Configuring/Start/
+
+require("env") -- 环境变量
+require("monitor") -- 显示器配置
+require("variables") -- 默认程序设置
+require("startup") -- 自启动程序
+require("permissions") -- 权限配置
+require("appearance") -- 外观设置
+require("input") -- 输入配置
+require("keybind") -- 键绑定
+require("workspace") -- 工作区配置
+
+-- 窗口规则(原 hyprland.conf 中已注释,如需要请取消下一行)
+-- require("window-rules")
+
+-- 原 hyprland.conf 中的环境变量
+hl.env("HYPRLAND_USE_LIBINPUT_GESTURES", "1")
+hl.env("GTK_USE_PORTAL", "1")
diff --git a/input.lua b/input.lua
new file mode 100644
index 0000000..81e63b4
--- /dev/null
+++ b/input.lua
@@ -0,0 +1,51 @@
+-- 输入配置(对应 input.conf)
+-- 参考 https://wiki.hypr.land/Configuring/Basics/Variables/#input
+
+hl.config({
+ input = {
+ kb_layout = "us",
+ kb_variant = "",
+ kb_model = "",
+ kb_options = "caps:escape",
+ kb_rules = "",
+
+ follow_mouse = 1,
+
+ -- 合法范围 -1.0 ~ 1.0,0 表示不修改;旧 conf 中的 -10 已超出(原值被旧解析器忽略校验)
+ sensitivity = -1.0,
+ scroll_method = "2fg",
+
+ touchpad = {
+ natural_scroll = false,
+ scroll_factor = 0.5,
+ clickfinger_behavior = true,
+ drag_lock = 0,
+ tap_to_click = true,
+ drag_3fg = 2,
+ },
+ },
+})
+
+-- 触摸板手势(对应 input.conf 中的 gesture)
+-- 参考 https://wiki.hypr.land/Configuring/Advanced-and-Cool/Gestures/
+hl.gesture({
+ fingers = 3,
+ direction = "horizontal",
+ action = "workspace",
+})
+hl.gesture({
+ fingers = 3,
+ direction = "swipe",
+ mods = "ALT",
+ action = "move",
+})
+
+-- 每设备配置(对应 input.conf 中的 device 块)
+-- 参考 https://wiki.hypr.land/Configuring/Advanced-and-Cool/Devices/
+hl.device({
+ name = "elan07c8:00-04f3:3298-touchpad",
+ sensitivity = -0.2,
+ scroll_factor = 0,
+ accel_profile = "flat",
+ clickfinger_behavior = true,
+})
diff --git a/keybind.lua b/keybind.lua
new file mode 100644
index 0000000..c0e765b
--- /dev/null
+++ b/keybind.lua
@@ -0,0 +1,102 @@
+-- 键绑定(对应 keybind.conf)
+-- 参考 https://wiki.hypr.land/Configuring/Basics/Binds/
+-- 在 Lua 中,键绑定通过 hl.bind(按键, 动作) 声明
+
+local variables = require("variables")
+
+local mainMod = "ALT" -- 将 "ALT" 键设置为主修饰键
+
+-- 打开终端 ALT + F2
+hl.bind(mainMod .. " + F2", hl.dsp.exec_cmd(variables.terminal))
+
+-- 打开文件管理器 ALT + CTRL + F
+hl.bind(mainMod .. " + CTRL + F", hl.dsp.exec_cmd(variables.fileManager))
+
+-- 退出当前程序 ALT + F4
+hl.bind(mainMod .. " + F4", hl.dsp.window.kill())
+
+-- 搜索文件 CTRL ALT + Q
+hl.bind(mainMod .. " + CTRL + Q", hl.dsp.exec_cmd("flatpak run io.github.cboxdoerfer.FSearch"))
+
+-- 截图 CTRL + ALT + A
+hl.bind(mainMod .. " + CTRL + A", hl.dsp.exec_cmd(variables.screenshot))
+
+-- 退出程序 ALT + SHIFT + F12
+hl.bind(mainMod .. " + SHIFT + F12", hl.dsp.exit())
+
+-- 切换浮动窗口 ALT + F
+-- hl.bind(mainMod .. " + F", hl.dsp.window.float())
+hl.bind(mainMod .. " + F", hl.dsp.exec_cmd("~/.config/hypr/scripts/toggle_float_center.sh"))
+
+-- 切换全屏 ALT + F12
+hl.bind(mainMod .. " + F12", hl.dsp.window.fullscreen())
+
+-- 显示应用菜单 ALT + SPACE
+hl.bind(mainMod .. " + space", hl.dsp.exec_cmd(variables.menu))
+
+-- 切换窗口平铺模式 ALT + O/P
+hl.bind(mainMod .. " + O", hl.dsp.window.pseudo()) -- dwindle
+hl.bind(mainMod .. " + P", hl.dsp.layout("togglesplit")) -- dwindle
+
+-- 系统监视器 CTRL SHIFT + ESC
+hl.bind("CTRL + SHIFT + escape", hl.dsp.exec_cmd(variables.systemMonitor))
+hl.bind(mainMod .. " + F5", hl.dsp.exec_cmd("hyprctl reload"))
+
+-- 剪贴板历史 SUPER + V
+hl.bind("SUPER + V", hl.dsp.exec_cmd(variables.clipboardManager))
+
+-- 移动焦点 ALT + 方向
+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" }))
+
+-- 移动窗口 ALT + CTRL + 方向
+hl.bind(mainMod .. " + CTRL + left", hl.dsp.window.move({ direction = "left" }))
+hl.bind(mainMod .. " + CTRL + right", hl.dsp.window.move({ direction = "right" }))
+hl.bind(mainMod .. " + CTRL + up", hl.dsp.window.move({ direction = "up" }))
+hl.bind(mainMod .. " + CTRL + down", hl.dsp.window.move({ direction = "down" }))
+
+-- 切换工作区 SUPER + ALT + 左/右
+hl.bind(mainMod .. " + SUPER + left", hl.dsp.focus({ workspace = "-1" }))
+hl.bind(mainMod .. " + SUPER + right", hl.dsp.focus({ workspace = "+1" }))
+-- hl.bind(mainMod .. " + SUPER + left", hl.dsp.layout("move -col"))
+-- hl.bind(mainMod .. " + SUPER + right", hl.dsp.layout("move +col"))
+
+-- 总览 SUPER + ALT + 上/下
+-- hl.bind(mainMod .. " + SUPER + up", hl.dsp.event("overview:toggle"))
+-- hl.bind(mainMod .. " + SUPER + down", hl.dsp.event("overview:close"))
+
+-- 示例特殊工作区(便签簿) SUPER + ALT + 上
+hl.bind(mainMod .. " + SUPER + up", hl.dsp.workspace.toggle_special("magic"))
+
+-- 浏览现有工作区 ALT + 滚轮
+-- hl.bind(mainMod .. " + mouse_down", hl.dsp.focus({ workspace = "e+1" }))
+-- hl.bind(mainMod .. " + mouse_up", hl.dsp.focus({ workspace = "e-1" }))
+
+-- 使用 ALT + 左键/右键 点击并拖动来移动/调整窗口大小(bindm)
+hl.bind(mainMod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true })
+hl.bind(mainMod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true })
+
+-- 笔记本电脑多媒体键,用于音量和 LCD 亮度(bindel)
+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 })
+
+-- 需要 playerctl(bindl)
+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 })
+
+-- 移动窗口至其他工作区(CTRL + ALT + 数字)
+for i = 1, 10 do
+ local key = i % 10 -- 10 映射到按键 0
+ hl.bind("CTRL + " .. mainMod .. " + " .. key, hl.dsp.window.move({ workspace = tostring(i) }))
+end
+
+-- 移动窗口至特殊工作区(CTRL + ALT + 下)
+hl.bind("CTRL + " .. mainMod .. " + down", hl.dsp.window.move({ workspace = "special:magic" }))
diff --git a/monitor.lua b/monitor.lua
new file mode 100644
index 0000000..9dddbec
--- /dev/null
+++ b/monitor.lua
@@ -0,0 +1,30 @@
+-- 显示器配置(对应 monitor.conf)
+-- 参考 https://wiki.hypr.land/Configuring/Basics/Monitors/
+
+-- 常量区
+local main_monitor = "eDP-1" -- 非特殊情况别碰,笔记本的主屏幕是永远不变的
+local main_monitor_size = "2560x1440@240"
+local main_monitor_pos = "0x1080"
+local main_monitor_scale = "1.6"
+
+local sub_monitor = "DP-1" -- TypeC 副屏
+-- local sub_monitor = "HDMI-A-1" -- HDMI 副屏
+local sub_monitor_size = "1920x1080@144.00Hz"
+-- 副屏置于主屏上方并水平居中:(320 = (2560 - 1920) / 2)
+local sub_monitor_pos = "320x0"
+local sub_monitor_scale = "1"
+
+-- 声明
+hl.monitor({
+ output = main_monitor,
+ mode = main_monitor_size,
+ position = main_monitor_pos,
+ scale = main_monitor_scale,
+})
+
+hl.monitor({
+ output = sub_monitor,
+ mode = sub_monitor_size,
+ position = sub_monitor_pos,
+ scale = sub_monitor_scale,
+})
diff --git a/permissions.lua b/permissions.lua
new file mode 100644
index 0000000..c6b9363
--- /dev/null
+++ b/permissions.lua
@@ -0,0 +1,13 @@
+-- 权限配置(对应 permissions.conf)
+-- 注意:出于安全原因,此处的权限更改需要重启 Hyprland 才能生效,且不会实时应用
+-- 参考 https://wiki.hypr.land/Configuring/Advanced-and-Cool/Permissions/
+
+-- 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")
diff --git a/startup.lua b/startup.lua
new file mode 100644
index 0000000..36206d3
--- /dev/null
+++ b/startup.lua
@@ -0,0 +1,38 @@
+-- 自启动程序(对应 startup.conf 中的 exec-once)
+-- 参考 https://wiki.hypr.land/Configuring/Basics/Autostart/
+-- Lua 中对应 exec-once 的写法:在 hyprland.start 事件中执行
+
+hl.on("hyprland.start", function()
+ -- 顶部菜单 / shell
+ -- hl.exec_cmd("polybar -q -c ~/.config/polybar/config.ini -r")
+ -- hl.exec_cmd("waybar")
+ hl.exec_cmd("ashell --config-path /home/catilgrass/.config/ashell/config.toml")
+
+ -- Seatd
+ hl.exec_cmd("seatd -g video")
+
+ -- 总览
+ hl.exec_cmd("hyprpm enable Hyprspace")
+
+ -- 壁纸
+ hl.exec_cmd("hyprpaper")
+
+ -- 剪贴板 (只存文本/图片数据)
+ hl.exec_cmd("wl-paste --type text --watch cliphist store")
+ hl.exec_cmd("wl-paste --type image --watch cliphist store")
+
+ -- Overview
+ -- hl.exec_cmd("hyprctl plugin load ~/.config/hypr/plugins/hyprspace.so")
+
+ -- 验证器
+ hl.exec_cmd("/usr/lib/mate-polkit/polkit-mate-authentication-agent-1")
+
+ -- 通知
+ hl.exec_cmd("/home/catilgrass/Scripts/dunst-daemon.sh")
+
+ -- 截图
+ -- hl.exec_cmd("flameshot")
+
+ -- FCITX5
+ hl.exec_cmd("fcitx5 --replace -d")
+end)
diff --git a/variables.lua b/variables.lua
new file mode 100644
index 0000000..6d326ab
--- /dev/null
+++ b/variables.lua
@@ -0,0 +1,16 @@
+-- 默认程序设置(对应 variables.conf)
+-- 供其它模块使用,例如:local v = require("variables")
+-- 参考 https://wiki.hypr.land/Configuring/Keywords/
+
+local screenshotFn = "/home/catilgrass/Image/Screenshot/screen_$(date +%Y%m%d_%H%M%S).png"
+
+return {
+ terminal = "kitty", -- 终端
+ fileManager = "nautilus", -- 文件管理器
+ menu = "wofi --allow-images --hide-scroll --dmenu --show drun --width 400", -- 应用程序菜单
+ -- menu = "rofi -show drun -show-icons",
+ systemMonitor = "kitty htop", -- 系统监视器
+ clipboardManager = 'cliphist list | wofi --dmenu --width 350 --pre-display-cmd "echo \'%s\' | cut -f 2" | cliphist decode | wl-copy',
+ -- 截图工具
+ screenshot = 'grim -t png -c -g "$(slurp)" ' .. screenshotFn .. ' && notify-send "截图保存至' .. screenshotFn .. '" | wl-copy < ' .. screenshotFn,
+}
diff --git a/window-rules.lua b/window-rules.lua
new file mode 100644
index 0000000..407fdfd
--- /dev/null
+++ b/window-rules.lua
@@ -0,0 +1,108 @@
+-- 窗口规则配置(对应 window-rules.conf)
+-- 注意:原 hyprland.conf 中 source = ./window-rules.conf 已被注释,
+-- 如需启用请在 hyprland.lua 中取消 require("window-rules") 的注释
+-- 参考 https://wiki.hypr.land/Configuring/Basics/Window-Rules/
+
+-- 浮动窗口特殊边框设置
+hl.window_rule({
+ name = "floating-bordersize",
+ match = { float = true },
+ border_size = 3,
+})
+hl.window_rule({
+ name = "floating-rounding",
+ match = { float = true },
+ rounding = 8,
+})
+
+-- 为所有浮动窗口设置统一的边框颜色
+-- hl.window_rule({
+-- name = "floating-border-color",
+-- match = { float = true },
+-- border_color = "rgba(FF6B9CFF)",
+-- })
+-- hl.window_rule({
+-- name = "tiled-border-color",
+-- match = { float = false },
+-- border_color = "rgba(FF6B9C64)",
+-- })
+
+-- "智能间隙" / "仅有一个窗口时无间隙"
+-- 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,
+-- })
+
+-- Flameshot 截图工具浮动窗口
+-- hl.window_rule({ name = "flameshot-float", match = { class = "^(flameshot)$" }, float = true })
+-- hl.window_rule({ name = "flameshot-pin", match = { class = "^(flameshot)$" }, pin = true })
+-- hl.window_rule({ name = "flameshot-noborder", match = { class = "^(flameshot)$" }, decorate = false }) -- 旧版 noborder 在 0.56 中由 decorate = false 取代
+-- hl.window_rule({ name = "flameshot-nofocus", match = { class = "^(flameshot)$" }, no_focus = true })
+-- hl.window_rule({ name = "flameshot-center", match = { class = "^(flameshot)$" }, center = true })
+
+-- Rofi 菜单透明度
+-- hl.window_rule({
+-- name = "rofi-opacity",
+-- match = { title = "^(rofi)$" },
+-- opacity = "0.6",
+-- })
+
+-- Wofi 菜单透明度
+hl.window_rule({
+ name = "wofi-opacity",
+ match = { class = "^(wofi)$" },
+ opacity = "0.9 0.8",
+})
+hl.window_rule({
+ name = "wofi-dimaround",
+ match = { class = "^(wofi)$" },
+ dim_around = true,
+})
+hl.window_rule({
+ name = "wofi-animation",
+ match = { class = "^(wofi)$" },
+ animation = "popin",
+})
+hl.window_rule({
+ name = "wofi-rounding",
+ match = { class = "^(wofi)$" },
+ rounding = 10,
+})
+
+-- 忽略应用程序的最大化请求
+hl.window_rule({
+ name = "suppress-maximize",
+ match = { class = ".*" },
+ suppress_event = "maximize",
+})
+
+-- 修复 XWayland 的一些拖动问题
+hl.window_rule({
+ name = "fix-xwayland-drags",
+ match = {
+ class = "^$",
+ title = "^$",
+ xwayland = true,
+ float = true,
+ fullscreen = false,
+ pin = false,
+ },
+ no_focus = true,
+})
+
+-- 示例窗口规则
+-- hl.window_rule({
+-- name = "kitty-float",
+-- match = { class = "^(kitty)$", title = "^(kitty)$" },
+-- float = true,
+-- })
diff --git a/workspace.lua b/workspace.lua
new file mode 100644
index 0000000..9742b76
--- /dev/null
+++ b/workspace.lua
@@ -0,0 +1,10 @@
+-- 工作区配置(对应 workspace.conf)
+-- 参考 https://wiki.hypr.land/Configuring/Basics/Workspace-Rules/
+
+-- 镜像所有工作区到显示器
+for i = 1, 20 do
+ hl.workspace_rule({
+ workspace = tostring(i),
+ monitor = "all",
+ })
+end