Browser open in virtual desktop 4, how to move focus too?

Using applications, configuring, problems
Post Reply
Message
Author
User avatar
tallboy
Posts: 1760
Joined: Tue 21 Sep 2010, 21:56
Location: Drøbak, Norway

Browser open in virtual desktop 4, how to move focus too?

#1 Post by tallboy »

I have for many years arranged for my browser to always open in virtual desktop 4. I use JWM, and here is how I do it:

In a terminal, enter:
xprop|grep WM_CLASS and then click in the application window (in this case - the browser)

Result: WM_CLASS(STRING) = "Navigator", "Pale moon"

Open /root/.jwm/.jwmrc-personal as text, and add these lines:

Code: Select all

<Group>
<Class>Pale moon</Class>
<Name>Navigator</Name>
<Option>desktop:4</Option>
</Group>
Run Restart JWM from the Menu, or jwm -restart in a terminal.

When I open the browser, it is because I need to use it, and if someone could suggest a piece of code to be added, to move the focus along with the window, I would be happy. Less clicking! :D
I know there is an option in JWM Group Settings named nofocus, what I need is the opposite!

BTW: I have also added another modification in the same text: These lines prevent switching to another virtual desktop when you accidentally scroll the mouse outside an application window:

Code: Select all

<RootMenu onroot="4"/>
<RootMenu onroot="5"/>
(thank you, MochiMoppel)
Then restart JWM.

tallboy
Last edited by tallboy on Sat 24 Jun 2017, 01:47, edited 1 time in total.

User avatar
6502coder
Posts: 677
Joined: Mon 23 Mar 2009, 18:07
Location: Western United States

#2 Post by 6502coder »

That "stop mouse wheel from switching desktops" fix no longer works in recent JWMs, at least version 2.3.6 and later. For example it does not work in TahrPup 6.0.6.

This has been pointed before elsewhere in the forum, probably in the same thread where MM first mentioned the fix.

User avatar
tallboy
Posts: 1760
Joined: Tue 21 Sep 2010, 21:56
Location: Drøbak, Norway

#3 Post by tallboy »

After years of struggling with my dual-function USB memory/modem, I have finally switched operator, and I now have a brand new wifi router. Well, it is connected to my old PC by cable, but it has wifi functions if needed. At the same time, my old Puppy CD was starting to misbehave at bootup because of wear(!).
So after much, and serious, contemplation, I have decided to switch from my beloved LupuPlus 5.2.8.005-1 to a newer Puppy! :shock: (yes, I know, I know...)
So I am writing this answer from my new live CD puppy - not yet remastered, the promising Lucid 5.2.8.7! :D

The JWM version is vgit-895, not that the number means anything to me. In any case, the script work as intended here, but thank you for the warning, 6502coder.

tallboy

User avatar
tallboy
Posts: 1760
Joined: Tue 21 Sep 2010, 21:56
Location: Drøbak, Norway

#4 Post by tallboy »

6502coder, I asked Joe, and he gave me a new version of that old trick, which also let the focus belong to the window! :D

In a JWM 2.3.5 or later, there is an option fixed under Group Settings
Fix the windows in this group to the current desktop. This will cause the desktop to change when the window is raised rather than the default behavior of moving the window to the current desktop. New in v2.3.5.


So the new version would be something like this:
In a terminal, enter:
xprop|grep WM_CLASS and then click in the application's window (in this case - the browser, opened in the desktop it will belong to after this code is activated)

Result: WM_CLASS(STRING) = "Navigator", "Pale moon"

Open /root/.jwm/.jwmrc-personal as text, and add these lines:

Code: Select all

<Group>
<Class>Pale moon</Class>
<Name>Navigator</Name>
<Option>fixed</Option>
</Group>	
Run Restart JWM from the Menu, or jwm -restart in a terminal.

Pity I cannot test it, my JWM is vgit-895, but I need 2.3.5 or later.

So the next question is why the regular version number of the JWM's have been replaced by the git snapshot code at download time, which don't tell squat about the version? :x

tallboy
True freedom is a live Puppy on a multisession CD/DVD.

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#5 Post by MochiMoppel »

