diff --git a/INSTALL.md b/INSTALL.md index e0e1769..d90d65d 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -10,7 +10,6 @@ We have packaged `swhkd-git`. `swhkd-bin` has been packaged separately by a user **Runtime:** -- Policy Kit Daemon ( polkit ) - Uinput kernel module - Evdev kernel module @@ -34,5 +33,5 @@ We have packaged `swhkd-git`. `swhkd-bin` has been packaged separately by a user ``` swhks & -pkexec swhkd +swhkd ``` diff --git a/README.md b/README.md index 7bc5855..9ebf6c4 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ Xorg or Wayland desktops, and you can even use `swhkd` in a TTY. ```bash swhks & -pkexec swhkd +swhkd ``` ## Runtime signals @@ -50,9 +50,7 @@ After opening `swhkd`, you can control the program through signals: `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`. +The default configuration file is in `~/.config/swhkd/swhkdrc` with a fallback 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 @@ -75,13 +73,13 @@ All supported key and modifier names are listed in `man 5 swhkd-keys`. ## 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 keybindings. 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). +process) is responsible for listening to key events and running shell commands. +The server (`swhks` — non-privileged process) is responsible for keeping a track of the +environment variables and sending them to the daemon. The daemon +uses these environment variables while running the shell commands. +The daemon only runs shell commands that have been parsed from the config file and there is no way to +run arbitrary shell commands. The server is responsible for only sending the environment variables to the daemon and nothing else. +This seperation of responsibilities ensures security. So yes, you're safe! diff --git a/docs/swhkd.1.scd b/docs/swhkd.1.scd index 8b3f3dc..10b437d 100644 --- a/docs/swhkd.1.scd +++ b/docs/swhkd.1.scd @@ -6,18 +6,11 @@ swhkd - Hotkey daemon inspired by sxhkd written in Rust # SYNOPSIS -*pkexec swhkd* [_flags_] +*swhkd* [_flags_] # CONFIG FILE -The config file goes in */etc/swhkd/swhkdrc*. Since swhkd is written with a pkexec privilege escalation model in mind, we can't detect -*$XDG_CONFIG_HOME*. - -This can be avoided as such: - - Using the *include* statement in your config file. - - Using the *-c* flag to mention a custom config file at runtime. - - Symlinking the config file from *~/.config/swhkd/swhkdrc* or any other directory of choice to */etc/swhkd/swhkdrc*. - +The config file goes in *~/.config/swhkd/swhkdrc* with a fallback to */etc/swhkd/swhkdrc*. More about the config file syntax in `swhkd(5)` # OPTIONS @@ -41,6 +34,9 @@ More about the config file syntax in `swhkd(5)` *-D, --device* <DEVICE_NAME> Manually set the keyboard devices to use. Can occur multiple times. +*-r, --refresh* <REFRESH_TIME> + Manually set the refresh time to check the server for a new environment + # SIGNALS - Reload config file: `sudo pkill -HUP swhkd` diff --git a/docs/swhkd.5.scd b/docs/swhkd.5.scd index 47fc42b..405c21f 100644 --- a/docs/swhkd.5.scd +++ b/docs/swhkd.5.scd @@ -6,7 +6,8 @@ swhkd - Hotkey daemon inspired by sxhkd written in Rust # CONFIG FILE - - A global config can be defined in */etc/swhkd/swhkdrc*. Swhkd attempts to look in your *$XDG_CONFIG_HOME*, failing which it defaults to *~/.config*. + - A global config can be defined in *~/.config/swhkd/swhkdrc*, with a + fallback to */etc/swhkd/swhkdrc*. Swhkd attempts to look in your *$XDG_CONFIG_HOME*, failing which it defaults to *~/.config*. - A local config overrides the global one. Local configs should be placed in the root of the project. # SYNTAX diff --git a/docs/swhks.1.scd b/docs/swhks.1.scd index 4bcd640..f08f892 100644 --- a/docs/swhks.1.scd +++ b/docs/swhks.1.scd @@ -16,12 +16,6 @@ swhks - Server for swhkd, used to run user level commands over IPC. *-V*, *--version* Print version information. -*-l*, *--log* <LOG_FILE_PATH> - Set a log file path. - If *XDG_DATA_HOME* exists then we use *swhks/swhks-current_time.log* relative to - it, else we use *.local/share/swhks/swhks-current_time.log* relative to the - user home directory. - *-d*, *--debug* Enable debug mode. diff --git a/swhks/src/main.rs b/swhks/src/main.rs index af7b707..ca4916e 100644 --- a/swhks/src/main.rs +++ b/swhks/src/main.rs @@ -23,10 +23,6 @@ use sysinfo::{ProcessExt, SystemExt}; #[derive(Parser)] #[command(version, about, long_about = None)] struct Args { - /// Set a custom log file. (Defaults to ${XDG_DATA_HOME:-$HOME/.local/share}/swhks-current_unix_time.log) - #[arg(short, long, value_name = "FILE")] - log: Option<PathBuf>, - /// Enable Debug Mode #[arg(short, long)] debug: bool,