Discussion:
[Fluxbox-users] Changing workspaces parallel on two screens
Rainer M Krug
2009-03-02 08:55:11 UTC
Permalink
Hi

I would like to be able to change the workspaces on two displays (:0.0
and :0.1) simultaneously (via keys or mouse). Is this possible, and if
yes, what do I have to add into the keys file? I could not find
anything on that.

Cheers

Rainer
--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Faculty of Science
Natural Sciences Building
Private Bag X1
University of Stellenbosch
Matieland 7602
South Africa
Jj
2009-03-06 05:11:52 UTC
Permalink
I'm looking for the same, I've tried with several X utilities,
pretending to focus any window on the other display, with no luck.

I'd like to hear if anyone came up with a work around, AFAIK there's no
key command for this when working with separate displays.
Post by Rainer M Krug
Hi
I would like to be able to change the workspaces on two displays (:0.0
and :0.1) simultaneously (via keys or mouse). Is this possible, and if
yes, what do I have to add into the keys file? I could not find
anything on that.
Cheers
Rainer
--
Jj
http://isgeek.net/
Fernando M. Maresca
2009-03-06 09:36:18 UTC
Permalink
Post by Jj
I'm looking for the same, I've tried with several X utilities,
pretending to focus any window on the other display, with no luck.
I'd like to hear if anyone came up with a work around, AFAIK there's no
key command for this when working with separate displays.
I'm using a script to change workspaces in rows:
ws1 ws2 ws3 ws4...
ws11 ws12 ws13 ws14...
I've got the script somewhere, don't remember, and modified it a little
to do several this.

Search for next_window.pl or mail me. With some hacking around, it may
be modified to do the trick.

It uses wmctrl to do the work, so it's slower than the built-in change
desktop. wmctrl will work as far as each ws have a unique identifier,
which I think it's always the case.

Regards,
Fernando
Post by Jj
Post by Rainer M Krug
Hi
I would like to be able to change the workspaces on two displays (:0.0
and :0.1) simultaneously (via keys or mouse). Is this possible, and if
yes, what do I have to add into the keys file? I could not find
anything on that.
Rainer M Krug
2009-03-06 10:28:27 UTC
Permalink
Hi Fernando
Post by Jj
I'm looking for the same, I've tried with several X utilities,
pretending to focus any window on the other display, with no luck.
I'd like to hear if anyone came up with a work around, AFAIK there's no
key command for this when working with separate displays.
   ws1  ws2  ws3  ws4...
   ws11 ws12 ws13 ws14...
I've got the script somewhere, don't remember, and modified it a little
to do several this.
Thanks for he reply, but this is not what I am looking for - I am
looking for a way to switching, simultaneously on two displays, to the
next / previous workspace. I have implemented the
matrix-like-workspace switching myself and I like it.
Search for next_window.pl or mail me. With some hacking around, it may
be modified to do the trick.
It uses wmctrl to do the work, so it's slower than the built-in change
desktop. wmctrl will work as far as each ws have a unique identifier,
which I think it's always the case.
wmctrl does only act on the actual display and has, as far as I could
find, no option of setting the display.
Regards,
Fernando
Post by Jj
Post by Rainer M Krug
Hi
I would like to be able to change the workspaces on two displays (:0.0
and :0.1) simultaneously (via keys or mouse). Is this possible, and if
yes, what do I have to add into the keys file? I could not find
anything on that.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAkmw7owACgkQCtDmpVXdEMatKQCfQRbqz0NQt/iJaiZiMxDNGtxg
XNIAn2kBb9MkFUHudqVNe4T2kBBMbU/6
=dE1G
-----END PGP SIGNATURE-----
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Fluxbox-users mailing list
https://lists.sourceforge.net/lists/listinfo/fluxbox-users
--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Faculty of Science
Natural Sciences Building
Private Bag X1
University of Stellenbosch
Matieland 7602
South Africa
Fernando M. Maresca
2009-03-06 10:52:43 UTC
Permalink
Post by Rainer M Krug
Hi Fernando
Hi
Post by Rainer M Krug
Thanks for he reply, but this is not what I am looking for - I am
looking for a way to switching, simultaneously on two displays, to the
next / previous workspace. I have implemented the
matrix-like-workspace switching myself and I like it.
You can use a keystroke in keys to fire up a script with parameters, like
this:

Mod1 1 :ExecCommand next_desktop.pl in_row 1

Note that "in_row" and "1" are parameters (arguments) to the next_desktop.pl
script.

Inside the script, you can do something like this (perl):
---
#!/usr/bin/perl

use strict;
use warnings;

my ($dir_string, $num, $wrap) = @ARGV;

# configuration variables
# set any or all of them
# values will be guessed if not set

my $num_rows = 2;
my $num_desktops_per_row = 10;

$dir_string ||= 'right'; # move right if not specified
$num ||= 1; # move by 1 workspace if not specified
$wrap = 1 unless (defined $wrap); # wrap around

my $debug = 0;



# get state from window manager

my $desktops = `wmctrl -d`;
chomp $desktops;
my $num_desktops = @{[split("\n", $desktops)]};
my $current_desktop = ($desktops =~ /^(\d+)\s+\*/m) ? $1 : 0;

print "Number of desktops: $num_desktops\nCurrent desktop: $current_desktop\n" if ($debug);

# guess configuration variables

$num_rows = 1 + int(($num_desktops - 1) / $num_desktops_per_row) if ($num_desktops_per_row);
my $tmp = int(sqrt($num_desktops));
until ($num_rows > 0) {
$num_rows = $tmp unless ($num_desktops % $tmp);
$tmp--;
}
$num_desktops_per_row ||= 1 + int(($num_desktops - 1) / $num_rows);

print "Number of rows: $num_rows\nNumber of cols: $num_desktops_per_row\n" if ($debug);

# actual code

my $current_row = int($current_desktop / $num_desktops_per_row);
my $current_col = $current_desktop % $num_desktops_per_row;

print "Current row: $current_row\nCurrent col: $current_col\n" if ($debug);

my $new_row = $current_row;
my $new_col = $current_col;
$new_row += $num if ($dir_string =~ /^down/i);
$new_row -= $num if ($dir_string =~ /^up/i);
$new_col += $num if ($dir_string =~ /^right/i);
$new_col -= $num if ($dir_string =~ /^left/i);
$new_col = $num -1 if ($dir_string =~ /^in_row/i);

my $tmp_num_rows = $num_rows;
my $tmp_num_cols = $num_desktops_per_row;
$tmp_num_rows-- if ($current_col > (($num_desktops - 1) % $num_desktops_per_row));
$tmp_num_cols = ($num_desktops % $num_desktops_per_row) || $num_desktops_per_row if ($current_row == $num_rows - 1);

if ($wrap) {
$new_col = ($tmp_num_cols + ($new_col % $tmp_num_cols)) % $tmp_num_cols;
$new_row = ($tmp_num_rows + ($new_row % $tmp_num_rows)) % $tmp_num_rows;
} else {
$new_col = 0 if ($new_col < 0);
$new_col = $tmp_num_cols - 1 if ($new_col >= $tmp_num_cols);
$new_row = 0 if ($new_row < 0);
$new_row = $tmp_num_rows - 1 if ($new_row >= $tmp_num_rows);
}

print "New row: $new_row\nNew col: $new_col\n" if ($debug);

# set the new desktop

my $new_desktop = $new_row * $num_desktops_per_row + $new_col;
system('wmctrl', '-s', $new_desktop) unless ($debug);

print "New desktop: $new_desktop\n" if ($debug);
--

If you make each "row" the desktops in each display, little hacking can
make switching the desktops in each display. You may need to get and
idea of where are you, maybe using xrandr to get info (Screen0:,
Screen1: in xrandr lexicon) to get the current display and what others
displays are.
You may need to hack around to make it work like you want but I think
it's possible.

Also, note that if you put _DISPLAY="0:0"_ (without the _) before
issuing a command in X, then command is executed in the indicated display.
Don't know if it's useful here.


Regards,
Fernando
higuita
2009-03-14 06:07:25 UTC
Permalink
Hi
Post by Rainer M Krug
I would like to be able to change the workspaces on two displays (:0.0
and :0.1) simultaneously (via keys or mouse). Is this possible, and if
then what you want is not dual head but xinerama/big-desktop...

:0.0 and :0.1 are two different desktops, but if you want to
sync then, use a already merged desktop, then fluxbox will control only
one desktop instead of 2

good luck
higuita
--
Naturally the common people don't want war... but after all it is the
leaders of a country who determine the policy, and it is always a
simple matter to drag the people along, whether it is a democracy, or
a fascist dictatorship, or a parliament, or a communist dictatorship.
Voice or no voice, the people can always be brought to the bidding of
the leaders. That is easy. All you have to do is tell them they are
being attacked, and denounce the pacifists for lack of patriotism and
exposing the country to danger. It works the same in every country.
-- Hermann Goering, Nazi and war criminal, 1883-1946
Continue reading on narkive:
Loading...