You are not logged in.

#1 2021-03-19 10:58:09

hybrid
Member
Registered: 2007-02-05
Posts: 262

[solved] autostart terminals on certain workspaces fluxbox

Hi,

I want fluxbox to start up a few terminal emulations on certain workspaces. To make things even more difficult, I use two monitors.
My setup kinda works but somehow the workspace and monitor the workspaces appear depends on the cursor position:
- When I start X and don't touch anything, the terminals are not opened on their designated workspaces and/or positions, seems to be somewhat random
- If I start X and scroll through my workspaces before the terminals are opened, the terminals are opened on their workspaces relative to the workspace I end up on, but the positions are off: sometimes they're all on either the left or the right monitor, sometimes right and left monitor swapped
- If I start X and scroll through my workspaces before the terminals are opened with the cursor on the right screen, then scroll through my workspaces with the cursor on the left screen and make sure the cursor ends on workspace1 on the left monitor the terminals get opened on their designated workspaces and positions.

Here is my setup:
xorg.conf

# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings:  version 450.57

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" 0 0
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
    Option         "Xinerama" "0"
EndSection

Section "Files"
EndSection

Section "Module"
    Load           "dbe"
    Load           "extmod"
    Load           "type1"
    Load           "freetype"
    Load           "glx"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "Monitor"
    # HorizSync source: edid, VertRefresh source: edid
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "ACB Digital"
    HorizSync       88.8 - 88.8
    VertRefresh     60.0
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce GTX 970"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "Stereo" "0"
    Option         "nvidiaXineramaInfoOrder" "DFP-2"
    Option         "metamodes" "DPY-5: nvidia-auto-select @2560x1440 +0+0 {ViewPortIn=2560x1440, ViewPortOut=2560x1440+0+0}, DPY-3: nvidia-auto-select @2560x1440 +2560+0 {ViewPortIn=2560x1440, ViewPortOut=2560x1440+0+0}"
    Option         "SLI" "Off"
    Option         "MultiGPU" "Off"
    Option         "BaseMosaic" "off"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

.fluxbox/apps

[app] (name=urxvt-ws1-left)
  [Workspace]	{0}
  [Position]	(UPPERLEFT)	{1025 0}
[end]
[app] (name=urxvt-ws3-left-df)
  [Workspace]	{2}
  [Dimensions]	{668 412}
  [Position]	(UPPERLEFT)	{0 0}
  [Hidden]	{yes}
  [Layer]	{12}
[end]
[app] (name=urxvt-ws3-left)
  [Workspace]	{2}
  [Position]	(UPPERLEFT)	{668 0}
[end]
[app] (name=urxvt-ws3-right-df)
  [Workspace]	{2}
  [Dimensions]	{668 412}
  [Position]	(UPPERLEFT)	{2560 0}
  [Hidden]	{yes}
  [Layer]	{12}
[end]
[app] (name=urxvt-ws3-right)
  [Workspace]	{2}
  [Position]	(UPPERLEFT)	{3228 0}
[end]
[app] (name=urxvt-ws4-left-fullscreen)
  [Workspace]	{3}
  [Position]	(UPPERLEFT)	{0 0}
  [Hidden]	{yes}
  [Layer]	{12}
[end]
[app] (name=aterm-ws4-right-big)
  [Workspace]	{3}
  [Position]	(UPPERLEFT)	{2560 0}
  [Dimensions]	{1205 1011}
  [Deco]	{NONE}
  [Hidden]	{yes}
  [Layer]	{12}
[end]
[app] (name=urxvt-ws4-right)
  [Workspace]	{3}
  [Position]	(UPPERLEFT)	{3761 0}
[end]
[group] (workspace=[current])
 [app] (name=urxvt)
 [app] (name=URxvt)
[end]
[app] (name=aterm-root)
  [Dimensions]	{1205 1011}
  [Position]	(UPPERLEFT)	{0 0}
  [Deco]	{NONE}
  [Hidden]	{yes}
  [Layer]	{12}
