Yaxwm + tint2

First of all very cool window manager thanks for your work @natemaia, i have it working nicely on my devuan beowulf system. Im using tint2 which is really nice as i like tint2 and dwm and the two have never been able to meet until now.

So i got a few questions. Im wanting tint2 to behave like say i3wm statusbar in regards to taskbar, so far all i can think of is to remove the tint2 taskbar and add in executors to show workspaces, what im stumped on is how to show inactive workspaces that are used but hidden, like say im on workspace 1 with st term, and have 2 and 3 open with an editor and web browser. Any ideas on how to show those workspaces as executors or display them in tint2 similar to how i3wm does it?

here is a scrot and im using wmctrl to show current workspace active.

wmctrl -d | grep "*" | awk '{print $9}'

#---- Generated by tint2conf c9e2 ----
# See https://gitlab.com/o9000/tint2/wikis/Configure for 
# full documentation of the configuration options.
#-------------------------------------
# Gradients
#-------------------------------------
# Backgrounds
# Background 1: Panel
rounded = 0
border_width = 2
border_sides = TB
border_content_tint_weight = 0
background_content_tint_weight = 0
background_color = #000000 100
border_color = #000000 100
background_color_hover = #000000 0
border_color_hover = #000000 0
background_color_pressed = #000000 0
border_color_pressed = #000000 0

# Background 2: Active taskbar
rounded = 0
border_width = 0
border_sides = B
border_content_tint_weight = 0
background_content_tint_weight = 0
background_color = #000000 100
border_color = #ff0000 100
background_color_hover = #000000 0
border_color_hover = #000000 0
background_color_pressed = #000000 0
border_color_pressed = #000000 0

# Background 3: 
rounded = 0
border_width = 0
border_sides = TBLR
border_content_tint_weight = 0
background_content_tint_weight = 0
background_color = #5c5c5c 64
border_color = #1d79cc 100
background_color_hover = #000000 0
border_color_hover = #000000 0
background_color_pressed = #000000 0
border_color_pressed = #000000 0

# Background 4: 
rounded = 0
border_width = 1
border_sides = TBLR
border_content_tint_weight = 0
background_content_tint_weight = 0
background_color = #000000 100
border_color = #ffffff 100
background_color_hover = #000000 0
border_color_hover = #000000 0
background_color_pressed = #000000 0
border_color_pressed = #000000 0

# Background 5: 
rounded = 0
border_width = 0
border_sides = TBLR
border_content_tint_weight = 0
background_content_tint_weight = 0
background_color = #5c5c5c 64
border_color = #1d79cc 100
background_color_hover = #000000 0
border_color_hover = #000000 0
background_color_pressed = #000000 0
border_color_pressed = #000000 0

#-------------------------------------
# Panel
panel_items = PE:FSC
panel_size = 100% 26
panel_margin = 0 0
panel_padding = 0 0 2
panel_background_id = 1
wm_menu = 1
panel_dock = 0
panel_position = top left horizontal
panel_layer = top
panel_monitor = 1
panel_shrink = 0
autohide = 0
autohide_show_timeout = 0.3
autohide_hide_timeout = 2
autohide_height = 2
strut_policy = follow_size
panel_window_name = tint2
disable_transparency = 0
mouse_effects = 1
font_shadow = 0
mouse_hover_icon_asb = 100 0 10
mouse_pressed_icon_asb = 100 0 25
scale_relative_to_dpi = 0
scale_relative_to_screen_height = 0

#-------------------------------------
# Taskbar
taskbar_mode = single_desktop
taskbar_hide_if_empty = 0
taskbar_padding = 6 0 0
taskbar_background_id = 0
taskbar_active_background_id = 2
taskbar_name = 0
taskbar_hide_inactive_tasks = 0
taskbar_hide_different_monitor = 0
taskbar_hide_different_desktop = 1
taskbar_always_show_all_desktop_tasks = 1
taskbar_name_padding = 5 0
taskbar_name_background_id = 0
taskbar_name_active_background_id = 0
taskbar_name_font = Liberation Sans Bold 10
taskbar_name_font_color = #393939 100
taskbar_name_active_font_color = #ffffff 100
taskbar_distribute_size = 1
taskbar_sort_order = none
task_align = center

