summaryrefslogtreecommitdiff
path: root/startup.lua
blob: 1d54f71f2b203d4a6af1daa39b40d54ed522876a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
-- 自启动程序(对应 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")
    hl.exec_cmd("noctalia")

    -- Seatd
    hl.exec_cmd("seatd -g video")

    -- 总览
    hl.exec_cmd("hyprpm enable Hyprspace")

    -- 壁纸:从 current_wallpaper 文件读取当前壁纸路径(由 switch_wallpaper.sh 写入)
    -- 注意:hyprpaper 0.8.4 会因 hyprtoolkit 的 cursor-shape 处理在本机 Hyprland 上崩溃
    -- (GPF in wl_proxy_marshal_array_flags),改用 swaybg(纯 layer-shell 实现,无此问题)
    local function currentWallpaper()
        local f = io.open("/home/catilgrass/.config/hypr/current_wallpaper", "r")
        if f then
            local path = f:read("*l")
            f:close()
            if path and path ~= "" then
                local g = io.open(path, "r")
                if g then
                    g:close()
                    return path
                end
            end
        end
        return "/home/catilgrass/图片/Wallpapers/KON_2.png" -- 默认壁纸
    end
    hl.exec_cmd("swaybg -i '" .. currentWallpaper() .. "' -m fill")

    -- 剪贴板 (只存文本/图片数据)
    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")

    -- 修复 xdg-desktop-portal:把 Wayland 会话环境同步给 systemd 用户会话,
    -- 并重启 portal(否则 xdph 会以 "Couldn't connect to a wayland compositor" 失败,
    -- 回退到 gtk.portal,导致屏幕共享等不可用)
    hl.exec_cmd("dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP HYPRLAND_INSTANCE_SIGNATURE")
    hl.exec_cmd("systemctl --user restart xdg-desktop-portal-hyprland.service xdg-desktop-portal.service")
end)