[end]
[app] (name=urxvt-fullscreen)
  [Dimensions]	{100% 100%}
  [Position]	(UPPERLEFT)	{0 0}
  [Hidden]	{yes}
  [Layer]	{12}
[end]
[app] (name=urxvt-root)
  [Position]	(UPPERLEFT)	{0 0}
  [Hidden]	{yes}
  [Layer]	{12}
[end]

~/.fluxbox/startup

#Workspace 1
sh -c 'sleep 20s && urxvt -name urxvt-ws1-left &'

#Workspace 3
sh -c 'sleep 20s && urxvt -name urxvt-ws3-left-df +sb -tr -bl -e sh -c "watch -n 0.2 df -BM" &'
sh -c 'sleep 20s && urxvt -name urxvt-ws3-left &'
sh -c 'sleep 20s && urxvt -name urxvt-ws3-left &'

sh -c 'sleep 20s && urxvt -name urxvt-ws3-right-df +sb -tr -bl -e sh -c "watch -n 0.2 df -BM" &'
sh -c 'sleep 20s && urxvt -name urxvt-ws3-right &'

#Workspace 4
sh -c 'sleep 20s && urxvt -name urxvt-ws4-left-fullscreen +sb -tr -bl -geometry 309x74 &'
sh -c 'sleep 20s ** aterm -name aterm-ws4-right-big +sb -tr -geometry 100x65 -e zsh &'
sh -c 'sleep 20s && urxvt -name urxvt-ws4-right &'

Just for testing purposes I'm starting it like this: once everything works as intended I'll clean this part up.


So again, my two questions are:
1) How do I get my terminals to always start on their designated positions without me having to scroll through my workspaces twice? Or can I at least automate this process somehow? (I tried having fluxbox autostart some dummy programs that were set to [JUMP] to each workspace, but still my terminals were put at wrong positions)
2) How do I get the autostarted terminals to group? When I manually open urxvt terminals, they group as they should/as set in ~/fluxbox/apps. But the autostarted terminals do not group.

Thanks a lot in advance, let me know if you need more information.






doesn't stack

Last edited by hybrid (2021-05-31 08:37:24)

Offline

#2 2021-03-19 13:08:08

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,524

Re: [solved] autostart terminals on certain workspaces fluxbox

Is the the latest fluxbox release or the git version of fluxbox?
If not the latter, please try that first.

Online

#3 2021-03-19 15:36:14

hybrid
Member
Registered: 2007-02-05
Posts: 262

Re: [solved] autostart terminals on certain workspaces fluxbox

I was using the latest release.
I just tried the git version from aur and I still need to make sure to place the cursor on the left screen. I don't seem to need to cycle through the workspaces anymore though.

Offline

#4 2021-03-19 15:50:38

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,524

Re: [solved] autostart terminals on certain workspaces fluxbox

What if you define the "[Head]" (and relative Position)?
You possibly also want to control the [Maximized] or [Fullscreen] state for some clients.

Online

#5 2021-04-01 11:43:21

hybrid
Member
Registered: 2007-02-05
Posts: 262

Re: [solved] autostart terminals on certain workspaces fluxbox

Sorry for the delay on my part. Pretty difficult right now to even find 10 minutes for myself these days. I may take till after easter to reply again, I'll have to see. But I am pursuing this and I am grateful for the information.

Great idea with the [head] definition combined with a relative position! The terminals now get spawned at the right locations.
Didn't think it would work because I don't use xinerama but it does.

Now the grouping: Why don't the urxvt that I spawn in my startup script group?
Well turns out even if I spawn urxvt -name urxvt-ws3-left by hand from another terminal it doesn't group up.
I feel like with the

[group] (workspace=[current])
 [app] (name=urxvt)
 [app] (name=URxvt)
[end]

it should already group, but it doesn't.

So I added

[group] (workspace=2)
  [app] (class=urxvt-ws3-left) (name=urxvt-ws3-left)
  [app] (name=urxvt-ws3-left)
