You are not logged in.
Hello, i hope i describe my problem with enough details to get a solution.
So, i have a few launchers in my bar, when i open and app with the launcher in the bar i don't want the app open in a new window but in the icon itself.
Here is how this work in windows:
Notice i have Slack and a few Google Chome windows in the bar and it shows in the app icon.
Otherwise here it's how it shows in EndeavourOS with lastest XFCE updates
Notice that i have three launchers, i open the terminal and it shows a new window. Is there a way to customize this in XFCE?
Last edited by juanprm (2019-08-10 15:19:58)
Offline
I'm not sure but I think this might be a solution:
-> Panel Preferences -> tab Items -> edit Window butons -> Apppearance -> uncheck Show button labels
Offline
It only hides the text i wan't the app uses the icon from the launcher and not show another icon.
Offline
I think what you want is a dock, such as Docky. I don't know if there's an Xfce specific dock, but I'm sure others will offer info on this.
Offline
Yes, i was testing a bit and with a dock it works, maybe there is a way to achieve this in native?
Offline
You could use ToZ's script for the launcher.
https://forum.xfce.org/viewtopic.php?pid=24932#p24932
Do you want to exit the Circus?
https://www.youtube.com/watch?v=ZJwQicZHp_c
Offline
You could use ToZ's script for the launcher.
https://forum.xfce.org/viewtopic.php?pid=24932#p24932
Thanks, that looks kinda tricky but if it works ill give a shot
Hoping ToZ answers here and give me another solution or give me the simplified steps to implement his script.
Offline
Yeah, the script is kind of a workaround. There is no such functionality in Xfce. You either need to use a dock program (like plank, docky, etc), a panel plugin like docbarx, or the script.
Implement the script is tricky in that you have to change the .desktop files of every program that you want to work like that. It's time-consuming.
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
Ill go with the script, can u rewrite the steps? i tried to make it works but its kinda confusing, forgive me, i'm new in Linux.
Offline
Steps:
Save the following script somewhere in your path (/usr/local/bin is good). Lets call is /usr/local/bin/xlaunch
#!/bin/bash
# This script acts as a launcher for apps that observes the following rules:
# 1. If the app is not running, then start it up
# 2. If the app is running, don't start a second instance, instead:
# 2a. If the app does not have focus, give it focus
# 2b. If the app has focus, minimize it
# Reference link: http://forum.xfce.org/viewtopic.php?id=6168&p=1
# there has to be at least one parameter, the name of the file to execute
if [ $# -lt 1 ]
then
echo "Usage: `basename $0` {executable_name parameters}"
exit 1
fi
BNAME=`basename $1`
# test to see if program is already running
if [ "`wmctrl -lx | tr -s ' ' | cut -d' ' -f1-3 | grep -i $BNAME`" ]; then
# means it must already be running
ACTIV_WIN=$(xdotool getactivewindow getwindowpid)
LAUNCH_WIN=$(ps -ef | grep "$BNAME" | grep -v grep | tr -s ' ' | cut -d' ' -f2 | head -n 1)
if [ "$ACTIV_WIN" == "$LAUNCH_WIN" ]; then
# launched app is currently in focus, so minimize
xdotool getactivewindow windowminimize
else
# launched app is not in focus, so raise and bring to focus
for win in `wmctrl -lx | tr -s ' ' | cut -d' ' -f1-3 | grep -i $BNAME | cut -d' ' -f1`
do
wmctrl -i -a $win
done
fi
exit
else
# start it up
$*&
fi
exit 0
Make the script executable:
chmod +x /usr/local/bin/xlaunch
For every program that you want this to work for, copy the program's .desktop file from /usr/share/applications to ~/.local/share/applications (create the directory if it doesn't exist)
For every desktop file you copied over, change the "Exec=" line by prepending "xlaunch" to each program executable. For example, for the mousepad application, change:
Exec=mousepad %F
...to:
Exec=xlaunch mousepad %F
That should do it.
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
It don't work, am i doing something wrong?
This is my root folder (testing it in a live iso in case i break something)
This is where the script is.
This is the content of the file.
This is the launcher command, everything LGTM but i don't know what is failing.
I did the steps one by one, making sure that everything is correct, I also did them again with other applications but it still does not work.
Last edited by juanprm (2019-08-09 04:23:53)
Offline
Can you post back the results of the following commands run from a terminal window:
echo $PATH
ls -l /usr/local/bin/xlaunch
which xlaunch
cat ~/.local/share/applications/Thunar.desktop | grep Exec
cat ~/.local/share/applications/transmission-gtk.desktop | grep Exec
Edit: Also make sure that xdotool and wmctrl are installed.
Last edited by ToZ (2019-08-09 13:13:02)
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
This is the result from the commands
Also make sure that xdotool and wmctrl are installed.
Both are installed.
Last edited by juanprm (2019-08-09 15:12:40)
Offline
Can you first try with a simpler program like mousepad or parole and use the following script?
#!/bin/bash
# This script acts as a launcher for apps that observes the following rules:
# 1. If the app is not running, then start it up
# 2. If the app is running, don't start a second instance, instead:
# 2a. If the app does not have focus, give it focus
# 2b. If the app has focus, minimize it
# Reference link: http://forum.xfce.org/viewtopic.php?id=6168&p=1
echo "1.start-->$(date)" >> /tmp/xlog
# there has to be at least one parameter, the name of the file to execute
if [ $# -lt 1 ]
then
echo "Usage: `basename $0` {executable_name parameters}"
exit 1
fi
echo "2.after check" >> /tmp/xlog
BNAME=`basename $1`
echo "3.BNAME=$BNAME" >> /tmp/xlog
# test to see if program is already running
if [ "`wmctrl -lx | tr -s ' ' | cut -d' ' -f1-3 | grep -i $BNAME`" ]; then
echo "4.$BNAME is running" >> /tmp/xlog
# means it must already be running
ACTIV_WIN=$(xdotool getactivewindow getwindowpid)
LAUNCH_WIN=$(ps -ef | grep "$BNAME" | grep -v grep | tr -s ' ' | cut -d' ' -f2 | head -n 1)
echo "5.ACTIV_WIN=$ACTIV_WIN" >> /tmp/xlog
echo "6.LAUNCH_WIN=$LAUNCH_WIN" >> /tmp/xlog
if [ "$ACTIV_WIN" == "$LAUNCH_WIN" ]; then
# launched app is currently in focus, so minimize
echo "7.launched app in focus so minimize" >> /tmp/xlog
xdotool getactivewindow windowminimize
else
# launched app is not in focus, so raise and bring to focus
echo "8.launched app is not in focus" >> /tmp/xlog
for win in `wmctrl -lx | tr -s ' ' | cut -d' ' -f1-3 | grep -i $BNAME | cut -d' ' -f1`
do
echo "9.bring to focus" >> /tmp/xlog
wmctrl -i -a $win
done
fi
else
echo "10.starting up app" >> /tmp/xlog
# start it up
exec $*&
fi
echo "11.end" >> /tmp/xlog
exit 0
I've changed some code and added debug statements. Do the following test:
From menu, select mousepad/parole (it should show up)
From menu, select mousepad/parole (it should minimize)
From menu, select mousepad/parole (it should display again)
...and then post back the contents of the /tmp/xlog file.
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
From menu, select mousepad/parole (it should show up)
From menu, select mousepad/parole (it should minimize)
From menu, select mousepad/parole (it should display again)
That works exactly as you said,
...and then post back the contents of the /tmp/xlog file.
Here it is.
1.start-->Fri 09 Aug 2019 01:30:03 PM UTC
2.after check
3.BNAME=mousepad
10.starting up app
11.end
1.start-->Fri 09 Aug 2019 01:30:12 PM UTC
2.after check
3.BNAME=mousepad
4.mousepad is running
5.ACTIV_WIN=1378
6.LAUNCH_WIN=2082
8.launched app is not in focus
9.bring to focus
11.end
1.start-->Fri 09 Aug 2019 01:30:31 PM UTC
2.after check
3.BNAME=mousepad
10.starting up app
11.end
1.start-->Fri 09 Aug 2019 01:30:39 PM UTC
2.after check
3.BNAME=mousepad
4.mousepad is running
5.ACTIV_WIN=2121
6.LAUNCH_WIN=2121
7.launched app in focus so minimize
11.end
1.start-->Fri 09 Aug 2019 01:30:46 PM UTC
2.after check
3.BNAME=mousepad
4.mousepad is running
5.ACTIV_WIN=1378
6.LAUNCH_WIN=2121
8.launched app is not in focus
9.bring to focus
11.end
1.start-->Fri 09 Aug 2019 01:31:28 PM UTC
2.after check
3.BNAME=mousepad
4.mousepad is running
5.ACTIV_WIN=979
6.LAUNCH_WIN=2121
8.launched app is not in focus
9.bring to focus
11.end
1.start-->Fri 09 Aug 2019 01:31:40 PM UTC
2.after check
3.BNAME=mousepad
10.starting up app
11.end
Offline
Good. Now clear the contents of the script:
> /tmp/xlog
...and try with transmission. Post back the contents of that log file after your tests.
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
...and try with transmission. Post back the contents of that log file after your tests.
Here is the log.
1.start-->Fri 09 Aug 2019 03:27:22 PM UTC
2.after check
3.BNAME=transmission-gtk
10.starting up app
11.end
1.start-->Fri 09 Aug 2019 03:27:29 PM UTC
2.after check
3.BNAME=transmission-gtk
4.transmission-gtk is running
5.ACTIV_WIN=1947
6.LAUNCH_WIN=1947
7.launched app in focus so minimize
11.end
1.start-->Fri 09 Aug 2019 03:27:33 PM UTC
2.after check
3.BNAME=transmission-gtk
4.transmission-gtk is running
5.ACTIV_WIN=1711
6.LAUNCH_WIN=1947
8.launched app is not in focus
9.bring to focus
11.end
1.start-->Fri 09 Aug 2019 03:27:38 PM UTC
2.after check
3.BNAME=transmission-gtk
4.transmission-gtk is running
5.ACTIV_WIN=1947
6.LAUNCH_WIN=1947
7.launched app in focus so minimize
11.end
1.start-->Fri 09 Aug 2019 03:27:59 PM UTC
2.after check
3.BNAME=transmission-gtk
10.starting up app
11.end
1.start-->Fri 09 Aug 2019 03:28:01 PM UTC
2.after check
3.BNAME=transmission-gtk
4.transmission-gtk is running
5.ACTIV_WIN=2077
6.LAUNCH_WIN=2077
7.launched app in focus so minimize
11.end
1.start-->Fri 09 Aug 2019 03:28:02 PM UTC
2.after check
3.BNAME=transmission-gtk
4.transmission-gtk is running
5.ACTIV_WIN=1711
6.LAUNCH_WIN=2077
8.launched app is not in focus
9.bring to focus
11.end
1.start-->Fri 09 Aug 2019 03:28:02 PM UTC
2.after check
3.BNAME=transmission-gtk
4.transmission-gtk is running
5.ACTIV_WIN=2077
6.LAUNCH_WIN=2077
7.launched app in focus so minimize
11.end
1.start-->Fri 09 Aug 2019 03:28:03 PM UTC
2.after check
3.BNAME=transmission-gtk
4.transmission-gtk is running
5.ACTIV_WIN=1711
6.LAUNCH_WIN=2077
8.launched app is not in focus
9.bring to focus
11.end
1.start-->Fri 09 Aug 2019 03:28:03 PM UTC
2.after check
3.BNAME=transmission-gtk
4.transmission-gtk is running
5.ACTIV_WIN=2077
6.LAUNCH_WIN=2077
7.launched app in focus so minimize
11.end
1.start-->Fri 09 Aug 2019 03:28:05 PM UTC
2.after check
3.BNAME=transmission-gtk
4.transmission-gtk is running
5.ACTIV_WIN=1711
6.LAUNCH_WIN=2077
8.launched app is not in focus
9.bring to focus
11.end
1.start-->Fri 09 Aug 2019 03:28:06 PM UTC
2.after check
3.BNAME=transmission-gtk
4.transmission-gtk is running
5.ACTIV_WIN=2077
6.LAUNCH_WIN=2077
7.launched app in focus so minimize
11.end
Offline
The logs say it is working. Is it working properly?
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
Yes, it is working, but I think we deviate a bit from the OP.
Maybe i should explain it again?
Offline
Sure. But keep in mind that the functionality you are asking for is not present in xfce4-panel. This is just a workaround to mimic that functionality.
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
Thanks for the help, sorry for wasting your time editing the scripts.
Offline
[ Generated in 0.015 seconds, 8 queries executed - Memory usage: 640.25 KiB (Peak: 673.53 KiB) ]