The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
0

move caja to scratchpad on start

asked 2015-08-19 03:39:59 +0000

chili gravatar image

Hi, I am new to i3, so please be patient :)

I use caja (file manager from Mate) and want it to be ready from the start of i3. I can do this by using this config:

for_window [instance="caja"] move window to scratchpad
exec --no-startup-id i3-msg 'workspace 0; exec caja; workspace 1'
bindsym $mod+e [instance="caja"] scratchpad show

But if i want to open a new caja window (so i have 2 different caja windows, one in scratchpad one in workspace), it will be sent to the scratchpad instead (so now i have 2 caja windows in scratchpad). So how do I fix this?

I tried several options included vim-like mark, but it is not working on startup. (it is working with bindsysm, but i want to mark it automatically). I tried something like this:

for_window [con_mark="^test$"] move window to scratchpad
exec --no-startup-id i3-msg 'workspace 0; exec caja, mark test; workspace 1'
bindsym $mod+e [con_mark="^test$"] scratchpad show

and several other options, but nothing works. caja has --name options, but it is not working. When i check it with xprop, the class still WM_CLASS(STRING) = "caja", "Caja". Thanks for all your help.

edit retag flag offensive close merge delete

Comments

The reason the second try does not work is that i3 does not wait after `exec caja` for a window to appear before running `mark test`, so unless caja starts exceptionally fast, `mark test` will run long before the window appears, thus marking something else.

Adaephon gravatar imageAdaephon ( 2015-08-19 07:30:24 +0000 )edit

Aside from that, scratchpads are available on all workspaces, so switching to "workspace 0", starting caja and then switching to "workspace 1" does not really make sense.

Adaephon gravatar imageAdaephon ( 2015-08-19 07:39:49 +0000 )edit

@Adaephon oh i forgot to explain about moving to workspace 0 first. It is because if i do all of that only on workspace 1, after caja is sent to the scratchpad, the focus is not come back to workspace 1. so i need to do $mod+1 again to bring the focus to workspace 1.

chili gravatar imagechili ( 2015-08-19 10:08:04 +0000 )edit

Does Caja perchance have a `--class=CLASS` command line argument?

Adaephon gravatar imageAdaephon ( 2015-08-19 10:48:15 +0000 )edit

it has, but same like the --name, it is not working at all.

chili gravatar imagechili ( 2015-08-19 11:09:11 +0000 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-08-19 09:11:13 +0000

Adaephon gravatar image

As your Caja seems to be uncooperative in regards to the --name argument, there is probably no clean solution.

You could try the following:

exec caja
exec --no-startup-id  "sleep 2; i3-msg '[instance=caja] mark cajascratch, move scratchpad'"
bindsym $mod+e [con_mark="^cajascratch$"] scratchpad show

Both exec statements are run at i3 startup. The first starts caja, the second one waits for two seconds and than marks and moves the Caja window scratchpad.
The mark is used as criterion for show scratchpad as to not interfere with other Caja windows.

Note: The quoting for the second exec statement has to be just so. The outer quotes need to be double quotes because single quotes have no special meaning in the i3 configuration and then ; and , would be parsed for the configuration. The inner single quotes are needed because [] might be special to the shell used for running the exec statements. And finally, there can be no double quotes around the criterion string because they would be parsed together with the outer double quotes.

edit flag offensive delete link more

Comments

Thanks!! Even tough the waiting time still bothering me, but I think this is the only workaround for now. I also exec the caja on other workspace so i can do something on workspace 1 immediately.

chili gravatar imagechili ( 2015-08-19 10:39:40 +0000 )edit

Question Tools

1 follower

Stats

Asked: 2015-08-19 03:39:59 +0000

Seen: 127 times

Last updated: Aug 19