cdump / awesome-shifty

Dynamic tagging library for awesome window manager
17 stars 7 forks source link

Screen property doesn't work #8

Open myuhe opened 11 years ago

myuhe commented 11 years ago

My rc.lua is

shifty.config.tags  = {
   emacs         = {layout = awful.layout.suit.max, init = false, float = false ,position = 1, screen = 1, mwfact = 0.40, spawn = "emacs"},
   www           = {leave_kills = true, position = 7, screen = 2, spawn = "firefox"}
}

Then, emacs tag shold be shown on screen 1, and www tag shold be shown on screen 2 too.

But each tag is shown on screen mouse hovered.

tbondarchuk commented 11 years ago

Confirmed.

Despite tag's screen value, all tags are creating on mouse hovered screen. Only tags with init=true are creating on proper screen. Also, windows, moved to another screen by "modkey+o" do not appear on target screen.

jcharest commented 11 years ago

I experience the same issue. Although in my case it also does not work with tags with init=true (unless i move cursor on second screen). Could it be the spawn function that does not obey the scr param ?

I am running awesome 3.5-2 on arch linux.

cdump commented 11 years ago

I have only 1 screen (and don't have free time now to trying emulate more screens), if anyone fix it and send me pull request - it will be great.

criemen commented 11 years ago

I can't send a pull request (yet) because of my non-existant lua knowledge, but I've debugged the problem a bit so far. I'll describe what I found out now, I'lll post more information as I get them. The problem lies in the match function in init.lua. The target_screen local is initialized to the current screen, and only overwritten, if the shifty.config.apps entry contains a screen. Later, when a matching tag object for the tag name is searched, only the tag objects for the current screen are considered:

local sel = awful.tag.selectedlist(target_screen)

As the current screen may not be the designated screen for the tag, another tag is created on the current screen, even if on the target screen, the correct tag already exists because of init=true. I do not know what the proper fix would be, though, as tag creation always should take the specified screen, not the current, and probably a target screen defined in shifty.config.apps should beat shifty.config.tags. Also, tag creation in "translate target names to tag objects, creating missing ones" block does not honor the shifty.config.tags settings at all. @cdump , can you help here?

criemen commented 11 years ago

Okay, I've got a workaround for the issue, but I don't know the implications of it. As my file is littered with debug statements, I can't really post a patch, but the changes made by me are: in the function set where the local scr is defined, I replaced "(not awful.tag.getscreen(t) and awful.tag.getscreen(preset)) or" with "preset.screen or" In the function match "name2tags(tn, target_screen) or" was removed, and I commented out "if awful.tag.getscreen(t) == mouse.screen then" and the corresponding "end" Now everything seems to work fine, but I'm not sure because I don't use all functions of shifty.

socek commented 11 years ago

This "patch" do not work for me. I still have "one big screen" instead of "two seperate sceens". :(

criemen commented 11 years ago

I can post my whole "patch" which generates lots of debug informations I used during debugging, if you're able to read code, it may help you in understanding the problem, have a look here: https://gist.github.com/Corni/6344126

MarceColl commented 7 years ago

Three years later the problem still exists.

I installed shifty today and after an hour or so of trying to use the screen property I decided to look at the source code.

The problem begins here: https://github.com/cdump/awesome-shifty/blob/master/init.lua#L367

spawn_with_shell is used with a scr second parameter, the problem is that the spawn_with_shell function in awful.util doesn't take a screen parameter.

It used to in 3.5 as seen here: https://github.com/awesomeWM/awesome/blob/v3.5/lib/awful/util.lua.in#L85-L90

but no longer in the later versions of awesome (v3.5.9): https://github.com/awesomeWM/awesome/blob/v3.5.9/lib/awful/util.lua.in#L86-L91

This makes the spawn propery useless because it spawns everything in the main screen always instead of using the tags.

Here in the actual spawn C code, it seems that by default default_screen is used. https://github.com/awesomeWM/awesome/blob/v3.5.9/spawn.c#L351-L362