[end]

I tried every combination of the code above (for example only [app] (class=...) and nothing else, (class...) (name...) in the same line, (class...) <newline> (name...), with the workspace definition set to 2, [current] and without the workspace definition at all), it simply doesn't group ever when I use the -name option of rxvt-u.

$xprop
WM_STATE(WM_STATE):
		window state: Normal
		icon window: 0x0
_NET_WM_STATE(ATOM) = _NET_WM_STATE_SKIP_TASKBAR
_NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_SHADE, _NET_WM_ACTION_STICK, _NET_WM_ACTION_RESIZE, _NET_WM_ACTION_MOVE, _NET_WM_ACTION_CLOSE, _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_MAXIMIZE_HORZ, _NET_WM_ACTION_MAXIMIZE_VERT, _NET_WM_ACTION_FULLSCREEN
_NET_FRAME_EXTENTS(CARDINAL) = 0, 0, 0, 0
_NET_WM_DESKTOP(CARDINAL) = 2
_FLUXBOX_GROUP_LEFT(WINDOW): window id # 0x0
_NET_WM_PID(CARDINAL) = 76413
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, _NET_WM_PING
_MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x2, 0x0, 0x0, 0xffffff78, 0x43
WM_LOCALE_NAME(STRING) = "en_US.UTF-8"
WM_CLASS(STRING) = "urxvt-ws3-left-df", "URxvt"
WM_HINTS(WM_HINTS):
		Client accepts input or input focus: True
		Initial state is Normal State.
		window id # of group leader: 0x2200009
WM_NORMAL_HINTS(WM_SIZE_HINTS):
		program specified minimum size: 12 by 21
		program specified resize increment: 8 by 17
		program specified base size: 4 by 4
		window gravity: NorthWest
WM_CLIENT_MACHINE(STRING) = "foobar"
WM_COMMAND(STRING) = { "urxvt", "-name", "urxvt-ws3-left-df", "+sb", "-tr", "-bl", "-e", "sh", "-c", "watch -n 0.2 df -BM" }
_NET_WM_ICON_NAME(UTF8_STRING) = "sh"
WM_ICON_NAME(STRING) = "sh"
_NET_WM_NAME(UTF8_STRING) = "sh"
WM_NAME(STRING) = "sh"

Seems like urxvt doesn't set the icon and title name correctly (urxvt man page says '-name' will set title and icon) but the WM_CLASS(STRING) is there, so I don't know why fluxbox doesn't want to group it with (class=...).

Offline

#6 2021-04-01 11:50:26

hybrid
Member
Registered: 2007-02-05
Posts: 262

Re: [solved] autostart terminals on certain workspaces fluxbox

Getting frustrated and throwing everything together:

[group] (workspace=2)
  [Head] {2}
  [app] (@WM_CLASS=urxvt-ws3-left)
  [app] (class=urxvt-ws3-left)
  [app] (name=urxvt-ws3-left)
[end]

doesn't work either. big_smile

Offline

#7 2021-04-01 12:54:25

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,524

Re: [solved] autostart terminals on certain workspaces fluxbox

WM_CLASS(STRING) = "urxvt-ws3-left-df", "URxvt"

[group]
  [app] (class=URxvt) (name=urxvt-ws3-left-df)
  [app] (class=URxvt) (name=urxvt-ws3-left)
[end]

Assuming you want urxvt-ws3-left-df and urxvt-ws3-left in the same group.
I'd skip the workspace condition for the moment, see whether it works in general and then narrow it down.

Online

#8 2021-04-09 12:10:22

hybrid
Member
Registered: 2007-02-05
Posts: 262

Re: [solved] autostart terminals on certain workspaces fluxbox

Well in the end I would like to have a few urxvt-ws3-left instances grouped together (just the urxvt-ws3-left instances, not the -df one) and the same on workspace 1, so a few urxvt-ws1-left grouped together with themselves.
Optionally it'd be awesome if occasional new instances of urxvt would get grouped with existing urxvt-wsX-left/right instances.

