The officially official Devuan Forum!

You are not logged in.

#1 2018-10-27 22:03:01

Ron
Member
Registered: 2018-04-22
Posts: 516  

[SOLVED] How to get these 2 apps to open maximized?

There are two apps, specifically AbiWord and Atril, that don't open in a maximized window. What can I do to get them to always open maximized? I did a search but came up empty. And, closing them while maximized will not make them open next time maxed.

Last edited by Ron (2018-10-28 19:41:21)

Offline

#2 2018-10-28 00:53:46

golinux
Administrator
Registered: 2016-11-25
Posts: 3,305  

Re: [SOLVED] How to get these 2 apps to open maximized?

Hmmm . . . I use Atril on Xfce and just opened a PDF.  Maxed it. Closed it. Opened it again and it popped up maximized.  Opened a different PDF and it opened maximized also.  I checked in the Menu and under Edit the last option is Save Current Settings as Default.  Under view there is also an option for fullscreen which is a bit different than maximized but you might play with it.  Sorry, don't have AbiWord installed.  What DE are you using?  That could possibly make a difference too.

Offline

#3 2018-10-28 01:11:03

Ron
Member
Registered: 2018-04-22
Posts: 516  

Re: [SOLVED] How to get these 2 apps to open maximized?

Thanks golinux. I'm using Mate. The "Save Current Settings as Default" option didn't help. Any other ideas?

Offline

#4 2018-10-28 01:15:06

arnaiz
Member
From: Leon
Registered: 2018-10-28
Posts: 28  
Website

Re: [SOLVED] How to get these 2 apps to open maximized?

Following Abiwords help and man page, Abiword hasn't that option. You can force the geometry to your screen resolution but that isn't full screen mode.

Atril has that option, but you must specify a document to start in fullscreen mode. To open automatically on full screen from file manager, you can do a simple script like this:

#!/bin/bash
[[ -f $1 ]] && atril --fullscreen $1

and tell your file manager always open pdf and other files using your script.

Another solution, you can automate a key and mouse events using xdotool

try:

atril & sleep 1 && xdotool key F11
abiword & sleep 1 && xdotool key F11

Offline

#5 2018-10-28 01:47:28

arnaiz
Member
From: Leon
Registered: 2018-10-28
Posts: 28  
Website

Re: [SOLVED] How to get these 2 apps to open maximized?

a more elegant solution for atril (works for me on Mate)

dconf write /org/mate/atril/default/fullscreen true
dconf update

Last edited by arnaiz (2018-10-28 01:47:47)

Offline

#6 2018-10-28 01:56:28

golinux
Administrator
Registered: 2016-11-25
Posts: 3,305  

Re: [SOLVED] How to get these 2 apps to open maximized?

@arnaiz . . . Note that fullscreen is different than maximized - no visible controls.

Offline

#7 2018-10-28 02:02:05

golinux
Administrator
Registered: 2016-11-25
Posts: 3,305  

Re: [SOLVED] How to get these 2 apps to open maximized?

Ron wrote:

Thanks golinux. I'm using Mate. The "Save Current Settings as Default" option didn't help. Any other ideas?

I suspect it's a Mate/Gnome thing rather than an application thing because it's working here even after a long idle time.  Check the Mate window manager options.  Also look for a Mate Settings Editor and find those apps.  I can't remember much of my Gnome2 days  . . . that wasn't long after Y2K.  LOL!

Offline

#8 2018-10-28 02:34:53

willbprogz227
Member
Registered: 2018-09-06
Posts: 31  

Re: [SOLVED] How to get these 2 apps to open maximized?

While I've not used it, gdevilspie is supposed to allow you to make geometry and positioning rules for windows.  I'm uncertain if it has any issues running alongside with Mate or other desktop environments but it's worth a shot! smile

The Atril and AbiWord window size thing is irritating to me too, but I use JWM and can make window rules in its config file then windows will always appear the way I want.

Last edited by willbprogz227 (2018-10-28 05:04:24)


Blessed and forgiven in the Pacific Northwest of the U.S.! smile

Offline

#9 2018-10-28 02:50:12

golinux
Administrator
Registered: 2016-11-25
Posts: 3,305  

Re: [SOLVED] How to get these 2 apps to open maximized?

@willbprogz227 . . . You jogged my memory . . . A very long time ago, I used devilspie because of the lack of window management options in gnome2.   Eventually I dropped it - it was rather fussy and sometimes didn't work.  Perhaps it has improved since   I ended up using compiz to do the task which was more than a bit of overkill but great fun for a while.

Offline

#10 2018-10-28 03:30:59

GNUser
Member
Registered: 2017-03-16
Posts: 568  

Re: [SOLVED] How to get these 2 apps to open maximized?

Ron, another option is to use a wrapper script. I tested this with both atril and abiword and it works as advertised. It should work with any graphical application.

For atril, create /usr/local/bin/atril with this in it:

#!/bin/sh

/usr/bin/atril "$@" &
child_pid=$!

# wait for child to have a window
while true; do
	wmctrl -lp | awk '{print $3}' | grep $child_pid && break
	sleep 0.5
done

# get windowid of child
child_windowid=$(wmctrl -lp | awk "\$3 == $child_pid { print \$1 }")

# maximize child's window
wmctrl -ir $child_windowid -b add,maximized_vert,maximized_horz

