Coder Social home page Coder Social logo

nwg-piotr / nwg-launchers Goto Github PK

View Code? Open in Web Editor NEW
390.0 11.0 15.0 861 KB

GTK-based launchers: application grid, button bar, dmenu for sway and other window managers

License: GNU General Public License v3.0

C++ 95.85% CSS 0.82% Meson 2.87% Python 0.45%
sway swaywm i3 i3wm openbox dwm fvwm gtk3 launcher dmenu panel gtk application-grid wayfire

nwg-launchers's Introduction

nwg-launchers

Build Status Build Status

This project is community-driven

As it seems I'm not going to live long enough to learn C++ properly, I decided to develop my launchers from scratch in Go. You'll find them in the nwg-shell project. They only support sway, and partially other wlroots-based compositors. Nwg-launchers is a community-driven project from now on. The main developer is Siborgium.

Description

It's damned difficult to make all the stuff behave properly on all window managers. My priorities are:

  1. it must work well on sway;
  2. it should work as well as possible on Wayfire, i3, dwm and Openbox.

Feel free to report issues you encounter on other window managers / desktop environments, but they may or may not be resolved.

Packages

The latest released version is available in Arch User Repository. Current development version (master branch) may be installed as the nwg-launchers-git AUR package. For other Linux distributions see the table below.

Packaging status

Building and installing

To build nwg-launchers from source, you need a copy of the source code, which can be obtained by cloning the repository or by downloading and unpacking the latest release.

Dependencies

Build dependencies
  • meson and ninja
  • nlohmann-json - will be downloaded as a subproject if not found on the system
Runtime dependencies
  • gtkmm3 (libgtkmm-3.0-dev)
  • gtk-layer-shell - optional, set to auto by default; will be downloaded as a subproject if explicitly enabled, but not found on the system
  • librsvg - optional, required to support SVG icons

Building

This project uses the Meson build system for building and installing the executables and the necessary data. The options that can be passed to the meson command can be found in the meson_options.txt file, and can be used to disable building some of the available programs.

$ git clone https://github.com/nwg-piotr/nwg-launchers.git
$ cd nwg-launchers
$ meson builddir -Dbuildtype=release
$ ninja -C builddir

Installation

To install:

$ sudo ninja -C builddir install

To uninstall:

$ sudo ninja -C builddir uninstall

Note: the descriptions below apply to the master branch. Certain features may or may not be available in the latest release, as well as in the current package for your Linux distribution.

nwggrid

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

This only works with the -p argument:

  • to pin up a program icon, right click its icon in the applications grid;
  • to unpin a program, right click its icon in the pinned programs grid.

Hit "Delete" key to clear the search box.

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

Starting with version 0.6.0 nwggrid can be run in server mode which drastically improves responsiveness. First, start a server with nwggrid-server command. When it's up and running, run nwggrid -client to show the grid.

Starting with version 0.7.0 nwggrid has limited support for XDG Desktop Menu Categories. A list of toggles is displayed between pinned/favorite grids and ordinary one. Clicking on a button displays entries of said category, and holding Ctrl allows to select multiple categories at the same time. Only non-empty categories from the list of "known" categories are shown. The list can be customized via /your/config/dir/nwg-launchers/nwggrid/grid.conf, a JSON configuration file. Sample file is provided along with other nwg-launchers sample configuration files. I plan to move all customization points to JSON config in the future. If the file is not present, a fixed list of categories is used. Additionally, you may use -no-categories to disable categories, or set no-categories: false in configuration file.

Usage

$ nwggrid -h
GTK application grid: nwggrid 0.7.1.1 (c) 2022 Piotr Miller, Sergey Smirnykh & Contributors 

Options:
-h               show this help message and exit
-f               display favourites (most used entries); does not work with -d
-p               display pinned entries; does not work with -d 
-d               look for .desktop files in custom paths (-d '/my/path1:/my/another path:/third/path') 
-o <opacity>     default (black) background opacity (0.0 - 1.0, default 0.9)
-b <background>  background colour in RRGGBB or RRGGBBAA format (RRGGBBAA alpha overrides <opacity>)
-n <col>         number of grid columns (default: 6)
-s <size>        button image size (default: 72)
-c <name>        css file name (default: style.css)
-l <ln>          force use of <ln> language
-g <theme>       GTK theme name
-wm <wmname>     window manager name (if can not be detected)
-no-categories   disable categories display
-oneshot         run in the foreground, exit when window is closed
                 generally you should not use this option, use simply `nwggrid` instead
[requires layer-shell]:
-layer-shell-layer          {BACKGROUND,BOTTOM,TOP,OVERLAY},         default: OVERLAY
-layer-shell-exclusive-zone {auto, valid integer (usually -1 or 0)}, default: auto


$ nwggrid-server -h
GTK application grid: nwggrid 0.7.1.1 (c) 2021 Piotr Miller, Sergey Smirnykh & Contributors 

Usage:
    nwggrid -client      sends -SIGUSR1 to nwggrid-server, requires nwggrid-server running
    nwggrid [ARGS...]    launches nwggrid-server -oneshot ARGS...

See also:
    nwggrid-server -h


Terminal applications

