Skip to content

Commit

Permalink
improv misc
Browse files Browse the repository at this point in the history
  • Loading branch information
wiiznokes committed Jan 8, 2025
1 parent 2aa49a3 commit b54aa15
Show file tree
Hide file tree
Showing 12 changed files with 169 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .github/ISSUE_TEMPLATE/blank_issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
name: Blank Issue (do not use this for bug reports or feature requests)
about: Create an issue with a blank template
---
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: Bug Report
about: Report a correctness issue or violated expectation
labels: bug
---

#### Bug Description

#### Expected Result

#### Steps to Reproduce

#### Additional Information

#### Logs
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: true
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
name: Feature Request
about: Request a feature
labels: enhancement
---
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"

# - package-ecosystem: cargo
# directory: .
# schedule:
# interval: monthly
68 changes: 68 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: CI

on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

paths-ignore:
- "**.md"

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always

jobs:
build:
name: Rust tests on ${{ matrix.os }}
if: github.event.pull_request.draft == false
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- run: rustup update
- uses: Swatinem/rust-cache@v2

- name: install system deps
run: sudo apt install libxkbcommon-dev

- name: Run tests
run: cargo test --workspace --all-features

clippy:
name: Clippy on ${{ matrix.os }}
if: github.event.pull_request.draft == false
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- run: rustup update
- uses: Swatinem/rust-cache@v2

- name: install system deps
run: sudo apt install libxkbcommon-dev

- name: Run clippy
run: cargo clippy --workspace --all-features

fmt:
name: Rustfmt
if: github.event.pull_request.draft == false
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update

- name: Run rustfmt
run: cargo fmt --all --check --verbose
18 changes: 18 additions & 0 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Prettier

on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

jobs:
prettier:
name: Prettier fmt
if: github.event.pull_request.draft == false
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Prettier
run: npx prettier --check .
26 changes: 24 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,33 @@ Change brightness of external monitors via DDC/CI protocol. You can also quickly

![Screenshot](res/screenshot1.png)

## Setup
## Install

### Fedora

You can use this [copr](https://copr.fedorainfracloud.org/coprs/wiiznokes/cosmic-applets-unofficial/).

```sh
sudo dnf copr enable wiiznokes/cosmic-applets-unofficial
sudo dnf install cosmic-ext-applet-external-monitor-brightness
```

### Other distros

```sh
sudo apt install just cargo libxkbcommon-dev git-lfs
git clone https://github.com/cosmic-utils/cosmic-ext-applet-external-monitor-brightness.git
cd cosmic-ext-applet-external-monitor-brightness
just build-release
sudo just install
```

## Troubleshooting

Maybe you need to setup the necessary udev rules if ddcutil is old.
For this to work you need write access to `/dev/i2c-*`.
See [https://www.ddcutil.com/i2c_permissions/](https://www.ddcutil.com/i2c_permissions/).

## Credits

Originally created by [@maciekk64][https://github.com/maciekk64]
Originally created by [@maciekk64](https://github.com/maciekk64)
21 changes: 20 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,23 @@ uninstall:
rm {{bin-dst}}

clean:
cargo clean
cargo clean

################### Test / Format


pull: fmt prettier fix test

test:
cargo test --workspace --all-features

fix:
cargo clippy --workspace --all-features --fix --allow-dirty --allow-staged

fmt:
cargo fmt --all

prettier:
# install on Debian: sudo snap install node --classic
# npx is the command to run npm package, node is the runtime
npx prettier -w .
File renamed without changes.
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use crate::app::Window;
use crate::localize::localize;
use crate::window::Window;

#[macro_use]
extern crate tracing;

mod app;
mod localize;
mod monitor;
mod window;

fn setup_logs() {
use tracing_subscriber::{fmt, layer::SubscriberExt, util::SubscriberInitExt, EnvFilter};
Expand Down
2 changes: 1 addition & 1 deletion src/monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use cosmic::iced::{
use ddc_hi::{Ddc, Display};
use tokio::sync::watch::Receiver;

use crate::window::Message;
use crate::app::Message;

const BRIGHTNESS_CODE: u8 = 0x10;

Expand Down

0 comments on commit b54aa15

Please sign in to comment.