You are not logged in.

#1 2021-12-27 10:24:46

Riggo
Member
Registered: 2021-12-05
Posts: 8

i3 Dynamic Floating Window Config

Hello all,
Arch OS
i3 Window manager
Visual Studio Code - IDE
Rust Programming language

Got Arch running VS code and got a little snake game running (Learning Rust).
I want to have VScode to be running normally in the windows manager but I want any of the applications I create and run using it to float.

I found a script to get the window info which I can use in the config file but I would hate to do this for EVERY SINGLE project individually.

I also read that you can allocate different workplaces to be all floating but I would like to avoid this if possible since I do not usually like floating windows at all.

Is there a way to dynamically allocate anything run by VS code (or any IDE) to float while keeping everything default?



Any help would be greatly appreciated.

https://drive.google.com/file/d/1DAcQo5 … sp=sharing
https://drive.google.com/file/d/17QQiF1 … sp=sharing

Last edited by Riggo (2021-12-27 10:30:12)

Offline

#2 2021-12-27 13:48:52

manyroads
Member
From: around here, somewhere
Registered: 2019-04-16
Posts: 121
Website

Re: i3 Dynamic Floating Window Config

Perhaps this will be of value... https://eirenicon.org/?s=i3


Pax vobiscum,
Mark Rabideau - http://many-roads.com  Professional Genealogist
dwm & i3wm ~ Reg. Linux User #449130
"For every complex problem there is an answer that is clear, simple, and wrong." H. L. Mencken

Offline

#3 2021-12-27 17:26:18

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 1,516

Re: i3 Dynamic Floating Window Config

Riggo wrote:

.
Is there a way to dynamically allocate anything run by VS code (or any IDE) to float while keeping everything default?

Can you assign a unique class name when you run the VS code? So instead of:

class="Snake Game"

it would be something like:

class="Game"

Then you could add

for_window [class="Game"] floating enable

to your i3 config.

Easiest way would be to toggle the floating on your VS code window. The default is $mod+f, so when you window comes you can make it floating and move it wherever you want.


You must unlearn what you have learned.
    -- yoda

Offline

#4 2021-12-29 12:11:59

Riggo
Member
Registered: 2021-12-05
Posts: 8

Re: i3 Dynamic Floating Window Config

PackRat wrote:
Riggo wrote:

.
Is there a way to dynamically allocate anything run by VS code (or any IDE) to float while keeping everything default?

Can you assign a unique class name when you run the VS code? So instead of:

class="Snake Game"

it would be something like:

class="Game"

Then you could add

for_window [class="Game"] floating enable

to your i3 config.

Easiest way would be to toggle the floating on your VS code window. The default is $mod+f, so when you window comes you can make it floating and move it wherever you want.

Hey thanks for the reply. I am not 100% sure I understand the suggestion.
Are you saying to replace "Snake Game" with just "Game" and then set up the i3 config with "Game" to float?

If that is the case I am not sure if I can change the class like that since the class title was created from the name of the application rather than anything else.

It would be cool if there was a way to set a directory to float, as in anything that loads from a directory auto floats.

Have to do a little more reading on that front but thank you for the suggestion.

All the best

Offline

#5 2021-12-29 12:13:48

Riggo
Member
Registered: 2021-12-05
Posts: 8

Re: i3 Dynamic Floating Window Config

manyroads wrote:

Perhaps this will be of value... https://eirenicon.org/?s=i3

hey thanks for the reply.

I have looked through the link provided but i did not see any information that would help me with my issue. Is there a specific section you wanted to show me?

All the best

Offline

#6 2021-12-29 12:33:39

Riggo
Member
Registered: 2021-12-05
Posts: 8

Re: i3 Dynamic Floating Window Config

I implemented the idea but did not get the result I wanted.

I would like to auto-float the window apon spawn.

Not sure if I got the config file wrong or not. Here is a link for you to double check.

https://drive.google.com/file/d/1hyhWAx … sp=sharing

**EDIT**

Rebooted the system and to new config kicked in and got it working. Thanks for the suggestion but still looking for a different solution since I will now need to name everything "WIP_Game" when I spawn a new window. With larger applications this might be an issue in the future.

This post is still un-resolved.

Last edited by Riggo (2021-12-29 12:39:03)

Offline

#7 2021-12-29 21:55:38

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 1,516

Re: i3 Dynamic Floating Window Config

Hey thanks for the reply. I am not 100% sure I understand the suggestion.
Are you saying to replace "Snake Game" with just "Game" and then set up the i3 config with "Game" to float?

Sort of. I've never used the software you're using, but some software allows you to assign a class name when starting. For example:

yad --class=MyCalendar --calendar

starts a calendar with the class name of MyCalendar that I can use in i3 (any window manager that supports per app settings) to have MyCalendar float by default. If there is a similar way to start your VS code, you can give everything a class name like RiggoVS then configure i3 so that RiggoVS will float by default.

Edit - That looks like what you did with your game. So it would be impractical to assign a standard class name to your applications.

Last edited by PackRat (2021-12-29 21:59:15)


You must unlearn what you have learned.
    -- yoda

Offline

#8 2021-12-31 07:08:01

Riggo
Member
Registered: 2021-12-05
Posts: 8

Re: i3 Dynamic Floating Window Config

Thanks again for the info PackRat

I think the main issue I am running into is that I am using VScode to create the program so it is not VSCode that is running it. It is only launching the application in a debug mode.

So VScode and the RUST project are in two different folders so anything I do with VS Code will not really effect the snake game project.

I am going to do a little more digging, it would be awesome if there was a way to select a directory and have everything from that directory to auto-float.

Like a "for_window [class="~/dir/goes/here/*"]" where the star represents all the projects that I want to auto float.

I am not sure if something like that is possible with i3 though.
Thoughts?

All the best

Offline

#9 2022-01-01 00:54:09

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 1,516

Re: i3 Dynamic Floating Window Config

So VScode and the RUST project are in two different folders so anything I do with VS Code will not really effect the snake game project.

So the game is written in RUST then you run the game in VScode?

Can you code the class and/or name into the RUST program?

You may want to ask on the i3 IRC or mailing list. The i3 development team is a good group; you should get an answer.


You must unlearn what you have learned.
    -- yoda

Offline

Board footer

Powered by FluxBB