✨ Got espanso to start without notification
This commit is contained in:
parent
bd8d6f8600
commit
76c8b1201f
2 changed files with 84 additions and 12 deletions
76
espanso/notification.rs
Normal file
76
espanso/notification.rs
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* This file is part of espanso.
|
||||
*
|
||||
* Copyright (C) 2019-2021 Federico Terzi
|
||||
*
|
||||
* espanso is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* espanso is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with espanso. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use espanso_config::config::Config;
|
||||
use espanso_ui::UIRemote;
|
||||
|
||||
pub struct NotificationManager<'a> {
|
||||
ui_remote: &'a dyn UIRemote,
|
||||
config: &'a dyn Config,
|
||||
}
|
||||
|
||||
impl<'a> NotificationManager<'a> {
|
||||
pub fn new(ui_remote: &'a dyn UIRemote, config: &'a dyn Config) -> Self {
|
||||
NotificationManager { ui_remote, config }
|
||||
}
|
||||
|
||||
fn notify(&self, text: &str) {
|
||||
if self.config.show_notifications() {
|
||||
self.ui_remote.show_notification(text);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn notify_start(&self) {
|
||||
// self.notify("Espanso is running!");
|
||||
}
|
||||
|
||||
pub fn notify_config_reloaded(&self, is_manual_restart: bool) {
|
||||
if is_manual_restart {
|
||||
// self.notify("Configuration reloaded!");
|
||||
} else {
|
||||
// self.notify(
|
||||
// "Configuration reloaded! Espanso automatically loads new changes as soon as you save them.",
|
||||
// );
|
||||
}
|
||||
}
|
||||
|
||||
pub fn notify_keyboard_layout_reloaded(&self) {
|
||||
// self.notify("Updated keyboard layout!");
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> espanso_engine::process::NotificationManager for NotificationManager<'a> {
|
||||
fn notify_status_change(&self, enabled: bool) {
|
||||
// Don't notify the status change outside Linux for now
|
||||
if !cfg!(target_os = "linux") {
|
||||
return;
|
||||
}
|
||||
|
||||
if enabled {
|
||||
// self.notify("Espanso enabled!")
|
||||
} else {
|
||||
// self.notify("Espanso disabled!")
|
||||
}
|
||||
}
|
||||
|
||||
fn notify_rendering_error(&self) {
|
||||
// self
|
||||
// .notify("An error occurred during rendering, please examine the logs for more information.");
|
||||
}
|
||||
}
|
||||
20
updates.txt
20
updates.txt
|
|
@ -60,7 +60,7 @@ Install espanso (use paru instead):
|
|||
paru -S espanso
|
||||
|
||||
cd aur_packages
|
||||
git clone https://github.com/federico-terzi/espanso
|
||||
git clone https://github.com/espanso/espanso
|
||||
|
||||
Install wxwidgets
|
||||
|
||||
|
|
@ -68,22 +68,18 @@ doas pacman -S wxwidgets
|
|||
|
||||
cd espanso
|
||||
|
||||
To turn off notifications, simply cp from this directory the notifications.rs file to the ~/aur_packages/espanso/espanso/src/cli/worker/ui/ directory before compiling.
|
||||
|
||||
cp ~/Documents/notes/espanso/notification.rs ~/aur_packages/espanso/espanso/src/cli/worker/ui/notification.rs
|
||||
|
||||
cargo install --force cargo-make --version 0.34.0
|
||||
cargo make --profile release build-binary
|
||||
doas mv target/release/espanso /usr/local/bin/espanso
|
||||
doas mv target/release/espanso /usr/bin/espanso
|
||||
|
||||
Copy xinitrc.txt which calls espanso at beginning
|
||||
|
||||
cp ~/Documents/notes/xinitrc.txt ~/.xinitrc
|
||||
|
||||
After restarting X session, you should be able to see some of espanso's effects on typing, just type something like ":date" and you'll see the effect.
|
||||
Copy your base.yml to your espanso/match config directory
|
||||
|
||||
This is just a demo, you can create your own custom replacement word "triggers" in the generated config file ~/.config/espanso/config/default.yml
|
||||
|
||||
You can also simply type:
|
||||
|
||||
espanso edit
|
||||
|
||||
To bring up the config file and edit it with commands, see:
|
||||
|
||||
https://espanso.org/docs/configuration/basics/
|
||||
cp ~/Documents/notes/espanso/base.yml ~/.config/espanso/match/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue