Open ghost opened 8 years ago
@ikhthiandor I would checkout out wmctrl. This is what I use to switch to applications that are already running. It provides functionality to list applications that are running and it allows you to bring forward a Xwindow application that is running. Here is the script I put together for myself: https://github.com/benfalk/dotfiles/blob/master/config/Mutate/scripts/goto/goto.sh
If you have any more questions feel free to ask :smile:
Hey @benfalk thanks for your response, wmctrl is cool :smile: . However, I didn't have success in switching windows with your script. Could you share a demo if it works on your end?
Here is a little screen-cast of it. I should point out that it only switches between running windows, it won't start them. It would need to be changed up to start a task if it's not running. I'd be happy to help debug if you want to go down the wmctl route
@benfalk I would like to control via wmctrl because it's fast. But my cpu gets hogged by mutate when I try to use this script. May be this is related to #89.
Here is a link to my $HOME/.config/Muate folder. Let me know if you would like any more debug info. https://drive.google.com/folderview?id=0B7n6kz1LnnAiTHNxblVjQUJTb1k&usp=sharing
Ya, there is a bug where if the script isn't found or doesn't execute correctly Mutate goes off into what I think is an infinite loop. Is your goto.sh
set to execute?
chmod 775 /home/ikhthiandor/.config/Mutate/scripts/goto/goto.sh
If so you should be able to produce output with it from the command line, here is an example of me using it with an e
./goto.sh e
Also, copy the following into your shell and run it. Post back what output you get
wmctrl -l | grep -i . | sed "s/.*$(hostname) //g" | sort | xargs -n 1 -I LINE echo -e "[LINE]\ncommand=wmctrl -a LINE\nicon=\nsubtext="
Silly me, grrr. The script wasn't set executable. I also chmod'ed to 775 now. Not sure if that was necessary. Anyway, it works now :smile: Thanks so much for your help :+1:
Btw, the script doesn't list firefox window if the selected tab has this url for example. https://github.com/qdore/Mutate/issues/108
This is the output in that case.
[cairo-dock] command=wmctrl -a cairo-dock icon= subtext= xargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 option [emacs@acer5742] command=wmctrl -a emacs@acer5742 icon= subtext=
It works for most other urls though. An example output without the xargs error.
[cairo-dock] command=wmctrl -a cairo-dock icon= subtext= [emacs@acer5742] command=wmctrl -a emacs@acer5742 icon= subtext= [Emacs: Org Mode Markup Cheatsheet - Mozilla Firefox] command=wmctrl -a Emacs: Org Mode Markup Cheatsheet - Mozilla Firefox icon= subtext= [wmctrl -l | grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn} -i . | ] command=wmctrl -a wmctrl -l | grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn} -i . |
icon= subtext=
Oh right on, I bet I can fix that :smile:
:point_up: @ikhthiandor I have updated my script to work with windows that have single quotes in them :smile:
Awesome! I pulled in your changes. You migh consider sending a pull request to include the script in master.
I thought about it; however the script seems pretty specialized and I'm not sure how much people would use it.
@benfalk Your solution is perfect. but there is one problem the icons are same for all applications. this not very much helpful. can you suggest how can we handle this or tell mutate to pick targeted app's icon.
:thinking: Let me ponder that for a bit @azeemhassni
@benfalk would you show the steps for using this script ubuntu 16.04 ??
Currently invoking an application from mutate launches a new instance every time. But I would prefer if it switched to a running instance if there is one like in Spotlight search in OS X.
Any plans to add this feature or some pointers how this functionality could be scripted?