Skip to content

Commit

Permalink
[docs] Create man-pages.
Browse files Browse the repository at this point in the history
Signed-off-by: Shinyzenith <[email protected]>
  • Loading branch information
Shinyzenith committed Jun 15, 2022
1 parent 5d11291 commit fb991f2
Show file tree
Hide file tree
Showing 17 changed files with 378 additions and 206 deletions.
4 changes: 3 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
charset = utf-8
trim_trailing_whitespace = true
indent_style = tab
indent_size = 4

[Makefile]
indent_style = tab
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ target
bin/swhkd
bin/swhks
*.zip
*.gz
6 changes: 5 additions & 1 deletion docs/INSTALL.md → INSTALL.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# AUR:

`swhkd-git` `swhkd-musl-git` have been packaged. `swhkd-bin` & `swhkd-musl-bin` will be released soon.

# Install
Expand All @@ -15,8 +16,10 @@

**Compile time:**

- rustup
- git
- scdoc
- make
- rustup

# Compiling:

Expand All @@ -28,6 +31,7 @@
- `sudo make install`

# Running:

```
swhks &
pkexec swhkd
Expand Down
14 changes: 13 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ POLKIT_DIR := /usr/share/polkit-1/actions
POLKIT_POLICY_FILE := com.github.swhkd.pkexec.policy
# Remember to edit the TARGET_DIR in policy file too if you do change it.
TARGET_DIR := /usr/bin
MAN1_DIR:= /usr/share/man/man1
MAN5_DIR:= /usr/share/man/man5
VERSION=$(shell awk -F ' = ' '$$1 ~ /version/ { gsub(/["]/, "", $$2); printf("%s",$$2) }' Cargo.toml)

all: build
Expand All @@ -20,8 +22,18 @@ glibc:
@cp ./target/release/$(SERVER_BINARY) ./bin/$(SERVER_BINARY)

install:
@mkdir -p $(TARGET_DIR)
@scdoc < ./$(DAEMON_BINARY).1.scd > $(DAEMON_BINARY).1.gz
@scdoc < ./$(SERVER_BINARY).1.scd > $(SERVER_BINARY).1.gz
@scdoc < ./$(DAEMON_BINARY).5.scd > $(DAEMON_BINARY).5.gz
@scdoc < ./$(DAEMON_BINARY)-keys.5.scd > $(DAEMON_BINARY)-keys.5.gz
@mv $(DAEMON_BINARY).1.gz $(MAN1_DIR)
@mv $(SERVER_BINARY).1.gz $(MAN1_DIR)
@mv $(DAEMON_BINARY).5.gz $(MAN5_DIR)
@mv $(DAEMON_BINARY)-keys.5.gz $(MAN5_DIR)
@mkdir -p $(MAN1_DIR)
@mkdir -p $(MAN5_DIR)
@mkdir -p $(POLKIT_DIR)
@mkdir -p $(TARGET_DIR)
@mkdir -p /etc/$(DAEMON_BINARY)
@touch /etc/$(DAEMON_BINARY)/$(DAEMON_BINARY)rc
@cp ./bin/$(DAEMON_BINARY) $(TARGET_DIR)
Expand Down
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<p align=center>
<img src="https://git.sr.ht/~shinyzenith/swhkd/blob/main/docs/assets/swhkd.png" alt=SWHKD width=60%>
<img src="https://git.sr.ht/~shinyzenith/swhkd/blob/main/assets/swhkd.png" alt=SWHKD width=60%>

<p align=center>A next-generation hotkey daemon for Wayland/X11 written in Rust.</p>

<p align="center">
<a href="./LICENSE.md"><img src="https://img.shields.io/github/license/waycrate/swhkd?style=flat-square&logo=appveyor"></a>
<img src="https://img.shields.io/badge/cargo-v1.1.5-green?style=flat-square&logo=appveyor">
Expand All @@ -24,9 +24,7 @@ Because swhkd can be used anywhere, the same swhkd config can be used across Xor

## Installation:

See [INSTALL.md](./docs/INSTALL.md) for installing swhkd.

Note: `swhks` is not a typo, it is the server process of the program.
[Installation instructions can be found here.](./INSTALL.md)

## Running:

Expand All @@ -53,7 +51,7 @@ If you use Vim, you can get swhkd config syntax highlighting with the
[swhkd-vim](https://github.com/waycrate/swhkd-vim) plugin. Install it in
vim-plug with `Plug 'waycrate/swhkd-vim'`.

All supported key names are listed in the [following file.](https://github.com/waycrate/swhkd/blob/main/docs/KEYS.md)
All supported key and modifier names are listed in `man 5 swhkd-keys`.

## Autostart:

Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
8 changes: 7 additions & 1 deletion contrib/PKGBUILD/glibc/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@ url="https://github.com/waycrate/swhkd"
pkgdesc="A display server independent hotkey daemon inspired by sxhkd."
license=('BSD')
depends=('polkit')
makedepends=('rustup' 'make' 'git')
makedepends=('rustup' 'make' 'git' 'scdoc')
conflicts=('swhkd-musl-git')
source=("$_pkgname::git+https://github.com/waycrate/$_pkgname")
sha256sums=('SKIP')

build(){
cd "$_pkgname"
scdoc < ./swhkd.1.scd > swhkd.1.gz
scdoc < ./swhks.1.scd > swhks.1.gz
scdoc < ./swhkd.5.scd > swhkd.5.gz
scdoc < ./swhkd-keys.5.scd > swhkd-keys.5.gz
make setup
make glibc
}
Expand All @@ -27,6 +31,8 @@ package() {
install -Dm 755 ./bin/swhks "$pkgdir/usr/bin/swhks"

install -Dm 644 -o root ./com.github.swhkd.pkexec.policy -t "$pkgdir/usr/share/polkit-1/actions"
install -Dm 644 ./*.1.gz -t "$pkgdir/usr/share/man/man1/"
install -Dm 644 ./*.5.gz -t "$pkgdir/usr/share/man/man5/"
}

pkgver() {
Expand Down
8 changes: 7 additions & 1 deletion contrib/PKGBUILD/musl_libc/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ pkgdesc="A display server independent hotkey daemon inspired by sxhkd."
license=('BSD')
conflicts=('swhkd-glib-git')
depends=('polkit')
makedepends=('rustup' 'make' 'git')
makedepends=('rustup' 'make' 'git' 'scdoc')
source=("$_pkgname::git+https://github.com/waycrate/$_pkgname")
sha256sums=('SKIP')

build(){
cd "$_pkgname"
scdoc < ./swhkd.1.scd > swhkd.1.gz
scdoc < ./swhks.1.scd > swhks.1.gz
scdoc < ./swhkd.5.scd > swhkd.5.gz
scdoc < ./swhkd-keys.5.scd > swhkd-keys.5.gz
make setup
make
}
Expand All @@ -27,6 +31,8 @@ package() {
install -Dm 755 ./bin/swhks "$pkgdir/usr/bin/swhks"

install -Dm 644 -o root ./com.github.swhkd.pkexec.policy -t "$pkgdir/usr/share/polkit-1/actions"
install -Dm 644 ./*.1.gz -t "$pkgdir/usr/share/man/man1/"
install -Dm 644 ./*.5.gz -t "$pkgdir/usr/share/man/man5/"
}

pkgver() {
Expand Down
152 changes: 0 additions & 152 deletions docs/KEYS.md

This file was deleted.

42 changes: 0 additions & 42 deletions docs/swhkdrc

This file was deleted.

2 changes: 2 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ impl Value for &Hotkey {
}

pub fn parse_contents(path: PathBuf, contents: String) -> Result<Vec<Hotkey>, Error> {
// Don't forget to update valid key list on the man page if you do change this list.
let key_to_evdev_key: HashMap<&str, evdev::Key> = HashMap::from([
("q", evdev::Key::KEY_Q),
("w", evdev::Key::KEY_W),
Expand Down Expand Up @@ -399,6 +400,7 @@ pub fn parse_contents(path: PathBuf, contents: String) -> Result<Vec<Hotkey>, Er
("f24", evdev::Key::KEY_F24),
]);

// Don't forget to update modifier list on the man page if you do change this list.
let mod_to_mod_enum: HashMap<&str, Modifier> = HashMap::from([
("ctrl", Modifier::Control),
("control", Modifier::Control),
Expand Down
Loading

0 comments on commit fb991f2

Please sign in to comment.