Xfce Forum

Sub domains
 

You are not logged in.

#1 2016-05-30 12:45:57

PIKNIK
Member
Registered: 2016-05-30
Posts: 5

Disable non-maximize windows at move through the mouse

Hello!

Sorry for my poor explanation of the problem. I have great difficulty can describe it in their own language, and even more difficult in English. But I will try..

I have xfce4 4.12 on the Xubuntu 15.04

For this system have feature: if window is maximize status - I can return normal size windows with the help of the mouse. I move window of maximize status down and end.

Something similar appeared in Windows 7 (or Windows Vista) for easy using interface. In Windows XP that did not happen.

Buttons "Minimize" and "Maximize" I hide. But users does not matter may withdraw from the program of fillscreen.

I need disable this feature like XP. Wherein disable this need with help console (command or edit configure file), but not "xfce4-settings-manager". This my limitation for now.

Please, help my for this problem.

If you not understood my - see this to my and I will try to describe it in pictures.

Thanks!

Last edited by PIKNIK (2016-05-30 13:38:35)

Offline

#2 2016-05-30 15:32:33

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,950

Re: Disable non-maximize windows at move through the mouse

Hello and welcome.

Perhaps you could include some pictures to show the problem.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2016-05-31 07:58:58

PIKNIK
Member
Registered: 2016-05-30
Posts: 5

Re: Disable non-maximize windows at move through the mouse

No problem.
Listen:
I have Firefox in maximize for users. I need to user can close only. (see screen1).

screen1


But if user trying to move this window - his change your size (see screen2).

screen2


From the above two problems are obtained:
1) User confused and starts to panic
2) Maximize this windows back do not is impossible as there is no button "Maximize".

Last edited by PIKNIK (2016-05-31 09:37:18)

Offline

#4 2016-05-31 10:29:42

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,950

Re: Disable non-maximize windows at move through the mouse

Go to Settings Manager > Window Manager. On the Style tab, on the right side, move the Maximize button from the "Hidden" section to the "Active" section. It will then show up on the window.

You can also right-click the window title-bar and choose Maximize.

You can also use the Alt-F10 keyboard shortcut.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#5 2016-05-31 16:52:15

alcornoqui
Member
Registered: 2014-07-28
Posts: 831

Re: Disable non-maximize windows at move through the mouse

I think the OP has something like a kiosk or public computer where he wants the user to only be able to close the window and nothing else (not minimizing or resizing). I don't know how to do it but I think ToZ will.

Users can maximize/minimize the window with a double click on the titlebar, through the option in Settings Manager > Window Manager > Advanced > Action with double click > Maximize window

If I misunderstood, maybe you can write the question again in your original language?

Offline

#6 2016-06-01 11:29:55

PIKNIK
Member
Registered: 2016-05-30
Posts: 5

Re: Disable non-maximize windows at move through the mouse

This is don't kiosk. Just very similar to it.

This is PXE-image on Ubuntu for diskless PC. Users works 99.999% time on the Firefox. If user close Firefox via button "Close" - computer starting shutdown-script and power off. Other programs user not use.

Problem next: user can accidentally try move window and Firefox becomes in non-maximize mode.

I do not want users can return windows in maximize independently. I need to users was not possible to move the window.

And one:
I need solve this quest via console only. No alternative.


Russian:
Мне нужно, чтобы Firefox был развернут на весь экран и пользователь мог только закрыть данную программу. Закрытие Firefox в моём случае запускает скрипт выключение рабочей станции.

Но суть в том, что пользователи бывают разные и парачка обязательно попробуют схватить окно мышкой за плашку и потащить вниз. При этом окно поддаётся перетаскиванию и выходит из режима "на весь экран". Я хочу отключить эту возможность перетаскивать мышью окна, если окно в режиме "на весь экран".  Как в WinXP было в своё время.

Ставить обратно кнопку изменения размера окна рядом с кнопкой "Закрыть" не вариант - тогда пользователи будут сами выводить Firefox из "на весь экран".

Одно условие: у меня больше нет инстумента для того, чтобы зайти в графические настройки xfce. Я их удалил для экономии места. Поэтому данную проблему мне нужно решить с помощью консоли (ввести какую-нибудь команду или подредактировать какой-либо файл).

Вот так.

Last edited by PIKNIK (2016-06-01 11:32:54)

Offline

#7 2016-06-01 13:54:04

alcornoqui
Member
Registered: 2014-07-28
Posts: 831

Re: Disable non-maximize windows at move through the mouse

Ok, I think the question is clear now... Unfortunately, I don't know the solution, hopefully someone will, sorry!

Offline

#8 2016-06-01 13:54:39

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,950

Re: Disable non-maximize windows at move through the mouse

nice catch, @alcornoqui.

The problem here is that the main purpose of the window manager (xfwm4), is to allow the user to manage windows (maximize, minimize, resize, etc). I don't believe that what you are asking is possible as a configuration item of the window manager.

There are options though.

One is to have a program running in the background that checks the current state of the window and if it is not maximized, then force a maximize. So in effect, if the user unmaximizes the window, it will be automatically maximized. If this is feasible to you, here is a script that will do this:

#!/bin/bash
### script to force a specific window to remain maximized
### requires wmctrl

### maximized window dimensions
### to get these run, while firefox is maximized: wmctrl -lxG | grep Firefox | awk '{print "WIDTH="$5" HEIGHT="$6}'
WIDTH=1366
HEIGHT=716