#-------------------------------------
# Task
task_text = 1
task_icon = 0
task_centered = 0
urgent_nb_of_blink = 65535
task_maximum_size = 0 0
task_padding = 0 0 0
task_font = Terminus Bold 14
task_tooltip = 0
task_thumbnail = 0
task_thumbnail_size = 8
task_font_color = #e7e7e7 100
task_normal_font_color = #e7e7e7 100
task_active_font_color = #e7e7e7 100
task_urgent_font_color = #e7e7e7 100
task_iconified_font_color = #e7e7e7 100
task_icon_asb = 100 0 0
task_normal_icon_asb = 100 0 0
task_active_icon_asb = 100 0 0
task_urgent_icon_asb = 0 0 16
task_iconified_icon_asb = 100 0 0
task_urgent_background_id = 0
task_iconified_background_id = 0
mouse_left = none
mouse_middle = none
mouse_right = none
mouse_scroll_up = none
mouse_scroll_down = none

#-------------------------------------
# System tray (notification area)
systray_padding = 5 5 1
systray_background_id = 0
systray_sort = ascending
systray_icon_size = 24
systray_icon_asb = 100 0 0
systray_monitor = 1
systray_name_filter = 

#-------------------------------------
# Launcher
launcher_padding = 5 5 1
launcher_background_id = 0
launcher_icon_background_id = 0
launcher_icon_size = 24
launcher_icon_asb = 100 0 0
launcher_icon_theme_override = 0
startup_notifications = 1
launcher_tooltip = 1

#-------------------------------------
# Clock
time1_format = %R
time2_format = 
time1_font = Terminus Bold 14
time1_timezone = 
time2_timezone = 
clock_font_color = #e7e7e7 80
clock_padding = 5 0
clock_background_id = 0
clock_tooltip = %Y-%m-%d %H:%M:%S
clock_tooltip_timezone = 
clock_lclick_command = gsimplecal
clock_rclick_command = gsimplecal
clock_mclick_command = gsimplecal
clock_uwheel_command = 
clock_dwheel_command = 

#-------------------------------------
# Battery
battery_tooltip = 1
battery_low_status = 10
battery_low_cmd = xmessage "Battery low"
battery_full_cmd = 
bat1_font = Terminus Bold 12
battery_font_color = #e7e7e7 80
bat1_format = 
bat2_format = 
battery_padding = 5 1
battery_background_id = 0
battery_hide = 101
battery_lclick_command = xmessage "Battery low"
battery_rclick_command = 
battery_mclick_command = 
battery_uwheel_command = 
battery_dwheel_command = 
ac_connected_cmd = notify-send -u normal "AC connected"
ac_disconnected_cmd = notify-send -u normal "AC disconnected"

#-------------------------------------
# Separator 1
separator = new
separator_background_id = 0
separator_color = #777777 80
separator_style = empty
separator_size = 1024
separator_padding = 1 0

#-------------------------------------
# Executor 1
execp = new
execp_command = wmctrl -d | grep "*" | awk '{print $9}'
execp_interval = 1
execp_has_icon = 0
execp_cache_icon = 0
execp_continuous = 1
execp_markup = 0
execp_lclick_command = 
execp_rclick_command = 
execp_mclick_command = 
execp_uwheel_command = 
execp_dwheel_command = 
execp_font = Terminus Bold 14
execp_font_color = #cc241d 100
execp_padding = 10 0
execp_background_id = 3
execp_centered = 1
execp_icon_w = 0
execp_icon_h = 0

#-------------------------------------
# Button 1
button = new
button_icon = start-here
button_text = 
button_lclick_command = jgmenu_run
button_rclick_command = 
button_mclick_command = 
button_uwheel_command = 
button_dwheel_command = 
button_font_color = #000000 100
button_padding = 4 0
button_background_id = 0
button_centered = 1
button_max_icon_size = 24

#-------------------------------------
# Tooltip
tooltip_show_timeout = 0
tooltip_hide_timeout = 0
tooltip_padding = 3 3
tooltip_background_id = 0
tooltip_font_color = #e7e7e7 80
tooltip_font = Liberation Sans 10

2 Likes

Welcome to the forum and to the yax side lol
I’m no tint2 expert but when I was trying to accomplish the same thing you want, I couldn’t get it to work as expected. Either it hid all the occupied workspaces or it showed them but with all the tasks that were currently on them. And the spacing between them was really annoying, either you set them to be all close together or annoyingly far from each other. Seems like tint2 is not the best option for tiling window managers, although it works. Nate could give a better opinion regarding tint2.
But have you tried polybar and lemonbar? Those two work perfectly with yax.

1 Like

cheers,

