Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,16 @@ nix run github:friedow/centerpiece

All plugins are enabled by default. Disable the ones you don't need ;).

### Window Switcher
### Sway Window Switcher

_Search for open windows and switch between them._

Currently, only [Sway](https://swaywm.org/) is supported as a window manger.
This plugin depends on the sway ipc socket to be available.
_Search for open sway windows and switch between them._

**Related config keys**

```yml
# ~/.config/centerpiece/config.yml
plugin:
windows:
sway_windows:
enable: true
```

Expand Down Expand Up @@ -205,6 +202,7 @@ plugin:
You can configure centerpiece through yaml or nix.

You can specify alternative configuration locations through:

- the `--config` flag
- the `CENTERPIECE_CONFIGURATION_FILE` environment variable

Expand Down Expand Up @@ -242,7 +240,7 @@ You can specify alternative configuration locations through:
enable: true
wifi:
enable: true
windows:
sway_windows:
enable: true
```

Expand Down Expand Up @@ -300,7 +298,7 @@ You can specify alternative configuration locations through:
wifi = {
enable = true;
};
windows = {
sway_windows = {
enable = true;
};
};
Expand Down
2 changes: 1 addition & 1 deletion client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ chrono = "0.4.33"
# applications plugin
freedesktop-desktop-entry = "0.5.0"

# windows plugin
# sway_windows plugin
swayipc = "3.0.1"

# system monitor plugin
Expand Down
4 changes: 2 additions & 2 deletions client/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,9 @@ impl Application for Centerpiece {
subscriptions.push(crate::plugin::utils::spawn::<crate::plugin::wifi::WifiPlugin>());
}

if self.settings.plugin.windows.enable {
if self.settings.plugin.sway_windows.enable {
subscriptions.push(crate::plugin::utils::spawn::<
crate::plugin::windows::WindowsPlugin,
crate::plugin::sway_windows::SwayWindowsPlugin,
>());
}

Expand Down
2 changes: 1 addition & 1 deletion client/src/plugin/git_repositories.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl Plugin for GitRepositoriesPlugin {
id: git_repository_path,
title: git_repository_display_name,
action: String::from("focus"),
meta: String::from("windows"),
meta: String::from("Git Repositories"),
command: None,
})
})
Expand Down
2 changes: 1 addition & 1 deletion client/src/plugin/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pub mod brave;
pub mod clock;
pub mod git_repositories;
pub mod resource_monitor;
pub mod sway_windows;
pub mod system;
pub mod utils;
pub mod wifi;
pub mod windows;
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use crate::plugin::utils::Plugin;
use anyhow::Context;

pub struct WindowsPlugin {
pub struct SwayWindowsPlugin {
sway: swayipc::Connection,
entries: Vec<crate::model::Entry>,
}

impl WindowsPlugin {
impl SwayWindowsPlugin {
fn get_window_nodes(node: swayipc::Node) -> Vec<swayipc::Node> {
if !node.nodes.is_empty() {
return node
Expand All @@ -24,9 +24,9 @@ impl WindowsPlugin {
}
}

impl Plugin for WindowsPlugin {
impl Plugin for SwayWindowsPlugin {
fn id() -> &'static str {
"windows"
"sway-windows"
}
fn priority() -> u32 {
30
Expand Down Expand Up @@ -69,7 +69,7 @@ impl Plugin for WindowsPlugin {
id: node.id.to_string(),
title,
action: String::from("focus"),
meta: String::from(Self::id()),
meta: String::from("Sway Windows"),
command: None,
}
})
Expand Down
8 changes: 4 additions & 4 deletions client/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,12 @@ impl Default for WifiPluginSettings {
}

#[derive(Debug, Deserialize)]
pub struct WindowsPluginSettings {
pub struct SwayWindowsPluginSettings {
#[serde(default = "default_true")]
pub enable: bool,
}

impl Default for WindowsPluginSettings {
impl Default for SwayWindowsPluginSettings {
fn default() -> Self {
Self { enable: true }
}
Expand Down Expand Up @@ -204,11 +204,11 @@ pub struct PluginSettings {
#[serde(default)]
pub resource_monitor_memory: ResourceMonitorMemoryPluginSettings,
#[serde(default)]
pub sway_windows: SwayWindowsPluginSettings,
#[serde(default)]
pub system: SystemPluginSettings,
#[serde(default)]
pub wifi: WifiPluginSettings,
#[serde(default)]
pub windows: WindowsPluginSettings,
}

#[derive(Debug, Default, Deserialize)]
Expand Down
6 changes: 3 additions & 3 deletions home-manager-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -105,23 +105,23 @@ in {
};
};

system = {
sway_windows = {
enable = lib.mkOption {
default = true;
type = lib.types.bool;
description = lib.mdDoc "Enable / disable the plugin.";
};
};

wifi = {
system = {
enable = lib.mkOption {
default = true;
type = lib.types.bool;
description = lib.mdDoc "Enable / disable the plugin.";
};
};

windows = {
wifi = {
enable = lib.mkOption {
default = true;
type = lib.types.bool;
Expand Down