初始化dotfiles

This commit is contained in:
2026-06-18 11:36:12 +08:00
commit f4305709a5
37 changed files with 1540 additions and 0 deletions

5
hypr/.luarc.json Normal file
View File

@ -0,0 +1,5 @@
{
"diagnostics": {
"globals": ["hl"]
}
}

96
hypr/conf/animations.lua Normal file
View File

@ -0,0 +1,96 @@
-- 动画配置
-- 为不同操作提供差异化的视觉反馈
-- ============================================
-- 动画曲线定义
-- ============================================
-- 平滑减速(通用)
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} } })
-- 弹性弹簧(窗口移动/调整)
hl.curve("easy", { type = "spring", mass = 1, stiffness = 71.2633, dampening = 15.8273644 })
-- 轻微过冲(窗口打开时的弹性感)
hl.curve("overshot", { type = "bezier", points = { {0.05, 0.9}, {0.1, 1.1} } })
-- Mac 风格阻尼(暂存区/抽屉)
hl.curve("macDamp", { type = "bezier", points = { {0.16, 1}, {0.3, 1} } })
-- ============================================
-- 全局动画开关
-- ============================================
hl.animation({ leaf = "global", enabled = true, speed = 10, bezier = "default" })
-- ============================================
-- 边框动画 — 焦点切换时边框颜色平滑过渡
-- ============================================
hl.animation({ leaf = "border", enabled = true, speed = 5.39, bezier = "easeOutQuint" })
hl.animation({ leaf = "borderangle", enabled = false })
-- ============================================
-- 窗口动画
-- ============================================
-- 窗口打开:从屏幕外滑入(视觉反馈:像推方块一样挤进来)
hl.animation({ leaf = "windowsIn", enabled = true, speed = 5, bezier = "easeOutQuint", style = "slide" })
-- 窗口关闭:缩小+淡出(视觉反馈:窗口收缩消失)
hl.animation({ leaf = "windowsOut", enabled = true, speed = 4, bezier = "easeOutQuint", style = "slide" })
-- 窗口移动/拖拽/调整大小:弹性弹簧(视觉反馈:窗口跟手且有弹性)
hl.animation({ leaf = "windows", enabled = true, speed = 4.79, spring = "easy" })
-- ============================================
-- 淡入淡出动画
-- ============================================
-- 窗口打开淡入(关闭,配合 slide 效果)
hl.animation({ leaf = "fadeIn", enabled = false })
-- 窗口关闭淡出(开启,配合缩小效果)
hl.animation({ leaf = "fadeOut", enabled = true, speed = 4, bezier = "easeOutQuint" })
-- 焦点切换时透明度过渡(视觉反馈:当前窗口高亮)
hl.animation({ leaf = "fade", enabled = true, speed = 3.03, bezier = "quick" })
hl.animation({ leaf = "fadeSwitch", enabled = true, speed = 3, bezier = "almostLinear" })
hl.animation({ leaf = "fadeShadow", enabled = true, speed = 3, bezier = "almostLinear" })
hl.animation({ leaf = "fadeDim", enabled = true, speed = 3, bezier = "quick" })
-- DPMS 屏幕开关淡入淡出
hl.animation({ leaf = "fadeDpms", enabled = true, speed = 5, bezier = "easeInOutCubic" })
-- ============================================
-- 工作区切换动画 — 水平平移效果
-- Super+1~10 切换工作区时,窗口水平滑动
-- ============================================
hl.animation({ leaf = "workspaces", enabled = true, speed = 5, bezier = "easeOutQuint", style = "slide" })
hl.animation({ leaf = "workspacesIn", enabled = true, speed = 5, bezier = "easeOutQuint", style = "slide" })
hl.animation({ leaf = "workspacesOut", enabled = true, speed = 5, bezier = "easeOutQuint", style = "slide" })
-- ============================================
-- 特殊工作区(暂存区/抽屉)动画 — 垂直抽拉效果
-- Super+S 切换暂存区时,窗口从底部弹出/收回,类似抽屉
-- ============================================
hl.animation({ leaf = "specialWorkspace", enabled = true, speed = 5, bezier = "macDamp", style = "slidevert" })
hl.animation({ leaf = "specialWorkspaceIn", enabled = true, speed = 5, bezier = "macDamp", style = "slidevert" })
hl.animation({ leaf = "specialWorkspaceOut", enabled = true, speed = 4, bezier = "easeOutQuint", style = "slidevert" })
-- ============================================
-- 图层表面动画(通知/栏/启动器等)
-- ============================================
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 = "zoomFactor", enabled = true, speed = 7, bezier = "quick" })

