-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from RasmusLindroth/filter
Add filter and TOC
- Loading branch information
Showing
13 changed files
with
239 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,25 @@ | ||
package i3parse | ||
|
||
import ( | ||
"errors" | ||
"fmt" | ||
"strconv" | ||
|
||
"github.com/RasmusLindroth/i3keys/internal/xlib" | ||
) | ||
|
||
//CodeToSymbol returns a code binding with the symbol equivalent | ||
func CodeToSymbol(code Binding) (Binding, error) { | ||
i, err := strconv.Atoi(code.Key) | ||
func CodeToSymbol(key string) (string, error) { | ||
i, err := strconv.Atoi(key) | ||
|
||
if err != nil { | ||
return Binding{}, errors.New("Couldn't parse string to int") | ||
return "", fmt.Errorf("Couldn't parse string %s to int", key) | ||
} | ||
|
||
hex := xlib.KeyCodeToHex(i) | ||
if name, ok := xlib.KeySyms[hex]; ok { | ||
code.Key = name | ||
code.Type = SymbolBinding | ||
|
||
return code, nil | ||
name, ok := xlib.KeySyms[hex] | ||
if !ok { | ||
return "", fmt.Errorf("Keycode %s not in keysymdef.h", key) | ||
} | ||
|
||
return Binding{}, errors.New("Keycode not in keysymdef.h") | ||
return name, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.