added menu functionality (default fuzzel)

This commit is contained in:
2026-03-13 19:02:44 +01:00
parent 2ed522d9e5
commit 3a89c9fc3c
9 changed files with 269 additions and 103 deletions
+4 -8
View File
@@ -8,19 +8,15 @@ use std::process::Command;
pub struct GameModule;
impl WaybarModule for GameModule {
fn run(&self, _config: &Config, _state: &SharedState, _args: &[&str]) -> Result<WaybarOutput> {
fn run(&self, config: &Config, _state: &SharedState, _args: &[&str]) -> Result<WaybarOutput> {
let output = Command::new("hyprctl")
.args(["getoption", "animations:enabled", "-j"])
.output();
let mut is_gamemode = false; // default to deactivated
let mut is_gamemode = false;
if let Ok(out) = output {
let stdout = String::from_utf8_lossy(&out.stdout);
// The JSON from hyprctl looks like {"int": 0, "float": 0.0, ...}
// If int is 0, animations are disabled (Gamemode active)
// If int is 1, animations are enabled (Gamemode deactivated)
if stdout.contains("\"int\": 0") {
is_gamemode = true;
}
@@ -28,14 +24,14 @@ impl WaybarModule for GameModule {
if is_gamemode {
Ok(WaybarOutput {
text: "<span size='large'>󰊖</span>".to_string(),
text: config.game.format_active.clone(),
tooltip: Some("Gamemode activated".to_string()),
class: Some("active".to_string()),
percentage: None,
})
} else {
Ok(WaybarOutput {
text: "<span size='large'></span>".to_string(),
text: config.game.format_inactive.clone(),
tooltip: Some("Gamemode deactivated".to_string()),
class: None,
percentage: None,