You are not logged in.

#1 2012-08-22 08:47:46

graph
Member
Registered: 2010-12-21
Posts: 105

[DWM] List applications and switch to tag

I'm having troubles with keeping track of my applications in DWM.

Is there any way to run a command and figure out:
1) My running applications (xlsclients maybe?)
2) More importantly, which tag a given window is in
3) Finally, switch to that tag to view the window.

My final goal would be to incorporate it in dmenu, if possible.
My knowledge of C is quite limited, but I'm fluent in Bash/zsh, so would prefer a scritable solution.

Offline

#2 2012-08-22 09:05:21

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [DWM] List applications and switch to tag

Would it not be easier to just have an extensive rule list for your applications, and assign each application to the relevant tag(s)?

If not, there are a couple of tilers with dynamic tagging.


Just a thought. Carry on regardless... smile


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2012-08-23 09:25:04

graph
Member
Registered: 2010-12-21
Posts: 105

Re: [DWM] List applications and switch to tag

jasonwryan wrote:

Would it not be easier to just have an extensive rule list for your applications, and assign each application to the relevant tag(s)?

Yeah, that would be the next-best thing. I have a small screen resolution, so I kindof just uses DWM's tiling capabilities like a constant monocle-mode. So I would have one window in each tag.

Having the possibility to search through open programs via dmenu would make the whole thing a lot easier, but I don't really think that it's possible.
I've had no luck with wmctrl - Am I right when I think that DWM isn't  compatible with the EWMH/NetWM specification (which is used by wmctrl)?

Last edited by graph (2012-08-23 09:26:04)

Offline

#4 2012-08-23 09:29:53

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [DWM] List applications and switch to tag

Yes: I think the suckless crew regard EWMH as some sort of abomination smile


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2012-08-23 11:41:12

Onyros
Member
From: Lisbon, Portugal
Registered: 2007-10-11
Posts: 307

Re: [DWM] List applications and switch to tag

You could also try Telescope, which may work pretty well for what you want: it'll show you (live) thumbnails of all your open windows with its respective name and allow you to choose and switch to its tag. Works pretty well with DWM - very fast, very lightweight - has a few bugs as it was originally intended for Maemo OS (Nokia Internet Tablets).

Last edited by Onyros (2012-08-23 11:42:03)

Offline

#6 2013-01-02 19:28:25

graph
Member
Registered: 2010-12-21
Posts: 105

Re: [DWM] List applications and switch to tag

jasonwryan wrote:

Just a thought. Carry on regardless...

And so I did. I just hacked a script that actually does this. It depends on xdotool and dmenu.
plugin-container is removed, since it's flash running inside Firefox in my case.

#!/bin/bash
# Search through open programs and switch to their tag
application=$(
	# List all running programs
	xlsclients |\
	# Fix Virtualbox and LibreOffice
   	sed -e 's/.*VirtualBox/foobar  virtualbox/g' -e 's/.*soffice/foobar  libreoffice/g' |\
	# Remove flash from results
	grep -v "plugin-container" |\
	# Show only app-names
   	cut -d" " -f3 |\
	# Pipe to dmenu ($@ to include font settings from dwm/config.h)
	dmenu -i -p "Switch to" $@
)

# Switch to chosen application
case $application in
	gimp | truecrypt)
		xdotool search --onlyvisible -classname "$application" windowactivate &> /dev/null
		;;
	*)
		xdotool search ".*${application}.*" windowactivate &> /dev/null
		;;
esac

Last edited by graph (2013-01-03 10:54:50)

Offline

#7 2014-02-21 16:04:46

chickenPie4tea
Member
Registered: 2012-08-21
Posts: 309

Re: [DWM] List applications and switch to tag

I know it's a year old but this is a very nice solution - could you tell me how I would add an app to filter out of the list.
I get Guake and clipit shown and don't want that.


You can like linux without becoming a fanatic!

Offline

Board footer

Powered by FluxBB