The xprop from the -ws3-left I want to group together

$ xprop 
_NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_SHADE, _NET_WM_ACTION_STICK, _NET_WM_ACTION_RESIZE, _NET_WM_ACTION_MOVE, _NET_WM_ACTION_CLOSE, _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_MAXIMIZE_HORZ, _NET_WM_ACTION_MAXIMIZE_VERT, _NET_WM_ACTION_FULLSCREEN
WM_STATE(WM_STATE):
		window state: Normal
		icon window: 0x0
_NET_FRAME_EXTENTS(CARDINAL) = 1, 1, 24, 6
_NET_WM_DESKTOP(CARDINAL) = 2
_FLUXBOX_GROUP_LEFT(WINDOW): window id # 0x0
_NET_WM_PID(CARDINAL) = 69804
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, _NET_WM_PING
WM_LOCALE_NAME(STRING) = "en_US.UTF-8"
WM_CLASS(STRING) = "urxvt-ws3-left", "URxvt"
WM_HINTS(WM_HINTS):
		Client accepts input or input focus: True
		Initial state is Normal State.
		window id # of group leader: 0x2400009
WM_NORMAL_HINTS(WM_SIZE_HINTS):
		program specified minimum size: 32 by 21
		program specified resize increment: 8 by 17
		program specified base size: 24 by 4
		window gravity: NorthWest
WM_CLIENT_MACHINE(STRING) = "foobar"
WM_COMMAND(STRING) = { "urxvt", "-name", "urxvt-ws3-left" }
_NET_WM_ICON_NAME(UTF8_STRING) = "user@hostname:~"
WM_ICON_NAME(STRING) = "user@hostname:~"
_NET_WM_NAME(UTF8_STRING) = "user@hostname:~"
WM_NAME(STRING) = "user@hostname:~"

here's my current group

[group]
  [app] (class=URxvt) (name=urxvt-ws3-left)
  [app] (class=URxvt)
[end]

But fluxbox doesn't group it up. When I start "urxvt -name urxvt-ws3-left" by hand it gets spawned at the correct location but it doesn't get grouped and I have no idea why.

Offline

#9 2021-04-09 12:29:15

hybrid
Member
Registered: 2007-02-05
Posts: 262

Re: [solved] autostart terminals on certain workspaces fluxbox

I thought maybe there is only one [group] section allowed in the apps file, but even without the working group for new urxvt and only with the group mentioned above fluxbox doesn't group the urxvt-ws3-left instances.

For reference: This works on my machine:
~/.fluxbox/apps

[group]  (workspace=[current])
 [app] (name=urxvt)
 [app] (name=URxvt)
[end]

for urxvt instances just started with '$ urxvt'

$ xprop
WM_STATE(WM_STATE):
		window state: Normal
		icon window: 0x0
_NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_SHADE, _NET_WM_ACTION_STICK, _NET_WM_ACTION_RESIZE, _NET_WM_ACTION_MOVE, _NET_WM_ACTION_CLOSE, _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_MAXIMIZE_HORZ, _NET_WM_ACTION_MAXIMIZE_VERT, _NET_WM_ACTION_FULLSCREEN
_NET_FRAME_EXTENTS(CARDINAL) = 1, 1, 24, 6
_NET_WM_DESKTOP(CARDINAL) = 1
_FLUXBOX_GROUP_LEFT(WINDOW): window id # 0x0
_NET_WM_PID(CARDINAL) = 114377
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, _NET_WM_PING
WM_LOCALE_NAME(STRING) = "en_US.UTF-8"
WM_CLASS(STRING) = "urxvt", "URxvt"
WM_HINTS(WM_HINTS):
		Client accepts input or input focus: True
		Initial state is Normal State.
		window id # of group leader: 0x4000009
WM_NORMAL_HINTS(WM_SIZE_HINTS):
		program specified minimum size: 32 by 21
		program specified resize increment: 8 by 17
		program specified base size: 24 by 4
		window gravity: NorthWest
WM_CLIENT_MACHINE(STRING) = "foobar"
WM_COMMAND(STRING) = { "urxvt" }
_NET_WM_ICON_NAME(UTF8_STRING) = "user@hostname:~"
WM_ICON_NAME(STRING) = "user@hostname:~"
_NET_WM_NAME(UTF8_STRING) = "user@hostname:~"
WM_NAME(STRING) = "user@hostname:~"

This is working for I don't know, maybe 15 years? It works even though it probably shouldn't, I mean I tell fluxbox to look for name and it matches class. Maybe something once got changed there, because that group in my apps-file is really old, I don't know. But it still works.


But '$ urxvt -name urxvt-ws3-left' I can't get fluxbox to group.
The "current group" I posted in the comment above doesn't work, also I tried [app] (name=URxvt) (name=urxvt-ws3-left), I tried [app] (name=URxvt) \newline [app] (name=urxvt-ws3-left), tried combinations with class and name, regardless, fluxbox does not group them ever.
Currently the group looks like this:

[group] 
  [app] (class=URxvt) (class=urxvt-ws3-left) (name=urxvt-ws3-left)
  [app] (class=URxvt)
  [app] (name=urxvt-ws3-left)
  [app] (name=URxvt)
[end]

and the 'urxvt -name urxvt-ws3-left' instances still do not get grouped, neither with themselves, nor with plain urxvt instances.


edit: just for good measure and because it's the only difference I see between the working group and the not working group, I also just tried [group] (workspace=2) and [group] (workspace=[current]) and of course still neither worked for the 'urxvt -name urxvt-ws3-left'.
I removed the (workspace=...) again, but I wanted to rule that out.

Last edited by hybrid (2021-04-09 12:35:49)

Offline

#10 2021-04-09 14:13:55

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,524

Re: [solved] autostart terminals on certain workspaces fluxbox

This here works reliably for me to group my youtube-viewer windows which are launched "… -name YouTV"

[group]
 [app] (name=YouTV) (class=URxvt)
[end]

Try just

[group]
 [app] (name=urxvt-ws3-left) (class=URxvt)
[end]

W/o seeing the entire apps file, I could imagine that the "[app] (name=URxvt)" line creates a rule ambiguity that not properly resolved (or maybe not resolvable at all)

Online

#11 2021-05-19 21:02:44

hybrid
Member
Registered: 2007-02-05
Posts: 262

Re: [solved] autostart terminals on certain workspaces fluxbox

Man you're good! I think we're on to something here:
First off, the [app] (name=urxvt-ws3-left) (class=URxvt) did not work. I deleted all other [group]-blocks but

[group]
 [app] (name=urxvt-ws3-left) (class=URxvt)
[end]

didn't behave any different.

But your idea about rule ambiguity got me thinking and when I change

[app] (name=urxvt-ws3-left-df)
  [Workspace]	{2}
  [Dimensions]	{668 412}
  [Position]	(UPPERLEFT)	{0 0}
  [Hidden]	{yes}
  [Layer]	{12}
[end]

into

[app] (class=urxvt-ws3-left-df)
  [Workspace]	{2}
  [Dimensions]	{668 412}
  [Position]	(UPPERLEFT)	{0 0}
  [Hidden]	{yes}
  [Layer]	{12}
[end]

the grouping works! Unfortunately this breaks the positioning so the urxvts get spawned on the active workspace instead of the one they're supposed to. So right now I have to choose whether I want them grouped up or spawn at the correct location/workspace. But yay, progress! The culprit seems to be somewhere with the [app] (name=....

I tried different things to get the urvxts spawned at their location without using (name=....) without luck so far.
I tried

 [app] (urxvt-ws3-left)  // some older fluxbox wiki set their examples up like that
[app] (class=urxvt-ws3-left)  // just shoot'n'poop
[app] (@=urxvt-ws3-left)
darnit, I tried more variations but I don't remember for sure and I don't want to accidently claim something I haven't tried

Here is the entire apps file

[app] (name=urxvt-ws1-left)
  [Head]	{2}
  [Workspace]	{0}
  [Position]	(UPPERLEFT)	{1025 0}
[end]
[app] (name=urxvt-ws3-left-df)
  [Head]	{2}
  [Workspace]	{2}
  [Dimensions]	{668 412}
  [Position]	(UPPERLEFT)	{0 0}
  [Hidden]	{yes}
  [Layer]	{12}
[end]
[app] (name=urxvt-ws3-left)
  [Head]	{2}
  [Workspace]	{2}
  [Position]	(UPPERLEFT)	{668 0}
[end]
[app] (name=urxvt-ws3-right-df)
  [Head]	{1}
  [Workspace]	{2}
  [Dimensions]	{668 412}
  [Position]	(UPPERLEFT)	{0 0}
  [Hidden]	{yes}
  [Layer]	{12}
[end]
[app] (name=urxvt-ws3-right)
  [Head]	{1}
  [Workspace]	{2}
  [Position]	(UPPERLEFT)	{668 0}
[end]
[app] (name=urxvt-ws4-left-fullscreen)
  [Head]	{2}
  [Workspace]	{3}
  [Position]	(UPPERLEFT)	{0 0}
  [Hidden]	{yes}
  [Layer]	{12}
[end]
[app] (name=aterm-ws4-right-big)
  [Head]	{1}
  [Workspace]	{3}
  [Dimensions]	{1205 1011}
  [Position]	(UPPERLEFT)	{0 0}
  [Deco]	{NONE}
  [Hidden]	{yes}
  [Layer]	{12}
[end]
[app] (name=urxvt-ws4-right)
  [Head]	{1}
  [Workspace]	{3}
  [Position]	(UPPERLEFT)	{1201 0}
[end]
[app] (name=aterm-root)
  [Dimensions]	{1205 1011}
  [Position]	(UPPERLEFT)	{0 0}
  [Deco]	{NONE}
  [Hidden]	{yes}
  [Layer]	{12}
[end]
[app] (name=urxvt-fullscreen)
  [Dimensions]	{100% 100%}
  [Position]	(UPPERLEFT)	{0 0}
  [Hidden]	{yes}
  [Layer]	{12}
[end]
[app] (name=urxvt-root)
  [Position]	(UPPERLEFT)	{0 0}
  [Hidden]	{yes}
  [Layer]	{12}
[end]
[app] (name=Navigator) (class=Firefox) (role=browser)
  [Workspace]	{1}
[end]
[app] (name=nvidia-settings) (class=Nvidia-settings)
  [Workspace]	{4}
  [Position]	(UPPERLEFT)	{1 630}
[end]
[app] (name=conky-tiles) (class=conky-tiles)
  [Workspace]	{4}
[end]
[app] (name=ts3client_linux_amd64) (class=TeamSpeak 3)
  [Workspace]	{4}
[end]
[app] (name=ksysguard) (class=ksysguard)
  [Workspace]	{4}
[end]
[app] (name=pavucontrol) (class=Pavucontrol)
  [Workspace]	{4}
  [Position]	(UPPERLEFT)	{924 629}
[end]
[app] (name=clementine) (class=Clementine)
  [Workspace]	{3}
[end]
[app] (name=gkrellm)
  [Deco]	{NONE}
[end]
[app] (name=fluxbox-slit)
  [Deco]	{NONE}
[end]
[group]
  [app] (name=urxvt-ws3-left) (class=URxvt)
[end]

Offline

#12 2021-05-20 12:42:31

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,524

Re: [solved] autostart terminals on certain workspaces fluxbox