yeah the taskbar is just not suited to tilers like dwm and yax it seems, but the rest of tint2 is so usable. I just deleted the taskbar and trying to hack together some sort of display through the executors.

Ive tried lemonbar and polybar on dwm, if all else fails ill resort to polybar.

Polybar doesn’t really work that well on dwm by default, actually no bar does apart from the default one. Some tweaking is needed to get them to behave properly in dwm. Maybe your experience with it wasn’t so good because you tried it on dwm.
Anyway, I hope you get tint2 working the way you want. If not, give polybar or lemonbar another shot.

Yeah come to think of it i think i was using bspwm with polybar not dwm, but lemonbar works well i know this, just not as many features as polybar or tint2

Firstly thanks for the interest.

Next you don’t need external programs like wmctrl to get info from yax, do

# print active workspace name, can also be num or both with just print ws
yaxwm -c print ws name

There’s a print command for just about everything, my documentation of them is just lacking.

Here’s what I made the other day for lemonbar (should work for any bar that can print text though)

ws()
{
	bg="#111111" fg="#666666" hi="#6699ee"

	a="$(yaxwm -c print all win |
		awk 'BEGIN{s=""} /[0-9]/ {sub(/:[0-9]*/, ""); if (s !~ $2) s = s $2} END{print s}')"

	yaxwm -c print all ws |
		awk -v i="$(yaxwm -c print ws num)" -v fg="$fg" -v hi="$hi" -v a="$a" -F: '{
			if ($1 == i && a ~ $1) {
				printf " %%{+u}%%{F" hi "}" $1 "%%{F" fg "}%%{-u} "
			} else if ($1 == i) {
				printf " %%{F" hi "}" $1 "%%{F" fg "} "
			} else if (a ~ $1) {
				printf " %%{+u}" $1 "%%{-u} "
			} else {
				printf " " $1 " "
			}
	}'
}

It’s using lemonbar formatting to get some extra info on the cheap, workspaces with windows on them get an underline, active workspace gets a (hi)light colour.

Example output with ws 2 active and both ws 1/2 with windows on them 2020-06-20-090700_321x28_scrot

The only thing I haven’t bothered with is the click actions, I’m sure it can be done though.

Since I went off on a bit of a tangent, to answer your tint2 question. yax doesn’t do workspaces like i3, we don’t destroy inactive workspaces or ever free them, only add more. There will always be a set amount of workspaces that can be accessed from any monitor.
Try this tint2conf (specifically the task sections)*

#---- Generated by tint2conf b7e5 ----
# See https://gitlab.com/o9000/tint2/wikis/Configure for 
# full documentation of the configuration options.
#-------------------------------------
# Gradients
#-------------------------------------
# Backgrounds
# Background 1: Panel
rounded = 0
border_width = 2
border_sides = TB
border_content_tint_weight = 0
background_content_tint_weight = 0
background_color = #000000 100
border_color = #000000 100
background_color_hover = #000000 0
border_color_hover = #000000 0
background_color_pressed = #000000 0
border_color_pressed = #000000 0

# Background 2: Inactive desktop name
rounded = 0
border_width = 0
border_sides = B
border_content_tint_weight = 0
background_content_tint_weight = 0
background_color = #000000 100
border_color = #ff0000 100
background_color_hover = #000000 0
border_color_hover = #000000 0
background_color_pressed = #000000 0
border_color_pressed = #000000 0

# Background 3: Active taskbar
rounded = 0
border_width = 0
border_sides = TBLR
border_content_tint_weight = 0
background_content_tint_weight = 0
background_color = #5c5c5c 64
border_color = #1d79cc 100
background_color_hover = #000000 0
border_color_hover = #000000 0
background_color_pressed = #000000 0
border_color_pressed = #000000 0

# Background 4: 
rounded = 0
border_width = 1
border_sides = TBLR
border_content_tint_weight = 0
background_content_tint_weight = 0
background_color = #000000 100
border_color = #ffffff 100
background_color_hover = #000000 0
border_color_hover = #000000 0
background_color_pressed = #000000 0
border_color_pressed = #000000 0

# Background 5: 
rounded = 0
border_width = 0
border_sides = TBLR
border_content_tint_weight = 0
background_content_tint_weight = 0
background_color = #5c5c5c 64
border_color = #1d79cc 100
background_color_hover = #000000 0
border_color_hover = #000000 0
background_color_pressed = #000000 0
border_color_pressed = #000000 0