tallboy wrote:6502coder, I asked Joe, and he gave me a new version of that old trick, which also let the focus belong to the window!
And you will share the new version with us, will you? I wonder why Joe doesn't scrap this idiotic "feature". Nobody needs it and it doesn't even work. As soon as the mouse pointer hits a window when scrolling with the middle button, it's the end of desktop switching and the scroll continues in (accidentaly) hit window.
Pity I cannot test it, my JWM is vgit-895, but I need 2.3.5 or later.
I tested and like with almost all new 2.3 features I'm not impressed. After booting I force my telephone application to open in desktop 9. JWM will not switch to the desktop and that's OK with me since I need the application to stay in the background and wait for calls.
When I add the fixed setting, the behavior does not change (I understand that in such case you would like JWM to switch to dt 9, right? Doesn't happen.). I tentatively set all windows to fixed and the only change I noticed is with Geany. Suppose you have Geany open on dt 1, then switch to dt 3 where you open ROX-Filer and Shift-click on a text file to open it in Geany. Normally Geany would move from dt 1 to 3, your current dt. With JWM 2.3.5 and Geany in a "fixed" group, Geany would stay in dt 1 and your dt will switch from 3 to 1. Hmmm... I like the current default better

You should consider to forget JWM and use wmctrl for opening applications on a specific desktop.
To open palemoon on dt 4 (that's 3 for wmctrl as wmctrl counts from zero):

Code: Select all

#!/bin/bash
wmctrl -s 3 ; exec /your/path/to/palemoon
So the next question is why the regular version number of the JWM's have been replaced by the git snapshot code at download time, which don't tell squat about the version?
I've asked this before and never received an answer. IMHO it's a bad habit of Puppy devs. I understand the temptation to use the newest version, but a snapshot is not a stable version and what's worse: there is no information that tells you on which (official) version a given snapshot number is built on.

User avatar
tallboy
Posts: 1760
Joined: Tue 21 Sep 2010, 21:56
Location: Drøbak, Norway

#6 Post by tallboy »

Thank you for testing and commenting, Mochi.
When I started to use Linux 17 yers ago, I used fvwm. I still have it in a big Debian on a spare HDD, along with a conf-file that is about 2 pages long! I have started my browser on desktop 4 for 17 years now! I have always used JWM with Puppy, but I am not a very advanced user nowadays. The option I use, desktop: 4, works fine, and is still available in the latest JWMs. My bash is too old for wmctrl, I need to upgrade it. But when I Ducked bash wmctrl (I cannot say I Googled it, because I use DuckDuckGo!), it seems that the bash version make a lot of problems for many users.
Oh well, I continue to click on my browser icon, and then click on dekstop 4 as I always have done. :D

tallboy
True freedom is a live Puppy on a multisession CD/DVD.

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#7 Post by MochiMoppel »

Ahemm...
I wrote:And you will share the new version with us, will you?
Enlighten us, please!
tallboy wrote:My bash is too old for wmctrl
Says who? wmctrl is 14 years old! How old is your bash? And what does bash has to do with wmctrl?
it seems that the bash version make a lot of problems for many users.
Links please! Searching for "wmctrl bash problem" produced a few reports by users who had basic problems with using bash. Neither was the bash version a factor nor were it "lot of problems for many users".

BTW: Did you actually try the code I posted? Just trying would be a lot faster than searching the web for problems and contemplating if running this tiny oneliner would work or not ...
Oh well, I continue to click on my browser icon, and then click on dekstop 4 as I always have done. :D
Your choice.

User avatar
tallboy
Posts: 1760
Joined: Tue 21 Sep 2010, 21:56
Location: Drøbak, Norway

#8 Post by tallboy »

1)
MochiMoppel wrote:Ahemm...
I wrote:And you will share the new version with us, will you?
Enlighten us, please!
Answer to 1):
I was seeking a way to move the focus along with the application that opened in desktop 4, following my addition to .jwmrc-personal:

Code: Select all

<Group>
<Class>Pale moon</Class>
<Name>Navigator</Name>
<Option>desktop:4</Option>
</Group>
I got no immediate response from members, so I sent Joe an email, and he gave me this solution, using the option fixed instead of desktop:.

Code: Select all

