Closed trinitronx closed 1 year ago
If the exclusive mode is default, wouldn't it be enough to add a boolean argument for the on demand mode?
If the exclusive mode is default, wouldn't it be enough to add a boolean argument for the on demand mode?
Yes, now that I think about it again this makes more sense. The reason I went down the path of using a string flag was to support all the enum
types supported by GTK layer shell, which included the none
type at first.
After testing this out, I realized that none
keyboard mode did not make sense from a UI/UX perspective for this app... so I changed it by removing that option and leaving the other two.
Now it can be represented by a simple binary on/off for on-demand
vs exclusive
modes (unless they add more modes in the future).
Sorry for delay. I was busy at other projects.
After some deliberation: I think we should just use LAYER_SHELL_KEYBOARD_MODE_ON_DEMAND
in main.go line 389, w/o multiplying arguments. I'll check how it behaves tonight.
On sway 1.8.1 setting keyboard mode layershell.LAYER_SHELL_KEYBOARD_MODE_ON_DEMAND
seems to change nothing. On Hyprland for some reason it behaves perfectly well in both ON_DEMAND and EXCLUSIVE mode. I failed installing the current development version of sway, so dunno how it's going to behave there. I suppose that just changing to ON_DEMAND mode should be safe.
Sorry for delay. I was busy at other projects.
After some deliberation: I think we should just use
LAYER_SHELL_KEYBOARD_MODE_ON_DEMAND
in main.go line 389, w/o multiplying arguments. I'll check how it behaves tonight.
I'd caution against making it the default unless also the app will grab focus on opening. In my testing, I could trigger nwg-wrapper
with hotkey and had to explicitly focus the app first by moving the mouse. Without a focus event, it detracts from keyboard power-users... who are probably the demographic that window managers like Sway & i3wm appeal to.
I've tested on the following versions of sway
:
1.9-dev-dc634c4a
: Pre-release build from git sources.
Use cases enabled:
Opening nwg-drawer
on a separate monitor / output, moving mouse to the second display to multi-task / copy text to clipboard / etc... Then coming back to nwg-drawer
window and pasting in text, opening an app, etc...
(I tested this via HEADLESS-1
output + wayvnc
too!)
GTK Inspector workflow (for theming, GTK debug, etc...)
gsettings set org.gtk.Settings.Debug enable-inspector-keybinding true
Open nwg-drawer
on a separate output (e.g. HEADLESS-1
or another display)
If using HEADLESS-1
, run wayvnc
, connect to it with a VNC Client (e.g. Remmina)
Press the keyboard shortcut to launch GTK Inspector: Ctrl+Shift+d
Move window to another output, make them floating so you can use GTK Inspector while viewing nwg-wrapper
in the VNC window.
Now keyboard focus follows your mouse, and GTK Inspector is actually usable! (Note: This was not possible before on sway v1.8.1
with Exclusive keyboard mode)
1.8.1-1
: Manjaro / Arch stable package release
nwg-wrapper
however it is launched (hotkey, rofi, mouse click on .desktop
, etc...)nwg-wrapper
window: This makes keyboard power-users happy! Also good UI/UX for ease of use in general.On sway 1.8.1 setting keyboard mode
layershell.LAYER_SHELL_KEYBOARD_MODE_ON_DEMAND
seems to change nothing.
This was my experience too during testing. It's because the only mode supported for that version was LAYER_SHELL_KEYBOARD_MODE_EXCLUSIVE
. New behavior depends on the following change:
On Hyprland for some reason it behaves perfectly well in both ON_DEMAND and EXCLUSIVE mode.
Sounds like it supports the zwlr_layer_surface_v1::keyboard_interactivity v4
protocol too! :tada:
I failed installing the current development version of sway, so dunno how it's going to behave there. I suppose that just changing to
ON_DEMAND
mode should be safe.
If you'd like to test... I built pre-release Arch packages from the PKGBUILD
s on Manjaro. Here is the PKGBUILD
testing repo I've been pushing to: gitlab.archlinux.org/trinitronx/nwg-drawer-git. Attaching the .pkg.tar.xz
files here...
Alright then. I'll merge it after #96. Sorry for prioritizing my own PR, which is younger, but your PR introduces less changes (in case of conflicts).
Alright then. I'll merge it after #96. Sorry for prioritizing my own PR, which is younger, but your PR introduces less changes (in case of conflicts).
No problem, you can prioritize however makes sense... it's your project after all :wink:
FYI: I just uploaded both of the pre-release versions that I was testing to the Releases page @ gitlab.archlinux.org/trinitronx/nwg-drawer-git.
I think the one for nwg-drawer-git
that I included in the sway-pre-release-packages.tar.gz
above is the older version with flag.String
implementation. The newer one with flag.Bool
is: 0.3.8.r20_pre.git.4724b52b0da
.
The other updated dependencies for sway 1.9-dev-dc634c4a
are still in sway-pre-release-packages.tar.gz
This update is simple enough to need no special testing, for which I have too little time by the way. I'm sure you tested it well enough. I'm a bit in hurry to finish what I'm working on before my holiday starts. :tada: As a hobbyist programmer, I have up to 4 hours a day (night!) for coding.
Change
-k
flag to set the GTK layer shell keyboard focus modeexclusive
/e
(Default)on-demand
/o
none
mode does not seem to make sense for this app, because it disables keyboard input completely.Rationale / Background:
gtk-layer-shell
, and Wayland now supports an "On Demand" mode viazwlr_layer_surface_v1::keyboard_interactivity v4
for keyboard focus. The demo app also supports this mode and works well to demonstrate the newzwlr_layer_surface_v1::keyboard_interactivity v4
wayland protocol for the on-demand keyboard focus mode.Note that for this to behave differently, it requires a newer version of
sway
than is currently released on most Linux distros, but it will not break anything given the backwards-compatible behavior beingexclusive
by default. (e.g. without this change: swaywm/sway@913a7679 / swaywm/sway#7587 ... and withon-demand
mode set, it still behaves as ifexclusive
mode was set)The following PRs have made it into
wl-protocols
,wlroots
, >k-layer-shell
:Note: there is also one for wayfire: WayfireWM/wayfire#962
Testing the
gtk-layer-shell
demo program on Sway1.8.1
behaves the same. For example: When setting the "On Demand" keyboard mode (--keyboard o
) and either "Top" or "Overlay" layers (--layer t
or--layer o
).When on these layers, it's impossible to get keyboard focus off of the demo program window without first setting keyboard setting back to "None". While not ideal from a UI/UX perspective, nor from an app developer perspective, it doesn't hurt to have this option in client programs to enable the feature when
sway
or other window managers adopt thezwlr_layer_surface_v1::keyboard_interactivity
v4
protocol.More information can be found in: swaywm/sway#7499.