44
hypr/conf/appearance.lua Normal file
View File

@ -0,0 +1,44 @@
-- 外观:间距、边框、圆角、阴影、模糊
hl.config({
general = {
gaps_in = 5, -- 窗口内间距
gaps_out = 20, -- 窗口外间距
border_size = 2, -- 边框宽度
col = {
active_border = "rgba(89b4faee)", -- Catppuccin Mocha 蓝
inactive_border = "rgba(45475aaa)", -- Catppuccin Mocha 表面0
},
resize_on_border = true, -- 拖拽边框调整窗口大小
extend_border_grab_area = 10, -- 边框可拖拽区域扩展
allow_tearing = false,
layout = "dwindle",
},
decoration = {
rounding = 10, -- 圆角半径
rounding_power = 2,
active_opacity = 1.0, -- 活动窗口不透明度
inactive_opacity = 0.95, -- 非活动窗口微透明
shadow = {
enabled = true,
range = 4, -- 阴影范围
render_power = 3, -- 阴影渲染精度
color = 0xee1a1a1a, -- 深色半透明阴影
},
blur = {
enabled = true,
size = 3, -- 模糊强度
passes = 1, -- 模糊迭代次数(性能与效果平衡)
vibrancy = 0.1696, -- 色彩饱和度
},
},
animations = {
enabled = true, -- 动画总开关(详细配置见 animations.lua
},
})

12
hypr/conf/autostart.lua Normal file
View File

@ -0,0 +1,12 @@
-- 自动启动Hyprland 启动后运行的服务
hl.on("hyprland.start", function()
hl.exec_cmd("systemctl --user start hyprpolkitagent") -- hyorpokitagent 认证模块
hl.exec_cmd("hyprpm reload -n") -- hyprpm 插件加载
hl.exec_cmd("qs -c noctalia-shell") -- Noctalia Shell状态栏/启动器/通知/壁纸)
hl.exec_cmd("udiskie") -- 自动挂载 U 盘
hl.exec_cmd("fcitx5 -d") -- 中文输入法
-- hypridle 由 systemd 管理(自动重启),不在 autostart 启动
hl.exec_cmd("nm-applet --indicator") -- 网络托盘图标
hl.exec_cmd("/home/atdunbg/.cargo/bin/alttabway daemon") -- Alt+Tab 窗口切换器守护进程
end)

23
hypr/conf/env.lua Normal file
View File

@ -0,0 +1,23 @@
-- 环境变量输入法、光标、Wayland 兼容性
hl.env("QT_QPA_PLATFORMTHEME", "qt6ct")
-- Dolphin 部分功能问题
hl.env("XDG_MENU_PREFIX", "plasma-")
-- Noctalia 图标主题
hl.env("QS_ICON_THEME", "Tela")
-- Fcitx5 中文输入法
hl.env("QT_IM_MODULE", "fcitx")
hl.env("XMODIFIERS", "@im=fcitx")
-- 光标主题与大小X11 + Hyprland 双协议)
hl.env("XCURSOR_SIZE", "24")
hl.env("XCURSOR_THEME", "Adwaita")
hl.env("HYPRCURSOR_SIZE", "24")
hl.env("HYPRCURSOR_THEME", "Adwaita")
-- Electron 应用 Wayland 原生支持
hl.env("ELECTRON_OZONE_PLATFORM_HINT", "auto")

33
hypr/conf/input.lua Normal file
View File

@ -0,0 +1,33 @@
-- 输入设备:键盘、鼠标、触控板、手势
hl.config({
input = {
kb_layout = "us", -- 键盘布局
kb_variant = "",
kb_model = "",
kb_options = "",
kb_rules = "",
follow_mouse = 1, -- 焦点跟随鼠标
sensitivity = 0, -- 鼠标灵敏度0 = 系统默认)
touchpad = {
natural_scroll = true, -- 自然滚动(反向)
disable_while_typing = true, -- 打字时禁用触控板
clickfinger_behavior = true, -- 点击行为(非按钮区域)
},
},
})
-- 触控手势3/4指水平滑动切换工作区
hl.gesture({
fingers = 3,
direction = "horizontal",
action = "workspace",
})
hl.gesture({
fingers = 4,
direction = "horizontal",
action = "workspace",
})

