#!/usr/bin/perl use strict; use warnings; =pod =head1 NAME lay-api-browser - lay out a browser for javadoc APIs =cut use lib "$ENV{HOME}/.config", '/etc/xdg'; # for desktop config files use lib '/home/mike/code/textbender/x/repo'; { use screenpager::Config_1 (); use textbender::a::b::Function qw( join_clean system_or_print ); use Zelea::Desktop qw( $MONITOR_SCREEN ); use Zelea::Lay qw( screen screen_x ); use Zelea::WindowManagement qw ( demax net_client_list_matching net_wm_frame_strut reposition_window ); Zelea::Lay::shift_options(); Zelea::Lay::pre_ensure(); # - - - # system_or_print join_clean( ' ', 'firefox -browser -P default', @ARGV, '&' ) and die; system_or_print join_clean( ' ', 'firefox', @ARGV, '&' ) and die; my $screen = screen(); my $screen_config_HASH = $screenpager::Config_1::screen[$screen]; sleep 1; # or 3, to avoid polls while matching my @window = net_client_list_matching 'Mozilla Firefox$'; my $window = $window[$#window]; demax( $window ); # Firefox opens maximized if previous instances are/were maximized my $frame_left; my $frame_right; my $frame_top; my $frame_bottom; ( $frame_left, $frame_right, $frame_top, $frame_bottom ) = net_wm_frame_strut( $window ); my $left_margin = 100; my $right_margin = 70; my $x = screen_x() + $left_margin; my $width = $$screen_config_HASH{width} - $left_margin - $right_margin; my $bottom_margin = 100; my $y = 0; my $height = $$screen_config_HASH{height} - $bottom_margin; reposition_window ( $window, $x, $y, $width - $frame_left - $frame_right, $height - $frame_top - $frame_bottom ); if( $screen != $MONITOR_SCREEN ) { system_or_print "wmctrl-zelea -i -r $window -b add,_OB_WM_STATE_UNDECORATED,maximized_vert" and die; system_or_print "wmctrl-zelea -i -r $window -b add,maximized_horz" and die; } # - - - Zelea::Lay::post_ensure(); } __END__ =pod =head1 AUTHOR Michael Allan =cut