Skip to content

Commit

Permalink
Using my own patched version of dmenu
Browse files Browse the repository at this point in the history
Instead of installing the default package I clone and install my own
version that already has some additional patches.
The main advantage is keeping the installation of dmenu in one place.
  • Loading branch information
marcoplaitano committed Jun 26, 2023
1 parent 9849b54 commit 19afa39
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 63 deletions.
40 changes: 20 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,18 @@ commands/routines just by typing out the command's name.

## Installation

+ Clone or [download] this repository.
+ `cd` into its directory.
+ Launch the `install.sh` script like so:
```shell
./install.sh
```
**Note:** It only works on <u>Ubuntu</u> or <u>Arch</u> based distributions, since it uses either `apt` or `pacman` to install.

```shell
git clone https://github.com/marcoplaitano/evemenu
cd evemenu && ./install.sh
```

What the `install.sh` script does is installing [my own patched version] of
dmenu with all its dependencies.

**Note:** `evemenu` will be in `$HOME/.local/bin`; make sure this is in
`$PATH`.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Expand Down Expand Up @@ -65,17 +71,7 @@ to open a new window/tab of firefox and load the Github website.

## Dependencies

Listed below are all the tools and libs used to download and install **dmenu**.
They are all automatically installed and properly used in the [installation
script].

+ wget
+ tar
+ gcc
+ make
+ libx11-dev
+ libxinerama-dev
+ libxft-dev
The only dependency is dmenu. It is installed via this [script].

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Expand Down Expand Up @@ -107,13 +103,17 @@ https://github.com/marcoplaitano/images/blob/main/evemenu_demo.gif
https://github.com/marcoplaitano/evemenu/archive/refs/heads/master.zip
"Zip download"

[my own patched version]:
https://github.com/marcoplaitano/dmenu
"My dmenu repository"

[file itself]:
evemenu
"Repository file"

[installation script]:
install.sh
"Repository file"
[script]:
https://github.com/marcoplaitano/dmenu/tree/main/install.sh
"dmenu installation script"

[MIT]:
LICENSE
Expand Down
69 changes: 26 additions & 43 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,57 +1,40 @@
#!/bin/env bash

# File: install.sh
# Author: Marco Plaitano https://github.com/marcoplaitano
# Author: Marco Plaitano
# Github: https://github.com/marcoplaitano/evemenu
# Date: 01 Aug 2022
# Brief: Download and install dmenu; make the evemenu script executable.
#
# Copyright (c) 2022 Marco Plaitano
# Copyright (c) 2023 Marco Plaitano


##################################################
# FUNCTIONS #
##################################################


function safe_exit {
[[ $(pwd) == */dmenu-5.0 ]] && popd
[[ -f dmenu.tar.gz ]] && rm dmenu.tar.gz
[[ -d dmenu-5.0/ ]] && rm -r --interactive=never dmenu-5.0/
exit $1
}


# Show error message and stop the execution of the script.
function raise_error {
_die() {
[[ -n $1 ]] && error_msg="ERROR: $1" || error_msg="Error in 'install.sh'."
echo "$error_msg"
safe_exit 1
exit 1
}


##################################################
# MAIN BODY #
##################################################


echo "########## INSTALLING DEPENDENCIES"
sudo apt install -y tar wget gcc make libx11-dev libxinerama-dev libxft-dev
[[ $? -ne 0 ]] && raise_error "Could not install needed dependencies."


echo "########## DOWNLOADING DMENU'S SOURCE CODE"
wget https://dl.suckless.org/tools/dmenu-5.0.tar.gz -O ./dmenu.tar.gz
[[ $? -ne 0 ]] && raise_error "Could not download source code from website."
tar xvfz dmenu.tar.gz > /dev/null
[[ $? -ne 0 ]] && raise_error "Could not extract source code folder."

echo "########## INSTALLING DMENU"
pushd dmenu-5.0 || raise_error "Could not find folder containing source code."
sudo make install
[[ $? -ne 0 ]] && raise_error "Could not install dmenu."

echo "########## ADDING evemenu SCRIPT TO /usr/local/bin"
sudo cp ./evemenu /usr/local/bin && sudo chmod +x /usr/local/bin/evemenu

echo "Installation succeded. Run with the command 'evemenu'."
safe_exit
dmenu_repo="https://github.com/marcoplaitano/dmenu"
dmenu_dir="/tmp/dmenu-dir"
if git clone "$dmenu_repo" "$dmenu_dir" ; then
pushd dmenu &>/dev/null
./install.sh || _die "Could not install dmenu."
popd &>/dev/null
[[ -d "$dmenu_dir" ]] && rm -rf "$dmenu_dir"
else
_die "Could not download dmenu from $dmenu_repo'."
fi

echo "########## INSTALLING EVEMENU"
chmod +x ./evemenu
mkdir -p "$HOME/.local/bin"
cp ./evemenu "$HOME/.local/bin"

if [[ ":$PATH:" == *":$HOME/.local/bin:"* ]]; then
echo "evemenu is installed."
else
echo "WARNING: Add \$HOME/.local/bin to \$PATH to execute evemenu."
fi

0 comments on commit 19afa39

Please sign in to comment.