Nwg-launchers: GTK+ launchers for sway, i3 and some other WMs

As it’s never too late to learn something new, I decided to try and code my sgtk-menu set of launchers, written in python, from scratch in C++. By the way I’m trying to simplify their usage, by reducing the number of arguments.

The very first package is available in AUR.

Take a look at the GitHub repository for details.

nwggrid

This command creates a GNOME-like application grid, with the search box, optionally prepended with a row of favourites (most frequently used apps).

Swappshot-Mon-Mar-23-205030-2020.th.png Swappshot-Mon-Mar-23-205157-2020.th.png Swappshot-Mon-Mar-23-205248-2020.th.png

nwgbar

This command creates a horizontal or vertical button bar, out of a template file.

Swappshot-Mon-Mar-23-210713-2020.th.png Swappshot-Mon-Mar-23-210652-2020.th.png

nwgdmenu

This program provides 2 commands:

  • nwgdmenu - displays newline-separated stdin input as a GTK menu
  • nwgdmenu_run - creates a GTK menu out of commands found in $PATH

Swappshot-Mon-Mar-23-211702-2020.th.png Swappshot-Mon-Mar-23-211911-2020.th.png Swappshot-Mon-Mar-23-211736-2020.th.png

3 Likes

@natemaia Could you take a look at PKGBUILD? I’ve never packaged C so far, so it may need improvement…

1 Like

Looks fine, couple small things I’d change.

You have a leftover line below source that’s just an address, it’s probably not gonna cause problems but it will throw a shell error, you can also use the $url in source if it’s the same

source=("$url/archive/v$pkgver.tar.gz")
https://github.com/nwg-piotr/nwg-launchers/archive/v0.1.0.tar.gz <<< Here

This quoting looks strange

"$srcdir/"$pkgname"-$pkgver"/grid  ->  "$srcdir/$pkgname-$pkgver/grid"

Thank you! I’ll try to digest what you wrote and use in 0.1.1.

Really impressive. Any environments this won’t work on?

1 Like

Wow, top again @nwg . Keep it on.

1 Like

Grid and bar should work anywhere. Dmenu may behave oddly in tiling WMs other than sway and i3. I’ll be working on this, at least for dwm & yaxwm.

1 Like

nwgbar:

Very nice. arcolinux offers a similar variant that is quite beautiful. I don’t know what tool Erik uses.

newgdmenu
Looks very similar to yad scripts. I like!

nwggrid
Have you looked at using ‘xlunch’ code for use?
http://xlunch.org/

Good work! Isn’t being quarantined fun!?!?! :innocent:

Haven’t heard about it until now. The only external code I looked into was about parsing categories for use in sgtk-menu. Not yet implemented in C++, and it’s going to be difficult. Haven’t even started so far.

I like xlunch’s name… It seems to offer a nice approach; although, the implementation isn’t as good as it could be.

Keep up the good work. Uważaj na siebie i bądź bezpieczny (Gotta love deepl.com)

1 Like

The name “xlunch” suggest that it may not work on Wayland. My primary objective is sway WM.

1 Like

nwgdmenu should work well now on dwm, and - I hope - other tiling WMs, which are neither sway nor i3.

Notice: if you start WM from a script (w/o DM), only sway and i3 will be auto-detected. You may need to pass the WM name as the argument:

nwgdmenu_run -wm dwm

Issue: for some damned reason, which I can’t recognize, positioning the menu does not work properly when started from terminal. E.g. nwgdmenu_run -va b -ha l will display the menu in the bottom left corner when started as a key binding, and somewhere else if the command was issued from the terminal window. I need (much) more beer to sort this out.

Latest changes will be published in a minute.

Excellent, thank you.

AUR updated to 0.1.2

Looks great @nwg

& top for the update in there.

Great and beautiful “thing” there!!
nwggrid could be very useful in ob! I will try to bind keys to it.
The -c is supposed to change number of columns right? I only get 6 no matter what!

womp

1 Like

Actually it’s the -n argument. See nwggrid -h.

If it comes to Openbox: I also use the bar configured to remind a dock, e.g. plank, started with a key binding.

2 Likes

Hi!! Got it working with a keybind now!! I was so eager to get it going that I took the wrong argument! It’s a bit slow here but that could be because of “(nwggrid:387946): Pango-WARNING **: 21:18:10.230: Invalid UTF-8 string passed to pango_layout_set_text()”, right?
Why is that happening?

Really cool this! Reminds me of Mac OS X!
I run plank (autostart) and how would I set it as a button there?

womp

The warning may be related to your gtk theme. They happen to have errors inside. Could you try changing the theme? Also if it comes to the speed: the icon theme may significantly slow down the icons creation.

This is on Debian with Adwaita icons:

$ time nwggrid -f
14 cache entries loaded
/home/piotr/.config/nwggrid/style.css
WM: other
Locale: pl
52 .desktop entries found
Using /home/piotr/.config/nwggrid/style.css
Focused display: 0, 0, 1920, 1080
Time: 208

real	0m1,531s
user	0m0,286s
sys	0m0,041s

After changing to Papirus:

$ time nwggrid -f
15 cache entries loaded
/home/piotr/.config/nwggrid/style.css
WM: other
Locale: pl
52 .desktop entries found
Using /home/piotr/.config/nwggrid/style.css
Focused display: 0, 0, 1920, 1080
Time: 157

real	0m1,532s
user	0m0,213s
sys	0m0,040s

user + sys = 0.286 + 0.041 = 0.327 for Adwaita
user + sys = 0.213 + 0.04 = 0.253 for Papirus

womp  ~  time nwggrid -f
0 cache entries loaded
/home/womp/.config/nwggrid/style.css
WM: openbox
Locale: sv
739 .desktop entries found
Using /home/womp/.config/nwggrid/style.css
Focused display: 0, 0, 1600, 900
Time: 860

(nwggrid:456127): Pango-WARNING **: 22:08:21.174: Invalid UTF-8 string passed to pango_layout_set_text()

real 0m3,062s
user 0m1,021s
sys 0m0,136s

theme=shades of grey
icon=epapirus

I still get the “pango-message” though! Is there anything I can do about “Invalid UTF-8 string”?

I will fiddle with it some more.

womp