Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Resize ConEmu split tabs with the mouse


  • Please log in to reply
2 replies to this topic
Zequez
  • Members
  • 7 posts
  • Last active: Dec 27 2014 07:43 PM
  • Joined: 04 Oct 2011

Well, ConEmu has this nifty feature to separate the console in multiple simultaneous divisions with different consoles. The problem is that to resize them you have to use a keyboard shortcut to move up/down/left/right by 1 pixel at a time. It's terribly impractical. So I just created this script that let you resize the tabs by dragging with the middle click.

#SingleInstance Force
#IfWinActive Cmder
#NoEnv

SetWorkingDir %A_ScriptDir%

  movementSensitivity := 15 ; sensitivity to mouse movement (lower is more sensitive)
  intervalPeriod := 25 ; timer period

  mouseMovementY := 0
  mouseMovementX := 0

  movementTriggered := false
return

MoveStart:
  Send {Shift down}{LWin down}
return
MoveEnd:
  Send {LWin up}{Shift up}
return
MoveLeft:
  Send {Left}
return
MoveRight:
  Send {Right}
return
MoveUp:
  Send {Up}
return
MoveDown:
  Send {Down}
return

MButton:: GoSub StartWatching
*MButton Up:: GoSub StopWatching

WatchCursor:
  MouseGetPos, wheelingNewMouseX, wheelingNewMouseY

  mouseMovementY := mouseMovementY + (wheelingNewMouseY - wheelingMouseY)
  mouseMovementX := mouseMovementX + (wheelingNewMouseX - wheelingMouseX)
  
  countY := Round(mouseMovementY/movementSensitivity)
  countX := Round(mouseMovementX/movementSensitivity)
  absCountX := abs(countX)
  absCountY := abs(countY)
  counted := countX != 0 or countY != 0

  ; MouseMove wheelingMouseX, wheelingMouseY
  wheelingMouseX := wheelingNewMouseX
  wheelingMouseY := wheelingNewMouseY
  
  if (counted) {
    movementTriggered := true
  }

  if (countY != 0) {
    mouseMovementY := 0
  }

  if (countX != 0) {
    mouseMovementX := 0
  }

  if (countY > 0) {
    Loop %absCountY% {
      GoSub MoveDown
    }
  }
  else if (countY < 0) {
    Loop %absCountY% {
      GoSub MoveUp
    }
  }

  if (countX > 0) {
    Loop %absCountX% {
      GoSub MoveRight
    }
  }
  else if (countX < 0) {
    Loop %absCountX% {
      GoSub MoveLeft
    }
  }
return

StartWatching:
  GoSub MoveStart
  movementTriggered := false
  mouseMovementY := 0
  mouseMovementX := 0
  MouseGetPos, wheelingMouseX, wheelingMouseY
  SetTimer WatchCursor, %intervalPeriod%
return

StopWatching:
  GoSub MoveEnd
  SetTimer WatchCursor, Off
  if !movementTriggered
    Send {MButton up}
return

The only catch is that you have to change the shortcut to Shift+Win+Arrows instead of AppMenu+Arrows, since the latter didn't work for some reason.

 

I guess is going to be obsolete once the feature is implemented by Maximus (the creator of ConEmu) but until then, enjoy.



Maximus5
  • Members
  • 2 posts
  • Last active: Nov 06 2014 08:20 AM
  • Joined: 25 Oct 2012

Hm. Split dragging was already implemented.



Zequez
  • Members
  • 7 posts
  • Last active: Dec 27 2014 07:43 PM
  • Joined: 04 Oct 2011

Hm. Split dragging was already implemented.

 

Hey! Hello there!

 

I saw there was an option for "Resize panel with mouse" but I never managed to make it work.

 

I checked the autoupdate and it was set on the stable version, I changed it to preview, it updated and now it works beautifully!

 

I guess this post was made obsolete rather quickly haha.