#-------------------------------------
# Panel
panel_items = PT:SC
panel_size = 100% 26
panel_margin = 0 0
panel_padding = 0 0 2
panel_background_id = 1
wm_menu = 1
panel_dock = 0
panel_pivot_struts = 0
panel_position = top left horizontal
panel_layer = top
panel_monitor = all
panel_shrink = 0
autohide = 0
autohide_show_timeout = 0
autohide_hide_timeout = 2
autohide_height = 2
strut_policy = follow_size
panel_window_name = tint2
disable_transparency = 0
mouse_effects = 1
font_shadow = 0
mouse_hover_icon_asb = 100 0 10
mouse_pressed_icon_asb = 100 0 25
scale_relative_to_dpi = 0
scale_relative_to_screen_height = 0

#-------------------------------------
# Taskbar
taskbar_mode = multi_desktop
taskbar_hide_if_empty = 1
taskbar_padding = 3 0 1
taskbar_background_id = 0
taskbar_active_background_id = 3
taskbar_name = 1
taskbar_hide_inactive_tasks = 0
taskbar_hide_different_monitor = 1
taskbar_hide_different_desktop = 1
taskbar_always_show_all_desktop_tasks = 1
taskbar_name_padding = 5 0
taskbar_name_background_id = 2
taskbar_name_active_background_id = 0
taskbar_name_font = Liberation Sans Bold 10
taskbar_name_font_color = #393939 100
taskbar_name_active_font_color = #ffffff 100
taskbar_distribute_size = 0
taskbar_sort_order = none
task_align = left

#-------------------------------------
# Task
task_text = 0
task_icon = 1
task_centered = 0
urgent_nb_of_blink = 65535
task_maximum_size = 30 0
task_padding = 0 0 0
task_font = Terminus Bold 14
task_tooltip = 0
task_thumbnail = 0
task_thumbnail_size = 8
task_font_color = #e7e7e7 100
task_normal_font_color = #e7e7e7 100
task_active_font_color = #e7e7e7 100
task_urgent_font_color = #e7e7e7 100
task_iconified_font_color = #e7e7e7 100
task_icon_asb = 100 0 0
task_normal_icon_asb = 100 0 0
task_active_icon_asb = 100 0 0
task_urgent_icon_asb = 0 0 16
task_iconified_icon_asb = 100 0 0
task_urgent_background_id = 0
task_iconified_background_id = 0
mouse_left = none
mouse_middle = none
mouse_right = none
mouse_scroll_up = none
mouse_scroll_down = none

#-------------------------------------
# System tray (notification area)
systray_padding = 5 5 1
systray_background_id = 0
systray_sort = ascending
systray_icon_size = 24
systray_icon_asb = 100 0 0
systray_monitor = 1
systray_name_filter = 

#-------------------------------------
# Launcher
launcher_padding = 5 5 1
launcher_background_id = 0
launcher_icon_background_id = 0
launcher_icon_size = 24
launcher_icon_asb = 100 0 0
launcher_icon_theme_override = 0
startup_notifications = 1
launcher_tooltip = 1

#-------------------------------------
# Clock
time1_format = %R
time2_format = 
time1_font = Terminus Bold 14
time1_timezone = 
time2_timezone = 
clock_font_color = #e7e7e7 80
clock_padding = 5 0
clock_background_id = 0
clock_tooltip = %Y-%m-%d %H:%M:%S
clock_tooltip_timezone = 
clock_lclick_command = gsimplecal
clock_rclick_command = gsimplecal
clock_mclick_command = gsimplecal
clock_uwheel_command = 
clock_dwheel_command = 

#-------------------------------------
# Battery
battery_tooltip = 1
battery_low_status = 10
battery_low_cmd = xmessage "Battery low"
battery_full_cmd = 
bat1_font = Terminus Bold 12
battery_font_color = #e7e7e7 80
bat1_format = 
bat2_format = 
battery_padding = 5 1
battery_background_id = 0
battery_hide = 101
battery_lclick_command = xmessage "Battery low"
battery_rclick_command = 
battery_mclick_command = 
battery_uwheel_command = 
battery_dwheel_command = 
ac_connected_cmd = notify-send -u normal "AC connected"
ac_disconnected_cmd = notify-send -u normal "AC disconnected"

#-------------------------------------
# Separator 1
separator = new
separator_background_id = 0
separator_color = #777777 88
separator_style = dots
separator_size = 3
separator_padding = 1 0

