Default laptop key set to capslock. Keys that can be set to fenrir key or script key selectable via checkbox.
This commit is contained in:
1 parent
47f18fdd28
commit
15e04aa8f8
47 files changed
+1560
-351
No files matched your search
@@ -59,25 +59,25 @@ func Layout_paths(layout, home string, uid int, bundledDirectory string) ([]stri
|
||||
|
||||
// Load_bindings selects one whole file. A malformed or unreadable candidate
|
||||
// stops loading; only absent named candidates advance to the next directory.
|
||||
func Load_bindings(paths []string) ([]Binding, string, error) {
|
||||
func Load_bindings(paths []string) (Layout, string, error) {
|
||||
for _, path := range paths {
|
||||
file, err := os.Open(path)
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
continue
|
||||
}
|
||||
if err != nil {
|
||||
return nil, path, err
|
||||
return Layout{}, path, err
|
||||
}
|
||||
data, readErr := io.ReadAll(io.LimitReader(file, (1<<20)+1))
|
||||
closeErr := file.Close()
|
||||
if err := errors.Join(readErr, closeErr); err != nil {
|
||||
return nil, path, err
|
||||
return Layout{}, path, err
|
||||
}
|
||||
if len(data) > 1<<20 {
|
||||
return nil, path, fmt.Errorf("keyboard layout exceeds 1 MiB")
|
||||
return Layout{}, path, fmt.Errorf("keyboard layout exceeds 1 MiB")
|
||||
}
|
||||
bindings, err := Decode_bindings(data)
|
||||
return bindings, path, err
|
||||
}
|
||||
return nil, "", fmt.Errorf("keyboard layout not found (searched %s)", strings.Join(paths, ", "))
|
||||
return Layout{}, "", fmt.Errorf("keyboard layout not found (searched %s)", strings.Join(paths, ", "))
|
||||
}
|
||||
Reference in new issue
Block a user