1 |
package Frey::Editor; |
package Frey::Editor; |
2 |
use Moose; |
use Moose; |
3 |
|
|
4 |
extends 'Frey::ClassLoader'; |
extends 'Frey::Class::Loader'; |
5 |
|
|
6 |
=head1 DESCRIPTION |
=head1 DESCRIPTION |
7 |
|
|
8 |
Support for local editor invocation from web |
Support for local editor invocation from web |
9 |
|
|
10 |
<a href="/editor+$path+$line" target="editor">$class</a> |
<a target="editor" href="/editor+$path+$line">$class</a> |
11 |
|
|
12 |
=head2 url |
=head2 url |
13 |
|
|
23 |
|
|
24 |
=cut |
=cut |
25 |
|
|
26 |
|
sub switch_screen { |
27 |
|
my $cmd = 'xdotool key super+Tab'; |
28 |
|
warn "# switch_screen $cmd"; |
29 |
|
system $cmd; |
30 |
|
} |
31 |
|
|
32 |
sub command { |
sub command { |
33 |
my ( $self, $url ) = @_; |
my ( $self, $url ) = @_; |
34 |
$url =~ url_regex; |
$url =~ url_regex; |
38 |
$path = $self->class_path( $path ) || $path if ! -e $path; |
$path = $self->class_path( $path ) || $path if ! -e $path; |
39 |
my $cmd = "$editor $path +$line"; |
my $cmd = "$editor $path +$line"; |
40 |
warn "# $url -> system $cmd"; |
warn "# $url -> system $cmd"; |
41 |
return $cmd; |
$self->switch_screen; |
42 |
|
system $cmd; |
43 |
|
$self->switch_screen; |
44 |
} |
} |
45 |
|
|
46 |
1; |
1; |