feat(wm): add cmds for titlebar removal

This commit introduces some basic commands to read from/add to a
whitelist of applications which that user has determined that are safe
to remove the titlebar from.

Titlebars and removed and added by removing and adding the WS_CAPTION
and WS_THICKFRAME styles (this is the approach that Workspacer also
takes) from the windows.

Wherever possible, the user should prefer native preferences and
settings that remove the titlebar in popular apps (Windows Terminal,
Firefox etc).

re #57
This commit is contained in:
LGUG2Z
2021-10-27 17:37:57 -07:00
parent 29a6c39084
commit 987dc2b8dd
8 changed files with 98 additions and 7 deletions
+23
View File
@@ -261,6 +261,7 @@ gen_application_target_subcommand_args! {
ManageRule,
IdentifyTrayApplication,
IdentifyBorderOverflow,
RemoveTitleBar,
}
#[derive(Clap, AhkFunction)]
@@ -493,6 +494,11 @@ enum SubCommand {
/// Identify an application that has overflowing borders
#[clap(setting = AppSettings::ArgRequiredElseHelp)]
IdentifyBorderOverflow(IdentifyBorderOverflow),
/// Whitelist an application for title bar removal
#[clap(setting = AppSettings::ArgRequiredElseHelp)]
RemoveTitleBar(RemoveTitleBar),
/// Toggle title bars for whitelisted applications
ToggleTitleBars,
/// Enable or disable focus follows mouse for the operating system
#[clap(setting = AppSettings::ArgRequiredElseHelp)]
FocusFollowsMouse(FocusFollowsMouse),
@@ -895,6 +901,23 @@ fn main() -> Result<()> {
&*SocketMessage::IdentifyBorderOverflow(target.identifier, target.id).as_bytes()?,
)?;
}
SubCommand::RemoveTitleBar(target) => {
match target.identifier {
ApplicationIdentifier::Exe => {}
_ => {
return Err(anyhow!(
"this command requires applications to be identified by their exe"
))
}
}
send_message(
&*SocketMessage::RemoveTitleBar(target.identifier, target.id).as_bytes()?,
)?;
}
SubCommand::ToggleTitleBars => {
send_message(&*SocketMessage::ToggleTitleBars.as_bytes()?)?;
}
SubCommand::Manage => {
send_message(&*SocketMessage::ManageFocusedWindow.as_bytes()?)?;
}