-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwindow.pl
More file actions
57 lines (49 loc) · 1.21 KB
/
Copy pathwindow.pl
File metadata and controls
57 lines (49 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# revok
package window;
use strict;
use Plugins;
# Register plugin
Plugins::register("window", "kore windows management", \&on_unload, \&on_reload);
my $commands_hooks = Commands::register(
['min', 'minimize kore window', \&w_manage],
['max', 'restore kore window', \&w_manage]
);
my $hw; # global
get_hw(); # avoid that small delay later.
sub get_hw {
if (!$hw){
require Win32::API;
my $gct = new Win32::API('kernel32', 'GetConsoleTitle', 'PN', 'N');
my $sct = new Win32::API('kernel32', 'SetConsoleTitle', 'P', 'N');
my $fw = new Win32::API('user32', 'FindWindow', 'PP', 'N');
my $bkpt = " " x 1024;
$gct->Call($bkpt, 1024);
my $ttitle = time-rand(999);
$sct->Call($ttitle);
sleep(0.5);
$hw = $fw->Call(0, $ttitle);
$sct->Call($bkpt);
}
return $hw;
}
sub w_manage {
require Win32::API;
use constant SW_HIDE => 0;
use constant SW_SHOWNORMAL => 1;
use constant SW_MINIMIZE => 6;
my $ShowWindow = new Win32::API('user32', 'ShowWindow', 'NN', 'N');
$ShowWindow->Call(get_hw,
{
'min' => SW_MINIMIZE,
'max' => SW_SHOWNORMAL
}->{$_[0]}
);
}
sub on_unload {
Commands::unregister($commands_hooks);
undef $commands_hooks;
}
sub on_reload {
&on_unload;
}
1;