.desktop files with the Terminal=true line should be started in a terminal emulator. There's no common method to determine which terminal to use. The nwggrid command since v0.4.1 at the first run will look for installed terminals in the following order: alacritty, kitty, urxvt, foot, lxterminal, sakura, st, termite, terminator, xfce4-terminal, gnome-terminal. The name of the first one found will be saved to the ~/.config/nwg-launchers/nwggrid/terminal file. If none of above is found, the fallback xterm value will be saved, regardless of whether xterm is installed or not. You may edit the term file to use another terminal.

Custom background

Use -b | argument (w/o #) to define custom background colour. If alpha value given, it overrides the opacity, as well default, as defined with the -o argument.

Custom styling

On first run the program creates the nwg-launchers/nwggrid folder in your .config directory. You'll find the style.css files inside. You may edit the style sheet to your liking.

Customization

On first run the program creates the nwg-launchers/nwggrid folder in your .config directory. You'll find a sample template grid.conf file inside.

Below lists the keys currently available to be set in the grid.conf file. Not all keys shown below are set by in the sample template, such as the "custom-path" and "language" keys.

It should be noted that the "favorites" and "pins" keys should not be set to true if the "custom-path" key is set, as those options will not work.

{
     "categories": {
         "AudioVideo" : "Multimedia ๐Ÿ“€",
         "Development" : "Development ๐Ÿ’ป",
         "Education" : "Education ๐ŸŽ“",
         "Game" : "Games ๐ŸŽฎ",
         "Graphics" : "Graphics ๐ŸŽจ",
         "Network" : "Network ๐ŸŒŽ",
         "Office" : "Office ๐Ÿ’ผ",
         "Science" : "Science ๐Ÿ”ฌ",
         "Settings" : "Settings โš™๏ธ",
         "System" : "System ๐Ÿ–ฅ๏ธ",
         "Utility" : "Utility ๐Ÿ› ๏ธ"
     },
     "custom-path" : "/my/path1:/my/another path:/third/path",
     "favorites" : false,
     "pins" : false,
     "columns" : 6,
     "icon-size" : 72,
     "language" : "en",
     "no-categories": false,
     "oneshot" : false
}

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

Usage

$ nwgbar -h
GTK button bar: nwgbar 0.7.1.1 (c) Piotr Miller & Contributors 2022

Options:
-h               show this help message and exit
-v               arrange buttons vertically
-ha <l>|<r>      horizontal alignment left/right (default: center)
-va <t>|<b>      vertical alignment top/bottom (default: middle)
-t <name>        template file name (default: bar.json)
-c <name>        css file name (default: style.css)
-o <opacity>     background opacity (0.0 - 1.0, default 0.9)
-b <background>  background colour in RRGGBB or RRGGBBAA format (RRGGBBAA alpha overrides <opacity>)
-s <size>        button image size (default: 72)
-g <theme>       GTK theme name
-wm <wmname>     window manager name (if can not be detected)

[requires layer-shell]:
-layer-shell-layer          {BACKGROUND,BOTTOM,TOP,OVERLAY},        default: OVERLAY
-layer-shell-exclusive-zone {auto, valid integer (usually -1 or 0)}, default: auto


Custom background

Use -b | argument (w/o #) to define custom background colour. If alpha value given, it overrides the opacity, as well default, as defined with the -o argument.

Customization

On first run the program creates the nwg-launchers/nwgbar folder in your .config directory. You'll find a sample template bar.json and the style.css files inside.

Templates use json format. The default one defines an example Exit menu for sway window manager on Arch Linux:

[
  {
    "name": "Lock screen",
    "exec": "swaylock -f -c 000000",
    "icon": "system-lock-screen"
  },
  {
    "name": "Logout",
    "exec": "swaymsg exit",
    "icon": "system-log-out"
  },
  {
    "name": "Reboot",
    "exec": "systemctl reboot",
    "icon": "system-reboot"
  },
  {
    "name": "Shutdown",
    "exec": "systemctl -i poweroff",
    "icon": "system-shutdown"
  }
]

To set a keyboard shortcut (using Alt+KEY) for an entry, you can add an underscore before the letter you want to use. Example to set s as the shortcut:

[
...
  {
    "name": "Lock _screen",
    "exec": "swaylock -f -c 000000",
    "icon": "system-lock-screen"
  }
...
]

Note for underscore ("_")

If you want to use an underscore in the name, you have to double it ("__").

Wayfire note

For the Logout button, as in the bar above, you may use wayland-logout by @soreau.

You may use as many templates as you need, with the -t argument. All of them must be placed in the config directory. You may use own icon files instead of icon names, like /path/to/the/file/my_icon.svg.

The style sheet makes the buttons look similar to nwggrid. You can customize them as well.

nwgdmenu

This program provides 2 commands:

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

Hit "Delete" to clear the search box. Hit "Insert" to switch case sensitivity.

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

Usage

$ nwgdmenu -h
GTK dynamic menu: nwgdmenu 0.7.1.1 (c) Piotr Miller & Contributors 2022

<input> | nwgdmenu - displays newline-separated stdin input as a GTK menu
nwgdmenu - creates a GTK menu out of commands found in $PATH

Options:
-h               show this help message and exit
-n               no search box
-ha <l>|<r>      horizontal alignment left/right (default: center)
-va <t>|<b>      vertical alignment top/bottom (default: middle)
-r <rows>        number of rows (default: 20)
-c <name>        css file name (default: style.css)
-o <opacity>     background opacity (0.0 - 1.0, default 0.3)
-b <background>  background colour in RRGGBB or RRGGBBAA format (RRGGBBAA alpha overrides <opacity>)
-g <theme>       GTK theme name
-wm <wmname>     window manager name (if can not be detected)
-run             ignore stdin, always build from commands in $PATH

[requires layer-shell]:
-layer-shell-layer          {BACKGROUND,BOTTOM,TOP,OVERLAY},        default: OVERLAY
-layer-shell-exclusive-zone {auto, valid integer (usually -1 or 0)}, default: auto

Hotkeys:
Delete        clear search box
Insert        switch case sensitivity


(1) The program should auto-detect if something has been passed in stdin, and build the menu out of the stdin content or from commands found in $PATH accordingly. However, in some specific cases (e.g. if you use gdm and start nwgdmenu from a key binding) the stdin content detection may be false-positive, which results in displaying an empty menu. In such case use the nwgdmenu -run instead, to force building the menu out of commands in $PATH.

Notice: if you start your 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 -wm dwm

The generic name tiling will be accepted as well.

Custom background

Use -b | argument (w/o #) to define custom background colour. If alpha value given, it overrides the opacity, as well default, as defined with the -o argument.

Custom styling

On first run the program creates the nwg-launchers/nwgdmenu folder in your .config directory. You'll find the default style.css files inside. Use it to adjust styling and a vertical margin to the menu, if needed.

i3 note

In case you use default window borders, an exclusion like this may be necessary:

for_window [title="~nwg"] border none

Openbox Note

To start nwgdmenu from a key binding, use the -run argument, e.g.:

<keybind key="W-D">
  <action name="Execute">
    <command>nwgdmenu -run</command>
  </action>
</keybind>

wlr-layer-shell protocol

From 0.5.0 the nwg-launchers support wlr-layer-shell protocol (via gtk-layer-shell), and use it where preferred. The default layer is OVERLAY and the default exclusive zone is auto, but you can change it using command line arguments. Notably, you may want to set exclusive zone to -1 to show nwggrid or nwgbar on top of panels (waybar, wf-panel, etc).

Tips & tricks

Hide unwanted icons in nwggrid

See: https://wiki.archlinux.org/index.php/desktop_entries#Hide_desktop_entries

nwg-launchers's People

Contributors

alebastr avatar ericonr avatar evo221 avatar jbeich avatar jovanlanik avatar markusvolk avatar nwg-piotr avatar saidsay-so avatar santouits avatar scotabroad avatar siborgium avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nwg-launchers's Issues

Fails to build with Clang

I can't use GCC on FreeBSD because gtkmm is built against libc++ but GCC defaults to libstdc++. Also, libstdc++fs shouldn't be necessary since GCC 9. libc++ dropped its equivalent in llvm/llvm-project@cc37af7a3631.

$ c++ --version
FreeBSD clang version 10.0.1 ([email protected]:llvm/llvm-project.git llvmorg-10.0.1-rc2-0-g77d76b71d7d)
Target: x86_64-unknown-freebsd13.0
Thread model: posix
InstalledDir: /usr/bin

$ meson _build && ninja -C _build
[...]
../bar/bar.cc:112:25: error: invalid suffix 'd' on floating constant
            if (o >= 0.0d && o <= 1.0d) {
                        ^
../bar/bar.cc:112:38: error: invalid suffix 'd' on floating constant
            if (o >= 0.0d && o <= 1.0d) {
                                     ^
../dmenu/dmenu.cc:136:25: error: invalid suffix 'd' on floating constant
            if (o >= 0.0d && o <= 1.0d) {
                        ^
../dmenu/dmenu.cc:136:38: error: invalid suffix 'd' on floating constant
            if (o >= 0.0d && o <= 1.0d) {
                                     ^
../grid/grid.cc:115:25: error: invalid suffix 'd' on floating constant
            if (o >= 0.0d && o <= 1.0d) {
                        ^
../grid/grid.cc:115:38: error: invalid suffix 'd' on floating constant
            if (o >= 0.0d && o <= 1.0d) {
                                     ^
ld: error: unable to find library -lstdc++fs
c++: error: linker command failed with exit code 1 (use -v to see invocation)

$ CC=gcc10 CXX=g++10 meson _build && ninja -C _build
/usr/bin/ld: grid/nwggrid.p/grid.cc.o: in function `main':
_build/../grid/grid.cc:301: undefined reference to `Glib::ustring::ustring(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: _build/../grid/grid.cc:301: undefined reference to `Glib::ustring::ustring(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: _build/../grid/grid.cc:311: undefined reference to `Glib::ustring::ustring(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)'
/usr/bin/ld: _build/../grid/grid.cc:319: undefined reference to `Glib::ustring::ustring(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: _build/../grid/grid.cc:319: undefined reference to `Glib::ustring::ustring(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: _build/../grid/grid.cc:330: undefined reference to `Glib::ustring::ustring(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: _build/../grid/grid.cc:347: undefined reference to `Glib::ustring::ustring(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: _build/../grid/grid.cc:347: undefined reference to `Glib::ustring::ustring(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: grid/nwggrid.p/grid.cc.o:/usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h:108: more undefined references to `Glib::ustring::ustring(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' follow
/usr/bin/ld: grid/nwggrid.p/grid_tools.cc.o: in function `app_image(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
_build/../grid/grid_tools.cc:283: undefined reference to `Gdk::Pixbuf::create_from_file(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, int, bool)'
/usr/bin/ld: _build/../grid/grid_tools.cc:279: undefined reference to `Gdk::Pixbuf::create_from_file(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, int, bool)'
/usr/bin/ld: _build/../grid/grid_tools.cc:285: undefined reference to `Gdk::Pixbuf::create_from_file(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, int, bool)'
/usr/bin/ld: common/libnwg.a(nwg_classes.cc.o): in function `AppBox::AppBox(Glib::ustring, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, Glib::ustring)':
_build/../common/nwg_classes.cc:44: undefined reference to `Glib::ustring::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: common/libnwg.a(nwg_classes.cc.o): in function `AppBox::AppBox(Glib::ustring, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, Glib::ustring)':
_build/../common/nwg_classes.cc:44: undefined reference to `Glib::ustring::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status

Keep Makefiles

Would you like to keep the Makefiles as a way of building the individual tools, or would you like to fully remove them?

Core dump on fresh install: key 'focused' not found

Compiled latest master via on Fedora 32:

$ meson build -Dbuildtype=release
$ ninja -C build
$ sudo ninja -C build install
$ nwggrid -h
GTK application grid: nwggrid 0.2.0 (c) Piotr Miller 2020 & Contributors

Options:
-h            show this help message and exit
-f            display favourites (most used entries)
-p            display pinned entries
-o <opacity>  background opacity (0.0 - 1.0, default 0.9)
-n <col>      number of grid columns (default: 6)
-s <size>     button image size (default: 72)
-c <name>     css file name (default: style.css)
-l <ln>       force use of <ln> language
-wm <wmname>  window manager name (if can not be detected)

$ nwggrid
WM: sway
Locale: en
604 .desktop entries found
/home/schroeter/.config/nwg-launchers/nwggrid/style.css
terminate called after throwing an instance of 'nlohmann::detail::out_of_range'
  what():  [json.exception.out_of_range.403] key 'focused' not found
Aborted (core dumped)

fatal error: ../nwgconfig.h: No such file or directory

I've just wanted to try out your launcher/grid, but following your instructions from the README.md file I get a fatal error.

I am on Fedora 32 and here's what I did:

sudo dnf -y install gtkmm30-devel json-devel
git clone [email protected]:nwg-piotr/nwg-launchers.git
cd nwg-launchers/grid
sudo make clean install

And the last command (make) output is as follows:

$ sudo make clean install
rm -rf *.o nwggrid
g++ -c -Wall -O2 -std=c++17 grid.cc -o grid.o `pkg-config gtkmm-3.0 --libs --cflags`
In file included from grid.cc:10:
grid.h:9:10: fatal error: ../nwgconfig.h: No such file or directory
    9 | #include "../nwgconfig.h"
      |          ^~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:15: grid.o] Error 1

There is no such file as nwgconfig.h in the repo root.

For the repo looks like it should be built with meson and not with make, I did the following:

sudo dnf -y install gtkmm30-devel json-devel meson ninja
git clone [email protected]:nwg-piotr/nwg-launchers.git
cd nwg-launchers
meson build
ninja -C build
sudo ninja -C build install

And this successfully installed all three programs: nwgbar, nwgdmenu, nwggrid.

I might be a good idea to update the instructions in README.md. ๐Ÿ˜ƒ

Nwggrid mode to pin programs in any place you like

As I have not found a worthy replacement for https://github.com/Zren/plasma-applet-tiledmenu that isn't applet I want to suggest a feature for nwggrid. It's an expansion to favourites, I do not need tiles, groups, sidebar search or other features from that project.

It could be two modes. nwggrid -m default is just like today .

nwggrid -m fixed could start the menu as a full screen blank grid (until you pin programs) with the same search bar. The important distinction here is that you have freedom to move and pin programs in any place of the entire screen grid. I pin more than 50 programs and scripts, with icon size 48, called from .desktop. When you start typing it search the entire program list, not just from pins.
I once tried to make wayland grid with Python and drag operations crashed my computer or window manager. It was ugly. So could pin with right click no problem or just text file. Changing icon size might mess up the position of saved items.

Good job on the grid, it opens instantly on high number of programs even without daemon.

Okular not showing in Nwggrid

When comparing the output of Wofi's drun and nwggrid, Wofi shows the application Okular, while Nwggrid does not.

Looking at the output of ls in my /usr/share/applications folder I think I can see why:

 /usr/share/applications โฏ ls                                                                 08:41:34
Alacritty.desktop		     org.kde.isoimagewriter.desktop
avahi-discover.desktop		     org.kde.kded5.desktop
bssh.desktop			     org.kde.mobile.okular_chm.desktop
bvnc.desktop			     org.kde.mobile.okular_comicbook.desktop
cmake-gui.desktop		     org.kde.mobile.okular_djvu.desktop
discord.desktop			     org.kde.mobile.okular_dvi.desktop
electron.desktop		     org.kde.mobile.okular_epub.desktop
firefox.desktop			     org.kde.mobile.okular_fax.desktop
gcr-prompter.desktop		     org.kde.mobile.okular_fb.desktop
gcr-viewer.desktop		     org.kde.mobile.okular_ghostview.desktop
gtk3-demo.desktop		     org.kde.mobile.okular_kimgio.desktop
gtk3-icon-browser.desktop	     org.kde.mobile.okular_md.desktop
gtk3-widget-factory.desktop	     org.kde.mobile.okular_mobi.desktop
htop.desktop			     org.kde.mobile.okular_ooo.desktop
ktelnetservice5.desktop		     org.kde.mobile.okular_pdf.desktop
mimeinfo.cache			     org.kde.mobile.okular_plucker.desktop
okularApplication_chm.desktop	     org.kde.mobile.okular_tiff.desktop
okularApplication_comicbook.desktop  org.kde.mobile.okular_txt.desktop
okularApplication_djvu.desktop	     org.kde.mobile.okular_xps.desktop
okularApplication_dvi.desktop	     org.kde.okular.desktop
okularApplication_epub.desktop	     org.nomacs.ImageLounge.desktop
okularApplication_fax.desktop	     pavucontrol.desktop
okularApplication_fb.desktop	     pcmanfm-qt.desktop
okularApplication_ghostview.desktop  pcmanfm-qt-desktop-pref.desktop
okularApplication_kimgio.desktop     polkit-gnome-authentication-agent-1.desktop
okularApplication_md.desktop	     qt5ct.desktop
okularApplication_mobi.desktop	     qv4l2.desktop
okularApplication_ooo.desktop	     qvidcap.desktop
okularApplication_pdf.desktop	     signon-ui.desktop
okularApplication_plucker.desktop    slack.desktop
okularApplication_tiff.desktop	     vim.desktop
okularApplication_txt.desktop	     wire-desktop.desktop
okularApplication_xps.desktop	     xdvi.desktop

It seems okular has very many .desktop files. org.kde.okular.desktop seems to be the correct one (that's the one recognized by Wofi)

grid: crash when LANG is unset

$ locale
LANG=
LC_CTYPE=en_US.UTF-8
LC_COLLATE="C"
LC_TIME="C"
LC_NUMERIC="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_ALL=

$ nwggrid
WM: sway
Process 43828 stopped
* thread #1, name = 'nwggrid', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
    frame #0: 0x00000008017ff58f libc.so.7`strlen(str=0x0000000000000000) at strlen.c:101:8
   98            * boundaries is integral multiple of word size.
   99            */
   100          lp = (const unsigned long *)((uintptr_t)str & ~LONGPTR_MASK);
-> 101          va = (*lp - mask01);
   102          vb = ((~*lp) & mask80);
   103          lp++;
   104          if (va & vb)
(lldb) bt
* thread #1, name = 'nwggrid', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
  * frame #0: 0x00000008017ff58f libc.so.7`strlen(str=0x0000000000000000) at strlen.c:101:8
    frame #1: 0x000000000023f345 nwggrid`std::__1::char_traits<char>::length(__s=0x0000000000000000) at __string:253:53
    frame #2: 0x0000000000239fe9 nwggrid`std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string<std::nullptr_t>(this="\x13!\0\0\0\0\0\0\0\0\0\0\0\0\0\x7f\0\0\x7f\0\0\x7f\0\0\0\0\0\0\0\0\0\0!\0\0\0\0\0\x80\x7f\0\0\x80\x7f\0\0Y#\0\0\0\0\0\b\0+\0\b\0\0\0\b\x04+\0\b\0\0\0\b\b+\0\b\0\0\0\b\f+\0\b\0\0\0\b +", __s=0x0000000000000000) at string:819:19
    frame #3: 0x0000000000262e24 nwggrid`get_locale() at nwg_tools.cc:84:21
    frame #4: 0x00000000002359d8 nwggrid`main(argc=1, argv=0x00007fffffffe0e0) at grid.cc:200:16
    frame #5: 0x000000000023419f nwggrid`_start(ap=<unavailable>, cleanup=<unavailable>) at crt1_c.c:75:7

Add more functionality to dmenu

nwgdmenu could:

  • have a working graphical erase button, the current one doesn't seem to do anything
  • launch the first application in the list if you press return inside the search box
  • have an option for displaying desktop applications (only the titles)
  • have an option for case insensitive search
  • be capable of performing fuzzy matching

What do you think of these ideas?

Portability tracker

Let's track here what has to be done to make the launchers more portable to different systems.

We discussed some things in the other PR:

The wrapper scripts inside /usr/lib/nwg* folders should be removed and the launchers will reside inside the bin directory, in whatever prefix we install them. Let's say that we install them to prefix /usr. That means the files will be:

/usr/bin/nwgbar
/usr/bin/nwgdmenu
/usr/bin/nwgdmenu_run // a wrapper script that executes nwgdmenu manually
/usr/bin/nwggrid

Also there are many paths that are hardcoded inside the code like

 fs::copy_file("/usr/share/nwgbar/style.css", target, fs::copy_options::overwrite_existing);

Zoom icon does not show.

The AUR package zoom-system-qt stores it's icon in /usr/share/pixmaps. Wofi's drunner finds this icon, but nwggrid does not. If it doesn't already, consider also searching in /usr/share/pixmaps?

Pressing enter for the first result in nwgdmenu isn't working with 0.4.3

If I have one or more available results in nwgdmenu, I can't just press enter to select it (it doesn't do anything), I have to press the down arrow key (which doesn't actually move the selection box) and then I can press enter. If I narrow down the search enough so that there is a single result, then pressing enter without any arrows works.

I can try to track this down, just wanted to make it known.

grid: crash when LANG is unset (again, v0.3.3)

Regressed by #83. See #70 for previous discussion.

$ locale
LANG=
LC_CTYPE=en_US.UTF-8
LC_COLLATE="C"
LC_TIME="C"
LC_NUMERIC="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_ALL=

$ nwggrid
WM: sway
Process 33697 stopped
* thread #1, name = 'nwggrid', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
    frame #0: 0x000000080160d32f libc.so.7`strlen(str=0x0000000000000000) at strlen.c:101:8
   98            * boundaries is integral multiple of word size.
   99            */
   100          lp = (const unsigned long *)((uintptr_t)str & ~LONGPTR_MASK);
-> 101          va = (*lp - mask01);
   102          vb = ((~*lp) & mask80);
   103          lp++;
   104          if (va & vb)
(lldb) bt
* thread #1, name = 'nwggrid', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
  * frame #0: 0x000000080160d32f libc.so.7`strlen(str=0x0000000000000000) at strlen.c:101:8
    frame #1: 0x000000000023fcd5 nwggrid`std::__1::char_traits<char>::length(__s=0x0000000000000000) at __string:370:53
    frame #2: 0x000000000023e454 nwggrid`std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string<std::nullptr_t>(this=Summary Unavailable, __s=0x0000000000000000) at string:818:19
    frame #3: 0x0000000000265173 nwggrid`get_locale() at nwg_tools.cc:175:23
    frame #4: 0x000000000023baea nwggrid`main(argc=1, argv=0x00007fffffffe0f8) at grid.cc:192:16
    frame #5: 0x000000000023a68f nwggrid`_start(ap=<unavailable>, cleanup=<unavailable>) at crt1_c.c:75:7
(lldb) f 3
frame #3: 0x0000000000265173 nwggrid`get_locale() at nwg_tools.cc:175:23
   172   * Returns current locale
   173   * */
   174  std::string get_locale() {
-> 175      std::string loc = getenv("LANG");
   176      if (!loc.empty()) {
   177          auto idx = loc.find_first_of("_");
   178          if (idx != std::string::npos) {

nwggrid: flatpaks are not listed

As the title says. sgtk-grid does list flatpaks, maybe it's something you want to implement.

By the way, very nice suite of apps, I'm really enjoying using them. Keep it up!

1.0.0 roadmap

I used to plan on 1.0.0 release after the fourth launcher - the sgtk-menu counterpart - is developed. However, the menu overflow issue on sway remains unresolved, and coding the insane workaround I used in python again in C++ would be a nightmare to me. Moreover, the menu looks well, but I don't use it at all since the grid appeared. That's why I thought to go ahead with the 1.0.0 release, and leave the menu for an undefined future - if any.

IMO we could find this project 1.0.0-ready as soon as the changes @ericonr is going to make are done.

Let me know what you think.

[Request] WLR Layer Shell protocol support?

This way, the bar/grid/dmenu can have animations disabled.

Currently, on wayfire, the bar and grid have animation effects (fire animation) just like rest of the windows.

Potentially, we don't want the bar and grid to have animations, and can probably put them in the overlay layer so that they are on top?

C++ vs Python menus

Which one would be the one getting more support into the future?

I want to package both for gentoo and would love to know which one to give a preference to.

Fails to build with Clang

Regressed by af54c04 (#83)

../grid/grid_tools.cc:204:22: error: 'dest' in capture list does not name a variable
                    [dest, pos, &view](nop_t) { *dest = view.substr(pos); },
                     ^
../grid/grid_tools.cc:204:28: error: 'pos' in capture list does not name a variable
                    [dest, pos, &view](nop_t) { *dest = view.substr(pos); },
                           ^
../grid/grid_tools.cc:204:50: error: reference to local binding 'dest' declared in enclosing function 'desktop_entry'
                    [dest, pos, &view](nop_t) { *dest = view.substr(pos); },
                                                 ^
../grid/grid_tools.cc:200:29: note: 'dest' declared here
        for (auto& [prefix, dest, tag] : matches) {
                            ^
../grid/grid_tools.cc:204:69: error: reference to local binding 'pos' declared in enclosing function 'desktop_entry'
                    [dest, pos, &view](nop_t) { *dest = view.substr(pos); },
                                                                    ^
../grid/grid_tools.cc:201:23: note: 'pos' declared here
            auto [ok, pos] = try_strip_prefix(prefix);
                      ^
../grid/grid_tools.cc:205:22: error: 'dest' in capture list does not name a variable
                    [dest, pos, &view](cut_t) {
                     ^
../grid/grid_tools.cc:205:28: error: 'pos' in capture list does not name a variable
                    [dest, pos, &view](cut_t) {
                           ^
../grid/grid_tools.cc:206:52: error: reference to local binding 'pos' declared in enclosing function 'desktop_entry'
                        auto idx = view.find(" %", pos);
                                                   ^
../grid/grid_tools.cc:201:23: note: 'pos' declared here
            auto [ok, pos] = try_strip_prefix(prefix);
                      ^
../grid/grid_tools.cc:210:26: error: reference to local binding 'dest' declared in enclosing function 'desktop_entry'
                        *dest = view.substr(pos, idx - pos);
                         ^
../grid/grid_tools.cc:200:29: note: 'dest' declared here
        for (auto& [prefix, dest, tag] : matches) {
                            ^
../grid/grid_tools.cc:210:45: error: reference to local binding 'pos' declared in enclosing function 'desktop_entry'
                        *dest = view.substr(pos, idx - pos);
                                            ^
../grid/grid_tools.cc:201:23: note: 'pos' declared here
            auto [ok, pos] = try_strip_prefix(prefix);
                      ^
../grid/grid_tools.cc:210:56: error: reference to local binding 'pos' declared in enclosing function 'desktop_entry'
                        *dest = view.substr(pos, idx - pos);
                                                       ^
../grid/grid_tools.cc:201:23: note: 'pos' declared here
            auto [ok, pos] = try_strip_prefix(prefix);
                      ^
10 errors generated.

Starting nwggrid in sway with tilling mode crashes the application

When i try to start nwggrid with "for_window [title="~nwg"] floating disable" (which for some reason was the default for my config) just makes nwggrid unresponsive and crashes after a while.
The same behavior i can observe with sgtk-grid but in this case it just becomes unresponsive without crashing.

i don't think its a big issue but you might want to warn users using sway to just put in there config file "for_window [title="~nwg"] floating enable" so nwg-launchers work as expected.

I'm using arch Linux, installed both from the aur.

Nwggrid doesn't sort .desktop files with names longer than 27 characters

Whenever you create a .desktop file with a name which nwggrid shortens, the sorting gets botched up.

To reproduce this bug, just create a few .desktop files with name fields more than 27 characters long, and add numbers at the end respectively like this:

File 1: "name that is more than 27 chars long 01"
File 2: "name that is more than 27 chars long 02"
File 3: "name that is more than 27 chars long 03"
File 4: "name that is more than 27 chars long 04"
and so on
Normally file 1 should be displayed before file 2, but since the application doesn't seem to parse characters after the 27 char limit, the files aren't in alphanumeric order.

Using nwggrid 0.4.0 latest from aur.

Two issues with terminal selection.

  1. Although common, it seems that the -e option for a terminal to run a command is not universal.
    I discovered this after opening an issue for the foot terminal emulator. See
    https://codeberg.org/dnkl/foot/issues/184

  2. The code that calls "command -v" redirects the output to /dev/null with "&>/dev/null". While this will work for bash, for other shells such as dash (default on Debian) this redirection will not work and as a quite unfortunate side effect the call to std::system() will return 0 even if the exit status for "command -v foo" is non-zero.

I prepared a pull request for this. The branch has thee commits. The first two fix the issues above and the third
adds the foot terminal emulator to the list of terminals to try. See #136

Broken i3 and Openbox compatibility

As mentioned before, on the current master branch we have several X11-related issues:

  1. MainWindow 100% opaque in both i3 and Openbox (hopefully fixed here).
  2. Detection of i3 is as much essential, as in the case of sway: we cant go fullscreen() in both of them; the current way is insufficient, as it fails detecting i3 if we dont use a DM or use ly, as myself lately; I added one more case in std::string detect_wm().
  3. Improper screen geometry detection on multi-headed setup (x and y always = 0 both on i3 and Openbox); this takes no effect on Openbox, but on i3 opens launchers always on the same screen. Not yet resolved. Partially resolved by adding a separate detection method for i3. #104
  4. nwgdmenu on Openbox, when started from a key binding or a Tint2 button, shows up empty. Behaves correctly if started from terminal. No idea at the moment. Not a bug. Just needed -run argument.

How do I change the background color?

I'd like to make nwggrid and nwgbar fit with a light theme and I can't seem to find how to change the background color. The icons of my light theme look terrible with the default black background.

What `PATH` does the `nwgdmenu` search?

I have the following PATH set on my system: /usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/opt/bin:/usr/lib64/qt4/bin:/usr/lib64/qt5/bin:/usr/share/Modules/bin.

I have installed Firefox Nightly to /opt/ff_nightly and symlinked /opt/ff_nightly/firefox to /opt/bin/ff_nightly, so with the PATH above I can run ff_nightly to open Firefox Nightly.

Now, nwgdmenu does not show it up. I tried to insert a slash (/) in order to provide absolute path of the (symlinked) binary, but it is not inserted (why would you disable input of any characters? I know there are other special characters that won't be input).

'nwggrid' terminated by signal SIGABRT

I installed nwg-launchers from the AUR

when i launch nwggrid, it doesn't launch and it outputs this error

WM: sway
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid
fish: 'nwggrid' terminated by signal SIGABRT (Abort)

tried building from master, the issue still persists.
nwgbar and nwgdmenu work as intended.

nwggrid shows no result

When I run nwggrid I don't see any apps. Even if I wait. There a 0 count at the bottom.

I wonder if I'm missing an icon theme or something.

nwg-launchers 0.2.0
sway
NixOS unstable

โฏ nwggrid
WM: sway
Locale: fr
91 .desktop entries found
/home/bbigras/.config/nwg-launchers/nwggrid/style.css
Focused display: 0, 0, 1600, 900
Time: 104

Output the selected item in nwgdmenu

In nwgdmenu, it is possible to select an item with the arrow keys. However, after pressing the return key, it outputs the first item in the list, rather than the highlighted item.

Dont depend on git

[    4s] The Meson build system
[    4s] Version: 0.55.1
[    4s] Source dir: /home/abuild/rpmbuild/BUILD/nwg-launchers-0.3.2
[    4s] Build dir: /home/abuild/rpmbuild/BUILD/nwg-launchers-0.3.2/build
[    4s] Build type: native build
[    4s] Using 'PKG_CONFIG_PATH' from environment with value: ':/usr/lib64/pkgconfig:/usr/share/pkgconfig'
[    4s] Using 'PKG_CONFIG_PATH' from environment with value: ':/usr/lib64/pkgconfig:/usr/share/pkgconfig'
[    4s] Project name: nwg-launchers
[    4s] Project version: 0.3.2
[    4s] Using 'CXXFLAGS' from environment with value: '-O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g'
[    4s] Using 'CXXFLAGS' from environment with value: '-O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g'
[    4s] C++ compiler for the host machine: c++ (gcc 10.2.1 "c++ (SUSE Linux) 10.2.1 20200805 [revision dda1e9d08434def88ed86557d08b23251332c5aa]")
[    4s] C++ linker for the host machine: c++ ld.bfd 2.34.0.20200325-1
[    4s] Host machine cpu family: x86_64
[    4s] Host machine cpu: x86_64
[    4s] Compiler for C++ supports link arguments -lc++fs: NO 
[    4s] Compiler for C++ supports link arguments -lstdc++fs: YES 
[    4s] Found pkg-config: /usr/bin/pkg-config (1.7.3)
[    4s] Using 'PKG_CONFIG_PATH' from environment with value: ':/usr/lib64/pkgconfig:/usr/share/pkgconfig'
[    4s] Run-time dependency gtkmm-3.0 found: YES 3.24.2
[    4s] Did not find CMake 'cmake'
[    4s] Found CMake: NO
[    4s] Run-time dependency nlohmann_json found: NO (tried pkgconfig and cmake)
[    4s] 
[    4s] meson.build:26:1: ERROR: Git program not found.

Plenty of build systems won't have a network connection available.
Git should only be optional.

Do you need it to download nlohmann_json in case it wasn't downloaded as subpackage? If yes then the README should be changed because the readme states that it is optional. If no, then why do you hard depend on git?

Standardize Makefiles

Hey there! I just packaged sgtk-menu for Void (which it seems you also use?) and was looking to package nwg-launchers as well, because I wanted to give them a test drive before making actual PRs for them.

Do you think it would be possible to make the Makefiles more standard? Furthermore, having to manually run each one is a pain for packaging in Void, but I fixed that part with a simple script:

#!/usr/bin/env bash

for dir in bar dmenu grid
do
	cd $dir
	make "$@"
	cd ..
done

However, using CC set to g++ is a bit of an anti-pattern, as well as the way you're outputing pkg-config stuff. As it stands, the only one that built cleanly without any patching was the bar one. Would you be open to PRs for fixing some of these issues? I'd also be interested in adding a toplevel makefile, because a script feels a little flimsy.

Makefile from nwgdmenu does not properly clean

The "clean" part in the nwgdmenu Makefile tries to remove "dmenu" instead of "nwgdmenu". I think there is a typo ;)
Original dmenu/Makefile:

clean:
        rm -rf *.o dmenu

Should be

clean:
        rm -rf *.o nwgdmenu

[request] Integration with Wayfire

I am using these with Wayfire on Gentoo and these are really awesome!

I was wondering if it was possible to make the nwgbar integrate with wayfire as currently it doesn't support the logout button.

Thanks a lot.

Check $TERMINAL and/or $TERMCMD

Regarding get_term function: I advise you to check $TERMINAL and/or $TERMCMD first, and only if this fails, fallback to config/predefined values. Although the variables are not standard, they are widely used, as noted in this discussion.

nwggrid randomly opens apps in terminal

I found that nwggrid randomly opens some apps in a terminal even if the desktop file does not specify

Terminal=true

This seems to be because of an uninitialised variable. A fix that works for me is at #131

[feature request][dmenu] read list from stdin

This has now a very nice shape (much more responsive than the older python based ones).

Since you provide a command which emulate the old dmenu-run functionality, it would be very cool to see the normal behaviour of dmenu: provide a gui to select an item from a list.
This can help people to substitute rofi and wofi to build their scripts. (the latter is wayland prepared but has a very poor efficiency running at 100% CPU for few seconds for long lists).

In particular dmenu (and rofi and wofi) read a list from stdin, a different approach would be to read a json file from stdin such as the configuration file of nwgbar.

nwgdmenu leaves PID file behind.

It certainly doesn't take up too much space, but it's a bit ugly. Is it necessary for the file to live beyond the application? I'm messing around in that code right now, so if you have an idea of what you'd like to do, I can implement it.

Slow start up

Hi! First of all, I like this project. Both nwggrid and nwgbar are useful tools. However, when I launch nwggrid, it takes about 2 seconds to show something on the screen, making a somewhat poor user experience.

Do you experience the same issue? Or perhaps there's something wrong with my configuration?

I'm using Sway on Manjaro.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.