Skip to content

Commit

Permalink
Readme and makefiles updates
Browse files Browse the repository at this point in the history
  • Loading branch information
5iddy committed Apr 10, 2023
1 parent b591019 commit c204eb0
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 13 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ build:
cargo build --profile release --package ${PROJECT_NAME}

install:
cargo install --profile release --bin ${PROJECT_NAME} --path .
cargo install --profile release --bin ${PROJECT_NAME} --path .

install-local: build
cp target/release/monitorctl ~/.local/bin
73 changes: 61 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,85 @@
# monitorctl

A way to control monitor brightness through the command line. You can change the brightness of all monitors simultaneously.

## Features
- [X] Change brightness of all monitors
- [X] Add multi-threading for perfomance boost
- [X] Use the `ddc-i2c` crate for perfomance improvement
- [X] Increase/Decrease from the current value using `-i` and `-d` flags
- [X] Change Contrast of all monitors
- [X] Change Volume of all monitors

- [x] Change brightness of all monitors
- [x] Add multi-threading for perfomance boost
- [x] Use the `ddc-i2c` crate for perfomance improvement
- [x] Increase/Decrease from the current value using `-i` and `-d` flags
- [x] Change Contrast of all monitors
- [x] Change Volume of all monitors
- [ ] Add the ability to change the brightness of a laptop screen.

## Installation

Install the dependencies first and then build and install the binary into PATH.

### Dependencies

1. DDC/CI feature need to be turned on in the monitors.
2. `i2c-dev` kernel module should be loaded during boot.
3. Add `~/.cargo/bin` to `$PATH` Environment variable.
Add `export PATH=$PATH:$HOME/.cargo/bin` to `~/.bash_profile` or `~/.zprofile`
Add `export PATH=$PATH:$HOME/.cargo/bin` to `~/.bash_profile` or `~/.zprofile`
4. Rust Toolchain and git

###
### To preload with modprobe

Add the following line to `/etc/modules-load.d/i2c-dev.conf`

```
i2c-dev
```

or run the following command

```sh
sudo echo "i2c-dev" > /etc/modules-load.d/i2c-dev.conf
```

### To preload `i2c-dev` in ArchLinux with mkinitcpio

### To preload `i2c-dev` in ArchLinux
1. Open `/etc/mkinitcpio` with the following command: `sudo vim /etc/mkinitcpio.conf`
2. Add `i2c-dev` to `MODULES` -> (`MODULES=(... i2c-dev)`)
3. Finally, run `sudo mkinitcpio -P` to generate linux kernel binaries
4. Reboot your computer.

>If the MODULES is empty in `/etc/mkinitcpio.conf` then, `MODULES=(i2c-dev)` should be enough.
> If the MODULES is empty in `/etc/mkinitcpio.conf` then, `MODULES=(i2c-dev)` should be enough.
> ... represents other modules that are present
### Build and Install

1. Clone this repo. `git clone https://github.com/5iddy/monitorctl.git`
2. Change directory to the repo. `cd monitorctl`
3. Run `make install`

### Add cargo folder to the $PATH

You need to make sure that the binary is located in a folder that is part of the $PATH environment variable.

You can either run `make install-local` which will copy the binary to `~/.local/bin`
or you can build the project first with `make build` or `cargo build --release` and
copy `target/release/monitorctl` to a directory that's in the path.

If you have used `make install` or `cargo install --profile release --bin monitorctl --path .`,
you should make sure to add the following line in `~/.bash_profile` or `~/.zprofile`

```
export $PATH=$PATH:~/.cargo/bin/
```

### Running without sudo

If you want to bind the commands to keyboard shortcuts. You user must be a member of the i2c group.
In order to add yourself to the `i2c` group:

```sh
sudo usermod -aG i2c <your-username>
```

## Usage

```
A command line tool to control monitor settings.
You can Increase/Decrease/Get/Set all connected monitors'
Expand Down Expand Up @@ -67,7 +110,9 @@ Commands:
Options:
-h, --help Print help
```

### brightness help

```
Change Brightness
Expand All @@ -83,7 +128,9 @@ Options:
-h, --help Print help
-V, --version Print version
```

### Contrast help

```
Change Contrast
Expand All @@ -99,7 +146,9 @@ Options:
-h, --help Print help
-V, --version Print version
```

### Volume help

```
Change Volume
Expand All @@ -116,4 +165,4 @@ Options:
-V, --version Print version
```

Note: Volume sub command doesnt change pulseaudio or local volume, it changes the volume of the inbuilt monitor speaker which would have been otherwise set in panel menu.
Note: Volume sub command doesnt change pulseaudio or local volume, it changes the volume of the inbuilt monitor speaker which would have been otherwise set in panel menu.

0 comments on commit c204eb0

Please sign in to comment.