#-------------------------------------
# Button 1
button = new
button_icon = start-here
button_text = 
button_lclick_command = jgmenu_run
button_rclick_command = 
button_mclick_command = 
button_uwheel_command = 
button_dwheel_command = 
button_font_color = #000000 100
button_padding = 4 0
button_background_id = 0
button_centered = 1
button_max_icon_size = 24

#-------------------------------------
# Tooltip
tooltip_show_timeout = 0
tooltip_hide_timeout = 0
tooltip_padding = 3 3
tooltip_background_id = 0
tooltip_font_color = #e7e7e7 80
tooltip_font = Liberation Sans 10
4 Likes

Hi ,
with lemonbar-click-git in AUR it seems it is available.
I have not test it.

Thanks nate, appreciate your advice.

I will give lemonbar a try, im not sure how to input that script into tint2, would need some modification i guess.

That tint2 config works good but similar to what i was using, with that added benefit of getting rid of wmctrl and using yaxwm directly so that is cool, thanks.

I know you said not to worry about wmctrl but something interesting that could be worked a bit better in a script is below piped commands.

wmctrl -d | awk '{print $2,$9}' | fmt -45 | tr -d '-'

this just gives an indication of all workspaces with a asterisk beside what desktop is being used. Still to figure out how to show used but hidden workspace but that might come from a yaxwm command somehow.

* 1 2 3 4 5 6 7 8 9 10

Anyhow thanks for taking the time to reply.

1 Like

that’s the same thing your wmctrl command does. The " %%{+u}" and “%%{-u} " put an underline below occupied workspaces as you can see in the picture of his bar. If you want a * instead you just replace the printf " %%{+u}" $1 "%%{-u} " with something like printf " *" $1 and then you will have a * by the occupied workspaces side.
The printf " %%{+u}” basically means print whatever comes next with an underline indicator and the other "%%{-u} " says stop it here. In between them there is only the ws name. So it’s the same thing that the wmctrl command is doing

2 Likes

You don’t need some alt fork, lemonbar supports actions and clickable areas out of the box.

1 Like

@natemaia, ok focus to the original.
Thanks

Here’s what I whipped up for tint2, first a workspace script kinda like the one in my previous post but using pango markup instead.

#!/bin/bash

cmd="$1"
ws="${2:-$cmd}"

if [[ -z $ws ]]; then
	echo "usage: $0 [view, send, follow] <num>"
	exit 2
fi

if [[ $ws == "$cmd" ]]; then
	a="$(yaxwm -c print all win |
		awk 'BEGIN{s=""} /[0-9]/ {sub(/:[0-9]*/, ""); if (s !~ $2) s = s $2} END{print s}')"

	if [[ $(yaxwm -c print ws num) == "$ws" ]]; then
		if [[ $a =~ $ws ]]; then
			echo " <span font_desc='Sans 14' foreground='#6699ee' underline='double'>$ws</span> "
		else
			echo " <span font_desc='Sans 14' foreground='#6699ee'>$ws</span> "
		fi
	elif [[ $a =~ $ws ]]; then
		echo -e " <span font_desc='Sans 14' underline='double'>$ws</span> "
	else
		echo " <span font_desc='Sans 14'>$ws</span> "
	fi
else
	yaxwm -c ws "$cmd" "$ws"
fi

if you just pass it an index it will print it back with formatting
tint2ws 1
pass in a command as well and it will run that
tint2ws view 1

Then I made an executor for each workspace and added them to the panel, it’s amazingly inefficient but does the job XD. Something like your pipeline works much better but gives no clickable actions, kinda catch 22.
2020-06-21-084154_233x28_scrot

An example executor I used

#-------------------------------------
# Executor 1
execp = new
execp_command = tint2ws.sh 1
execp_interval = 1
execp_has_icon = 0
execp_cache_icon = 1
execp_continuous = 0
execp_markup = 1
execp_lclick_command = tint2ws.sh view 1
execp_rclick_command = 
execp_mclick_command = 
execp_uwheel_command = 
execp_dwheel_command = 
execp_font_color = #ffffff 100
execp_padding = 0 0
execp_background_id = 0
execp_centered = 0
execp_icon_w = 0
execp_icon_h = 0

Also, it’s not like I’m against wmctrl but if you can get the info you need without having to install other programs I’m all over that.

5 Likes

Nateji, is there an AUR package that you have created for yax? I will build it soon on AL, but just wondering if I can yay it or something …

No not yet, still need to build from source.