… | |
… | |
128 | } |
128 | } |
129 | () |
129 | () |
130 | } |
130 | } |
131 | |
131 | |
132 | sub my_resource { |
132 | sub my_resource { |
133 | my $self = shift; |
133 | $_[0]->x_resource ("%.$_[1]") |
134 | $self->x_resource ("$self->{name}.$_[0]"); |
|
|
135 | } |
134 | } |
136 | |
135 | |
137 | # turn a rendition spec in the resource into a sub that implements it on $_ |
136 | # turn a rendition spec in the resource into a sub that implements it on $_ |
138 | sub parse_rend { |
137 | sub parse_rend { |
139 | my ($self, $str) = @_; |
138 | my ($self, $str) = @_; |
… | |
… | |
150 | } |
149 | } |
151 | |
150 | |
152 | sub on_start { |
151 | sub on_start { |
153 | my ($self) = @_; |
152 | my ($self) = @_; |
154 | |
153 | |
155 | ($self->{name} = __PACKAGE__) =~ s/.*:://; |
|
|
156 | $self->{name} =~ tr/_/-/; |
|
|
157 | $self->{launcher} = $self->my_resource ("launcher") || $self->x_resource("url-launcher") || "sensible-browser"; |
154 | $self->{launcher} = $self->my_resource ("launcher") || $self->x_resource("url-launcher") || "sensible-browser"; |
158 | |
155 | |
159 | $self->{urls} = []; |
156 | $self->{urls} = []; |
160 | $self->{showing} = 0; |
157 | $self->{showing} = 0; |
161 | $self->{button} = 2; |
158 | $self->{button} = 2; |
… | |
… | |
170 | } elsif($mod eq "S") { |
167 | } elsif($mod eq "S") { |
171 | $self->{state} |= urxvt::ShiftMask; |
168 | $self->{state} |= urxvt::ShiftMask; |
172 | } elsif($mod eq "M") { |
169 | } elsif($mod eq "M") { |
173 | $self->{state} |= $self->ModMetaMask; |
170 | $self->{state} |= $self->ModMetaMask; |
174 | } elsif($mod ne "-" && $mod ne " ") { |
171 | } elsif($mod ne "-" && $mod ne " ") { |
175 | warn("$mod is invalid in $self->{name}<$self->{argv}[0]>\n"); |
172 | warn("$mod is invalid in $self->{_name}<$self->{argv}[0]>\n"); |
176 | } |
173 | } |
177 | } |
174 | } |
178 | } |
175 | } |
179 | |
176 | |
180 | my @defaults = ($url); |
177 | my @defaults = ($url); |