From f65a59aae2c7f1355a0c5ddc61668fa8873f3cda Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Wed, 6 Jul 2022 23:36:25 +0200 Subject: [PATCH] layout: Add floating exceptions from pop-shell --- Cargo.toml | 1 + src/shell/layout/mod.rs | 84 ++++++++++++++++++++++++++++++++++++++--- 2 files changed, 79 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b092df56..e9430dc6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,6 +20,7 @@ egui = { version = "0.18.1", optional = true } edid-rs = { version = "0.1" } lazy_static = "1.4.0" thiserror = "1.0.26" +regex = "1" xcursor = "0.3.3" id_tree = "1.8.0" xkbcommon = "0.4" diff --git a/src/shell/layout/mod.rs b/src/shell/layout/mod.rs index c3cf977f..26581db6 100644 --- a/src/shell/layout/mod.rs +++ b/src/shell/layout/mod.rs @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-only use crate::{input::ActiveOutput, state::State}; +use regex::RegexSet; use smithay::{ desktop::{Space, Window}, wayland::{ @@ -19,6 +20,75 @@ pub enum Orientation { Vertical, } +lazy_static::lazy_static! { + static ref EXCEPTIONS_APPID: RegexSet = RegexSet::new(&[ + r"Authy Desktop", + r"Com.github.amezin.ddterm", + r"Com.github.donadigo.eddy", + r".*", + r"Enpass", + r"Gjs", + r"Gnome-initial-setup", + r"Gnome-terminal", + r"Guake", + r"Io.elementary.sideload", + r"KotatogramDesktop", + r"Mozilla VPN", + r"update-manager", + r"Solaar", + r"Steam", + r"TelegramDesktop", + r"Zotero", + r"gjs", + r"gnome-screenshot", + r"ibus-.*", + r"jetbrains-toolbox", + r"jetbrains-webstorm", + r"jetbrains-webstorm", + r"jetbrains-webstorm", + r"krunner", + r"pritunl", + r"re.sonny.Junction", + r"system76-driver", + r"tilda", + r"zoom", + r"^.*?action=join.*$", + ]).unwrap(); + static ref EXCEPTIONS_TITLE: RegexSet = RegexSet::new(&[ + r".*", + r".*", + r".*", + r"Discord Updater", + r"Enpass Assistant", + r"Settings", + r".*", + r"Preferences – General", + r".*", + r".*", + r"Media viewer", + r".*", + r"Software Updater", + r".*", + r"^.*?(Guard|Login).*", + r"Media viewer", + r"Quick Format Citation", + r".*", + r".*", + r".*", + r".*", + r"Customize WebStorm", + r"License Activation", + r"Welcome to WebStorm", + r".*", + r".*", + r".*", + r".*", + r".*", + r".*", + r".*", + ]).unwrap(); +} + pub fn should_be_floating(window: &Window) -> bool { let surface = window.toplevel().wl_surface(); with_states(surface, |states| { @@ -38,13 +108,15 @@ pub fn should_be_floating(window: &Window) -> bool { } // else take a look at our exceptions - match ( - attrs.app_id.as_deref().unwrap_or(""), - attrs.title.as_deref().unwrap_or(""), - ) { - ("gcr-prompter", _) => true, - _ => false, + let appid_matches = EXCEPTIONS_APPID.matches(attrs.app_id.as_deref().unwrap_or("")); + let title_matches = EXCEPTIONS_TITLE.matches(attrs.app_id.as_deref().unwrap_or("")); + for idx in appid_matches.into_iter() { + if title_matches.matched(idx) { + return true; + } } + + false }) }