Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/popout buffer #548

Merged
merged 13 commits into from
Sep 12, 2024
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

Added:

- Multi-window support: Pop out panes into separate windows.
- In-app theme editor with ability to with share it via a halloy:// URL.
- New configuration options
- Ability to include or exclude channels for server messages (join, part, etc.). See [configuration](https://halloy.squidowl.org/configuration/buffer/server_messages/index.html).
Expand Down
6 changes: 6 additions & 0 deletions assets/fontello/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@
"css": "docs",
"code": 61637,
"src": "fontawesome"
},
{
"uid": "ca1c07c0df52dbf2af6813c9e36c2611",
"css": "popup",
"code": 59406,
"src": "typicons"
}
]
}
3 changes: 3 additions & 0 deletions data/src/dashboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ use crate::{compression, environment};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Dashboard {
pub pane: Pane,
#[serde(default)]
pub popout_panes: Vec<Pane>,
}

#[derive(Debug, Clone, Copy, Default, Deserialize, Serialize)]
Expand All @@ -17,6 +19,7 @@ pub enum BufferAction {
#[default]
NewPane,
ReplacePane,
NewWindow,
}

#[derive(Debug, Clone, Copy, Default, Deserialize, Serialize)]
Expand Down
Binary file modified fonts/halloy-icons.ttf
Binary file not shown.
4 changes: 4 additions & 0 deletions src/icon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ pub fn copy<'a>() -> Text<'a> {
to_text('\u{F0C5}')
}

pub fn popout<'a>() -> Text<'a> {
to_text('\u{E80E}')
}

fn to_text<'a>(unicode: char) -> Text<'a> {
text(unicode.to_string())
.line_height(LineHeight::Relative(1.0))
Expand Down
25 changes: 21 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,10 @@ impl Halloy {
main_window: window::Id,
config_load: Result<Config, config::Error>,
) -> (Halloy, Task<Message>) {
let main_window = Window::new(main_window);

let load_dashboard = |config| match data::Dashboard::load() {
Ok(dashboard) => screen::Dashboard::restore(dashboard, config),
Ok(dashboard) => screen::Dashboard::restore(dashboard, config, &main_window),
Err(error) => {
log::warn!("failed to load dashboard: {error}");

Expand Down Expand Up @@ -182,7 +184,7 @@ impl Halloy {
servers: config.servers.clone(),
config,
modal: None,
main_window: Window::new(main_window),
main_window,
},
command,
)
Expand Down Expand Up @@ -689,6 +691,7 @@ impl Halloy {
&self.version,
&self.config,
&mut self.theme,
&self.main_window,
)
.map(Message::Dashboard);
}
Expand Down Expand Up @@ -794,7 +797,14 @@ impl Halloy {

let screen = match &self.screen {
Screen::Dashboard(dashboard) => dashboard
.view(now, &self.clients, &self.version, &self.config, &self.theme)
.view(
now,
&self.clients,
&self.version,
&self.config,
&self.theme,
&self.main_window,
)
.map(Message::Dashboard),
Screen::Help(help) => help.view().map(Message::Help),
Screen::Welcome(welcome) => welcome.view().map(Message::Welcome),
Expand All @@ -817,7 +827,13 @@ impl Halloy {
}
} else if let Screen::Dashboard(dashboard) = &self.screen {
dashboard
.view_window(id, &self.theme)
.view_window(
id,
&self.clients,
&self.config,
&self.theme,
&self.main_window,
)
.map(Message::Dashboard)
} else {
column![].into()
Expand All @@ -830,6 +846,7 @@ impl Halloy {

container(content)
.padding(padding::top(height_margin))
.style(theme::container::general)
.into()
}

Expand Down
Loading
Loading