From 2f7ba17fbf451689f6a661b63e09749065145d7b Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Sun, 14 Aug 2022 13:40:17 -0600 Subject: [PATCH] Update readme --- Makefile | 58 -------------------------------------- README.md | 84 +++++++++++++++++++++++++++++++++++++------------------ 2 files changed, 57 insertions(+), 85 deletions(-) delete mode 100644 Makefile diff --git a/Makefile b/Makefile deleted file mode 100644 index 8a9908e..0000000 --- a/Makefile +++ /dev/null @@ -1,58 +0,0 @@ -DAEMON_BINARY := sohkd -SERVER_BINARY := sohks -CONTROL_BINARY := sohkctl -MODE_CHANGE_BINARY := sohkmc -BUILDFLAGS := --release -UDEV_DIR := /etc/udev/rules.d/ -UDEV_RULE := sohkd.rules -TARGET_DIR := /usr/bin - -all: build - -build: - @cargo build $(BUILDFLAGS) --target=x86_64-unknown-linux-musl - @cp ./target/x86_64-unknown-linux-musl/release/$(DAEMON_BINARY) ./bin/$(DAEMON_BINARY) - @cp ./target/x86_64-unknown-linux-musl/release/$(SERVER_BINARY) ./bin/$(SERVER_BINARY) - -glibc: - @cargo build $(BUILDFLAGS) - @cp ./target/release/$(DAEMON_BINARY) ./bin/$(DAEMON_BINARY) - @cp ./target/release/$(SERVER_BINARY) ./bin/$(SERVER_BINARY) - @cp ./target/release/$(CONTROL_BINARY) ./bin/$(CONTROL_BINARY) - -install: - @mkdir -p $(TARGET_DIR) - @mkdir -p $(UDEV_DIR) - @mkdir -p /etc/$(DAEMON_BINARY) - @touch /etc/$(DAEMON_BINARY)/$(DAEMON_BINARY)rc - @cp ./bin/$(DAEMON_BINARY) $(TARGET_DIR) - @cp ./bin/$(SERVER_BINARY) $(TARGET_DIR) - @cp ./bin/$(CONTROL_BINARY) $(TARGET_DIR) - @cp ./bin/$(CHANGE_MODE_BINARY) $(TARGET_DIR) - @cp ./$(UDEV_RULE) $(UDEV_DIR)/$(UDEV_RULE) - @chmod +x $(TARGET_DIR)/$(DAEMON_BINARY) - @chmod +x $(TARGET_DIR)/$(SERVER_BINARY) - @chmod +x $(TARGET_DIR)/$(CONTROL_BINARY) - @chmod +x $(TARGET_DIR)/$(CHANGE_MODE_BINARY) - -uninstall: - @rm $(TARGET_DIR)/$(SERVER_BINARY) - @rm $(TARGET_DIR)/$(DAEMON_BINARY) - @rm $(TARGET_DIR)/$(CONTROL_BINARY) - @rm $(TARGET_DIR)/$(CHANGE_MODE_BINARY) - @rm $(UDEV_DIR)/$(UDEV_RULE) - -check: - @cargo fmt - @cargo check --target=x86_64-unknown-linux-musl - -clean: - @cargo clean - -setup: - @mkdir -p ./bin - @rustup install stable - @rustup default stable - @rustup target add x86_64-unknown-linux-musl - -.PHONY: check clean setup all install build glibc diff --git a/README.md b/README.md index f0577ad..28cb18e 100644 --- a/README.md +++ b/README.md @@ -1,48 +1,78 @@ -# SOHKD +

+ SWHKD -**S**imple **O**dilia **H**ot**K**ey **D**aemon +

A next-generation hotkey daemon for Wayland/X11 written in Rust.

-*A next-generation hotkey daemon for Wayland/X11 written in Rust.* +

+ + + + + +

+

-sohkd is a display protocol-independent hotkey daemon made in Rust (based off the original, [swhkd](https://waycrate.github.io/swhkd/)). sohkd uses an easy-to-use configuration system inspired by swhkd so you can easily add or remove hotkeys, and it integrates with the [Odilia screen reader](https://odilia.app) to provide modal access to key bindings. +## SWHKD: -Because sohkd can be used anywhere, the same sohkd config can be used across Xorg or Wayland desktops, and you can even use sohkd in a tty. +**S**imple **W**ayland **H**ot**K**ey **D**aemon -**Note: The project is a WIP.** +swhkd is a display protocol-independent hotkey daemon made in Rust. swhkd uses an easy-to-use configuration system inspired by sxhkd so you can easily add or remove hotkeys. -**BUT!! It does work right now [Example config file](./docs/sohkdrc).** +It also attempts to be a drop-in replacement for sxhkd, meaning your sxhkd config file is also compatible with swhkd. -## Installation +Because swhkd can be used anywhere, the same swhkd config can be used across Xorg or Wayland desktops, and you can even use swhkd in a tty. -See [INSTALL.md](./docs/INSTALL.md) for installing sohkd. +## Installation and Building: + +[Installation and building instructions can be found here.](./INSTALL.md) ## Running: -```bash -sohks & -sohkd -``` -To refresh the config at runtime, make a script like so: ```bash -#!/bin/sh -killall sohkd -sohkd +swhks & +pkexec swhkd ``` -Mark it as executable using `chmod +x `. +## Runtime signals: -Then call it using `setsid -f `. +After opening swhkd, you can control the program through signals: -A better implementation using signals will be developed later. +- `sudo pkill -USR1 swhkd` - Pause key checking +- `sudo pkill -USR2 swhkd` - Resume key checking +- `sudo pkill -HUP swhkd` - Reload config file -## Contributors: +## Configuration: + +Swhkd closely follows sxhkd syntax, so most existing sxhkd configs should be functional with swhkd. + +The default configuration file is in `/etc/swhkd/swhkdrc`. If you don't like having to edit the file as root every single time, you can create a symlink from `~/.config/swhkd/swhkdrc` to `/etc/swhkd/swhkdrc`. + +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 and modifier names are listed in `man 5 swhkd-keys`. -Original developers: +## Autostart: -* Shinyzenith `` -* Angelo Fallaria `` -* EdenQwQ `` +### To autostart swhkd you can do one of two things: -Adapters: +1. Add the commands from the ["Running" section](https://github.com/waycrate/swhkd#running) to your window managers configuration file. +1. Enable the [service file](https://github.com/waycrate/swhkd/tree/main/contrib/init) for your respective init system. Currently only systemd and OpenRC service files exist and more will be added soon including Runit. + +## Security: + +We use a server-client model to keep you safe. The daemon ( swhkd - privileged process ) communicates to the server ( swhks - running as non root user ) after checking for valid keybinds. Since the daemon is totally separate from the server, no other process can read your keystrokes. As for shell commands, you might be thinking that any program can send shell commands to the server and that's true! But the server runs the commands as the currently logged in user so no extra permissions are provided ( This is essentially the same as any app on your desktop calling shell commands ). + +So yes, you're safe! + +## Support: + +1. https://matrix.to/#/#waycrate-tools:matrix.org +1. https://discord.gg/KKZRDYrRYW + +## Contributors: -* Tait Hoyem `` + + +