<Group>
<Class>Pale moon</Class>
<Name>Navigator</Name>
<Option>fixed</Option>
</Group>   
It was new to me, so I referred to this as "The new version", and because I haven't seen it mentioned in the forum, I shared it with you.
2)
MochMoppel wrote:
tallboy wrote:My bash is too old for wmctrl
Says who? wmctrl is 14 years old! How old is your bash? And what does bash has to do with wmctrl?
Answer to 2):
I was unfamiliar with wmctrl, so I consulted my terminal:

Code: Select all

# wmctrl --version
bash: wmctrl: command not found
# 
I therefore assumed - incorrectly - that it was a command from a newer Bash than mine, which is 4.3.30.
3)
MochiMoppel wrote:
it seems that the bash version make a lot of problems for many users.
Links please! Searching for "wmctrl bash problem" produced a few reports by users who had basic problems with using bash. Neither was the bash version a factor nor were it "lot of problems for many users".
Answer to 3):
As I wrote, my query in DuckDuckGo was "bash wmctrl" which I suggest you try, without adding the word problem, and you will get a list of problems. I still did not know it was a Linux command.
4)
MochiMoppel wrote:BTW: Did you actually try the code I posted? Just trying would be a lot faster than searching the web for problems and contemplating if running this tiny oneliner would work or not ...
Answer to 4):
But I did make a script as you suggested, and tried to open Dia in desktop 3:

Code: Select all

#!/bin/bash
wmctrl -s 2 ; exec /usr/bin/dia-normal
Well, it didn't. Dia just opened in the same desktop as I executed the script.
5)
MociMoppel wrote:
Oh well, I continue to click on my browser icon, and then click on dekstop 4 as I always have done. :D
Your choice.
Answer to 5):
The main reason for my choice is that it actually works, so my choice seems sound. And your comment about my new version was a good reason for not trying a newer JWM, as you obviously had tested the new option fixed yourself:
MochiMoppel wrote:I wonder why Joe doesn't scrap this idiotic "feature". Nobody needs it and it doesn't even work. As soon as the mouse pointer hits a window when scrolling with the middle button, it's the end of desktop switching and the scroll continues in (accidentaly) hit window.
So you see, I actually listened to you!

I hope this will answer your questions, please tell me if I missed something.

BTW, I also mentioned to Joe your solution for preventing the mouse scroll from switching desktops - without mentioning your name, of course, and told him, as 6502coder pointed out, that it was no longer possible to execute in the latest version of JWM.

Code: Select all

<RootMenu onroot="4"/>
<RootMenu onroot="5"/>
His answer was that the solution was interesting but unfamiliar to him, but he has had several requests to control the switching of desktops, so he will make some option to turn it on/off, in a later version of JWM.

tallboy
True freedom is a live Puppy on a multisession CD/DVD.

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#9 Post by MochiMoppel »

Thanks for the clarification. I see that something got lost in translation. Your "6502coder, I asked Joe, and he gave me a new version of that old trick" was an answer to 6502coder's post, where he mentioned the trick to prevent desktop switching, so I assumed that "new version" refers to "trick" and not to "JWM".

Your answer to 4): Your script can't work when you don't have wmctrl installed. Unfortunately it's not included in standard Puppies but a pet is available here. It's only 1 small file that can do things you can hardly do otherwise.

User avatar
tallboy
Posts: 1760
Joined: Tue 21 Sep 2010, 21:56
Location: Drøbak, Norway

#10 Post by tallboy »

...was an answer to 6502coder's post, where he mentioned the trick to prevent desktop switching,...
OK, I see what you mean, I expressed myself clumsy. Sorry!
Your answer to 4): Your script can't work when you don't have wmctrl installed. Unfortunately it's not included in standard Puppies but a pet is available here. It's only 1 small file that can do things you can hardly do otherwise.
Is that a shortcoming of Busybox?

tallboy
True freedom is a live Puppy on a multisession CD/DVD.

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#11 Post by MochiMoppel »

First things first: Did you install wmctrl? Does the script work now? Is your problem solved?

User avatar
tallboy
Posts: 1760
Joined: Tue 21 Sep 2010, 21:56
Location: Drøbak, Norway

#12 Post by tallboy »

I have installed wctrl 1.07 from your link, and it solved my problem immediately. Very nice!
I will go through all other options, and those in stickyjwm-4.1 also, both applications are new to me.

Thank you, MochiMoppel. :D

tallboy
True freedom is a live Puppy on a multisession CD/DVD.

Post Reply