### window to be forced maximized - enter unique part of window title
WINDOW=Firefox

###
### Do not change anything below
###

### create a lock file to prevent multiple copies of this script from running simultaneously (which would be bad)
lockfile=/tmp/.force_fs.$USER.lockfile
if ( set -o noclobber; echo "locked" > "$lockfile") 2> /dev/null; then
  	trap 'rm -f "$lockfile"; exit $?' INT TERM EXIT
  	echo "force_fsDEBUG: Locking succeeded" >&2

    ### create an endless loop
    while true
    do
        ### loop timeout value
	    sleep 1

        ### get information about the window (id, current width, current height)
	    read id width height <<< "$(wmctrl -lxG | grep $WINDOW | awk '{print $1" " $5" " $6}')"
	    
	    ### only evaluate if window is open
	    if [ "$id" != "" ]
	    then

            ### if the current window dimensions do not match the maximized dimension, maximize
	        if [ $width != $WIDTH ] || [ $height != $HEIGHT ]
	        then
		        wmctrl -i -r $id -b add,maximized_vert,maximized_horz
	        fi
        fi
    done

### can't create lockfile - notify user and quit
else
  	echo "force_fsDEBUG: Lock failed, check for existing process and/or lock file and delete - exiting." >&2
  	exit 1
fi			

exit 0

You will need to edit the WIDTH and HEIGHT variables in that script. These will be specific to every user account. To do so, with firefox maximized, run the command:

wmctrl -lxG | grep Firefox | awk '{print "WIDTH="$5" HEIGHT="$6}'

...and change the values in the script to match.

Then place the script in the user's ~/bin directory (create the directory if it doesn't exist), name the script ~/force_fs and make it executable. Finally, make it autostart by creating an entry for it in Settings Manager > Session and Startup > Autostart applications.

Log out and back in again to test.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#9 2016-06-01 14:52:32

PIKNIK
Member
Registered: 2016-05-30
Posts: 5

Re: Disable non-maximize windows at move through the mouse

Hm....

Nice crutch. I think this will work.

I will try and write the result of this week.

Very thanks!

Offline

#10 2016-06-01 15:15:15

alcornoqui
Member
Registered: 2014-07-28
Posts: 831

Re: Disable non-maximize windows at move through the mouse

Wow, thanks! ToZ & Co. here are one of the nicest Xfce features smile

Offline

#11 2016-06-02 11:47:15

PIKNIK
Member
Registered: 2016-05-30
Posts: 5

Re: Disable non-maximize windows at move through the mouse

Perfectly!

I universalize this script for Future!

1) WIDTH and HEIGHT self-determined in first 5 seconds work script. This script start at the same time with Firefox, wait 5 seconds
starting  program and stores the size of the screen. This is done, because the display resolution may be different.
2) Name process move outside script. Now his start via command ./size.sh Firefox &; firefox. This is allows you to substitute any other program for running this script.
3) Now maximize triggered by moving window too. In case you move the program does not change its size.
4) If Firefox closed - script delete lock-file and exit.
5) Lock-file use ID window. This makes it possible to run multiple copies of scripts for a single user.

#!/bin/bash
### script to force a specific window to remain maximized
### requires wmctrl

### Sleep and wait starting process
sleep 5

### Find process and his window-parameters
### wmctrl -lxG | grep $1 | awk '{print "X="$3" Y="$4" WIDTH="$5" HEIGHT="$6}'
read ID X Y W H <<< "$(wmctrl -lxG | grep $1 | head -n 1|  awk '{print $1" " $3" " $4" " $5" " $6}')"

### maximized window dimensions
### to get these run, while firefox is maximized: wmctrl -lxG | grep Firefox | awk '{print "WIDTH="$5" HEIGHT="$6}'
WIDTH=$W
HEIGHT=$H

### window to be forced maximized - enter unique part of window title
WINDOW=$1

###
### Do not change anything below
###

### create a lock file to prevent multiple copies of this script from running simultaneously (which would be bad)
lockfile=/tmp/.force_fs.$ID.lockfile
if ( set -o noclobber; echo "locked" > "$lockfile") 2> /dev/null; then
  	trap 'rm -f "$lockfile"; exit $?' INT TERM EXIT
  	echo "force_fsDEBUG: Locking succeeded" >&2

    ### create an endless loop
    while true
    do
        ### loop timeout value
	    sleep 1

        ### get information about the window (id, current width, current height)
            read id x y width height <<< "$(wmctrl -lxG | grep $WINDOW | awk '{print $1" " $3" " $4" " $5" " $6}')"
	    
	    ### only evaluate if window is open
	    if [ "$id" != "" ]
	    then

            ### if the current window dimensions do not match the maximized dimension, maximize
	        if [ $width != $WIDTH ] || [ $height != $HEIGHT ] || [ $x != $X ] || [ $y != $Y ]
	        then
		        wmctrl -i -r $id -b add,maximized_vert,maximized_horz
	        fi	       
	     else
		rm -f "$lockfile"; exit $?
	     fi
    done

### can't create lockfile - notify user and quit
else
  	echo "force_fsDEBUG: Lock failed, check for existing process and/or lock file and delete - exiting." >&2
  	exit 1
fi			

exit 0

You all cool! Thank you for help!

Last edited by PIKNIK (2016-06-02 11:49:54)

Offline

Board footer

Powered by FluxBB