NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.38k stars 14.34k forks source link

Trouble running Squeekboard under SwayWM #353415

Open aria-dos opened 4 weeks ago

aria-dos commented 4 weeks ago

Describe the bug

Squeekboard fails to appear when invoked.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Install pkgs.squeekboard. (Add pkgs.squeekboard to environment.systemPackages in configuration.nix. Have nixos-rebuild switch pass.)
  2. Run squeekboard in the terminal.
  3. Have it print the output below, then hang.
    
    ** (squeekboard:53082): WARNING **: 15:52:43.339: No system layout present

(squeekboard:53082): WARNING : 15:52:43.340: Could not register to session manager: Cannot invoke method; proxy is for the well-known name org.gnome.SessionManager without an owner, and proxy was constructed with the G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START flag


### Expected behavior
A clear and concise description of what you expected to happen.
1. Install `pkgs.squeekboard`.
2. Run `squeekboard` in the terminal.
3. The squeekboard virtual keyboard displays on the screen. 

### Additional context
Running NixOS + SwayWM with greetd as greeter.
[Also posted here in the squeekboard repo.](https://gitlab.gnome.org/World/Phosh/squeekboard/-/issues/426)

### Notify maintainers
@artturin
@tomfitzhenry

### Metadata
- system: `"x86_64-linux"`
- host os: `Linux 6.6.58, NixOS, 24.05 (Uakari), 24.05.6043.64b80bfb316b`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Lix, like Nix) 2.91.1`
Artturin commented 4 weeks ago

That's normal, you have to

busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b true

busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b false

To unhide and hide the it

See https://gitlab.gnome.org/World/Phosh/squeekboard#running for other methods

aria-dos commented 3 weeks ago

Aah I see, thank you! Is there perchance also a toggle command? This would be easier to tie to a button for use on touch screens

Artturin commented 3 weeks ago

Aah I see, thank you! Is there perchance also a toggle command? This would be easier to tie to a button for use on touch screens

https://github.com/search?q=%2Fbusctl.%2Bosk0%2F&type=code

When I played around with my pinephone in 2021 I was using lisgd

exec lisgd -v -t 200 -d "/dev/input/by-path/platform-1c2ac00.i2c-event" \
 -g "1,LR,*,*, false" \
 -g "1,RL,*,*, false" \
 -g "1,UD,*,*, false" \
 -g "1,DU,*,*, false" \
 -g "2,LR,*,*, swaymsg workspace prev" \
 -g "2,RL,*,*, swaymsg workspace next" \
 -g "2,UD,*,*, swaymsg exec keyboard-show false" \
 -g "2,DU,*,*, swaymsg exec keyboard-show true" \
 -g "2,LU,*,*, swaymsg fullscreen" \
 -g "2,RD,*,*, swaymsg kill" \
 -g "3,LR,*,*, swaymsg focus right" \
 -g "3,RL,*,*, swaymsg focus left" \
 -g "3,UD,*,*, swaymsg focus down" \
 -g "3,DU,*,*, swaymsg focus up" \
 -g "4,LR,*,*, swaymsg move right" \
 -g "4,RL,*,*, swaymsg move left" \
 -g "4,UD,*,*, swaymsg move down" \
 -g "4,DU,*,*, swaymsg move up"

To show the keyboard on two finger up and down swipes

keyboard-show = pkgs.writeScriptBin "keyboard-show" ''
  #!/usr/bin/env bash

  set -e

  # Override default theme but allow selecting the replacement
  export GTK_THEME="Adwaita:dark"
  DIRS="$HOME/.config $(set -f; IFS=:; printf '%s\n' $XDG_CONFIG_DIRS)"
  for DIR in $DIRS; do
    if cat $DIR/squeekboard/gtk_theme 2> /dev/null; then
      export GTK_THEME="$(cat $DIR/squeekboard/gtk_theme 2> /dev/null)"
      break;
    fi;
  done;

  pidof squeekboard || ${pkgs.squeekboard}/bin/squeekboard &
  busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b "$@"
'';
aria-dos commented 3 weeks ago

aah thank u! I was able to write up a small script to tie to a waybar button like this:

keyboard-toggle = pkgs.writeScriptBin "keyboard-toggle" ''
  visibility=$(busctl get-property --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 Visible)
  toggle=""

  if [ "$visibility" = "b false" ]; then
      toggle="true"
  else
      toggle="false"
  fi

  busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b $toggle
'';

However, now I'm running into the problem that the keyboard randomly disappears when switching windows to/from foot. The same happens when I run the script from a .sh file.