Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Z-Bolt/OctoScreen.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffB42 <10328858+JeffB42@users.noreply.github.com>2021-04-04 20:51:35 +0300
committerJeffB42 <10328858+JeffB42@users.noreply.github.com>2021-04-04 20:51:35 +0300
commitacbaf89bc40661c3a2ea8fc73b2c444ea4492ba3 (patch)
tree65c366c8da6d47daf504defbb700b7c8b4e93c19
parent659a640de3ff2231bd7e6d79d68b939e78ed0625 (diff)
added new environment variable, DISPLAY_CURSOR
-rwxr-xr-xdebian/local/octoscreen/config5
-rwxr-xr-xmain.go12
-rwxr-xr-xutils/environment.go12
3 files changed, 21 insertions, 8 deletions
diff --git a/debian/local/octoscreen/config b/debian/local/octoscreen/config
index 002dd80..85f7ea7 100755
--- a/debian/local/octoscreen/config
+++ b/debian/local/octoscreen/config
@@ -50,3 +50,8 @@ OCTOSCREEN_LOG_LEVEL=Error
OCTOSCREEN_RESOLUTION=800x480
# OCTOSCREEN_RESOLUTION is optional and defaults to 800x480 if missing
# (defined in globalVars.go)
+
+
+# To display the cursor, uncomment the following line and set to true.
+#DISPLAY_CURSOR=true
+# You will also need to edit /lib/systemd/system/octoscreen.service and remove "-nocursor"
diff --git a/main.go b/main.go
index 4c9c9bc..dc34493 100755
--- a/main.go
+++ b/main.go
@@ -373,11 +373,15 @@ func getSize() (width int, height int, err error) {
}
func setCursor() {
- /*
- if todo: test for new env setting to be defined and not be false {
+ // For reference, see "How to turn on a pointer"
+ // https://github.com/Z-Bolt/OctoScreen/issues/285
+ // and "No mouse pointer when running xinit"
+ // https://www.raspberrypi.org/forums/viewtopic.php?t=139546
+
+ displayCursor := strings.ToLower(os.Getenv("DISPLAY_CURSOR"))
+ if displayCursor != "true" {
return
}
- */
window, err := getRootWindow()
if err != nil {
@@ -397,7 +401,7 @@ func getRootWindow() (*gdk.Window, error) {
if err != nil {
return nil, err
}
-
+
window, err := screen.GetRootWindow()
return window, err
diff --git a/utils/environment.go b/utils/environment.go
index 9fb6a59..c9b9448 100755
--- a/utils/environment.go
+++ b/utils/environment.go
@@ -22,10 +22,11 @@ const (
// Optional (but good to have) environment variables
const (
- EnvLogLevel = "OCTOSCREEN_LOG_LEVEL"
- EnvLogFilePath = "OCTOSCREEN_LOG_FILE_PATH"
- EnvResolution = "OCTOSCREEN_RESOLUTION"
- EnvConfigFile = "OCTOPRINT_CONFIG_FILE"
+ EnvLogLevel = "OCTOSCREEN_LOG_LEVEL"
+ EnvLogFilePath = "OCTOSCREEN_LOG_FILE_PATH"
+ EnvResolution = "OCTOSCREEN_RESOLUTION"
+ EnvConfigFile = "OCTOPRINT_CONFIG_FILE"
+ EnvDisplayCursor = "DISPLAY_CURSOR"
)
func RequiredEnvironmentVariablesAreSet(apiKey string) bool {
@@ -109,9 +110,12 @@ func DumpEnvironmentVariables() {
dumpEnvironmentVariable(EnvConfigFile)
dumpEnvironmentVariable(EnvLogFilePath)
dumpEnvironmentVariable(EnvLogLevel)
+
dumpEnvironmentVariable(EnvResolution)
// EnvResolution is optional. If not set, the window size will
// default to the values defined in globalVars.go.
+
+ dumpEnvironmentVariable(EnvDisplayCursor)
}
func dumpEnvironmentVariable(key string) {