main 6af0a61

gpu.go RawHistoryFolder

1package system
2
3import "strings"
4
5// GPUVendor represents the GPU vendor.
6type GPUVendor string
7
8const (
9	GPUVendorAMD     GPUVendor = "amd"
10	GPUVendorIntel   GPUVendor = "intel"
11	GPUVendorNVIDIA  GPUVendor = "nvidia"
12	GPUVendorUnknown GPUVendor = "unknown"
13)
14
15// String returns human-readable vendor name.
16func (v GPUVendor) String() string {
17	switch v {
18	case GPUVendorAMD:
19		return "AMD"
20	case GPUVendorIntel:
21		return "Intel"
22	case GPUVendorNVIDIA:
23		return "NVIDIA"
24	default:
25		return "Unknown"
26	}
27}
28
29// GPU represents a detected GPU and its recommended configuration.
30type GPU struct {
31	vendor  GPUVendor
32	model   string
33	drivers []string
34	envVars map[string]string
35}
36
37// NewGPU creates a new GPU value object.
38func NewGPU(vendor GPUVendor, model string, drivers []string, envVars map[string]string) *GPU {
39	if strings.TrimSpace(model) == "" {
40		model = "Unknown"
41	}
42
43	if drivers == nil {
44		drivers = []string{}
45	}
46
47	if envVars == nil {
48		envVars = map[string]string{}
49	}
50
51	return &GPU{
52		vendor:  vendor,
53		model:   model,
54		drivers: drivers,
55		envVars: envVars,
56	}
57}
58
59// Vendor returns the GPU vendor.
60func (g *GPU) Vendor() GPUVendor {
61	return g.vendor
62}
63
64// Model returns the GPU model name.
65func (g *GPU) Model() string {
66	return g.model
67}
68
69// Drivers returns recommended GPU driver packages.
70func (g *GPU) Drivers() []string {
71	return append([]string{}, g.drivers...)
72}
73
74// EnvVars returns recommended environment variables for compositors.
75func (g *GPU) EnvVars() map[string]string {
76	copyVars := make(map[string]string, len(g.envVars))
77	for key, value := range g.envVars {
78		copyVars[key] = value
79	}
80	return copyVars
81}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 0

    ↑↓ moveenter openesc close