From 512b7a28a3aeee42640a0c4a8728e9491a80d305 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Sun, 27 Feb 2022 11:46:43 -0700 Subject: [PATCH] Add mode changer, Polkit -> Udev --- Makefile | 16 ++++++++++------ bin/sohkmc | 7 +++++++ 2 files changed, 17 insertions(+), 6 deletions(-) create mode 100755 bin/sohkmc diff --git a/Makefile b/Makefile index 2154206..8a9908e 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,10 @@ DAEMON_BINARY := sohkd SERVER_BINARY := sohks CONTROL_BINARY := sohkctl +MODE_CHANGE_BINARY := sohkmc BUILDFLAGS := --release -POLKIT_DIR := /etc/polkit-1/rules.d -POLKIT_RULE := sohkd.rules +UDEV_DIR := /etc/udev/rules.d/ +UDEV_RULE := sohkd.rules TARGET_DIR := /usr/bin all: build @@ -21,22 +22,25 @@ glibc: install: @mkdir -p $(TARGET_DIR) - @mkdir -p $(POLKIT_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 ./$(POLKIT_RULE) $(POLKIT_DIR)/$(POLKIT_RULE) + @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 $(POLKIT_DIR)/$(POLKIT_RULE) + @rm $(TARGET_DIR)/$(CONTROL_BINARY) + @rm $(TARGET_DIR)/$(CHANGE_MODE_BINARY) + @rm $(UDEV_DIR)/$(UDEV_RULE) check: @cargo fmt diff --git a/bin/sohkmc b/bin/sohkmc new file mode 100755 index 0000000..23cd8f5 --- /dev/null +++ b/bin/sohkmc @@ -0,0 +1,7 @@ +# HotKey Mode Change; first argument is the mode to switch to, second argument is what to announce to the user, usually e.g. "browse mode", "focus mode". +# Note that due to the speech dispatcher client needing to be spun up on every invocation of this file, it sometimes does not respond imidiately; +# wheras the hot key daemon mode changing will happen nearly instantaneously + +#!/bin/bash +sohkctl "$1" & +spd-say "$2" &