layout: Add floating exceptions from pop-shell

This commit is contained in:
Victoria Brekenfeld 2022-07-06 23:36:25 +02:00
parent 65046f1265
commit f65a59aae2
2 changed files with 79 additions and 6 deletions

View file

@ -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"

View file

@ -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
})
}