aboutsummaryrefslogtreecommitdiffstats
path: root/hypr/dashboard.lua
blob: 9b03e8111a39916baa3ad814555637ad08a92563 (plain)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
-- Conky Lua dashboard: window placement and toggle.
--
-- Copy or symlink into ~/.config/hypr/sections/ and add to hyprland.lua:
--     require("sections.dashboard")
--
-- The dashboard is a normal toplevel, not a desktop-layer surface, which is
-- what lets a window rule put it on a workspace at all.

-- Its own named special workspace: the unnamed `special` already hosts the
-- btop scratchpad.
local WS = "special:dash"

-- Pin the workspace to the primary monitor. THIS DOES NOT WORK: special
-- workspaces ignore a workspace_rule's `monitor` and open on whichever monitor
-- has focus (verified 2026-09-18 on 0.56.2; upstream hyprwm/Hyprland#7990 and
-- #5570, both closed in the issues-to-discussions migration, not fixed). The
-- rule registers and `hyprctl workspacerules` reports it enabled, which is
-- what makes it look like it works.
--
-- Kept so the intent is recorded and the line is ready if upstream fixes it.
-- Until then the procedure is manual: focus DP-1 before SUPER+S. The conky
-- surface is a fixed 2560x1080 (Hyprland's fullscreen rule resizes the window
-- but not the drawing surface), so on the 1920-wide DP-3 it is cropped, and
-- the window STAYS on DP-3 once opened there, so the next toggle is cropped
-- too until it is moved back.
--
-- `hl.workspace_rule` takes `workspace`, not `match`, and unlike
-- `hl.window_rule` it has no `name` field; both were checked against the
-- runtime, which rejects an unknown field with "unknown field '<name>'".
hl.workspace_rule({
    workspace = WS,
    monitor   = "DP-1",
})

hl.window_rule({
    name      = "dash-workspace",
    match     = { class = "conky-dash" },
    workspace = WS,
})
hl.window_rule({
    name  = "dash-float",
    match = { class = "conky-dash" },
    float = true,
})
-- `fullscreen` appears in no other rule in this config, so it was checked
-- against the runtime directly: hl.window_rule rejects an unknown field with
-- "unknown field '<name>'", and both `fullscreen` and `no_focus` pass that
-- check, so the Lua API does accept them.
hl.window_rule({
    name       = "dash-fullscreen",
    match      = { class = "conky-dash" },
    fullscreen = true,
})
hl.window_rule({
    name        = "dash-no-border",
    match       = { class = "conky-dash" },
    border_size = 0,
})
hl.window_rule({
    name     = "dash-no-rounding",
    match    = { class = "conky-dash" },
    rounding = 0,
})
-- It is a dashboard, not a window: never let it take focus or be tabbed to.
-- This matters because it starts with the session, so without it the dashboard
-- would steal focus at login. Validity checked the same way as `fullscreen`
-- above.
hl.window_rule({
    name     = "dash-no-focus",
    match    = { class = "conky-dash" },
    no_focus = true,
})

-- SUPER+S, not SUPER+D: keybindings.lua already binds D to the unnamed special
-- workspace.
--
-- Literal "SUPER", not hl.mainMod: mainMod is a file-local in
-- keybindings.lua (`local mainMod = "SUPER"`), not exported on hl, so
-- hl.mainMod is nil here.
--
-- Focus DP-1 before pressing this. The workspace rule above cannot do it,
-- and the dashboard opens on whichever monitor has focus.
hl.bind("SUPER + s", hl.dsp.workspace.toggle_special("dash"))