108
hypr/conf/keybinds.lua Normal file
View File

@ -0,0 +1,108 @@
-- 快捷键绑定
-- mainMod = SUPER所有组合基于 Super 键
local programs = require("conf.programs")
local terminal = programs.terminal
local fileManager = programs.fileManager
local browser = programs.browser
local mainMod = "SUPER"
-- —— tide-island ——
hl.bind(mainMod .. " + Tab", hl.dsp.exec_cmd("qs ipc -p /usr/share/tide-island call overview toggle"), { description = "切换预览下的窗口(tide-island)" })
-- ── 概览与窗口切换 ──
hl.bind(mainMod .. " + W", function() hl.plugin.hyprexpo.expo("toggle") end, { description = "工作区概览" })
hl.bind("ALT + Tab", hl.dsp.exec_cmd("/home/atdunbg/.cargo/bin/alttabway show --next"), { description = "切换预览下的窗口" })
hl.bind("ALT + SHIFT + Tab", hl.dsp.exec_cmd("/home/atdunbg/.cargo/bin/alttabway show --prev"), { description = "切换预览上的窗口" })
-- ── 应用启动 ──
hl.bind(mainMod .. " + RETURN", hl.dsp.exec_cmd(terminal), { description = "终端 (kitty)" })
hl.bind(mainMod .. " + E", hl.dsp.exec_cmd(fileManager), { description = "文件管理器 (dolphin)" })
hl.bind(mainMod .. " + R", hl.dsp.exec_cmd("qs -c noctalia-shell ipc call launcher toggle"), { description = "应用启动器 (Noctalia)" })
hl.bind(mainMod .. " + B", hl.dsp.exec_cmd(browser), { description = "浏览器 (firefox)" })
hl.bind(mainMod .. " + SLASH", hl.dsp.exec_cmd("bash -c 'if hyprctl clients -j | grep -q keymap-float; then hyprctl dispatch focuswindow keymap-float; else kitty --class keymap-float --override window_padding_width=12 --override font_size=13 /home/atdunbg/.config/hypr/scripts/keymap; fi'"), { description = "快捷键速查" })
-- ── 窗口控制 ──
hl.bind(mainMod .. " + Q", hl.dsp.window.close(), { description = "关闭窗口" })
hl.bind(mainMod .. " + F", hl.dsp.window.fullscreen({ mode = "maximized" }), { description = "最大化(保留边距)" })
hl.bind(mainMod .. " + SHIFT + F", hl.dsp.window.fullscreen(), { description = "全屏" })
hl.bind(mainMod .. " + V", hl.dsp.window.float({ action = "toggle" }), { description = "浮动/平铺切换" })
hl.bind(mainMod .. " + P", hl.dsp.window.pseudo(), { description = "伪平铺" })
hl.bind(mainMod .. " + T", hl.dsp.layout("togglesplit"), { description = "切换分割方向" })
-- 窗口调整大小Super+Alt+H/J/K/L支持长按重复
hl.bind(mainMod .. " + ALT + H", hl.dsp.window.resize({ x = -30, y = 0, relative = true }), { repeating = true, description = "窗口缩小(左)" })
hl.bind(mainMod .. " + ALT + L", hl.dsp.window.resize({ x = 30, y = 0, relative = true }), { repeating = true, description = "窗口扩大(右)" })
hl.bind(mainMod .. " + ALT + K", hl.dsp.window.resize({ x = 0, y = -30, relative = true }), { repeating = true, description = "窗口缩小(上)" })
hl.bind(mainMod .. " + ALT + J", hl.dsp.window.resize({ x = 0, y = 30, relative = true }), { repeating = true, description = "窗口扩大(下)" })
-- ── 布局切换dwindle ↔ scrolling──
hl.bind(mainMod .. " + G", function() hl.config({ general = { layout = "dwindle" } }) end, { description = "切换到 dwindle 布局" })
hl.bind(mainMod .. " + SHIFT + G", function() hl.config({ general = { layout = "scrolling" } }) end, { description = "切换到 scrolling 布局" })
-- ── 焦点移动Vim 风格 H/J/K/L──
hl.bind(mainMod .. " + H", hl.dsp.focus({ direction = "left" }), { description = "焦点左移" })
hl.bind(mainMod .. " + L", hl.dsp.focus({ direction = "right" }), { description = "焦点右移" })
hl.bind(mainMod .. " + K", hl.dsp.focus({ direction = "up" }), { description = "焦点上移" })
hl.bind(mainMod .. " + J", hl.dsp.focus({ direction = "down" }), { description = "焦点下移" })
-- Scrolling 布局专用快捷键
hl.bind(mainMod .. " + CTRL + J", hl.dsp.layout("focus l"), { description = "无限平铺: 聚焦左列" })
hl.bind(mainMod .. " + CTRL + K", hl.dsp.layout("focus r"), { description = "无限平铺: 聚焦右列" })
hl.bind(mainMod .. " + CTRL + N", hl.dsp.layout("colresize -0.1"), { description = "无限平铺: 缩小列宽" })
hl.bind(mainMod .. " + CTRL + M", hl.dsp.layout("colresize +0.1"), { description = "无限平铺: 增大列宽" })
-- ── 窗口移动Super+Shift+H/J/K/L──
hl.bind(mainMod .. " + SHIFT + H", hl.dsp.window.move({ direction = "left" }), { description = "窗口左移" })
hl.bind(mainMod .. " + SHIFT + L", hl.dsp.window.move({ direction = "right" }), { description = "窗口右移" })
hl.bind(mainMod .. " + SHIFT + K", hl.dsp.window.move({ direction = "up" }), { description = "窗口上移" })
hl.bind(mainMod .. " + SHIFT + J", hl.dsp.window.move({ direction = "down" }), { description = "窗口下移" })
-- ── 工作区1-100 代表 10──
for i = 1, 10 do
local key = i % 10
hl.bind(mainMod .. " + " .. key, hl.dsp.focus({ workspace = i }), { description = "切换工作区 " .. i })
hl.bind(mainMod .. " + SHIFT + " .. key, hl.dsp.window.move({ workspace = i }), { description = "移动到工作区 " .. i })
end
-- 相邻工作区
hl.bind(mainMod .. " + CTRL + LEFT", hl.dsp.focus({ workspace = "e-1" }), { description = "上一个工作区" })
hl.bind(mainMod .. " + CTRL + RIGHT", hl.dsp.focus({ workspace = "e+1" }), { description = "下一个工作区" })
-- ── 暂存区抽屉式Super+S 收放)──
hl.bind(mainMod .. " + S", hl.dsp.workspace.toggle_special("magic"), { description = "切换暂存区" })
hl.bind(mainMod .. " + SHIFT + S", hl.dsp.window.move({ workspace = "special:magic" }), { description = "移动到暂存区" })
-- ── 鼠标与滚轮 ──
hl.bind(mainMod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true, description = "鼠标拖动窗口" })
hl.bind(mainMod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true, description = "鼠标调整大小" })
hl.bind(mainMod .. " + mouse_down", hl.dsp.focus({ workspace = "e+1" }), { description = "滚轮下一个工作区" })
hl.bind(mainMod .. " + mouse_up", hl.dsp.focus({ workspace = "e-1" }), { description = "滚轮上一个工作区" })
-- ── 退出 ──
hl.bind(mainMod .. " + M", hl.dsp.exit(), { description = "退出 Hyprland" })
-- ── 多媒体键(锁屏下也可用,支持长按重复)──
hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+"), { locked = true, repeating = true, description = "音量增加 5%" })
hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"), { locked = true, repeating = true, description = "音量减少 5%" })
hl.bind("XF86AudioMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"), { locked = true, repeating = true, description = "切换静音" })
hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"), { locked = true, repeating = true, description = "切换麦克风" })
-- ── 亮度 ──
hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("brightnessctl s +10%"), { locked = true, repeating = true, description = "亮度增加 10%" })
hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd("brightnessctl s 10%-"), { locked = true, repeating = true, description = "亮度减少 10%" })
-- ── 媒体控制 ──
hl.bind("XF86AudioNext", hl.dsp.exec_cmd("playerctl next"), { locked = true, description = "下一曲" })
hl.bind("XF86AudioPause", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true, description = "播放/暂停" })
hl.bind("XF86AudioPlay", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true, description = "播放/暂停" })
hl.bind("XF86AudioPrev", hl.dsp.exec_cmd("playerctl previous"), { locked = true, description = "上一曲" })
-- ── 截图 ──
hl.bind("Print", hl.dsp.exec_cmd("/home/atdunbg/.config/hypr/scripts/screenshot full"), { locked = true, description = "全屏截图→保存文件" })
hl.bind(mainMod .. " + Print", hl.dsp.exec_cmd("/home/atdunbg/.config/hypr/scripts/screenshot area"), { locked = true, description = "区域截图→保存文件" })
hl.bind(mainMod .. " + SHIFT + Print", hl.dsp.exec_cmd("grim -g \"$(slurp)\" - | wl-copy && notify-send -a 截图 已复制到剪贴板 || notify-send -a 截图 截图失败"), { locked = true, description = "区域截图→仅剪贴板" })

