Skip to content

Commit

Permalink
feat: exclusive keyboard mode by default
Browse files Browse the repository at this point in the history
Set layer shell keyboard mode depending on `GTK_DEBUG` environment
variable. If it is set to "interactive", allow to focus on other
windows, so that the debug window can be focused. Otherwise, set
exclusive keyboard mode.
  • Loading branch information
shelepuginivan committed Jan 26, 2025
1 parent f117f87 commit 9f4be08
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"os"
"sort"

"github.com/dlasky/gotk3-layershell/layershell"
Expand Down Expand Up @@ -83,7 +84,12 @@ func main() {
}

// Allow keyboard input.
layershell.SetKeyboardMode(win, layershell.LAYER_SHELL_KEYBOARD_MODE_ON_DEMAND)
// If $GTK_DEBUG is set to "interactive", allow focusing the debug window.
if os.Getenv("GTK_DEBUG") == "interactive" {
layershell.SetKeyboardMode(win, layershell.LAYER_SHELL_KEYBOARD_MODE_ON_DEMAND)
} else {
layershell.SetKeyboardMode(win, layershell.LAYER_SHELL_KEYBOARD_MODE_EXCLUSIVE)
}

// Recursively show all widgets contained in this window.
win.ShowAll()
Expand Down

0 comments on commit 9f4be08

Please sign in to comment.