chore: import official kitty sources from upstream
Bring the kovidgoyal/kitty codebase in as the base of FWS-Kitty, vendored at upstream commit 91fb38a without its git history.
This commit is contained in:
commit
7e7d249099
1134 files changed
+433629
No files matched your search
@@ -0,0 +1,53 @@
|
||||
// License: GPLv3 Copyright: 2026, Kovid Goyal, <kovid at kovidgoyal.net>
|
||||
|
||||
package resize_window
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/kovidgoyal/kitty/tools/cmd/at"
|
||||
"github.com/kovidgoyal/kitty/tools/utils"
|
||||
)
|
||||
|
||||
type resize_payload struct {
|
||||
Increment int `json:"increment"`
|
||||
Axis string `json:"axis"`
|
||||
Self bool `json:"self"`
|
||||
Fraction float64 `json:"fraction,omitempty"`
|
||||
Restore bool `json:"restore_entry_layout,omitempty"`
|
||||
}
|
||||
|
||||
func resize_command_escape_code(increment int, axis string, fraction float64) (string, error) {
|
||||
restore := axis == "restore"
|
||||
if restore {
|
||||
axis = "reset"
|
||||
}
|
||||
rc := utils.RemoteControlCmd{
|
||||
Cmd: "resize-window", Version: at.ProtocolVersion,
|
||||
Payload: resize_payload{Increment: increment, Axis: axis, Self: true, Fraction: fraction, Restore: restore},
|
||||
}
|
||||
data, err := json.Marshal(rc)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return "\x1bP@kitty-cmd" + string(data) + "\x1b\\", nil
|
||||
}
|
||||
|
||||
func edge_command_escape_code(operation, edge, divider string, increment int, fraction float64) (string, error) {
|
||||
rc := utils.RemoteControlCmd{
|
||||
Cmd: "resize-window-edge", Version: at.ProtocolVersion,
|
||||
Payload: struct {
|
||||
Operation string `json:"operation"`
|
||||
Edge string `json:"edge"`
|
||||
Divider string `json:"divider,omitempty"`
|
||||
Increment int `json:"increment"`
|
||||
Fraction float64 `json:"fraction,omitempty"`
|
||||
Self bool `json:"self"`
|
||||
}{operation, edge, divider, increment, fraction, true},
|
||||
}
|
||||
data, err := json.Marshal(rc)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return "\x1bP@kitty-cmd" + string(data) + "\x1b\\", nil
|
||||
}
|
||||
Reference in new issue
Block a user