24
hypr/conf/layout.lua Normal file
View File

@ -0,0 +1,24 @@
-- 布局配置dwindle二叉树平铺、master主从、scrolling无限平铺
-- dwindle保留分割方向避免自动合并
hl.config({
dwindle = {
preserve_split = true,
},
})
-- master新窗口成为 master 占左侧
hl.config({
master = {
new_status = "master",
mfact = 0.55, -- master 区占比
orientation = "left", -- master 在左侧
},
})
-- scrolling单列全屏模式
hl.config({
scrolling = {
fullscreen_on_one_column = true,
},
})

13
hypr/conf/misc.lua Normal file
View File

@ -0,0 +1,13 @@
-- 杂项壁纸、Logo、DPMS 唤醒、XWayland 缩放
hl.config({
misc = {
force_default_wallpaper = 0, -- 不强制默认壁纸(由 Noctalia 管理)
disable_hyprland_logo = true, -- 隐藏 Hyprland Logo
mouse_move_enables_dpms = true, -- 鼠标移动唤醒屏幕
key_press_enables_dpms = true, -- 按键唤醒屏幕
},
xwayland = {
force_zero_scaling = true, -- XWayland 以原生分辨率渲染,避免分数缩放模糊
},
})

20
hypr/conf/monitors.lua Normal file
View File

