gosmartkeyboard/docs/XdotoolCommands.html

69 lines
2.7 KiB
HTML
Raw Normal View History

2023-03-07 22:29:26 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>GoSmartKeyboard</title>
<link rel="stylesheet" href="google-code-prettify/prettify.css">
<link rel="stylesheet" href="styles/prettify-theme.css">
<script defer src="google-code-prettify/prettify.js"></script>
<script defer src="google-code-prettify/run_prettify.js"></script>
<link rel="stylesheet" href="styles/main.css">
</head>
<!-- Generated by srcweave https://github.com/justinmeiners/srcweave -->
<h1>Handle xdotool commands<a id="c19"></a></h1>
<p>Currently the two commands are <code>type</code> and <code>key</code>. <code>type</code> is used to type a character and <code>key</code> is used to type a special character like <code>Enter</code> or <code>Backspace</code>.</p>
<p><code>type</code> is specified by &lsquo;{kb_cmd:xdotool}:&rsquo;, and <code>key</code> is specified by &lsquo;{kb_cmd:kxdotool}:&rsquo;. If the command is not specified and <code>alwaysUseXdotool</code> is set from the environment variable, it will default to <code>type</code>.</p>
<div class="code-block">
<span class="block-header">
<strong class="block-title"><em><a id="handle-xdotoool-commands-block-64" href="#handle-xdotoool-commands-block-64">handle xdotoool commands</a></em></strong></span>
<pre class="prettyprint"><code class="">if alwaysUseXdotool || strings.HasPrefix(message_string, "{kb_cmd:xdotool}:") {
message_string = strings.TrimPrefix(message_string, "{kb_cmd:xdotool}:")
if message_string == "" {
message_string = "\n"
}
if characterRegex.MatchString(message_string) {
for _, character := range message_string {
charString := string(character)
if charString == "\n" {
charString = "Enter"
} else if charString == "\t" {
charString = "Tab"
} else if charString == "\b" {
charString = "BackSpace"
} else{
doXDoTool("type", charString)
continue
}
// key is required for special characters
err = doXDoTool("key", charString)
continue
}
continue
} else {
doXDoTool("type", message_string)
}
continue
} else if strings.HasPrefix(message_string, "{kb_cmd:kxdotool}:") {
message_string = strings.TrimPrefix(message_string, "{kb_cmd:kxdotool}:")
if message_string == "" {
message_string = "\n"
}
doXDoTool("key", message_string)
continue
}
</code></pre>
<p class="block-usages"><small>Used by <a href="Streaming.html#send-keys-to-system-block-58" title="send keys to system. Streaming.html">1</a> </small></p></div>
</body>
</html>