On Fri, 27 Jul 2018 21:19:39 -0400, Mike Squires wrote:
>I have a home desktop running Ubuntu Studio 16.04 (Supermicro X7DAE, 
>dual Xeon, ATI R430 card with two HP 1080P monitors set up as a single 
>3840x1080 pixel window.
>
>Some application windows - the "Print" dialog box when printing from 
>"evince" is an example - disappear when moved more than about 25% of
>the way to the far edge of secondary monitor.
>
>This does not happen with most applications.  If the left edge of the 
>window is visible then the window can usually be dragged to the left
>so that the entire window can be seen (and used).  This would not be a 
>problem except that some applications seem to have their own ideas
>about where to open dialog boxes like the "Print" window.
>
>This system dual-boots Windows 7 Enterprise (Ubuntu Studio is now more 
>stable for me) and I don't see this with Windows 7.
>
>I'm wondering if there is a library that has a built-in limit of the 
>width of a window that is much less than 3840.

I'm using a script for an openbox shortcut or a menu item to move the
active window, if it should hide the title bar under the top panel. For
hdspmixer and extcalc I added fbpanel main menu entries to do this
automagically. The available xfce4-panel main menus would need a

/usr/share/applications/*.desktop

file, but the xfwm4 window manager likely does provide to customize
shortcuts, too.

IOW using xdotool and wmctrl you more or less could solve any window
related issue, at least for the active window, by assigning a shortcut.

See my examples:

[rocketmouse@archlinux ~]$ grep window2unhide 
.config/openbox-profile-lcd-realignment/rc.xml -B2 -A2 
    <keybind key="C-9">
      <action name="Execute">
        <command>window2unhide</command>
      </action>
    </keybind>
[rocketmouse@archlinux ~]$ grep window2unhide .config/fbpanel/lcd-realignment 
-B3 -A1
            item {
              name = Extcalc
          icon = extcalc
              action = window2unhide "extcalc"
            }
--
            action = wing
          }
          item {
            name = window2unhide            Ctrl+9
            action = window2unhide
          }
--
    item {
      name = HDSPMixer
      icon = hdspmixer
      action = window2unhide "hdspmixer"
        }
[rocketmouse@archlinux ~]$ cat /usr/local/bin/window2unhide 
#!/bin/dash

# window2unhide 2017-08-25 Ralf Mardorf

# To configure window2unhide you could use /etc/profile.d/window2unhide.sh
#
# values of the wanted x and y position of the window
# export WINDOW2UNHIDE_X_POS=hold
# export WINDOW2UNHIDE_Y_POS=141
#
# delay required to ensure that a launched application's window is active
# export WINDOW2UNHIDE_SLEEP=1
#
# values to eliminate x and y drift of the window
#   this fix is needed for all windows
# export WINDOW2UNHIDE_X_FIX=2
# export WINDOW2UNHIDE_Y_FIX=54
#
# offset required to eliminate x and y drift of the window if x and/or y 
do/does not change
#   this offset is needed for windows that open under the top panel
#     but its unfavorable for windows that don't open under the top panel
# export WINDOW2UNHIDE_X_OFF=1
# export WINDOW2UNHIDE_Y_OFF=25

unhide_window ()
{
  # values of the wanted x and y position of the window
  case $WINDOW2UNHIDE_X_POS in
    ""|hold)
      WINDOW2UNHIDE_X_POS=$X
    ;;
  esac
  case $WINDOW2UNHIDE_Y_POS in
    "")
      WINDOW2UNHIDE_Y_POS=141
    ;;
    hold)
      WINDOW2UNHIDE_Y_POS=$Y
    ;;
  esac

  # value to eliminate x drift of the window
  case $WINDOW2UNHIDE_X_FIX in
    "")
      WINDOW2UNHIDE_X_FIX=2
    ;;
  esac

  # calculate value for x position of the window...
  case $WINDOW2UNHIDE_X_POS in
    $X) # ...if the x position doesn't change subtract the value to eliminate x 
drift and add an offset
      case $WINDOW2UNHIDE_X_OFF in
      "") 
        WINDOW2UNHIDE_X_OFF=1
      ;;
      esac
      X_POS=$(expr $WINDOW2UNHIDE_X_POS - $WINDOW2UNHIDE_X_FIX + 
$WINDOW2UNHIDE_X_OFF)
    ;;
    *) # ...if the x position does change subtract the value to eliminate x 
drift
      X_POS=$(expr $WINDOW2UNHIDE_X_POS - $WINDOW2UNHIDE_X_FIX)
    ;;
  esac

  # value to eliminate y drift of the window
  case $WINDOW2UNHIDE_Y_FIX in
    "")
      WINDOW2UNHIDE_Y_FIX=54
    ;;
  esac

  # calculate value for y position of the window...
  case $WINDOW2UNHIDE_Y_POS in
    $Y) # ...if the y position doesn't change subtract the value to eliminate y 
drift and add an offset
      case $WINDOW2UNHIDE_Y_OFF in
        "")
          WINDOW2UNHIDE_Y_OFF=25
        ;;
      esac
      Y_POS=$(expr $WINDOW2UNHIDE_Y_POS - $WINDOW2UNHIDE_Y_FIX + 
$WINDOW2UNHIDE_Y_OFF)
    ;;
    *) # ...if the x position does change subtract the value to eliminate x 
drift
      Y_POS=$(expr $WINDOW2UNHIDE_Y_POS - $WINDOW2UNHIDE_Y_FIX)
    ;;
  esac

  # move the window to new position
  wmctrl -i -r $WINDOW -b remove,maximized_vert,maximized_horz
  wmctrl -i -r $WINDOW -e "0,$X_POS,$Y_POS,$WIDTH,$HEIGHT"
}

case $1 in
  "") # unhide active window
    eval $(xdotool getwindowgeometry --shell $(xdotool getactivewindow))
    unhide_window
  ;;
  *)  # launch an application and unhide its window
    case $WINDOW2UNHIDE_SLEEP in
      "")
        WINDOW2UNHIDE_SLEEP=1
      ;;
    esac
    $@ &
    sleep $WINDOW2UNHIDE_SLEEP # ensure that the window of the launched 
application...
    eval $(xdotool getwindowgeometry --shell $(xdotool getactivewindow))
    wmctrl -l | grep $(printf '%x\n' $WINDOW) | grep -qi $1 # ...is the active 
window
    case $? in
      0)
        unhide_window
      ;;
    esac
  ;;
esac
exit
[rocketmouse@archlinux ~]$ cat /etc/profile.d/window2unhide.sh
export WINDOW2UNHIDE_SLEEP=1.2

-- 
ubuntu-studio-users mailing list
ubuntu-studio-users@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-studio-users

Reply via email to