Class and name are not the same, the class is "URxvt", the urxvt name parameter impacts "urxvt-ws3-left" and that's whatfluxbox matched to the "name".
So "class=urxvt-ws3-left-df" should™ not match anything (you could test that by impacting an unrelated parameter, eg.  "[Sticky]    {yes}" or "[Deco]    {NONE}"

I suspect what happens is that fluxbox only matches one rule and skips subsequent ones. Try merging them

[group]
  [app] (name=urxvt-ws3-left) (class=URxvt)
  [Head]	{2}
  [Workspace]	{2}
  [Position]	(UPPERLEFT)	{668 0}
[end]
man 5 fluxbox-apps wrote:

GROUP SECTIONS
       The primary purpose of [group] sections is to group windows together. All windows in a
       group will be tabbed together automatically.

       These sections begin with a line of the format
           [group](pattern)

       Where the pattern item is optional. If specified, this pattern must match for the group to
       take effect. It is common to use non-window-specific patterns such as (workspace) here.
       See CLIENT PATTERNS for more details.

       This is followed by any number of [app] lines. These have a similar format to the [app]
       section detailed above in APP SECTIONS, but do not contain any settings and do not have an
       associated [end] line.

       Like this
           [app](pattern)

       This section may also contain settings that are applied to every window in the group. See
       the SETTINGS section for details.

       As with [app] sections, each of these sections ends with the single line
           [end]

Online

#13 2021-05-27 13:12:23

hybrid
Member
Registered: 2007-02-05
Posts: 262

Re: [solved] autostart terminals on certain workspaces fluxbox

Awesome, making progress here. FIrst off:

[group]
  [app (name=urxvt-ws3-left)
  [Head]			{2}
  [Workspace]	{2}
  [Position]		(UPPERLEFT)	{668 0}
[end]

works. The urxvt instances started by the startup script get spawned and grouped correctly.
Having the (class=) in the [app] line doesn't seem to make a difference.

I am now trying to get fluxbox to behave like this:
When I start a new urxvt from my fluxbox menu (the menu just executes 'urxvt'):
- on a workspace that is empty, I want it to be created on that workspace
- on a workspace that has urxvt-wsX instances from my startup script present, I want the new urxvt instance grouped with the one present on that workspace

I'm not sure if that's even possible and I suspect fluxbox to get confused on workspaces like ws3 that have a group of urxvt on the left and a group of urxvt on the right monitor.

But still I am messing around with it and this is what I got:

[group]
  [app] (name=urxvt-ws3-left) (class=URxvt)
  [Head]	{2}
  [Workspace]	{2}
  [Position]	(UPPERLEFT)	{668 0}
[end]
[group] (workspace=[current])
  [app]  (name=urxvt)
  [app]  (name=URxvt)
  [app]  (class=urxvt)
  [app]  (class=URxvt)
[end]

Doesn't group the plain urxvt with the -ws3-left ones.

[group]
  [app] (name=urxvt-ws3-left) 
  [app] (name=urxvt)
  [Head]	{2}
  [Workspace]	{2}
  [Position]	(UPPERLEFT)	{668 0}
[end]

Groups the plain urxvt with the -ws3-left ones. But of course it always does that, so if I am on workspace one and start a new urxvt it gets created on workspace3.

[group] (workspace=2)
  [app] (name=urxvt-ws3-left) 
  [app] (name=urxvt)
  [Head]	{2}
  [Workspace]	{2}
  [Position]	(UPPERLEFT)	{668 0}
[end]

Doesn't group the urxvt-ws3-left together at startup because at startup I'm then on the wrong workspace so my rule is omitted.

[group]
  [app] (name=urxvt-ws3-left)
  [Head]	{2}
  [Workspace]	{2}
  [Position]	(UPPERLEFT)	{668 0}
[end]
[group] (workspace=[current])
  [app]  (name=urxvt)
  [app]  (name=URxvt)
  [app]  (class=urxvt)
  [app]  (class=URxvt)
  [app]  (name=urxvt-ws3-left)
[end]

Does group together but always spawns on workspace 3.

[group]
  [app] (name=urxvt-ws3-left)
  [Head]	{2}
  [Workspace]	{2}
  [Position]	(UPPERLEFT)	{668 0}
[end]
[group]
  [app]  (name=urxvt)
  [app]  (name=URxvt)
  [app]  (class=urxvt)
  [app]  (class=URxvt)
  [app]  (name=urxvt-ws3-left) (workspace=2)
[end]

Does group together but always spawns on workspace 3.

Again, I'm not sure if it is at all possible to get the functionality I want. And this is just a quality of life thing and not entirely necessary, but maybe you see a way to achieve this.

Offline

#14 2021-05-27 14:48:25

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,524

Re: [solved] autostart terminals on certain workspaces fluxbox

ftr, there's a typo (missing "]") in your rule.

Reg, the dynamic urxvt tabbing, I don't think that's possibly by "just" running "urxvt" because the class isn't distinguishable, however you can oc. instead run sth. along

#!/bin/sh
WS=$(xdotool get_desktop)
xdotool search --desktop ${WS} --classname urxvt-ws${WS}-left && urxvt --name urxvt-ws${WS}-left || urxvt

Online

#15 2021-05-30 22:12:27

hybrid
Member
Registered: 2007-02-05
Posts: 262

Re: [solved] autostart terminals on certain workspaces fluxbox

Wow, awesome!

Regarding the typo: good find, luckily it is correct in the apps file.

Thank you for the hint with xdotool! I didn't even know about that. Just quickly checked the man and help pages and 'xdotool getmouselocation' looks interesting too.
I think I'll expand your script something like
#!/bin/bash
WS=$(xdotool get_desktop)
if [ $(xdotool getmouselocation  cut -c 3-6) -gt 2560]; then SCREEN=right; else SCREEN=left; fi
xdotool search --desktop ${WS} --classname urxvt-ws${WS}-${SCREEN} && urxvt --name urxvt-ws${WS}-${SCREEN} || urxvt

Not tested and thinking about it I should probably name my variable something different than screen, that variable is probably already taken.
Will think this through another day.
Thank you so much for all the help!

Last edited by hybrid (2021-05-30 22:12:57)

Offline

#16 2021-05-31 06:30:39

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,524

Re: [solved] autostart terminals on certain workspaces fluxbox

echo $SCREEN

As long as you don't export it to the urxvt instance, it doesn't really matter whether something else doesn't use it.
"xdotool getmouselocation --shell" will actually set it (just not to the value you want ;-)

Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Online

#17 2021-05-31 09:52:59

hybrid
Member
Registered: 2007-02-05
Posts: 262

Re: [solved] autostart terminals on certain workspaces fluxbox

Thanks for the reminder to mark the thread as solved, I probably would have forgotten it. big_smile

What do you mean by "will actually set it (just not to the value you want ;-)"?
My logic is: if x > 2560 the cursor must be on the right screen, therefore start urxvt with the name ....-right so it gets grouped with the ones on the right screen (if present). And if x <= 2560 the cursor is on the left screen, so start urxvt with the name ....-left so it gets grouped with the ones on the left screen.
Then I have my fluxbox menu point to that script and the urxvt instances get created on the screen that I call the fb-menu on.

So I'm not sure I'm getting what you mean.


That aside, here's my current script that I briefly tested and it seems to work as intended

#!/bin/bash
WS=$(xdotool get_desktop)
WSFB=$(($(xdotool get_desktop) + 1))
if [ $(xdotool getmouselocation | cut -c 3-6) -gt 2560 ]; then SCREEN=right; else SCREEN=left; fi
xdotool search --desktop ${WS} --classname urxvt-ws${WSFB}-${SCREEN} && urxvt -name urxvt-ws${WSFB}-${SCREEN} || urxvt

Looks jank, can surely be expressed more neatly, but seems to work.

Offline

#18 2021-05-31 12:55:41

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,524

Re: [solved] autostart terminals on certain workspaces fluxbox

Run "xdotool getmouselocation --shell", the output sets some variables which ex executed if you "eval" the command.
One of the set variables is SCREEN (but it'll be set to 0)
This was just to re-assure you that it's fine to use that variable.

Online

Board footer

Powered by FluxBB