@ -0,0 +1,20 @@
-- 显示器配置
-- eDP-1: 内置 2560x1600@165Hz
hl.monitor({
disabled = true,
output = "eDP-1",
mode = "2560x1600@165",
position = "auto",
scale = "1.6",
})
-- HDMI-A-1: 外接 2560x1440@144Hz
hl.monitor({
-- disabled = false,
output = "HDMI-A-1",
mode = "2560x1440@144",
position = "0x0",
scale = "1.25",
})

16
hypr/conf/plugins.lua Normal file
View File

@ -0,0 +1,16 @@
-- 插件配置
-- hyprexpo工作区网格概览Super+W 触发)
hl.config({
plugin = {
hyprexpo = {
columns = 3, -- 概览网格列数
gaps_in = 5, -- 窗口内间距
gaps_out = 0, -- 窗口外间距
bg_col = "rgb(111111)", -- 背景色
workspace_method = "first 1", -- 从工作区 1 开始排列
gesture_distance = 200, -- 手势触发距离
show_cursor = 1, -- 显示光标
},
},
})

11
hypr/conf/programs.lua Normal file
View File

@ -0,0 +1,11 @@
-- 常用程序定义(供 keybinds 等模块引用)
local terminal = "kitty"
local fileManager = "dolphin"
local browser = "firefox"
return {
terminal = terminal,
fileManager = fileManager,
browser = browser,
}

94
hypr/conf/rules.lua Normal file
View File

@ -0,0 +1,94 @@
-- 窗口和工作区规则
-- ── 全局规则 ──
-- 抑制最大化事件(避免 XWayland 窗口异常最大化)
hl.window_rule({
name = "suppress-maximize-events",
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 = "float-keymap",
match = { class = "keymap-float" },
float = true,
center = true,
size = { 720, 520 },
})
-- 系统工具浮动
hl.window_rule({
name = "float-pavucontrol",
match = { class = "pavucontrol" },
float = true,
})
hl.window_rule({
name = "float-nm-connection-editor",
match = { class = "nm-connection-editor" },
float = true,
})
-- 文件对话框浮动
hl.window_rule({
name = "float-file-dialog",
match = { title = "Open File" },
float = true,
})
hl.window_rule({
name = "float-save-dialog",
match = { title = "Save As" },
float = true,
})
-- 认证对话框浮动
hl.window_rule({
name = "float-auth-dialog",
match = { title = "Authentication Required" },
float = true,
})
-- ── Noctalia Shell 组件规则 ──
hl.window_rule({
name = "noctalia-wallpaper",
match = { namespace = "^noctalia-wallpaper.*" },
})
hl.window_rule({
name = "noctalia-bar",
match = { namespace = "^noctalia-bar.*" },
})
hl.window_rule({
name = "noctalia-notifications",
match = { namespace = "^noctalia-notification.*" },
})
hl.window_rule({
name = "noctalia-launcher",
match = { namespace = "^noctalia-launcher.*" },
})
hl.window_rule({
name = "noctalia-lock",
match = { namespace = "^noctalia-lock.*" },
})

