Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for svkbd (on-screen keyboard) #1471

Open
realroot2185 opened this issue Nov 8, 2023 · 9 comments
Open

Support for svkbd (on-screen keyboard) #1471

realroot2185 opened this issue Nov 8, 2023 · 9 comments

Comments

@realroot2185
Copy link

On bspwm svkbd is not docked well in the bottom:

it takes focus, it has the border and overlaps other windows (bspwm does not allocate the space).

While on dwm with the patch it works nice.
Like on sxmo.

@jvvv
Copy link
Contributor

jvvv commented Oct 6, 2024

The {left,top,right,botton}_padding settings. In the manual page under Monitor and Desktop Settings subsection.

@realroot2185
Copy link
Author

realroot2185 commented Oct 6, 2024

I did know that.
I can manually add bottom_padding when I open svkbd and remove it when it's close.

Can I prevent svbkd to take focus?

@jvvv
Copy link
Contributor

jvvv commented Oct 6, 2024

If you have set the padding, then not sure why it is covering other windows. You mention docking, but that is something that I have never known bspwm to handle. As far as focus, that should be able to be handled with 'focus=off' in a rule, perhaps also appropriate might be 'manage=off'. Perhaps I'm wrong and perhaps you've already tried some of these. I'll mess around with svbkd to see if I can reproduce. Will report back findings.

@realroot2185
Copy link
Author

Sorry I meant to write I did NOT know that, it's not covering other windows.

Using focus=off works for focus.
With also manage=off svkbd it's in all workspace and does not have the border so looks perfect.
It's like it is docked.
Only thing you need to calculate the padding manually and remove it when it is closed.
In sxmo the OSK(on-screen keyboard) it is opened/closed by a script so it should fine.
I quickly tested it on a desktop I will check on my phone too.

@jvvv
Copy link
Contributor

jvvv commented Oct 7, 2024

Sounds like you are making progress with your setup. If it's still not quite what you need, maybe we can come up with a solution that works for what you need. I was going to play around with svkbd this morning, but will defer that unless you say it's still not working, since I have no need for OSK at this time, though I might later if I get a pine or purism phone (was thinking of getting one this winter, but depends on cash flow).

@realroot2185
Copy link
Author

Is it possible to make a rule, maybe an external one, that add/remove padding when svkbd is active?
Then you use xprop to calculate the padding size I guess, and you could it to some environment variable.

@jvvv
Copy link
Contributor

jvvv commented Oct 8, 2024

Using external rule for this seems like the way to go. I haven't messed around with my setup much lately, so my bspwm rule-fu is a bit rusty, but will do some playing around with it in the morning so I don't give you bad help if you need any.

Edit:
Implementing the external rule to apply the padding at svkbd start is straight forward enough. One question though is: what tool are you going to use to get the height? I have been using xwinfo -g | cut -d' ' -f2, but using wmutils' wattr is more terse: wattr h wid. I am certain that there are other choices; those are just my goto tools for stuff like this.

#!/bin/sh
wid=$1
class=$2
instance=$3
consequences=$4

if [ "$instance" = svkbd ]; then
    #height=$(xwinfo -g | cut -d' ' -f2)
    height=$(wattr h $(printf '0x%X' $wid))
    bspc config -d focused bottom_padding $height
    echo "focus=off manage=off"
fi

A caveat with 'manage=off': because svkbd window it is no longer managed by the window manager, svkbd will end up on all desktops. Not sure if this what you really want or not.

Also, automating the revert of the padding seems a bit more complicated than I thought.

@realroot2185
Copy link
Author

I was not sure to how get the height.
I calculate it, svkbd is 1/14 by default and it has 5 rows.
I use a different version with the super key and 6 rows.

open() {
	if [ -n "$SXMO_NO_KEYBOARD" ]; then
		return
	fi
	if [ -n "$KEYBOARD" ]; then
		#Note: KEYBOARD_ARGS is not quoted by design as it may includes a pipe and further tools
		# shellcheck disable=SC2086
		if [ $SXMO_WM = "bspwm" ]; then
			SCREENHEIGHT=$(xrandr | grep "Screen 0" | cut -d" " -f 10 | tr -d ",")
			OSK_HEIGHT=$(( SCREENHEIGHT / OSK_HEIGHTFACTOR * OSK_ROWS ))
			bspc config bottom_padding "$OSK_HEIGHT"
		fi
		
		isopen || eval "$KEYBOARD" $KEYBOARD_ARGS >> "${XDG_STATE_HOME:-$HOME}"/sxmo.log 2>&1 &
	fi
}

close() {
	if [ $SXMO_WM = "bspwm" ]; then
		bspc config bottom_padding 0
	fi
	if [ -n "$KEYBOARD" ]; then # avoid killing everything !
		pkill -f "$KEYBOARD"
	fi
}

Having it on all desktops is good.
I made sxmo with bspwm.

Sometimes when there is one window it has the focus border but it has the colors of inactive window.
I can tell cause of qt theme and pressing keys on svkbd has no effect.
Focusing another window fixes it.
I tried some rules and problem persisted, it is not very common.

I've been using this:
bspc rule -a svkbd sticky=on manage=off layer=above focus=off border=off

@realroot2185
Copy link
Author

@jvvv If you edit a message I do not get the notification (after the first one) so I did not see it before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants