update check for linux running desktop (#1137)

This commit is contained in:
Bethuel Mmbaga 2023-09-08 21:08:02 +03:00 committed by GitHub
parent 30f1c54ed1
commit bb791d59f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -232,16 +232,7 @@ func openURL(cmd *cobra.Command, verificationURIComplete, userCode string) {
// isLinuxRunningDesktop checks if a Linux OS is running desktop environment.
func isLinuxRunningDesktop() bool {
for _, env := range os.Environ() {
values := strings.Split(env, "=")
if len(values) == 2 {
key, value := values[0], values[1]
if key == "XDG_CURRENT_DESKTOP" && value != "" {
return true
}
}
}
return false
return os.Getenv("DESKTOP_SESSION") != "" || os.Getenv("XDG_CURRENT_DESKTOP") != ""
}
// isPKCEFlow determines if the PKCE flow is active or not,