Skip to content

Commit 263115a

Browse files
author
Yousef El-Zebdeh
committed
Three window level actions
Added three window level functions to MMAppController. These allow the window to float on top, stay on bottom or revert back to normal status. I have also added the commands to the Actions.plist. The commands were added using the menu.vim file.
1 parent 6127f5c commit 263115a

4 files changed

Lines changed: 36 additions & 0 deletions

File tree

runtime/menu.vim

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ if has("gui_macvim")
8080
an <silent> 9998.350 Window.Select\ Previous\ Tab :tabprevious<CR>
8181
an 9998.360 Window.-SEP2- <Nop>
8282
an <silent> 9998.370 Window.Bring\ All\ To\ Front <Nop>
83+
an <silent> 9998.380 Window.Stay\ On\ Bottom <Nop>
84+
an <silent> 9998.390 Window.Stay\ On\ Top <Nop>
85+
an <silent> 9998.400 Window.Stay\ Level\ Normal <Nop>
8386
endif
8487

8588
" Help menu
@@ -1255,6 +1258,9 @@ if has("gui_macvim")
12551258
macm Window.Select\ Next\ Tab key=<D-}>
12561259
macm Window.Select\ Previous\ Tab key=<D-{>
12571260
macm Window.Bring\ All\ To\ Front action=arrangeInFront:
1261+
macm Window.Stay\ On\ Bottom action=stayOnBottom:
1262+
macm Window.Stay\ On\ Top action=stayOnTop:
1263+
macm Window.Stay\ Level\ Normal action=stayLevelNormal:
12581264

12591265
macm Help.MacVim\ Help key=<D-?>
12601266
macm Help.MacVim\ Website action=openWebsite:

src/MacVim/Actions.plist

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,11 @@
7272
<string></string>
7373
<key>zoomAll:</key>
7474
<string></string>
75+
<key>stayOnBottom:</key>
76+
<string></string>
77+
<key>stayOnTop:</key>
78+
<string></string>
79+
<key>stayLevelNormal:</key>
80+
<string></string>
7581
</dict>
7682
</plist>

src/MacVim/MMAppController.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,8 @@
5353
- (IBAction)openWebsite:(id)sender;
5454
- (IBAction)showVimHelp:(id)sender;
5555
- (IBAction)zoomAll:(id)sender;
56+
- (IBAction)stayOnBottom:(id)sender;
57+
- (IBAction)stayOnTop:(id)sender;
58+
- (IBAction)stayLevelNormal:(id)sender;
5659

5760
@end

src/MacVim/MMAppController.m

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,6 +1196,27 @@ - (IBAction)zoomAll:(id)sender
11961196
[NSApp makeWindowsPerform:@selector(performZoom:) inOrder:YES];
11971197
}
11981198

1199+
- (IBAction)stayOnBottom:(id)sender
1200+
{
1201+
ASLogDebug(@"Stay on bottom");
1202+
NSWindow *keyWindow = [NSApp keyWindow];
1203+
[keyWindow setLevel:kCGDesktopIconWindowLevel +1];
1204+
}
1205+
1206+
- (IBAction)stayOnTop:(id)sender
1207+
{
1208+
ASLogDebug(@"Stay on top");
1209+
NSWindow *keyWindow = [NSApp keyWindow];
1210+
[keyWindow setLevel:NSFloatingWindowLevel];
1211+
}
1212+
1213+
- (IBAction)stayLevelNormal:(id)sender
1214+
{
1215+
ASLogDebug(@"Stay level normal");
1216+
NSWindow *keyWindow = [NSApp keyWindow];
1217+
[keyWindow setLevel:NSNormalWindowLevel];
1218+
}
1219+
11991220
- (IBAction)coreTextButtonClicked:(id)sender
12001221
{
12011222
ASLogDebug(@"Toggle CoreText renderer");

0 commit comments

Comments
 (0)