mirror of
https://codeberg.org/icewind/evtype.git
synced 2026-06-03 09:34:11 +02:00
move socket to statedirectory
This commit is contained in:
parent
db2f6d81b5
commit
ee47c1a5b8
4 changed files with 7 additions and 6 deletions
|
|
@ -24,7 +24,7 @@ with a different keyboard layout.
|
|||
|
||||
## Programmatic usage
|
||||
|
||||
You can use the `evtype_daemon` from your own programs by connecting to the unix socket at `/var/run/evtype.sock` and
|
||||
You can use the `evtype_daemon` from your own programs by connecting to the unix socket at `/var/run/evtype/evtype.sock` and
|
||||
send the text to be typed over the socket.
|
||||
|
||||
A basic rust example:
|
||||
|
|
@ -34,7 +34,7 @@ use std::io::Write;
|
|||
use std::os::unix::net::UnixStream;
|
||||
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
let mut stream = UnixStream::connect("/var/run/evtype.sock")?;
|
||||
let mut stream = UnixStream::connect("/var/run/evtype/evtype.sock")?;
|
||||
stream.write_all("hello world".as_bytes())?;
|
||||
Ok(());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ SystemCallFilter=~@resources
|
|||
MemoryDenyWriteExecute=true
|
||||
IPAddressDeny=any
|
||||
ReadWritePaths=/var/run
|
||||
RuntimeDirectory=evtype
|
||||
|
||||
ExecStart=/usr/bin/evtype_daemon
|
||||
ExecStopPost=/usr/bin/rm /var/run/evtype.sock
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use std::io::Write;
|
|||
use std::os::unix::net::UnixStream;
|
||||
|
||||
fn main() -> Result<(), MainError> {
|
||||
let path = "/var/run/evtype.sock";
|
||||
let path = "/var/run/evtype/evtype.sock";
|
||||
|
||||
let text = std::env::args().skip(1).next().unwrap_or_default();
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use crate::keyboard::{char_to_key, create_device};
|
|||
use evdev::{EventType, InputEvent, Key, Synchronization};
|
||||
use main_error::MainError;
|
||||
use std::fs;
|
||||
use std::fs::Permissions;
|
||||
use std::fs::{create_dir_all, Permissions};
|
||||
use std::io::Read;
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
use std::os::unix::net::UnixListener;
|
||||
|
|
@ -36,8 +36,9 @@ fn type_string(dev: &mut VirtualDevice, text: &str) -> Result<(), MainError> {
|
|||
fn main() -> Result<(), MainError> {
|
||||
let mut keyboard = create_device()?;
|
||||
|
||||
let path = "/var/run/evtype.sock";
|
||||
let path = "/var/run/evtype/evtype.sock";
|
||||
|
||||
create_dir_all("/var/run/evtype")?;
|
||||
let listener = UnixListener::bind(path)?;
|
||||
fs::set_permissions(path, Permissions::from_mode(0o666))?;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue