Application drawer for wlroots-based Wayland compositors
Go to file
Piotr Miller 94c94b8b1e
Merge pull request #35 from nwg-piotr/term
support for the foot terminal
2021-11-29 00:47:33 +01:00
bin support foot terminal 2021-11-21 21:45:10 +01:00
desktop-directories basic layout 2021-05-19 04:38:54 +02:00
.gitignore Initial commit 2021-05-19 00:45:41 +02:00
drawer.css default css modified 2021-06-29 17:32:44 +02:00
go.mod watch .desktop & pinned file changes 2021-09-24 03:01:55 +02:00
go.sum watch .desktop & pinned file changes 2021-09-24 03:01:55 +02:00
LICENSE Initial commit 2021-05-19 00:45:41 +02:00
main.go support foot terminal 2021-11-21 21:45:10 +01:00
Makefile wait for binary to be released while installing 2021-09-29 22:41:44 +02:00
README.md update README 2021-09-29 22:02:29 +02:00
tools.go support foot terminal 2021-11-21 21:45:10 +01:00
uicomponents.go remove 1 error message 2021-09-28 02:51:03 +02:00
watcher.go wait for binary to be released while installing 2021-09-29 22:41:44 +02:00
xdgdesktop_parser_test.go remove old parse entry version 2021-08-31 06:33:04 -04:00
xdgdesktop_parser.go remove old parse entry version 2021-08-31 06:33:04 -04:00

nwg-drawer

This application is a part of the nwg-shell project.

Nwg-drawer is a golang replacement to the nwggrid command (a part of nwg-launchers). It's being developed with sway in mind, but should also work with other wlroots-based Wayland compositors. X Window System is not officially supported, but you should be able to use the drawer on some floating window managers (tested on Openbox).

The nwg-drawer command displays the application grid. The search entry allows to look for installed applications, and for files in XDG user directories. The grid view may also be filtered by categories.

You may pin applications by right-clicking them. Pinned items will appear above the application grid. Right-click a pinned item to unpin it. The pinned items cache is shared with nwg-menu and nwggrid.

screenshot-01.png

more screenshots | see on YouTube

Packaging status

v0.2.x note

  1. Placing config files in the nwg-panel config directory was a mistake, sorry. The 0.2.0 version migrates them to ~/.config/nwg-drawer.
  2. From now on you may run the program residently, which should speed it up. See "Running" below.

Installation

Dependencies

  • go >=1.16 (just to build)
  • gtk3
  • gtk-layer-shell
  • xdg-utils

Optional (recommended):

  • thunar
  • alacritty

You may use another file manager and terminal emulator (see command line arguments), but mentioned above have been confirmed to work well with the program. Also see Files below.

Steps

  1. Clone the repository, cd into it.
  2. Install necessary golang libraries with make get.
  3. make build
  4. sudo make install

Building the gotk3 library takes quite a lot of time. If your machine is x86_64, you may skip steps 2-3, and install the provided binary by executing step 4.

Command line arguments

$ nwg-drawer -h
Usage of nwg-drawer:
  -c uint
    	number of Columns (default 6)
  -d	Turn on Debug messages
  -fm string
    	File Manager (default "thunar")
  -fscol uint
    	File Search result COLumns (default 2)
  -fslen int
    	File Search name LENgth Limit (default 80)
  -is int
    	Icon Size (default 64)
  -lang string
    	force lang, e.g. "en", "pl"
  -nocats
    	Disable filtering by category
  -nofs
    	Disable file search
  -o string
    	name of the Output to display the drawer on (sway only)
  -ovl
    	use OVerLay layer
  -r	Leave the program resident in memory
  -s string
    	Styling: css file name (default "drawer.css")
  -spacing uint
    	icon spacing (default 20)
  -term string
    	Terminal emulator (default "alacritty")
  -v	display Version information

NOTE: the $TERM environment variable overrides the -term argument if defined.

Running

Since v0.2.x you may use the drawer in two ways:

  1. Simply run the nwg-drawer command, by adding a key binding to your sway config file, e.g.:
bindsym Mod1+F1 exec nwg-drawer
  1. Run a resident instance on startup, and use the nwg-drawer command to show the window, e.g.:
exec_always nwg-drawer -r
bindsym Mod1+F1 exec nwg-drawer

The second line does nothing but pkill -USR1 nwg-drawer, so you may just use this command instead. Actually this should be a little bit faster.

Running a resident instance should speed up use of the drawer significantly. Pay attention to the fact, that you need to pkill -f nwg-drawer and reload sway to apply any new arguments!

Logging

In case you encounter an issue, you may need debug messages. If you use the resident instance, you'll see nothing in the terminal. Please edit your sway config file:

exec nwg-drawer -r -d 2> ~/drawer.log

exit sway, launch it again and include the drawer.log content in the GitHub issue. Do not use exec_always here: it'll destroy the log file content on sway reload.

Styling

Edit ~/.config/nwg-drawer/drawer.css to your taste.

Files

When the search phrase is at least 3 characters long, your XDG user directories are being searched.

screenshot-03.png

Use the left mouse button to open a file with the xdg-open command. As configuring file associations for it is PITA, you may override them, by creating the ~/.config/nwg-panel/preferred-apps.json file with your own definitions.

Sample preferred-apps.json file content

{
  "\\.pdf$": "atril",
  "\\.svg$": "inkscape",
  "\\.(jpg|png|tiff|gif)$": "feh",
  "\\.(mp3|ogg|flac|wav|wma)$": "audacious",
  "\\.(avi|mp4|mkv|mov|wav)$": "mpv",
  "\\.(doc|docx|xls|xlsx)$": "libreoffice"
}

Use the right mouse button to open the file with your file manager (see -fm argument). The result depends on the file manager you use.

  • thunar will open the file location
  • pcmanfm will open the file with its associated program
  • caja won't open anything, except for directories

I've noy yet tried other file managers.

File search exclusions

You may want to exclude some paths inside your XDG user directories from searching. If so, define exclusions in the ~/.config/nwg-panel/excluded-dirs file, e.g. like this:

# exclude all paths containing 'node_modules'
node_modules

Credits

This program uses some great libraries:

  • gotk3 Copyright (c) 2013-2014 Conformal Systems LLC, Copyright (c) 2015-2018 gotk3 contributors
  • gotk3-layershell by @dlasky - many thanks for writing this software, and for patience with my requests!
  • go-sway Copyright (c) 2019 Joshua Rubin
  • go-singleinstance Copyright (c) 2015 Allan Simon
  • logrus Copyright (c) 2014 Simon Eskildsen
  • fsnotify Copyright (c) 2012-2019 fsnotify Authors