How it works is basically this: Run target application, wait for a window associated with that application to exist, maximize that window. The wmctrl utility needs to be installed for this to work, of course.

For abiword, create /usr/local/bin/abiword identical to above except replace atril with abiword in the third line.

Last edited by GNUser (2018-10-28 03:38:00)

Offline

#11 2018-10-28 03:35:13

willbprogz227
Member
Registered: 2018-09-06
Posts: 31  

Re: [SOLVED] How to get these 2 apps to open maximized?

GNUser wrote:

For atril, create /usr/local/bin/atril with this in it:

#!/bin/sh

/usr/bin/atril "$@" &
child_pid=$!

# wait for child to have a window
while true; do
	wmctrl -lp | awk '{print $3}' | grep $child_pid && break
	sleep 0.5
done

# get windowid of child
child_windowid=$(wmctrl -lp | awk "\$3 == $child_pid { print \$1 }")

# maximize child's window
wmctrl -ir $child_windowid -b add,maximized_vert,maximized_horz

Wow GNUser, thanks for that! big_smile  Pretty nice!


Blessed and forgiven in the Pacific Northwest of the U.S.! smile

Offline

#12 2018-10-28 04:25:02

Ron
Member
Registered: 2018-04-22
Posts: 516  

Re: [SOLVED] How to get these 2 apps to open maximized?

@GNUser, it isn't working for me. When I open Atril (from the desktop icon) it still doesn't open maximized.

Offline

#13 2018-10-28 05:01:18

ralph.ronnquist
Administrator
From: Battery Point, Tasmania, AUS
Registered: 2016-11-30
Posts: 1,236  

Re: [SOLVED] How to get these 2 apps to open maximized?

If you feel like using the "big stick", then you simply
a) install the devilspie package, then
b) put

(if (is (application_name) "Atril Document Viewer") (maximize))

into the file $HOME/.devilspie/maximize_atril.ds, then
c) run devilspie (e.g. via a session application startup thingy).

Thereafter, supposedly, atril will be maximized when started.

Offline

#14 2018-10-28 11:35:31

GNUser
Member
Registered: 2017-03-16
Posts: 568  

Re: [SOLVED] How to get these 2 apps to open maximized?

Ron, it works for me from desktop shortcut as well.

Did you remember to make the script executable? If it isn't, the first executable atril found in your PATH is the real one instead of our wraparound script, causing our fix to fail silently. Please do $ sudo chmod a+x /usr/local/bin/atril. Also, did you remember to $ sudo apt install wmctrl? Try these two, then give the desktop shortcut another shot.

Last edited by GNUser (2018-10-28 12:24:40)

Offline

#15 2018-10-28 15:49:28

Ron
Member
Registered: 2018-04-22
Posts: 516  

Re: [SOLVED] How to get these 2 apps to open maximized?

Thanks GNUser, sudo chmod a+x /usr/local/bin/atril did the trick. There's just one little annoyance . . . when I open Atril (and AbiWord), it first opens unmaximized for a split second, before going maximized. But I can live with that (I'm guessing there's nothing that can be done about that).

Last edited by Ron (2018-10-28 15:56:39)

Offline

#16 2018-10-28 16:19:59

GNUser
Member
Registered: 2017-03-16
Posts: 568  

Re: [SOLVED] How to get these 2 apps to open maximized?

Changing sleep 0.5 to something smaller--e.g. sleep 0.1--will decrease the delay. Or, to really make the maximization take place as fast as possible, you can eliminate the sleep 0.5 line altogether.

Glad I could help. Enjoy!

Last edited by GNUser (2018-10-28 16:30:30)

Offline

#17 2018-10-28 19:40:30

Ron
Member
Registered: 2018-04-22
Posts: 516  

Re: [SOLVED] How to get these 2 apps to open maximized?

I totally deleted the line, "sleep 0.5" and the line itself. That was the right way to do it, right? It seems to have made the delay a (very) tad bit shorter.

Thanks GNUser. smile

Last edited by Ron (2018-10-28 19:42:26)

Offline

#18 2018-10-29 13:40:09

GNUser
Member
Registered: 2017-03-16
Posts: 568  

Re: [SOLVED] How to get these 2 apps to open maximized?

Yes, removing the "sleep 0.5" line entirely is the way to make the script work as quickly as possible.

You're welcome smile

Offline

#19 2018-11-15 16:21:05

GNUser
Member
Registered: 2017-03-16
Posts: 568  

Re: [SOLVED] How to get these 2 apps to open maximized?

I made small improvements that allow the script to be used without any alteration for any app smile

For any app foo, just create /usr/local/bin/foo with this in it:

#!/bin/sh

# This is a wrapper script that immediately maximizes the target application
# after its window appears. Script should be /usr/local/bin/foo where foo is 
# the name of the target application. 

app_name="$(basename "$0")"
app_path="$(which -a "$app_name" | tail -n 1)"
"$app_path" "$@" &
app_pid=$!

# wait for app to have a window
while true; do
	wmctrl -lp | awk '{print $3}' | grep $app_pid && break
	sleep 0.1
done

# get windowid of app
app_windowid=$(wmctrl -lp | awk "\$3 == $app_pid { print \$1 }")

# maximize app's window
wmctrl -ir $app_windowid -b add,maximized_vert,maximized_horz

Don't forget to make the script executable. All the script needs to work is its own name.

Offline

Board footer