Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 23 Oct 2018, 09:57
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Desktop
Send excess windows on desktop 1 to desktops 2 and 3.
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [3 Posts]  
Author Message
musher0

Joined: 04 Jan 2009
Posts: 12845
Location: Gatineau (Qc), Canada

PostPosted: Mon 15 Jan 2018, 01:50    Post subject:  Send excess windows on desktop 1 to desktops 2 and 3.  

Hello all.

This is an off-shoot of the discussion on "aerosnap" started by Stemsee here.

Yes you can line up windows nicely in four quadrants using wmctrl, but what if you have
too many windows for one desktop? This script tries to solve over-population of windows
on desktop 1. Not over-population of windows on desktop 2, and not over-population
of windows on desktop 3.

I mean: "Be careful, there is no checking. This is a draft." If you try this script with
only two desktops, and app Z gets lost in Lala land because the script sent it to desktop 3,
don't blame me or the script! Got it? Wink There, you've been told! Also, please read the
notes in the code, I won't repeat myself.

It was fun doing; you do with it what you like. Any questions? This is what this thread is for!

Enjoy!
~~~~~~~~~~~~~
Code:
#!/bin/sh
# /opt/local/Redimensionner/spread-out.sh
#
# Goal: Spread out too many windows on desktop 1 to desktops 2 and 3.
#
# Requires wmctrl, awk, wc.
####
# Notes --
# -- 1) May be used with script paves2.sh
#
# -- 2) Assumes that you have three desktops and that you are
# starting from desktop 0 (aka "first desktop" in human terms).
#
# -- 3) You can repeat the script to make even more room on desktop 1.
####
#  © Christian L'Écuyer, Gatineau (Qc), Canada, 15 janv. 2018. GPL3
#  (alias musher0 [forum Puppy])
#################### # https://opensource.org/licenses/GPL-3.0
#    This program is free software: you can redistribute it and/or modify it under the
#    terms of the GNU General Public License as published by the Free Software Foundation,
#    either version 3 of the License, or  (at your option) any later version.
#       This program is distributed in the hope that it will be useful, but WITHOUT ANY
#    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
#    A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#       You should have received a copy of the GNU General Public License along with
#   this program. If not, see <http://www.gnu.org/licenses/>.
##########
#   Ce programme est libre : vous pouvez le redistribuer ou modifier selon les termes
#   de la Licence Publique Générale GNU publiée par la Free Software Foundation (v. 3
#   ou toute version ultérieure choisie par vous).
#       Ce programme est distribué dans l'espoir qu'il sera utile, mais SANS AUCUNE
#   GARANTIE, ni explicite ni implicite, y compris des garanties de commercialisation
#   ou d'adaptation à un but spécifique. Pour plus de détails, veuillez vous reporter
#   au texte officiel de cette licence à https://opensource.org/licenses/GPL-3.0, à
#   http://www.linux-france.org/article/these/gpl.html pour une traduction et, pour une
#   explication en français, à https://fr.wikipedia.org/wiki/Licence_publique_générale_GNU.
#################### set -xe
wmctrl -s 0 # See note 2 above.
wmctrl -l | awk '$2 ~ /0/ { print $1}' > /tmp/fen.lst

A="`wc -l < /tmp/fen.lst`";A="`echo $[$A/3]`"
head -n "$A" /tmp/fen.lst > /tmp/fen2.lst
tail -n "$A" /tmp/fen.lst > /tmp/fen3.lst

j=1;for i in 2 3;do
   while read line;do
      wmctrl -i -r "$line" -t $j
   done < /tmp/fen$i.lst
   j="`echo $[$j+1]`"
done

rm -f /tmp/fen*.lst # set +xe

_________________
musher0
~~~~~~~~~~
Fidèle elle commença, ainsi elle restera. (Prov. canadien) /
Faithful she began, so will she stay. (Canadian prov.)
Back to top
View user's profile Send private message 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 13049
Location: Arizona USA

PostPosted: Mon 15 Jan 2018, 19:04    Post subject:  

In JWM, if you right-click on a window's title bar, the popup context menu offers the option to "Send to" another desktop. I use it all the time.
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 12845
Location: Gatineau (Qc), Canada

PostPosted: Tue 16 Jan 2018, 00:20    Post subject:  

Flash wrote:
In JWM, if you right-click on a window's title bar, the popup context menu offers the option to "Send to" another desktop. I use it all the time.

Hi Flash.

Yeah, most WMs have that feature. But this script may be handy if you happen to
have a lot of apps on the same desktop and you don't want to do it one by one.

Now what user of sane mind would put six or seven apps on the same desktop? So...
this script is probably useless!!! It's to show one capacity amng many of the wmctrl
utility. (Hehe.)

BFN.

_________________
musher0
~~~~~~~~~~
Fidèle elle commença, ainsi elle restera. (Prov. canadien) /
Faithful she began, so will she stay. (Canadian prov.)
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [3 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Desktop
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0405s ][ Queries: 14 (0.0070s) ][ GZIP on ]