18
hypr/hyprland.lua Normal file
View File

@ -0,0 +1,18 @@
-- ==============================================
-- Hyprland 0.55 Lua 配置
-- Arch Linux + Hyprland
-- ==============================================
-- 加载各模块
require("conf.env") -- 环境变量(最先加载)
require("conf.monitors") -- 显示器
require("conf.programs") -- 程序定义
require("conf.appearance") -- 外观(general/decoration)
require("conf.animations") -- 动画
require("conf.layout") -- 布局(dwindle/master/scrolling)
require("conf.input") -- 输入设备/手势
require("conf.misc") -- 杂项
require("conf.plugins") -- 插件(hyprexpo等)
require("conf.keybinds") -- 快捷键
require("conf.rules") -- 窗口规则
require("conf.autostart") -- 自启动(最后加载)

40
hypr/scripts/keymap Executable file
View File

@ -0,0 +1,40 @@
#!/bin/sh
# 快捷键速查 - 动态从 hyprctl binds 读取
modmask_to_str() {
local mask=$1
local mods=""
# bit 0: SHIFT (1), bit 2: CTRL (4), bit 3: ALT (8), bit 6: SUPER (64)
[ $((mask & 64)) -ne 0 ] && mods="${mods}Super+"
[ $((mask & 1)) -ne 0 ] && mods="${mods}Shift+"
[ $((mask & 4)) -ne 0 ] && mods="${mods}Ctrl+"
[ $((mask & 8)) -ne 0 ] && mods="${mods}Alt+"
[ $((mask & 16)) -ne 0 ] && mods="${mods}Mod2+"
[ $((mask & 32)) -ne 0 ] && mods="${mods}Mod3+"
[ $((mask & 128)) -ne 0 ] && mods="${mods}Mod5+"
echo "${mods%+}"
}
hyprctl binds 2>/dev/null | awk -v RS='' -F'\n' '
/^bindd/ {
key=""; desc=""; mask=""; submap=""
for (i=2; i<=NF; i++) {
split($i, kv, ": ")
if (kv[1] ~ /^[[:space:]]*modmask$/) mask=kv[2]
if (kv[1] ~ /^[[:space:]]*key$/) key=kv[2]
if (kv[1] ~ /^[[:space:]]*description$/) desc=kv[2]
if (kv[1] ~ /^[[:space:]]*submap$/) submap=kv[2]
}
# 跳过鼠标绑定和无描述的
if (key ~ /^mouse/ || desc == "") next
if (submap != "") next
print mask "\t" key "\t" desc
}
' | while IFS=$'\t' read -r mask key desc; do
mod_str=$(modmask_to_str "$mask")
if [ -n "$mod_str" ]; then
printf " %-28s %s\n" "${mod_str}+${key}" "${desc}"
else
printf " %-28s %s\n" "${key}" "${desc}"
fi
done | fzf --prompt " 快捷键速查 > " --reverse --no-sort --bind 'esc:abort'

20
hypr/scripts/screenshot Executable file
View File

@ -0,0 +1,20 @@
#!/bin/sh
# 截图保存到文件并复制到剪贴板
# 用法: screenshot [full|area]
dir=~/Pictures/Screenshots
mkdir -p "$dir"
file="$dir/$(date +%Y%m%d_%H%M%S).png"
if [ "$1" = "area" ]; then
grim -g "$(slurp)" "$file"
else
grim "$file"
fi
if [ -f "$file" ]; then
wl-copy < "$file"
notify-send -a 截图 "已保存并复制到剪贴板" -i "$file"
else
notify-send -a 截图 "截图失败"
fi