nwg-piotr / nwg-drawer

Application drawer for wlroots-based Wayland compositors
MIT License
233 stars 25 forks source link

add support to hyprlandctl #102

Closed gouvinb closed 9 months ago

gouvinb commented 9 months ago

Description

This pull request adds the wm flag to the nwg-drawer command to launch a program with the swaymsg exec or hyprctl dispatch exec command.

:warning: BREAKING CHANGE: '-swaymsg' removed, use '-wm sway' instead

Reference

This pull request refers to this comment (#101)

Instructions

To use this new feature, simply add the -wm <current wm name> argument to the nwg-drawer command, or set the XDG_CURRENT_DESKTOP environment variable to "sway", "hypr" or "hyprland".

Example

Before

rubymine # without -term, -swaymsg and without XDG_CURRENT_DESKTOP=sway

After

swaymsg exec firefox # with `-wm sway` or with XDG_CURRENT_DESKTOP=sway

or

hyprctl dispact exec firefox # with `-wm hyprland` or with XDG_CURRENT_DESKTOP=hyprland

or

hyprctl dispact exec firefox # with `-wm hypr` or with XDG_CURRENT_DESKTOP=hypr

Note

I don't use Hypr or Hyprland (yet). So this PR must be tested.

nwg-piotr commented 9 months ago

Thanks! I see hardly anything on the phone. Will test tonight, when I'm back home.

gouvinb commented 9 months ago

Wait, I've caught a bug with this kind of command: /opt/google/chrome/google-chrome --profile-directory=Default --app-id=xxx.

gouvinb commented 9 months ago

I reworked command building.

Typical shell-supported command sets:

The listed commands above are now better managed.

Initially, the command types cmd --arg=value or ENV_VAR="value" cmd --arg=value were not correctly parsed. After finding a solution to this problem, I conducted further tests and discovered cases that were not currently handled. These cases are as follows:

gouvinb commented 9 months ago

Running apps with go is insanely complicated and always makes me miss the good, old python.

The approach with the Go language is a bit too low-level.

I think that most cases are covered and that the remaining 2 cases represent only a minority of situations.

Personally, I've never had a case like this; I had to invent them myself to check whether they worked or not.

nwg-piotr commented 9 months ago

All right. Let's find it ready.