feat(wm): add more named-workspace cmd variants

This commit is contained in:
LGUG2Z
2023-02-16 12:24:42 -08:00
parent a23019eccf
commit 8adff69b81
5 changed files with 383 additions and 15 deletions

View File

@@ -47,11 +47,13 @@ pub enum SocketMessage {
CycleStack(CycleDirection),
MoveContainerToMonitorNumber(usize),
MoveContainerToWorkspaceNumber(usize),
MoveContainerToNamedWorkspace(String),
CycleMoveContainerToWorkspace(CycleDirection),
SendContainerToMonitorNumber(usize),
SendContainerToWorkspaceNumber(usize),
CycleSendContainerToWorkspace(CycleDirection),
SendContainerToMonitorWorkspaceNumber(usize, usize),
SendContainerToNamedWorkspace(String),
MoveWorkspaceToMonitorNumber(usize),
ForceFocus,
Close,
@@ -94,14 +96,22 @@ pub enum SocketMessage {
FocusMonitorWorkspaceNumber(usize, usize),
FocusNamedWorkspace(String),
ContainerPadding(usize, usize, i32),
NamedWorkspaceContainerPadding(String, i32),
WorkspacePadding(usize, usize, i32),
NamedWorkspacePadding(String, i32),
WorkspaceTiling(usize, usize, bool),
NamedWorkspaceTiling(String, bool),
WorkspaceName(usize, usize, String),
WorkspaceLayout(usize, usize, DefaultLayout),
NamedWorkspaceLayout(String, DefaultLayout),
WorkspaceLayoutCustom(usize, usize, PathBuf),
NamedWorkspaceLayoutCustom(String, PathBuf),
WorkspaceLayoutRule(usize, usize, usize, DefaultLayout),
NamedWorkspaceLayoutRule(String, usize, DefaultLayout),
WorkspaceLayoutCustomRule(usize, usize, usize, PathBuf),
NamedWorkspaceLayoutCustomRule(String, usize, PathBuf),
ClearWorkspaceLayoutRules(usize, usize),
ClearNamedWorkspaceLayoutRules(String),
// Configuration
ReloadConfiguration,
WatchConfiguration(bool),

View File

@@ -5,6 +5,12 @@
; 1Password
Run, komorebic.exe float-rule exe "1Password.exe", , Hide
; Ableton Live
; Targets VST2 windows
Run, komorebic.exe float-rule class "AbletonVstPlugClass", , Hide
; Targets VST3 windows
Run, komorebic.exe float-rule class "Vst3PlugWindow", , Hide
; Adobe Creative Cloud
; If you have disabled minimize/close to tray for this application, you can delete/comment out the next line
Run, komorebic.exe identify-tray-application class "CreativeCloudDesktopWindowClass", , Hide
@@ -153,6 +159,10 @@ Run, komorebic.exe identify-border-overflow-application exe "Kotatogram.exe", ,
; If you have disabled minimize/close to tray for this application, you can delete/comment out the next line
Run, komorebic.exe identify-tray-application exe "Kotatogram.exe", , Hide
; LocalSend
; If you have disabled minimize/close to tray for this application, you can delete/comment out the next line
Run, komorebic.exe identify-tray-application exe "localsend_app.exe", , Hide
; Logi Bolt
Run, komorebic.exe float-rule exe "LogiBolt.exe", , Hide
@@ -287,6 +297,11 @@ Run, komorebic.exe float-rule exe "QuickLook.exe", , Hide
; RepoZ
Run, komorebic.exe float-rule exe "RepoZ.exe", , Hide
; Rider
Run, komorebic.exe identify-object-name-change-application exe "rider64.exe", , Hide
; If you have disabled minimize/close to tray for this application, you can delete/comment out the next line
Run, komorebic.exe identify-tray-application exe "rider64.exe", , Hide
; Roblox FPS Unlocker
; If you have disabled minimize/close to tray for this application, you can delete/comment out the next line
Run, komorebic.exe identify-tray-application exe "rbxfpsunlocker.exe", , Hide
@@ -304,6 +319,9 @@ Run, komorebic.exe identify-border-overflow-application exe "ShareX.exe", , Hide
; If you have disabled minimize/close to tray for this application, you can delete/comment out the next line
Run, komorebic.exe identify-tray-application exe "ShareX.exe", , Hide
; Sideloadly
Run, komorebic.exe float-rule exe "sideloadly.exe", , Hide
; Signal
; If you have disabled minimize/close to tray for this application, you can delete/comment out the next line
Run, komorebic.exe identify-tray-application exe "signal.exe", , Hide
@@ -342,6 +360,10 @@ Run, komorebic.exe identify-tray-application exe "Spotify.exe", , Hide
; Steam
Run, komorebic.exe identify-border-overflow-application class "vguiPopupWindow", , Hide
; Stremio
; If you have disabled minimize/close to tray for this application, you can delete/comment out the next line
Run, komorebic.exe identify-tray-application exe "stremio.exe", , Hide
; System Informer
; If you have disabled minimize/close to tray for this application, you can delete/comment out the next line
Run, komorebic.exe identify-tray-application exe "SystemInformer.exe", , Hide
@@ -375,12 +397,21 @@ Run, komorebic.exe identify-border-overflow-application exe "UnrealEditor.exe",
; If you have disabled minimize/close to tray for this application, you can delete/comment out the next line
Run, komorebic.exe identify-tray-application exe "UnrealEditor.exe", , Hide
; VRCX
; If you have disabled minimize/close to tray for this application, you can delete/comment out the next line
Run, komorebic.exe identify-tray-application exe "VRCX.exe", , Hide
; Visual Studio
Run, komorebic.exe identify-object-name-change-application exe "devenv.exe", , Hide
; Visual Studio Code
Run, komorebic.exe identify-border-overflow-application exe "Code.exe", , Hide
; Voice.ai
Run, komorebic.exe identify-border-overflow-application exe "VoiceAI.exe", , Hide
; If you have disabled minimize/close to tray for this application, you can delete/comment out the next line
Run, komorebic.exe identify-tray-application exe "VoiceAI.exe", , Hide
; WebTorrent Desktop
; If you have disabled minimize/close to tray for this application, you can delete/comment out the next line
Run, komorebic.exe identify-tray-application exe "WebTorrent.exe", , Hide
@@ -394,8 +425,7 @@ Run, komorebic.exe float-rule class "OperationStatusWindow", , Hide
Run, komorebic.exe float-rule title "Control Panel", , Hide
; Windows Installer
; Targets MSI Installers
Run, komorebic.exe float-rule class "MsiDialogCloseClass", , Hide
Run, komorebic.exe float-rule exe "msiexec.exe", , Hide
; WingetUI
; If you have disabled minimize/close to tray for this application, you can delete/comment out the next line

View File

@@ -197,9 +197,23 @@ impl WindowManager {
SocketMessage::ContainerPadding(monitor_idx, workspace_idx, size) => {
self.set_container_padding(monitor_idx, workspace_idx, size)?;
}
SocketMessage::NamedWorkspaceContainerPadding(ref workspace, size) => {
if let Some((monitor_idx, workspace_idx)) =
self.monitor_workspace_index_by_name(workspace)
{
self.set_container_padding(monitor_idx, workspace_idx, size)?;
}
}
SocketMessage::WorkspacePadding(monitor_idx, workspace_idx, size) => {
self.set_workspace_padding(monitor_idx, workspace_idx, size)?;
}
SocketMessage::NamedWorkspacePadding(ref workspace, size) => {
if let Some((monitor_idx, workspace_idx)) =
self.monitor_workspace_index_by_name(workspace)
{
self.set_workspace_padding(monitor_idx, workspace_idx, size)?;
}
}
SocketMessage::WorkspaceRule(_, ref id, monitor_idx, workspace_idx) => {
{
let mut workspace_rules = WORKSPACE_RULES.lock();
@@ -332,6 +346,25 @@ impl WindowManager {
SocketMessage::SendContainerToMonitorWorkspaceNumber(monitor_idx, workspace_idx) => {
self.move_container_to_monitor(monitor_idx, Option::from(workspace_idx), false)?;
}
SocketMessage::SendContainerToNamedWorkspace(ref workspace) => {
if let Some((monitor_idx, workspace_idx)) =
self.monitor_workspace_index_by_name(workspace)
{
self.move_container_to_monitor(
monitor_idx,
Option::from(workspace_idx),
false,
)?;
}
}
SocketMessage::MoveContainerToNamedWorkspace(ref workspace) => {
if let Some((monitor_idx, workspace_idx)) =
self.monitor_workspace_index_by_name(workspace)
{
self.move_container_to_monitor(monitor_idx, Option::from(workspace_idx), true)?;
}
}
SocketMessage::MoveWorkspaceToMonitorNumber(monitor_idx) => {
self.move_workspace_to_monitor(monitor_idx)?;
}
@@ -406,6 +439,62 @@ impl WindowManager {
SocketMessage::ClearWorkspaceLayoutRules(monitor_idx, workspace_idx) => {
self.clear_workspace_layout_rules(monitor_idx, workspace_idx)?;
}
SocketMessage::NamedWorkspaceLayoutCustom(ref workspace, ref path) => {
if let Some((monitor_idx, workspace_idx)) =
self.monitor_workspace_index_by_name(workspace)
{
self.set_workspace_layout_custom(monitor_idx, workspace_idx, path.clone())?;
}
}
SocketMessage::NamedWorkspaceTiling(ref workspace, tile) => {
if let Some((monitor_idx, workspace_idx)) =
self.monitor_workspace_index_by_name(workspace)
{
self.set_workspace_tiling(monitor_idx, workspace_idx, tile)?;
}
}
SocketMessage::NamedWorkspaceLayout(ref workspace, layout) => {
if let Some((monitor_idx, workspace_idx)) =
self.monitor_workspace_index_by_name(workspace)
{
self.set_workspace_layout_default(monitor_idx, workspace_idx, layout)?;
}
}
SocketMessage::NamedWorkspaceLayoutRule(ref workspace, at_container_count, layout) => {
if let Some((monitor_idx, workspace_idx)) =
self.monitor_workspace_index_by_name(workspace)
{
self.add_workspace_layout_default_rule(
monitor_idx,
workspace_idx,
at_container_count,
layout,
)?;
}
}
SocketMessage::NamedWorkspaceLayoutCustomRule(
ref workspace,
at_container_count,
ref path,
) => {
if let Some((monitor_idx, workspace_idx)) =
self.monitor_workspace_index_by_name(workspace)
{
self.add_workspace_layout_custom_rule(
monitor_idx,
workspace_idx,
at_container_count,
path.clone(),
)?;
}
}
SocketMessage::ClearNamedWorkspaceLayoutRules(ref workspace) => {
if let Some((monitor_idx, workspace_idx)) =
self.monitor_workspace_index_by_name(workspace)
{
self.clear_workspace_layout_rules(monitor_idx, workspace_idx)?;
}
}
SocketMessage::CycleFocusWorkspace(direction) => {
// This is to ensure that even on an empty workspace on a secondary monitor, the
// secondary monitor where the cursor is focused will be used as the target for

View File

@@ -100,6 +100,10 @@ MoveToWorkspace(target) {
RunWait, komorebic.exe move-to-workspace %target%, , Hide
}
MoveToNamedWorkspace(workspace) {
RunWait, komorebic.exe move-to-named-workspace %workspace%, , Hide
}
CycleMoveToWorkspace(cycle_direction) {
RunWait, komorebic.exe cycle-move-to-workspace %cycle_direction%, , Hide
}
@@ -112,6 +116,10 @@ SendToWorkspace(target) {
RunWait, komorebic.exe send-to-workspace %target%, , Hide
}
SendToNamedWorkspace(workspace) {
RunWait, komorebic.exe send-to-named-workspace %workspace%, , Hide
}
CycleSendToWorkspace(cycle_direction) {
RunWait, komorebic.exe cycle-send-to-workspace %cycle_direction%, , Hide
}
@@ -132,6 +140,10 @@ FocusMonitorWorkspace(target_monitor, target_workspace) {
RunWait, komorebic.exe focus-monitor-workspace %target_monitor% %target_workspace%, , Hide
}
FocusNamedWorkspace(workspace) {
RunWait, komorebic.exe focus-named-workspace %workspace%, , Hide
}
CycleMonitor(cycle_direction) {
RunWait, komorebic.exe cycle-monitor %cycle_direction%, , Hide
}
@@ -204,38 +216,74 @@ EnsureWorkspaces(monitor, workspace_count) {
RunWait, komorebic.exe ensure-workspaces %monitor% %workspace_count%, , Hide
}
EnsureNamedWorkspaces(monitor, names) {
RunWait, komorebic.exe ensure-named-workspaces %monitor% %names%, , Hide
}
ContainerPadding(monitor, workspace, size) {
RunWait, komorebic.exe container-padding %monitor% %workspace% %size%, , Hide
}
NamedWorkspaceContainerPadding(workspace, size) {
RunWait, komorebic.exe named-workspace-container-padding %workspace% %size%, , Hide
}
WorkspacePadding(monitor, workspace, size) {
RunWait, komorebic.exe workspace-padding %monitor% %workspace% %size%, , Hide
}
NamedWorkspacePadding(workspace, size) {
RunWait, komorebic.exe named-workspace-padding %workspace% %size%, , Hide
}
WorkspaceLayout(monitor, workspace, value) {
RunWait, komorebic.exe workspace-layout %monitor% %workspace% %value%, , Hide
}
NamedWorkspaceLayout(workspace, value) {
RunWait, komorebic.exe named-workspace-layout %workspace% %value%, , Hide
}
WorkspaceCustomLayout(monitor, workspace, path) {
RunWait, komorebic.exe workspace-custom-layout %monitor% %workspace% %path%, , Hide
}
NamedWorkspaceCustomLayout(workspace, path) {
RunWait, komorebic.exe named-workspace-custom-layout %workspace% %path%, , Hide
}
WorkspaceLayoutRule(monitor, workspace, at_container_count, layout) {
RunWait, komorebic.exe workspace-layout-rule %monitor% %workspace% %at_container_count% %layout%, , Hide
}
NamedWorkspaceLayoutRule(workspace, at_container_count, layout) {
RunWait, komorebic.exe named-workspace-layout-rule %workspace% %at_container_count% %layout%, , Hide
}
WorkspaceCustomLayoutRule(monitor, workspace, at_container_count, path) {
RunWait, komorebic.exe workspace-custom-layout-rule %monitor% %workspace% %at_container_count% %path%, , Hide
}
NamedWorkspaceCustomLayoutRule(workspace, at_container_count, path) {
RunWait, komorebic.exe named-workspace-custom-layout-rule %workspace% %at_container_count% %path%, , Hide
}
ClearWorkspaceLayoutRules(monitor, workspace) {
RunWait, komorebic.exe clear-workspace-layout-rules %monitor% %workspace%, , Hide
}
ClearNamedWorkspaceLayoutRules(workspace) {
RunWait, komorebic.exe clear-named-workspace-layout-rules %workspace%, , Hide
}
WorkspaceTiling(monitor, workspace, value) {
RunWait, komorebic.exe workspace-tiling %monitor% %workspace% %value%, , Hide
}
NamedWorkspaceTiling(workspace, value) {
RunWait, komorebic.exe named-workspace-tiling %workspace% %value%, , Hide
}
WorkspaceName(monitor, workspace, value) {
RunWait, komorebic.exe workspace-name %monitor% %workspace% %value%, , Hide
}
@@ -320,6 +368,10 @@ WorkspaceRule(identifier, id, monitor, workspace) {
RunWait, komorebic.exe workspace-rule %identifier% "%id%" %monitor% %workspace%, , Hide
}
NamedWorkspaceRule(identifier, id, workspace) {
RunWait, komorebic.exe named-workspace-rule %identifier% "%id%" %workspace%, , Hide
}
IdentifyObjectNameChangeApplication(identifier, id) {
RunWait, komorebic.exe identify-object-name-change-application %identifier% "%id%", , Hide
}

View File

@@ -1,7 +1,6 @@
#![warn(clippy::all, clippy::nursery, clippy::pedantic)]
#![allow(clippy::missing_errors_doc)]
use std::fs;
use std::fs::File;
use std::fs::OpenOptions;
use std::io::BufRead;
@@ -151,6 +150,26 @@ gen_target_subcommand_args! {
MoveWorkspaceToMonitor,
}
macro_rules! gen_named_target_subcommand_args {
// SubCommand Pattern
( $( $name:ident ),+ $(,)? ) => {
$(
#[derive(clap::Parser, derive_ahk::AhkFunction)]
pub struct $name {
/// Target workspace name
workspace: String,
}
)+
};
}
gen_named_target_subcommand_args! {
MoveToNamedWorkspace,
SendToNamedWorkspace,
FocusNamedWorkspace,
ClearNamedWorkspaceLayoutRules
}
// Thanks to @danielhenrymantilla for showing me how to use cfg_attr with an optional argument like
// this on the Rust Programming Language Community Discord Server
macro_rules! gen_workspace_subcommand_args {
@@ -185,6 +204,34 @@ gen_workspace_subcommand_args! {
Tiling: #[enum] BooleanState,
}
macro_rules! gen_named_workspace_subcommand_args {
// Workspace Property: #[enum] Value Enum (if the value is an Enum)
// Workspace Property: Value Type (if the value is anything else)
( $( $name:ident: $(#[enum] $(@$value_enum:tt)?)? $value:ty ),+ $(,)? ) => (
paste! {
$(
#[derive(clap::Parser, derive_ahk::AhkFunction)]
pub struct [<NamedWorkspace $name>] {
/// Target workspace name
workspace: String,
$(#[clap(value_enum)] $($value_enum)?)?
#[cfg_attr(
all($(FALSE $($value_enum)?)?),
doc = ""$name " of the workspace as a "$value ""
)]
value: $value,
}
)+
}
)
}
gen_named_workspace_subcommand_args! {
Layout: #[enum] DefaultLayout,
Tiling: #[enum] BooleanState,
}
#[derive(Parser, AhkFunction)]
pub struct ClearWorkspaceLayoutRules {
/// Monitor index (zero-indexed)
@@ -206,6 +253,15 @@ pub struct WorkspaceCustomLayout {
path: String,
}
#[derive(Parser, AhkFunction)]
pub struct NamedWorkspaceCustomLayout {
/// Target workspace name
workspace: String,
/// JSON or YAML file from which the custom layout definition should be loaded
path: String,
}
#[derive(Parser, AhkFunction)]
pub struct WorkspaceLayoutRule {
/// Monitor index (zero-indexed)
@@ -221,6 +277,18 @@ pub struct WorkspaceLayoutRule {
layout: DefaultLayout,
}
#[derive(Parser, AhkFunction)]
pub struct NamedWorkspaceLayoutRule {
/// Target workspace name
workspace: String,
/// The number of window containers on-screen required to trigger this layout rule
at_container_count: usize,
#[clap(value_enum)]
layout: DefaultLayout,
}
#[derive(Parser, AhkFunction)]
pub struct WorkspaceCustomLayoutRule {
/// Monitor index (zero-indexed)
@@ -236,6 +304,18 @@ pub struct WorkspaceCustomLayoutRule {
path: String,
}
#[derive(Parser, AhkFunction)]
pub struct NamedWorkspaceCustomLayoutRule {
/// Target workspace name
workspace: String,
/// The number of window containers on-screen required to trigger this layout rule
at_container_count: usize,
/// JSON or YAML file from which the custom layout definition should be loaded
path: String,
}
#[derive(Parser, AhkFunction)]
struct Resize {
#[clap(value_enum)]
@@ -334,12 +414,6 @@ struct FocusMonitorWorkspace {
target_workspace: usize,
}
#[derive(Parser, AhkFunction)]
struct FocusNamedWorkspace {
/// Target workspace name
name: String,
}
#[derive(Parser, AhkFunction)]
pub struct SendToMonitorWorkspace {
/// Target monitor index (zero-indexed)
@@ -370,6 +444,27 @@ gen_padding_subcommand_args! {
WorkspacePadding,
}
macro_rules! gen_named_padding_subcommand_args {
// SubCommand Pattern
( $( $name:ident ),+ $(,)? ) => {
$(
#[derive(clap::Parser, derive_ahk::AhkFunction)]
pub struct $name {
/// Target workspace name
workspace: String,
/// Pixels to pad with as an integer
size: i32,
}
)+
};
}
gen_named_padding_subcommand_args! {
NamedWorkspaceContainerPadding,
NamedWorkspacePadding,
}
macro_rules! gen_padding_adjustment_subcommand_args {
// SubCommand Pattern
( $( $name:ident ),+ $(,)? ) => {
@@ -622,6 +717,9 @@ enum SubCommand {
/// Move the focused window to the specified workspace
#[clap(arg_required_else_help = true)]
MoveToWorkspace(MoveToWorkspace),
/// Move the focused window to the specified workspace
#[clap(arg_required_else_help = true)]
MoveToNamedWorkspace(MoveToNamedWorkspace),
/// Move the focused window to the workspace in the given cycle direction
#[clap(arg_required_else_help = true)]
CycleMoveToWorkspace(CycleMoveToWorkspace),
@@ -631,6 +729,9 @@ enum SubCommand {
/// Send the focused window to the specified workspace
#[clap(arg_required_else_help = true)]
SendToWorkspace(SendToWorkspace),
/// Send the focused window to the specified workspace
#[clap(arg_required_else_help = true)]
SendToNamedWorkspace(SendToNamedWorkspace),
/// Send the focused window to the workspace in the given cycle direction
#[clap(arg_required_else_help = true)]
CycleSendToWorkspace(CycleSendToWorkspace),
@@ -646,7 +747,7 @@ enum SubCommand {
/// Focus the specified workspace on the target monitor
#[clap(arg_required_else_help = true)]
FocusMonitorWorkspace(FocusMonitorWorkspace),
/// Focus the specified workspace on the target monitor
/// Focus the specified workspace
#[clap(arg_required_else_help = true)]
FocusNamedWorkspace(FocusNamedWorkspace),
/// Focus the monitor in the given cycle direction
@@ -700,33 +801,57 @@ enum SubCommand {
/// Create at least this many workspaces for the specified monitor
#[clap(arg_required_else_help = true)]
EnsureWorkspaces(EnsureWorkspaces),
/// Create at least this many workspaces for the specified monitor
/// Create these many named workspaces for the specified monitor
#[clap(arg_required_else_help = true)]
EnsureNamedWorkspaces(EnsureNamedWorkspaces),
/// Set the container padding for the specified workspace
#[clap(arg_required_else_help = true)]
ContainerPadding(ContainerPadding),
/// Set the container padding for the specified workspace
#[clap(arg_required_else_help = true)]
NamedWorkspaceContainerPadding(NamedWorkspaceContainerPadding),
/// Set the workspace padding for the specified workspace
#[clap(arg_required_else_help = true)]
WorkspacePadding(WorkspacePadding),
/// Set the workspace padding for the specified workspace
#[clap(arg_required_else_help = true)]
NamedWorkspacePadding(NamedWorkspacePadding),
/// Set the layout for the specified workspace
#[clap(arg_required_else_help = true)]
WorkspaceLayout(WorkspaceLayout),
/// Set the layout for the specified workspace
#[clap(arg_required_else_help = true)]
NamedWorkspaceLayout(NamedWorkspaceLayout),
/// Set a custom layout for the specified workspace
#[clap(arg_required_else_help = true)]
WorkspaceCustomLayout(WorkspaceCustomLayout),
/// Set a custom layout for the specified workspace
#[clap(arg_required_else_help = true)]
NamedWorkspaceCustomLayout(NamedWorkspaceCustomLayout),
/// Add a dynamic layout rule for the specified workspace
#[clap(arg_required_else_help = true)]
WorkspaceLayoutRule(WorkspaceLayoutRule),
/// Add a dynamic layout rule for the specified workspace
#[clap(arg_required_else_help = true)]
NamedWorkspaceLayoutRule(NamedWorkspaceLayoutRule),
/// Add a dynamic custom layout for the specified workspace
#[clap(arg_required_else_help = true)]
WorkspaceCustomLayoutRule(WorkspaceCustomLayoutRule),
/// Add a dynamic custom layout for the specified workspace
#[clap(arg_required_else_help = true)]
NamedWorkspaceCustomLayoutRule(NamedWorkspaceCustomLayoutRule),
/// Clear all dynamic layout rules for the specified workspace
#[clap(arg_required_else_help = true)]
ClearWorkspaceLayoutRules(ClearWorkspaceLayoutRules),
/// Clear all dynamic layout rules for the specified workspace
#[clap(arg_required_else_help = true)]
ClearNamedWorkspaceLayoutRules(ClearNamedWorkspaceLayoutRules),
/// Enable or disable window tiling for the specified workspace
#[clap(arg_required_else_help = true)]
WorkspaceTiling(WorkspaceTiling),
/// Enable or disable window tiling for the specified workspace
#[clap(arg_required_else_help = true)]
NamedWorkspaceTiling(NamedWorkspaceTiling),
/// Set the workspace name for the specified workspace
#[clap(arg_required_else_help = true)]
WorkspaceName(WorkspaceName),
@@ -920,6 +1045,9 @@ fn main() -> Result<()> {
SubCommand::MoveToWorkspace(arg) => {
send_message(&SocketMessage::MoveContainerToWorkspaceNumber(arg.target).as_bytes()?)?;
}
SubCommand::MoveToNamedWorkspace(arg) => {
send_message(&SocketMessage::MoveContainerToNamedWorkspace(arg.workspace).as_bytes()?)?;
}
SubCommand::CycleMoveToWorkspace(arg) => {
send_message(
&SocketMessage::CycleMoveContainerToWorkspace(arg.cycle_direction).as_bytes()?,
@@ -931,6 +1059,9 @@ fn main() -> Result<()> {
SubCommand::SendToWorkspace(arg) => {
send_message(&SocketMessage::SendContainerToWorkspaceNumber(arg.target).as_bytes()?)?;
}
SubCommand::SendToNamedWorkspace(arg) => {
send_message(&SocketMessage::SendContainerToNamedWorkspace(arg.workspace).as_bytes()?)?;
}
SubCommand::CycleSendToWorkspace(arg) => {
send_message(
&SocketMessage::CycleSendContainerToWorkspace(arg.cycle_direction).as_bytes()?,
@@ -990,12 +1121,23 @@ fn main() -> Result<()> {
.as_bytes()?,
)?;
}
SubCommand::NamedWorkspaceContainerPadding(arg) => {
send_message(
&SocketMessage::NamedWorkspaceContainerPadding(arg.workspace, arg.size)
.as_bytes()?,
)?;
}
SubCommand::WorkspacePadding(arg) => {
send_message(
&SocketMessage::WorkspacePadding(arg.monitor, arg.workspace, arg.size)
.as_bytes()?,
)?;
}
SubCommand::NamedWorkspacePadding(arg) => {
send_message(
&SocketMessage::NamedWorkspacePadding(arg.workspace, arg.size).as_bytes()?,
)?;
}
SubCommand::AdjustWorkspacePadding(arg) => {
send_message(
&SocketMessage::AdjustWorkspacePadding(arg.sizing, arg.adjustment).as_bytes()?,
@@ -1027,6 +1169,11 @@ fn main() -> Result<()> {
.as_bytes()?,
)?;
}
SubCommand::NamedWorkspaceLayout(arg) => {
send_message(
&SocketMessage::NamedWorkspaceLayout(arg.workspace, arg.value).as_bytes()?,
)?;
}
SubCommand::WorkspaceCustomLayout(arg) => {
send_message(
&SocketMessage::WorkspaceLayoutCustom(
@@ -1037,6 +1184,15 @@ fn main() -> Result<()> {
.as_bytes()?,
)?;
}
SubCommand::NamedWorkspaceCustomLayout(arg) => {
send_message(
&SocketMessage::NamedWorkspaceLayoutCustom(
arg.workspace,
resolve_windows_path(&arg.path)?,
)
.as_bytes()?,
)?;
}
SubCommand::WorkspaceLayoutRule(arg) => {
send_message(
&SocketMessage::WorkspaceLayoutRule(
@@ -1048,6 +1204,16 @@ fn main() -> Result<()> {
.as_bytes()?,
)?;
}
SubCommand::NamedWorkspaceLayoutRule(arg) => {
send_message(
&SocketMessage::NamedWorkspaceLayoutRule(
arg.workspace,
arg.at_container_count,
arg.layout,
)
.as_bytes()?,
)?;
}
SubCommand::WorkspaceCustomLayoutRule(arg) => {
send_message(
&SocketMessage::WorkspaceLayoutCustomRule(
@@ -1059,17 +1225,37 @@ fn main() -> Result<()> {
.as_bytes()?,
)?;
}
SubCommand::NamedWorkspaceCustomLayoutRule(arg) => {
send_message(
&SocketMessage::NamedWorkspaceLayoutCustomRule(
arg.workspace,
arg.at_container_count,
resolve_windows_path(&arg.path)?,
)
.as_bytes()?,
)?;
}
SubCommand::ClearWorkspaceLayoutRules(arg) => {
send_message(
&SocketMessage::ClearWorkspaceLayoutRules(arg.monitor, arg.workspace).as_bytes()?,
)?;
}
SubCommand::ClearNamedWorkspaceLayoutRules(arg) => {
send_message(
&SocketMessage::ClearNamedWorkspaceLayoutRules(arg.workspace).as_bytes()?,
)?;
}
SubCommand::WorkspaceTiling(arg) => {
send_message(
&SocketMessage::WorkspaceTiling(arg.monitor, arg.workspace, arg.value.into())
.as_bytes()?,
)?;
}
SubCommand::NamedWorkspaceTiling(arg) => {
send_message(
&SocketMessage::NamedWorkspaceTiling(arg.workspace, arg.value.into()).as_bytes()?,
)?;
}
SubCommand::Start(arg) => {
let mut buf: PathBuf;
@@ -1233,7 +1419,7 @@ fn main() -> Result<()> {
)?;
}
SubCommand::FocusNamedWorkspace(arg) => {
send_message(&SocketMessage::FocusNamedWorkspace(arg.name).as_bytes()?)?;
send_message(&SocketMessage::FocusNamedWorkspace(arg.workspace).as_bytes()?)?;
}
SubCommand::CycleMonitor(arg) => {
send_message(&SocketMessage::CycleFocusMonitor(arg.cycle_direction).as_bytes()?)?;
@@ -1470,9 +1656,10 @@ fn main() -> Result<()> {
)?;
}
SubCommand::AhkAppSpecificConfiguration(arg) => {
let content = fs::read_to_string(resolve_windows_path(&arg.path)?)?;
let content = std::fs::read_to_string(resolve_windows_path(&arg.path)?)?;
let lines = if let Some(override_path) = arg.override_path {
let override_content = fs::read_to_string(resolve_windows_path(&override_path)?)?;
let override_content =
std::fs::read_to_string(resolve_windows_path(&override_path)?)?;
ApplicationConfigurationGenerator::generate_ahk(
&content,
@@ -1507,7 +1694,7 @@ fn main() -> Result<()> {
}
SubCommand::FormatAppSpecificConfiguration(arg) => {
let file_path = resolve_windows_path(&arg.path)?;
let content = fs::read_to_string(&file_path)?;
let content = std::fs::read_to_string(&file_path)?;
let formatted_content = ApplicationConfigurationGenerator::format(&content)?;
let mut file = OpenOptions::new()