-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from risoflora/v1.1
Implementing v1.1 with macOS support (fix #1)
- Loading branch information
Showing
12 changed files
with
344 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 2 | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
###################################################################### | ||
# Copyright (c) 2022 Silvio Clecio (silvioprog) <silvioprog@gmail.com> | ||
# | ||
# SPDX-License-Identifier: MIT | ||
###################################################################### | ||
|
||
name: CI/CD | ||
|
||
on: [push, pull_request] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
build: | ||
name: ${{ matrix.job.target }} | ||
runs-on: ${{ matrix.job.os }} | ||
|
||
strategy: | ||
matrix: | ||
job: | ||
- target: x86_64-unknown-linux-gnu | ||
os: ubuntu-22.04 | ||
test: false | ||
publish: true | ||
|
||
- target: x86_64-apple-darwin | ||
test: false | ||
os: macos-11 | ||
|
||
- target: aarch64-apple-darwin | ||
os: macos-11 | ||
|
||
- target: x86_64-pc-windows-msvc | ||
test: false | ||
os: windows-2022 | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
target: ${{ matrix.job.target }} | ||
|
||
- name: Cargo build | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: build | ||
args: --release --target ${{ matrix.job.target }} | ||
|
||
- name: Cargo test | ||
if: matrix.job.test | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: test | ||
args: --target ${{ matrix.job.target }} | ||
|
||
- name: Cargo publish | ||
if: startsWith(github.ref, 'refs/tags/') && matrix.job.publish | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: publish | ||
args: --token ${{ secrets.CARGO_TOKEN }} -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
[package] | ||
name = 'lock_keys' | ||
version = '1.0.0' | ||
version = '1.1.0' | ||
authors = ['Silvio Clecio (silvioprog) <silvioprog@gmail.com>'] | ||
license = 'MIT/Apache-2.0' | ||
description = 'Rust library for lock keys handling.' | ||
homepage = 'https://github.com/risoflora/lock_keys' | ||
repository = 'https://github.com/risoflora/lock_keys' | ||
readme = 'README.md' | ||
keywords = [ | ||
'capslock', | ||
'numlock', | ||
'numlockx', | ||
'scrolllock', | ||
] | ||
keywords = ['capslock', 'numlock', 'numlockx', 'scrolllock'] | ||
categories = [ | ||
'api-bindings', | ||
'hardware-support', | ||
'os::macos-apis', | ||
'os::unix-apis', | ||
'os::windows-apis', | ||
'api-bindings', | ||
'hardware-support', | ||
'os::macos-apis', | ||
'os::unix-apis', | ||
'os::windows-apis', | ||
] | ||
edition = '2021' | ||
|
||
[dependencies] | ||
[target."cfg(windows)".dependencies.winapi] | ||
version = '0.3' | ||
features = ['winuser'] | ||
[target.'cfg(target_os = "macos")'.dependencies] | ||
core-foundation = '0.9' | ||
mach = '0.3' | ||
io-kit-sys = '0.2' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,54 @@ | ||
# `lock_keys` | ||
|
||
[![Build Status][travis-badge]][travis-url] | ||
[![CI/CD][ci-cd-badge]][ci-cd-url] | ||
[![Crates.io][crates-badge]][crates-url] | ||
[![Documentation][docs-badge]][docs-url] | ||
[![License][license-badge]][license-url] | ||
|
||
[travis-badge]: https://travis-ci.org/risoflora/lock_keys.svg | ||
[travis-url]: https://travis-ci.org/risoflora/lock_keys | ||
[crates-badge]: https://img.shields.io/crates/v/lock_keys.svg | ||
[crates-url]: https://crates.io/crates/lock_keys | ||
[docs-badge]: https://docs.rs/lock_keys/badge.svg | ||
[docs-url]: https://docs.rs/lock_keys | ||
[license-badge]: https://img.shields.io/crates/l/lock_keys.svg | ||
[license-url]: https://github.com/risoflora/lock_keys#license | ||
|
||
`lock_keys` provides a cross platform way for lock keys handling. | ||
|
||
Supported platforms: Linux ([Xlib](https://en.wikipedia.org/wiki/Xlib) static) and Windows ([winuser API](https://docs.microsoft.com/en-us/windows/win32/api/winuser)). | ||
|
||
## Example | ||
|
||
The example below shows how to turn on the Number Lock key: | ||
|
||
```rust | ||
extern crate lock_keys; | ||
|
||
use lock_keys::*; | ||
|
||
fn main() { | ||
let lockkey = LockKey::new(); | ||
lockkey.enable(LockKeys::NumberLock).unwrap(); | ||
} | ||
``` | ||
Supported platforms: Linux ([Xlib][xlib-wiki-url] static), | ||
Windows ([winuser API][winuser-api-url]) and macOS ([IOKit][iokit-url]). | ||
|
||
## Usage | ||
|
||
Add this to your `Cargo.toml`: | ||
|
||
```ini | ||
[dependencies] | ||
lock_keys = "1.0.0" | ||
lock_keys = "*" | ||
``` | ||
|
||
and this to your crate root: | ||
and then: | ||
|
||
```rust | ||
extern crate lock_keys; | ||
use lock_keys::*; | ||
|
||
fn main() { | ||
let lock_key = LockKey::new(); | ||
lock_key.enable(LockKeys::CapitalLock).unwrap(); | ||
} | ||
``` | ||
|
||
## Contributions | ||
|
||
Pull Requests and Issues are welcome! | ||
Pull Requests are welcome! =) | ||
|
||
## License | ||
|
||
`lock_keys` is licensed under either of the following, at your option: | ||
|
||
- Apache License 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) | ||
- MIT License ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) | ||
- [Apache License 2.0](LICENSE-APACHE) | ||
- [MIT License](LICENSE-MIT) | ||
|
||
[ci-cd-badge]: https://github.com/risoflora/lock_keys/actions/workflows/CI.yml/badge.svg | ||
[ci-cd-url]: https://github.com/risoflora/lock_keys/actions/workflows/CI.yml | ||
[crates-badge]: https://img.shields.io/crates/v/lock_keys.svg | ||
[crates-url]: https://crates.io/crates/lock_keys | ||
[docs-badge]: https://docs.rs/lock_keys/badge.svg | ||
[docs-url]: https://docs.rs/lock_keys | ||
[license-badge]: https://img.shields.io/crates/l/lock_keys.svg | ||
[license-url]: https://github.com/risoflora/lock_keys#license | ||
[xlib-wiki-url]: https://en.wikipedia.org/wiki/Xlib | ||
[winuser-api-url]: https://docs.microsoft.com/en-us/windows/win32/api/winuser | ||
[iokit-url]: https://developer.apple.com/documentation/iokit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//! How to toggle the state of the Capital Lock key. | ||
use lock_keys::*; | ||
|
||
fn main() { | ||
let lock_key = LockKey::new(); | ||
lock_key.toggle(LockKeys::CapitalLock).unwrap(); | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.