ErikReider/SwayOSD

I'm using Hyprland, i am not able to make it work

daUnknownCoder opened this issue · 3 comments

if i do exec swayosd-server um it works but on killing the op, it exits the term too idk why

Check this out: https://unix.stackexchange.com/questions/296838/whats-the-difference-between-eval-and-exec

exec makes the command you run replace the current process (your shell, e.g. bash).

So you'll see the same behavior (shell exits, so terminal quits) whenever you use exec directly in your shell.

Sway, Hyprland, etc. have exec commands that are their own thing in the context of their configuration. In actuality, my guess is sway, hyprland, etc. take a configuration of

# sway
exec swayosd-server
# hyprland
exec = swayosd-server

and do the following:
spawn a new process running sh -c exec 'swayosd-server'

the new process is a shell... but it (probably) uses exec to replace that shell with whatever you wanted to run. The reason for the shell is it's needed to interpret and perform any special stuff in your command, like variable substitutions ($VAR) and pipes (some-command | other-command).

I don't use Hyprland so I can't provide any help, also seems unrelated to swayosd so I'll be closing this. Hopefully you'll find a solution :)

For posterity, in case someone else stumbles upon this.

Here's what I did to make this work:

  • create a simple script only containing
exec sleep 2 && dbus-update-activation-environment --all  # still works even without this, but just in case...
pkexec swayosd-libinput-backend # on screen display for some keys
  • chmod +x file/to/script it
  • then in hyprland config, add exec-once = /file/path/to/script and exec-once = swayosd-server

it just works™