You are not logged in.
Hi,
I use a lot of rdesktop and Xephyr windows but neither have an icon, so it's hard to select the correct window by clicking on the right icon/ or by selecting goog icon via alt-tab
I would like to change dynamically the icon for the just launched app, examples :
to launch a desktop session on my server's virtual machine "vm1" i use this script :
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/lib/x86_64-linux-gnu/
Xephyr -title xephyrvm1 -ac -screen 1680x1050 -br -reset -terminate 2> /dev/null :1 &
sleep 1
wmctrl -i -r $(wmctrl -l |grep xephyrvm1|cut -f1 -d" ") -b toggle,fullscreen
DISPLAY=:1.0 ssh -XfC user@xephyrvm1 gnome-session --failsafe
i would like to associate the window's icon with ~/Documents/ICONS/vm1.png
is it possible ?
Last edited by pieplu (2016-05-03 07:50:40)
Offline
You can use xseticon to change that icon. Be careful though, there are 2 versions of xseticon and I can't get the newer version to work. The one I linked above does work. You may need to build it from source though if your repositories don't carry it.
This is the template executable file that I dump into /usr/local/bin:
#!/bin/bash
### EDIT THESE VALUES #########################################################
APP="/full/path/to/real/executable" # path to real executable
ICON="/full/path/to/png/icon" # icon file - only png supported
WAIT=2 # wait time for application window to display - adjust to suit
###############################################################################
###############################################################################
### DON'T CHANGE ANYTHING BELOW
###############################################################################
function change-panel-icon {
sleep $WAIT
activeWinLine=$(xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)")
activeWinId="${activeWinLine:40}"
xseticon -id "$activeWinId" "$ICON"
}
$APP & change-panel-icon
I adapted it to get xephyr to startup as per your commands:
#!/bin/bash
### EDIT THESE VALUES #########################################################
APP="Xephyr -title xephyrvm1 -ac -screen 1680x1050 -br -reset -terminate"
ICON="/usr/local/share/xephyr.png"
WAIT=1
###############################################################################
###############################################################################
### DON'T CHANGE ANYTHING BELOW
###############################################################################
function change-panel-icon {
sleep $WAIT
activeWinLine=$(xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)")
activeWinId="${activeWinLine:40}"
xseticon -id "$activeWinId" "$ICON"
}
$APP 2> /dev/null :1 &
change-panel-icon
I had to change a few things, but it worked for me - brought up the xephyr window with the new icon. I wasn't able to test the ssh connection part of your command, but you should be able to add it to the end and it should work.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Just tried this on my Xubuntu 16.04 install and it got tricky with getting xseticon installed. Its no longer available in the repositories and it will not compile. What did work was the following:
1. Dowload the xseticon deb file from http://packages.leonerd.org.uk/pool/main/x/xseticon/. Make sure you get the correct one for your architecture (amd64 or i386).
2. Extract the xseticon executable from that deb file and place it in /usr/local/bin.
3. Run the following command to make the libgd library backwards compatible and resolvable to the version 2 library:
sudo ln -s /usr/lib/$(uname -m)-linux-gnu/libgd.so.3.0.0 /usr/lib/$(uname -m)-linux-gnu/libgd.so.2
Then it should work.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
hello ToZ and thanks a lot for the answer !
i got it to work, but your xprop command can't get correctly the window id of my apps, but as i already had it, i modified my script for now with :
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/lib/x86_64-linux-gnu/
Xephyr -title xephyrvm1 -ac -screen 1680x1050 -br -reset -terminate 2> /dev/null :1 &
ICON=<path to png icon>
window_id=$(wmctrl -l |grep xephyrvm1|cut -f1 -d" ")
wmctrl -i -r $window_id -b toggle,fullscreen
xseticon -id $window_id $ICON
with a win7 icon, a suse11 icon and a suse12 icon ! the alt-tab shows icons too, so i'm so happy
so neat ! thanks a lot ToZ
i will cross post this in a xubuntu forum
Offline
[ Generated in 0.007 seconds, 7 queries executed - Memory usage: 532.55 KiB (Peak: 533.39 KiB) ]