Skip to content

Commit

Permalink
Merge pull request #95 from trinitronx/add-keyboard-mode-flag
Browse files Browse the repository at this point in the history
Add keyboard mode flag to support both: "on-demand" & "exclusive" GTK layer-shell modes
  • Loading branch information
nwg-piotr authored Jul 27, 2023
2 parents 94b8b8d + 830edef commit 58ea8ea
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ Usage of nwg-drawer:
GTK theme name, eg. "Adwaita-dark"
-is int
Icon Size (default 64)
-k
Set GTK layer shell keyboard interactivity to "on-demand" mode (default "exclusive")
-lang string
force lang, e.g. "en", "pl"
-nocats
Expand Down
10 changes: 9 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ func defaultStringIfBlank(s, fallback string) string {
var cssFileName = flag.String("s", "drawer.css", "Styling: css file name")
var targetOutput = flag.String("o", "", "name of the Output to display the drawer on (sway only)")
var displayVersion = flag.Bool("v", false, "display Version information")
var keyboard = flag.Bool("k", false, "Set GTK layer shell keyboard interactivity to 'on-demand' mode")
var overlay = flag.Bool("ovl", false, "use OVerLay layer")
var gtkTheme = flag.String("g", "", "GTK theme name")
var gtkIconTheme = flag.String("i", "", "GTK icon theme name")
Expand Down Expand Up @@ -387,7 +388,14 @@ func main() {
layershell.SetMargin(win, layershell.LAYER_SHELL_EDGE_RIGHT, *marginRight)
layershell.SetMargin(win, layershell.LAYER_SHELL_EDGE_BOTTOM, *marginBottom)

layershell.SetKeyboardMode(win, layershell.LAYER_SHELL_KEYBOARD_MODE_EXCLUSIVE)
if *keyboard {
log.Info("Setting GTK layer shell keyboard mode to: on-demand")
layershell.SetKeyboardMode(win, layershell.LAYER_SHELL_KEYBOARD_MODE_ON_DEMAND)
} else {
log.Info("Setting GTK layer shell keyboard mode to default: exclusive")
layershell.SetKeyboardMode(win, layershell.LAYER_SHELL_KEYBOARD_MODE_EXCLUSIVE)
}

}

win.Connect("destroy", func() {
Expand Down

0 comments on commit 58ea8ea

Please sign in to comment.