You are not logged in.
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
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.
Online
Thanks golinux. I'm using Mate. The "Save Current Settings as Default" option didn't help. Any other ideas?
Offline
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
@arnaiz . . . Note that fullscreen is different than maximized - no visible controls.
Online
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!
Online
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!
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.!
Offline
@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.
Online
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
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! Pretty nice!
Blessed and forgiven in the Pacific Northwest of the U.S.!
Offline
@GNUser, it isn't working for me. When I open Atril (from the desktop icon) it still doesn't open maximized.
Offline
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
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
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
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
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.
Last edited by Ron (2018-10-28 19:42:26)
Offline
Yes, removing the "sleep 0.5" line entirely is the way to make the script work as quickly as possible.
You're welcome
Offline
I made small improvements that allow the script to be used without any alteration for any app
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