DK Window Manager

Do you mean ignore bars too? If so then no, unless the window has built in support for setting it’s own state to fullscreen (video players, web browsers, etc.).

To use up the free real estate enable smart gaps so you don’t get gaps in layouts with only a single window visible (tiled with only one window or mono layout).

I’m also not trying to fully implement everything from [insert wm here] if it can be easily done through other means. I think you just want a different layout, the implementation of the mono layout is very simple; tweak it and add it to config.h with a matching entry in the layouts array under a different name then add a bind for that name to your sxhkdrc.

/* config.h */

int gmono(Workspace *ws)
{
	Client *c;
	int g, wx, wy, ww, wh;

	wx = ws->mon->wx + ws->padl;
	wy = ws->mon->wy + ws->padt;
	ww = ws->mon->ww - ws->padl - ws->padr;
	wh = ws->mon->wh - ws->padt - ws->padb;
	for (c = nextt(ws->clients); c; c = nextt(c->next))
		resizehint(c, wx, wy, ww, wh, border[Smart] ? 0 : border[Width], 0, 0);
	return 1;
}

static Layout layouts[] = {
	{ "tile",  tile  }, /* first is initial default */
	{ "mono",  mono  },
	{ "gmono", gmono },
	{ "none",  NULL  },
};
# sxhkdrc

alt + {t,m,g,f}
    yaxcmd set layout {tile,mono,gmono,none}

The same could be done for a “true” fullscreen layout that ignores bars too by changing the wx, wy, ww, wh variables though there might be issues with the stacking order and the bar may be on-top of the windows.

Edit: fixed error

3 Likes

No no, I don’t mean hiding the bar, in fact mine is hidden most of the time. It was just the case that I thought that the monocle would maximize the windows even with smart gaps disabled. It’s not really a problem to me, I always use smart gaps, I just disabled it to see how the layout would look like with a new wallpaper lol

1 Like

A lot of format changes in there. May have time to check it out again this week.

nate I just added this monocle layout and works great, thanks! I had to replace ‘border[Smart]’ with ‘globalcfg[SmartBorder]’ because it wouldn’t recompile so I checked the mono layout in yaxwm.c and copied that part.
Dude I’m really loving yax, it’s been 3 days taht I really got to use it and now it is the only wm I’ve used this past couple of days, and today I completely removed bspwm and i3 from my machine, now there’s just yax and dwm and to be honest I don’t plan on going back to dwm lol The only thing I miss is the option to move through occupied workspaces, other than that it just fits all my needs.

Whoops lol.

Thanks man, I’ve added next/prev non-empty workspace command, just working on some other things and haven’t pushed yet. I’ll post back here when I do.


@PackRat Yea for sure do it up man.

awesome!

Installed no problem. Using polybar at the moment.

@PackRat Very nice, lemme know if you run into anything.

@rml Just pushed my changes with some new binds.

3 Likes

Thanks! I’ll get it right away!

@natemaia I was trying to get a way to focus the master window so I made a ‘focusmaster patch’ by editing a focusmaster patch for dwm I’ve found on github.

I added the following to yaxwm.h

static void cmdfocusm(char **);

and

{ “focusm”, cmdfocusm },

And also added this to yaxwm.c

void cmdfocusm(char **argv)
{
focus(nextt(selws->clients));
}

Added a keybind to sxhkd to run ‘yaxcmd win focusm’ and it’s all good. Its working great but I would like if the way it’s written would bring me some troubles with something later (got 0 knowledge about C).

1 Like

Looks great to me, shouldn’t have issues in the future. I’m planning on stabilizing the code base and limiting my changes, going forward function/variable names won’t be changing if it can be avoided.

I’ll move a bunch of the command arrays (like layouts/callbacks) to the config header so you wouldn’t need a patch per-se, just a custom config.h. I had done this before but moved most out of the config to keep it shorter but I think it’s better to have the option of changing more than just layouts and callbacks.

You can just add functions to it and modify the command array in which you want it to belong setcmds, wincmds, etc.

2 Likes

Sounds good! Looking forward to it

Oh also @natemaia there was something ive been meaning to ask you but just remembered. Is there a way to set a program to spawn on a specific workspace and switch to it? For some reason gimp, chromium and brave automatically switch to their respective workspaces respecting their rules, but other programs like firefox, thunar and my terminals do appear on the desktop they’se supposed to but i have to manually switch to it. A workaround i’m using rn is to set it when launching them, for example super + w runs firefox & yaxcmd ws view 1 or thunar & yaxcdm ws view 3

1 Like

Yea this is just due to some applications sending a _NET_ACTIVE_WINDOW or _NET_WM_STATE_DEMANDS_ATTENTION and some not, the focus_urgent setting when true will change the active workspace and focus it, otherwise the window has it’s urgency hint set. Sadly adhering to specs only gets me so far when half the applications out there don’t.

I think a forcefocus or activate and neverfocus would be good additions to the rules though, I don’t plan on adding them immediately but over the course of the weekend I’ll get to it.

