inflintor
November 2nd, 2010, 09:33 PM
I found the ApplicationMenu in Ubuntu Netbook Edition interesting and used this guide to enable it in my desktop setup:
http://askubuntu.com/questions/4681/how-do-i-enable-a-mac-style-global-application-menu-in-classic-desktop-edition
Seeing this OSX style menu made me think about if it would be possible to show the name of the focused application also in the top panel. I wasn't able to find ready made functionality for it, but putting it together with some hacks was actually surprisingly easy.
NOTE: This solution is far from perfect and I have no intentions to develop it further, but I wanted to share it anyway. If you aren't familiar with gconf-tool, you probably shouldn't try this.
Enable indicator-applet-appmenu like in the link above (may require restart)
Right click on the panel and select "Add to panel". Add new Clock to the panel next to ApplicationMenu
Press Alt+F2 and type "gconf-editor" and click "Run"
Navigate to settings of the new Clock applet, apps/panel/applets/applet_1/prefs in my case
Find setting called "format" and enter value "custom" for it. Additionally you can try to put some text to "custom-format" setting which should be visible in your Clock applet
Install wmctrl with command "sudo apt-get install wmctrl"
Create a new file, for example show-app.sh and put following script there (modify the gconftool command accordingly if your path to applet settings was different)
#!/usr/bin/env bash
# sudo apt-get install wmctrl
while [ true ];
do
ACTIVEWIN=$(wmctrl -va ":ACTIVE:" 2>&1 | grep -o -e "0x.*$");
LAST_APPLICATION=$APPLICATION;
APPLICATION=$(wmctrl -xl | grep $ACTIVEWIN | cut -d" " -f -4 -s | cut -d"." -f 2 -s);
if [ "$APPLICATION" != "$LAST_APPLICATION" ]; then
#echo $APPLICATION
gconftool -s /apps/panel/applets/applet_1/prefs/custom_format --type string "<b>$APPLICATION</b>"
fi
sleep 0.2;
done
Give execution permissions for this file: "chmod +x app-show.sh"
Execute the file: "./app-show.sh"
Now when you click different windows, you should see the names of the applications changing in this applet.
This cool idea of using Clock to show custom text was presented by konerx in thread http://wwww.ubuntuforums.org/showthread.php?t=837612. Also the script for controlling Spotify http://sites.google.com/site/tommymattila/home/spotifycontrol was very usefull in finding out the focused window and as an example of basic bash scripting.
http://askubuntu.com/questions/4681/how-do-i-enable-a-mac-style-global-application-menu-in-classic-desktop-edition
Seeing this OSX style menu made me think about if it would be possible to show the name of the focused application also in the top panel. I wasn't able to find ready made functionality for it, but putting it together with some hacks was actually surprisingly easy.
NOTE: This solution is far from perfect and I have no intentions to develop it further, but I wanted to share it anyway. If you aren't familiar with gconf-tool, you probably shouldn't try this.
Enable indicator-applet-appmenu like in the link above (may require restart)
Right click on the panel and select "Add to panel". Add new Clock to the panel next to ApplicationMenu
Press Alt+F2 and type "gconf-editor" and click "Run"
Navigate to settings of the new Clock applet, apps/panel/applets/applet_1/prefs in my case
Find setting called "format" and enter value "custom" for it. Additionally you can try to put some text to "custom-format" setting which should be visible in your Clock applet
Install wmctrl with command "sudo apt-get install wmctrl"
Create a new file, for example show-app.sh and put following script there (modify the gconftool command accordingly if your path to applet settings was different)
#!/usr/bin/env bash
# sudo apt-get install wmctrl
while [ true ];
do
ACTIVEWIN=$(wmctrl -va ":ACTIVE:" 2>&1 | grep -o -e "0x.*$");
LAST_APPLICATION=$APPLICATION;
APPLICATION=$(wmctrl -xl | grep $ACTIVEWIN | cut -d" " -f -4 -s | cut -d"." -f 2 -s);
if [ "$APPLICATION" != "$LAST_APPLICATION" ]; then
#echo $APPLICATION
gconftool -s /apps/panel/applets/applet_1/prefs/custom_format --type string "<b>$APPLICATION</b>"
fi
sleep 0.2;
done
Give execution permissions for this file: "chmod +x app-show.sh"
Execute the file: "./app-show.sh"
Now when you click different windows, you should see the names of the applications changing in this applet.
This cool idea of using Clock to show custom text was presented by konerx in thread http://wwww.ubuntuforums.org/showthread.php?t=837612. Also the script for controlling Spotify http://sites.google.com/site/tommymattila/home/spotifycontrol was very usefull in finding out the focused window and as an example of basic bash scripting.