[xubuntu-users] Force app to launch maximized?

Ralf Mardorf silver.bullet at zoho.com
Sun Mar 5 19:11:58 UTC 2017


Hi,

I don't know what related features are or aren't provided by Xfce.
Assuming it shouldn't provide what you want, then

1. take a look at the app itself.

   For example:

   [root at archlinux ~]# xfce4-terminal --help | tail -9 
   Window Options:
     --display=display; --geometry=geometry; --role=role; --drop-down;
     --startup-id=string; -I, --icon=icon; --fullscreen; --maximize;
     --show-menubar, --hide-menubar; --show-borders, --hide-borders;
     --show-toolbar, --hide-toolbar; --show-scrollbar, --hide-scrollbar;
     --font=font; --zoom=zoom

   See the xfce4-terminal man page for full explanation of the options
   above.

2. if an app shouldn't provide geometry options use tools to handle
   windows. For your purpose  xdotool  and  wmctrl  are helpful.

I'm using two scripts, one two resize the active window and another to
display information about the window geometry. Using those tools
requires minimal shell scripting skills.

   Examples:

   [root at archlinux ~]# cat /usr/local/bin/win75
   #!/bin/bash
   eval $(xdotool getwindowgeometry --shell $(xdotool getactivewindow))
   X_FIX=$(grep X_FIX ~/.rocketmouse/win75/config | cut -d"=" -f2)
   Y_FIX=$(grep Y_FIX ~/.rocketmouse/win75/config | cut -d"=" -f2)
   ((XX=X-X_FIX))
   ((YY=Y-Y_FIX))
   WIDTH=$(calc "int($WIDTH*0.75)")
   case $1 in
     "") HEIGHT=$(calc "int($HEIGHT*0.75)");;
   esac
   echo "x:$X-$X_FIX=$XX/y:$Y-$Y_FIX=$YY"
   wmctrl -i -r $WINDOW -b remove,maximized_vert,maximized_horz
   wmctrl -i -r $WINDOW -e "0,$XX,$YY,$WIDTH,$HEIGHT"
   eval $(xdotool getwindowgeometry --shell $(xdotool getactivewindow))
   echo "x:$X-$X_FIX=$XX/y:$Y-$Y_FIX=$YY"
   exit
   [root at archlinux ~]# cat /usr/local/bin/wing 
   #!/bin/dash
   xdotool getwindowgeometry --shell $(xdotool getactivewindow) | zenity --text-info
   exit

All menu editors are useless crap, you better edit the desktop files
yourself. Apart from editing desktop files, I prefer to use a good
panel, providing a menu I could edit by the panel's configuration file,
independent from the freedesktop.org thingy, e.g. fbpanel.

An example desktop file:

[root at archlinux ~]# grep -v
Name /usr/share/applications/xfce4-terminal.desktop | grep -v Comment
[Desktop Entry] Version=1.0
Exec=xfce4-terminal
Icon=utilities-terminal
Terminal=false
Type=Application
Categories=GTK;System;TerminalEmulator;
StartupNotify=true

Take a look at other desktop files and especially at freedesktop.org to
learn what options are provided and where the files could be located.

Regards,
Ralf





More information about the xubuntu-users mailing list