I do really like the idea of not and having additional settings and instead relying on scripting commands together like you mentioned but this isn’t a very clean solution and would require having specialty binds for everything (which I’m not a fan of, I just use dmenu for everything aside from terminal emulator) and changing them any time you want to tweak the setup. Overall I think the rule additions are a better, more robust option.

2 Likes

Oh I understand it now. Tbh I use dmenu to launch most of the stuff as well, I added the binds for the applications I set rules to. But yeah ‘activate’ and ‘neverfocus’ would be great additions to the rules. In the meantime I’ll keep this workaround in sxhkdrc since it does the job

@natemaia I just saw you updated yax and added the focus option but something’s happening when the programs with rules assigned launch. It seems like they go to the workspace they’re assigned to but that workspace kind of shows the application I launched with the same applications I had open on the previous workspace I was working before launching them. Looking at the screenshots (I don’t have any ways of recording my screen rn) you can see that on the first one I have my mouse focused on firefox (assigned to ws1) and it shows I’m on ws1, whereas on the second one I just moved the cursor focus to transmission-cli (floating window and assigned to ws9) and now it shows I’m on ws9. The same thing happens on the 3rd screenshot, I launched thunar (assigned to ws3) and it appears on ws9. I had focus on transmission so it still shows I’m on ws9. Apparently thunar is tiled that way because on ws3 that instance is the third window on the stack area. Now if I switch to the proper ws for the respective applications, it sort of fixes it and they don’t appear on the ws I was before anymore, but the same happens if I run other instances of them. I don’t know if I was clear but that’s the best way I could explain it lol.



1 Like

Yea it was late and I was too tired to test, will get it all fixed up and pushed tonight.

1 Like

@rml should be all good now, still needs some work for multi-mon setups I think but for just focusing the workspace on-open it handles fine.

1 Like

It’s working great! Thanks for your work, I’m really enjoying yax

@natemaia Here’s the workspaces module for lemonbar

dt_next() {
	yaxcmd ws view nextne
}

dt_prev() {
	yaxcmd ws view prevne
}

dt_set() {
	xdotool set_desktop $1
}


sp_desktops() {
	pkill -x xprop >/dev/null 2>&1
	NL='
'
	module_index="$1"
	# check what X properties are supported by wm
	xprop_list="_NET_NUMBER_OF_DESKTOPS \
		_WIN_WORKSPACE_COUNT \
		_NET_CURRENT_DESKTOP \
		_WIN_WORKSPACE \
		_NET_DESKTOP_NAMES \
		_WIN_WORKSPACE_NAMES \
		_NET_ACTIVE_WINDOW"
	xprop_query=""
	for prop in $xprop_list ; do
		{ xprop -root -notype _NET_SUPPORTED _WIN_PROTOCOLS 2>/dev/null | grep -q -s "$prop" 2>/dev/null; } && xprop_query="$xprop_query $prop"
	done
	dt_max_num=1
	dt_current=0
	dt_names=""	
	xprop -spy -root -notype $xprop_query 2>/dev/null \
	| while unset IFS; read xprop_name eq_sign xprop_value; do
		case "$xprop_name" in
			_NET_NUMBER_OF_DESKTOPS|\
			_WIN_WORKSPACE_COUNT)
				dt_max_num="$xprop_value" ;;
			_NET_CURRENT_DESKTOP|\
			_WIN_WORKSPACE)
				dt_current="$xprop_value" ;;
			_NET_DESKTOP_NAMES|\
			_WIN_WORKSPACE_NAMES)
				dt_names=""
				i=1
				IFS=','
				for dt in $xprop_value ; do
					dt="${dt#*\"}"; dt="${dt%\"}"	# remove ""
					[ "$dt" ] || dt="$i"	# use number (starting from 1) if name is not set
					dt_names="$dt_names$dt$NL"
					i=$(($i+1))
				done ;;
		esac
		IFS="$NL"
		set -- $dt_names
		dt_line=""
		dt_number=0
		while [ $dt_number -lt $dt_max_num ] ; do
			dt="$1"
			[ "$dt" ] || dt="$(($dt_number+1))"	# use number (starting from 1) if there are more desktops than names
			if [ $dt_number -eq $dt_current ] ; then
				dt_line="${dt_line}${SP}${FC4}[${FC}${FC3}${SP}${dt}${SP}${FC}${FC4}]${FC}${SP}"
			else	# check if desktop is occupied
				if [ $(xdotool search --desktop $dt_number --limit 1 --class "") ] ; then
					dt_line="${dt_line}%{A1:dt_set $dt_number:}${SP}${dt}${SP}%{A1}"
				fi
			fi
			dt_number=$(($dt_number+1))
			[ $# -gt 0 ] && shift
		done
		print_module "$module_index" \
			"%{A4:dt_next:}
				%{A5:dt_prev:}
					${dt_line}
				%{A5}
			%{A4}"
	done
}

3 Likes