1 | #! perl |
1 | #! perl |
|
|
2 | |
|
|
3 | #:META:RESOURCE:%.hotkey:string:activation hotkey keysym |
|
|
4 | |
|
|
5 | =head1 NAME |
|
|
6 | |
|
|
7 | kuake - kuake-like hotkey terminal |
|
|
8 | |
|
|
9 | =head1 EXAMPLES |
|
|
10 | |
|
|
11 | urxvt -kuake-hotkey F10 |
|
|
12 | |
|
|
13 | URxvt.kuake.hotkey: F10 |
|
|
14 | |
|
|
15 | =head1 DESCRIPTION |
|
|
16 | |
|
|
17 | A very primitive quake-console-like extension. It was inspired by a |
|
|
18 | description of how the programs C<kuake> and C<yakuake> work: Whenever the |
|
|
19 | user presses a global accelerator key (by default C<F10>), the terminal |
|
|
20 | will show or hide itself. Another press of the accelerator key will hide |
|
|
21 | or show it again. |
|
|
22 | |
|
|
23 | Initially, the window will not be shown when using this extension. |
|
|
24 | |
|
|
25 | This is useful if you need a single terminal that is not using any desktop |
|
|
26 | space most of the time but is quickly available at the press of a key. |
|
|
27 | |
|
|
28 | The accelerator key is grabbed regardless of any modifiers, so this |
|
|
29 | extension will actually grab a physical key just for this function. |
|
|
30 | |
|
|
31 | If you want a quake-like animation, tell your window manager to do so |
|
|
32 | (fvwm can do it). |
|
|
33 | |
|
|
34 | =cut |
2 | |
35 | |
3 | sub on_start { |
36 | sub on_start { |
4 | my ($self) = @_; |
37 | my ($self) = @_; |
5 | |
38 | |
6 | $self->{key} = $self->{argv}[0] || "F10"; |
39 | $self->{key} = $self->{argv}[0] || $self->x_resource ("%.hotkey") || "F10"; |
7 | |
40 | |
8 | $self->{keysym} = $self->XStringToKeysym ($self->{key}) |
41 | $self->{keysym} = $self->XStringToKeysym ($self->{key}) |
9 | or urxvt::fatal "cannot convert requested kuake wake-up key '$self->{key}' to keysym, unable to continue.\n"; |
42 | or urxvt::fatal "cannot convert requested kuake wake-up key '$self->{key}' to keysym, unable to continue.\n"; |
10 | |
43 | |
11 | $self->{keycode} = $self->XKeysymToKeycode ($self->{keysym}) |
44 | $self->{keycode} = $self->XKeysymToKeycode ($self->{keysym}) |
… | |
… | |
24 | my ($self) = @_; |
57 | my ($self) = @_; |
25 | |
58 | |
26 | # suppress initial map event |
59 | # suppress initial map event |
27 | $self->XUnmapWindow ($self->parent) |
60 | $self->XUnmapWindow ($self->parent) |
28 | if delete $self->{unmap_me}; |
61 | if delete $self->{unmap_me}; |
29 | |
62 | |
30 | () |
63 | () |
31 | } |
64 | } |
32 | |
65 | |
33 | sub on_root_event { |
66 | sub on_root_event { |
34 | my ($self, $event) = @_; |
67 | my ($self, $event) = @_; |