spmenu-wiki/pages/Getting Started.md

220 lines
11 KiB
Markdown
Raw Normal View History

2023-01-26 19:42:40 +01:00
Getting Started
---------------
2023-06-04 22:13:20 +02:00
spmenu is a simple X11 and Wayland menu application which takes standard input, parses
it, lets the user choose an option and sends the selected option to standard output.
2023-04-24 19:33:59 +02:00
2023-05-21 22:16:45 +02:00
In addition to this, it also serves as a run launcher through the included
shell script `spmenu_run`, which handles both $PATH listing, .desktop entries
and file listing.
2023-04-24 19:33:59 +02:00
2023-05-21 22:16:45 +02:00
While spmenu is based on dmenu, and is also fully compatible with dmenu,
spmenu introduces many new features which can be useful in shell scripting.
2023-06-04 22:13:20 +02:00
It also serves as a dmenu replacement for Wayland users.
2023-01-26 19:42:40 +01:00
### Supported operating systems
This is not some arbitrary requirement. While it may run if it's not listed
here, I will not be providing support due to having a lack of experience with
2023-05-21 22:16:45 +02:00
said operating system. The main operating system that doesn't support
spmenu is Microsoft Windows. UNIX like operating systems are most likely to run
it. macOS has some different steps.
2023-01-26 19:42:40 +01:00
- Nearly all GNU/Linux distributions
2023-05-21 22:16:45 +02:00
- NixOS and GNU Guix *may* require separate instructions, particularly
when building. I will not provide support for these as of now,
use the existing documentation to set it up.
Chances are if you use one of these you already know how to compile
software for it.
2023-01-26 19:42:40 +01:00
- FreeBSD, OpenBSD, NetBSD
- There are likely more BSDs that can run speedwm, but I cannot support all
2023-05-21 22:16:45 +02:00
of them. Try it and see if it works. If it doesn't please try and fix it.
You know more about the BSDs than I do.
2023-04-24 19:33:59 +02:00
- macOS/Mac OS X
2023-05-21 22:16:45 +02:00
- macOS *should* be supported, however it requires `Xquartz` to be installed
on the system. See [[Using spmenu on macOS]] for more information.
2023-06-04 22:13:20 +02:00
- As far as I know, there is no Wayland display server for macOS, so
Wayland support will need to be disabled.
2023-01-26 19:42:40 +01:00
### Installation on Gentoo GNU/Linux
2023-05-21 22:16:45 +02:00
**NOTE: The Gentoo overlay is as of now quite outdated and the spmenu-9999
ebuild is not functional. The latest stable (and functional) version available
is 0.3.2. Gentoo users are recommended to follow 'Installation on generic
GNU/Linux distributions'.**
2023-04-24 19:33:59 +02:00
Gentoo has slightly different instructions for setting up spmenu. While you
2023-01-26 19:42:40 +01:00
can follow along with the generic installation instructions, I have a Gentoo
2023-04-24 19:33:59 +02:00
overlay with packages for most if not all spmenu versions.
2023-01-26 19:42:40 +01:00
2023-06-03 06:09:30 +02:00
To get started, add [my overlay](https://git.speedie.site/speedie/speedie-overlay).
2023-05-21 22:16:45 +02:00
Then simply `emerge x11-misc/spmenu`.
2023-01-26 19:42:40 +01:00
2023-04-24 19:33:59 +02:00
If you want to install spmenu using Git, do this by adding the following
2023-01-26 19:42:40 +01:00
lines:
2023-04-24 19:33:59 +02:00
`=x11-misc/spmenu-9999 **`
2023-01-26 19:42:40 +01:00
to `/etc/portage/package.accept_keywords` and then emerging the packages as
per the instructions above.
### Installation on generic GNU/Linux distributions
2023-04-24 19:33:59 +02:00
Installing spmenu on most GNU/Linux distributions is very simple. First,
2023-01-26 19:42:40 +01:00
determine if you want to install it using Git (the absolute latest version) or
using a stable tarball.
2023-05-21 22:16:45 +02:00
While using a tarball can sometimes be more stable, it's not going to have any
bug fixes or features I'm adding. With Git, issues can be fixed rather often.
For this reason, it is recommended that you `git clone` the repository. If you
do not have `git`, install it using your distribution's package manager. If
you're going to be using a 'stable' tarball, you do not need to install `git`.
2023-01-26 19:42:40 +01:00
2023-04-24 19:33:59 +02:00
While the list of dependencies will vary depending on the spmenu version
you're going to install (see README.md for your specific version),
2023-05-21 22:16:45 +02:00
below is a list for the latest release.
2023-01-26 19:42:40 +01:00
2023-06-04 22:13:20 +02:00
- wayland-client
- For Wayland support, which is optional.
- wayland-scanner
- For Wayland support, which is optional.
- wayland-protocols
- For Wayland support, which is optional.
- xkbcommon
- For Wayland support, which is optional.
2023-04-24 19:33:59 +02:00
- libX11
2023-06-04 22:13:20 +02:00
- For X11 support
2023-05-21 22:16:45 +02:00
- If you're using macOS, XQuartz is a dependency instead.
- If you're using Wayland, `xorg-xwayland` is a dependency.
2023-04-24 19:33:59 +02:00
- libXrender
2023-01-26 19:42:40 +01:00
- imlib2
2023-05-21 22:16:45 +02:00
- Used for image support, can be disabled during compile time.
2023-04-24 19:33:59 +02:00
- libXinerama
2023-05-21 22:16:45 +02:00
- Used for multi-monitor support, can be disabled during compile time.
2023-04-24 19:33:59 +02:00
- OpenSSL
- Used to calculate MD5 of images if image support is enabled, can be
2023-05-21 22:16:45 +02:00
disabled during compile time.
2023-04-24 19:33:59 +02:00
- Pango
2023-05-21 22:16:45 +02:00
- Cairo
2023-04-24 19:33:59 +02:00
- libconfig
2023-05-21 22:16:45 +02:00
- Can be disabled if you don't want/need config file support during compile time.
- meson
- Used to compile spmenu, not optional unless you're experienced with build systems.
2023-01-26 19:42:40 +01:00
#### Installation using `git`
This assumes you have `git` installed.
`cd` into a location where your normal user (not root) has permission to both
2023-05-21 22:16:45 +02:00
read and write. Do not clone the spmenu repository in `~/.config` as spmenu
2023-01-26 19:42:40 +01:00
will write configuration files to that location.
2023-04-24 19:33:59 +02:00
From here on, we're going to assume you are in the location `~/Documents`. Run
2023-06-03 06:09:30 +02:00
`git clone https://git.speedie.site/speedie/spmenu spmenu` to clone the
2023-04-24 19:33:59 +02:00
repository into a directory named `spmenu`. Provided the repository hasn't
2023-01-26 19:42:40 +01:00
moved and you have a working internet connection, you should have received a
2023-04-24 19:33:59 +02:00
copy of the spmenu source code.
2023-01-26 19:42:40 +01:00
2023-04-24 19:33:59 +02:00
You can now `cd spmenu` into it so we can actually install it. If you need to
make changes to the source code for whatever reason, now you want to do that.
2023-01-26 19:42:40 +01:00
Now, it's time to compile it! Provided you have all dependencies installed,
2023-05-21 22:16:45 +02:00
this should be very, very easy and quick.
Configure the build by running these commands:
`mkdir -p build/ # Create a build/ directory, Meson will use this as the working
directory`
`meson setup build # This will check to make sure all dependencies are found.
If you're recompiling you may want to pass --reconfigure as an argument`
This is where you can enable/disable certain features, as well as set
compiler options.
Now, to build it run `ninja -C build`. If all went well you should have a
binary in the `build/` directory.
Finally, to install it all, run:
`meson install -C build --prefix /usr # /usr may be overriden to /usr/local
or anything else if you use macOS or simply want another destination directory`
To generate documentation, which may be necessary if you're pushing new changes
to your Git repository, run `scripts/make/generate-docs.sh` **in the current
directory**.
To generate a tarball, run `scripts/make/generate-pkg.sh` **in the current
directory**. If you want to generate a Pacman package, run
`scripts/make/generate-pacman-pkg.sh` instead. You can run `pacman -U` on this
if you wish later on.
2023-01-26 19:42:40 +01:00
2023-04-24 19:33:59 +02:00
Now follow along with 'Using spmenu'.
2023-01-26 19:42:40 +01:00
#### Installation using a tarball
Installation using a tarball works pretty much the same. Visit [the releases
2023-04-24 19:33:59 +02:00
page](https://ls.speedie.site/index.php?b=releases%2Fspmenu) and get the latest
(or an old if you want) tarball.
2023-01-26 19:42:40 +01:00
`cd` into a location where your normal user (not root) has permission to both
2023-04-24 19:33:59 +02:00
read and write.
2023-01-26 19:42:40 +01:00
Now we need to unpack the tarball and get our source code. To do this, you can
use the `tar` command. I will spare you the time reading the man page and the
command to unpack the tarball is `tar -xpvf
2023-04-24 19:33:59 +02:00
/path/to/the/spmenu/tarball.tar.gz`. The `-x` argument here means extract.
2023-01-26 19:42:40 +01:00
`-p` means preserve permissions. The `-v` means verbose, we want to see
what's going on. `-f` means file, we want to specify a file to unpack.
2023-04-24 19:33:59 +02:00
After unpacking it, there should be one directory; `spmenu-<version>`. Let's
`cd spmenu-<version>` into it. Now it's time to compile spmenu!
Now, it's time to compile it! Provided you have all dependencies installed,
2023-05-21 22:16:45 +02:00
this should be very, very easy and quick.
Configure the build by running these commands:
`mkdir -p build/ # Create a build/ directory, Meson will use this as the working
directory`
`meson setup build # This will check to make sure all dependencies are found.
If you're recompiling you may want to pass --reconfigure as an argument`
This is where you can enable/disable certain features, as well as set
compiler options.
Now, to build it run `ninja -C build`. If all went well you should have a
binary in the `build/` directory.
Finally, to install it all, run:
`meson install -C build --prefix /usr # /usr may be overriden to /usr/local
or anything else if you use macOS or simply want another destination directory`
To generate documentation, which may be necessary if you're pushing new changes
to your Git repository, run `scripts/make/generate-docs.sh` **in the current
directory**.
To generate a tarball, run `scripts/make/generate-pkg.sh` **in the current
directory**. If you want to generate a Pacman package, run
`scripts/make/generate-pacman-pkg.sh` instead. You can run `pacman -U` on this
if you wish later on.
2023-04-24 19:33:59 +02:00
Now follow along with 'Using spmenu'.
### Using spmenu
spmenu accepts standard input. All of spmenu's features **require** standard input to be passed. If you only want to return the input text, you can simply pass nothing to spmenu and a blank menu will open up. The `spmenu_run` script bundled with spmenu which works as a run launcher uses this fact to list out all available executables which are then run. See the article [[Using spmenu as a run launcher]] for more information, this article **only** focuses on spmenu itself.
2023-01-26 19:42:40 +01:00
2023-04-24 19:33:59 +02:00
For example, `printf "Apple\nBanana\nOrange\n" | spmenu` will bring up a basic menu listing with three options, Apple, Banana and Orange. The one the user selects will be returned when (by default) Enter is pressed. You can also press Shift+Enter to select what you have typed in rather than the selected match.
2023-01-26 19:42:40 +01:00
2023-05-21 22:16:45 +02:00
spmenu also has a lot of arguments you can give. `spmenu --help` or if you prefer, `spmenu -h` will return a full list of available arguments. This is not the *only* way to configure spmenu, however it's useful when you want a setting to be applied only to the current instance. Most options are configurable through arguments, but not all of them are.
2023-01-26 19:42:40 +01:00
2023-04-24 19:33:59 +02:00
spmenu also has a config file through libconfig. A default config should be installed at `/usr/share/spmenu/spmenu.conf`. You can copy this to `~/.config/spmenu/spmenu.conf`. You may edit this file using your favorite text editor. Note that .Xresources takes priority over spmenu.conf configuration, as long as `xresources = 1`. You can find a list of accepted .Xresources values in `/usr/share/spmenu/example.Xresources`, and this file should more or less be identical to the defaults. For more information regarding the configuration file, see [[Configuring spmenu]].
2023-01-26 19:42:40 +01:00
2023-05-09 19:37:40 +02:00
Great, you should now know how spmenu works on a basic level. Now, if you are a tiling window manager user or just want a better run launcher, you can check out the article 'Using spmenu as a run launcher'. Alternatively, if you want to use this for scripting you can check out [[Scripting with spmenu]]. There are also many scripts that use spmenu to display items, see [[User scripts]] for that.
2023-01-26 19:42:40 +01:00
2023-06-04 22:13:20 +02:00
If you want to theme spmenu, you can see [[User themes]]. If you want some scripts to go along with spmenu, see [[User scripts]].