Skip to content

Commit

Permalink
Merge pull request #3 from sigseg5/parse_iter_opt
Browse files Browse the repository at this point in the history
Add iter instead of cycle
  • Loading branch information
sigseg5 authored Jun 26, 2022
2 parents 6a2750b + 26f4003 commit 77b6050
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 11 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ You fingerprint is [

* Run `bash build.sh` and `sudo bash install.sh` to build app and install `systemd` service.

# Upgrading

* Run `sudo bash uninstall.sh`
* Continue normal installation

# Uninstall

* Run `sudo bash uninstall.sh`
* Run `sudo bash uninstall.sh`
Empty file modified build.sh
100644 → 100755
Empty file.
Empty file modified install.sh
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion semap.service
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ Type=simple
ExecStart=/usr/bin/semap

[Install]
WantedBy=multi-user.target
WantedBy=multi-user.target
21 changes: 13 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ fn main() {
thread::sleep(five_secs);
let after_connect_devices = cli::get_devices();
let mut difference = vec![];
for i in after_connect_devices {
if !pre_connect_devices.contains(&i) {
difference.push(i);
after_connect_devices.iter().for_each(|i| {
if !pre_connect_devices.contains(i) {
difference.push(&*i);
}
}
});
println!(
"You fingerprint is {:#X?}\n
Put this data to 50 line in main.rs, after that rebuild and reinstall service.\n
Expand All @@ -50,16 +50,21 @@ fn main() {
loop {
for i in cli::get_devices() {
if i == kb_fingerprint {
if dconf::get(xkb_opt).unwrap() == model_m_settings {
if dconf::get(xkb_opt).expect("Can't get xkb-options from dconf.")
== model_m_settings
{
break;
};
dconf::set(xkb_opt, model_m_settings).unwrap();
dconf::set(xkb_opt, model_m_settings).expect("Can't set xkb-options for Model M.");
break;
} else {
if dconf::get(xkb_opt).unwrap() == default_settings {
if dconf::get(xkb_opt).expect("Can't get xkb-options from dconf.")
== default_settings
{
break;
} else {
dconf::set(xkb_opt, default_settings).unwrap();
dconf::set(xkb_opt, default_settings)
.expect("Can't set xkb-options for standart keyboard.");
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion uninstall.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ sudo systemctl disable semap
sudo rm -f /lib/systemd/system/semap.service
sudo rm -f /usr/bin/semap

echo "Done."
echo "Done."

0 comments on commit 77b6050

Please sign in to comment.