LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-25-2014, 03:46 PM   #1
rac8006
Member
 
Registered: Oct 2014
Posts: 39

Rep: Reputation: Disabled
notification area or system tray


I'm running OpenSuse 13.1 with KDE. I would like to have my program place
a icon on the notification when it is not being used. I want to have the icon
when clicked cause the application to display its window.
I'm not sure that I explained what I want to do correctly. I'm trying to make an application
that does not show up on the task bar when its running. Or have an icon that starts the
application when clicked. What I'm trying to do is create an application that will switch
the keyboard/mouse/monitor between systems using the trendnet 4 port KVM.
I have most features working. But I need to place an icon on the bottom right of the screen
to bring up the window so the switch can be done.

I hope this helps explain what I'm trying to do.

Thanks
RAC
 
Old 11-25-2014, 04:24 PM   #2
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,673

Rep: Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657
do you want something like this screenshot of my kde install
from left to right -- see attachment

1)"kick-off"
2) "activity manager"
3) "CPU monitor"
4) "Virt desktops"
5) "Seamonkey"
6) "Dolphin"
7) " task bar with seamonkey open reading this page"
8) "kate"
9) "Konsole" ( ternimal)
10) "default notification area "
11) "time"
or
all bunched together in the center like Apple osx

Last edited by John VV; 10-03-2015 at 07:16 PM.
 
Old 11-25-2014, 06:45 PM   #3
rac8006
Member
 
Registered: Oct 2014
Posts: 39

Original Poster
Rep: Reputation: Disabled
notification area

What I'm looking for is too be able to put an icon next to the speaker icon on your
attachment. I want this icon to execute my application when clicked.

RAC
 
Old 11-25-2014, 07:25 PM   #4
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,673

Rep: Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657
on KDE is is SO VERY EASY to mess up the desktop
that you DO NEED!!! to "lock the widgets" ( it is on the r-click menu)

so

first
unlock the widgets !!!!!
you can not do this with them still locked

Example putting Firefox on the panel

go to
Kickoff / applacations / internet/
and "R-click" the firefox icon

and select from the menu
" add to panel "
bingo -- it is on it

now to move it to where you want it

r-click on the "panel" and select "panel options" and click on
"panel settings"

move the mouse over the icon to be moved and a overlay will pop up
click and drag it to where you want it

then
LOCK THE WIDGETS!!!!!!
r-click the desktop and select " lock widgets"


the lock and unlocked widget setting
CHANGES THE R-CLICK MENU IN KICKOFF !!!!

now with it locked the r-click on firefox will show " add to favorites"

Last edited by John VV; 11-25-2014 at 07:26 PM.
 
Old 11-26-2014, 12:52 AM   #5
rac8006
Member
 
Registered: Oct 2014
Posts: 39

Original Poster
Rep: Reputation: Disabled
noticication area

I followed your steps and was able to add an icon to the area of the screen that I wanted.
But when I double click on the icon It starts my program I think. Because on the task bar
it shows my program name but the icon to the left of the program name is spinning. It stays
on the task bar for several seconds and then goes away. If I do a ps -eaf my application
is not shown.
I also found that if I right click on my new icon it brings up a window talking about icon settings.
I also have an icon for hp. When I click in the HP icon I get a window talking about system tray.

I've got the icon where I want it but I can't seem to get it to start my program.

Thanks
RAC
 
Old 11-26-2014, 01:24 AM   #6
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,673

Rep: Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657
dose this unknown "program" launch from the menu ?

what is in the kickoff menu are the "*.desktop " files in
/usr/share/applications
 
Old 11-26-2014, 06:10 PM   #7
rac8006
Member
 
Registered: Oct 2014
Posts: 39

Original Poster
Rep: Reputation: Disabled
notification area

The unknown program is called KVMUtility. In the directory /usr/share/application there is
no *.desktop file with KVMUtility in the file. When I click on the icon KVMUtility shows up in
the task bar at the bottom of the display with an icon that is spinning. When the spinning quits
the program is no longer on the task bar.

If I right click on my icon I get a window that says icon settings and panel options. I also have
an icon for HP. When I right click on the HP icon I get a menu to run HP services.

Thanks
RAC
 
Old 11-26-2014, 06:23 PM   #8
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,673

Rep: Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657
seeing as you need to be root to launch that
i would leave in in the normal kde menu

that is this right
/kickoff / applications / system / virtualization / virtual machine manager

are you using "sudo" or did you set up a real root account that is using a different password that the first non root user

you might be able to setup a desktop file that points to a shell script that will launch konsel as root

the program name it launches is " virt-manager "
Code:
su -
---- /* type in your root password when prompt */------
virt-manager
and there IS a *.desktop file for it in
/usr/share/applications
it is called "virt-manager.desktop "
Code:
su -
---- /* type in your root password when prompt */------
kate /usr/share/applications/virt-manager.desktop
------ or use vi ----
vi /usr/share/applications/virt-manager.desktop
--- or emacs ----
emacs /usr/share/applications/virt-manager.desktop

Last edited by John VV; 11-26-2014 at 06:28 PM.
 
Old 11-26-2014, 07:37 PM   #9
rac8006
Member
 
Registered: Oct 2014
Posts: 39

Original Poster
Rep: Reputation: Disabled
Notification area

Just for fun I copied the hplip.desktop file from /usr/share/applications and put it
in /home/rac/.local/share/applications directory. This puts an icon in the system tray
But when you double click on the icon. You get an error saying that there is no Type.
Not sure why it is doing this.

You have these different icons on the bottom left of the desktop. I think thay are called the
system tray. When I click on them I can go to network manager or HP printer manager etc.

I just want to put an icon down there. so when I want to switch systems I click on the icon and a
window opens giving me the option to switch between one of the four systems.

Thanks
RAC
 
Old 11-27-2014, 02:38 AM   #10
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,673

Rep: Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657
for a hp printer
there is NO NEED to "kludge" things
( if you do not know -- then google " to kludge things " it is a verb )

the HP icon should auto display in the notification area once the printer is turned on

it was NOT displayed in the screen shot i posted because i DO NOT keep my printer powered up if i am not using it

now

you did setup the printer in CUPS ? right ?

make sure the HP software is installed
( if the printer WAS pluged in and turned ON at the time of opensuse 13 install this WILL HAVE been auto done by the operating system installer )
Code:
su -
zypper in hplip  hplip-hpijs hplip-sane  python-reportlab
click the below link -- that IS your printer
http://localhost:631/
if you have not added it
do so
once the printer IS installed and you have ran a GOOD looking "test print"

to make SURE that the icon will be displayed

open a terminal and type this
Code:
 hp-toolbox
a pop up window will pop-up
click on "configure "
in that NEW window click on the "system tray icon" TAB
click " Always on"
or
"hide when inactive " -- use this
or
"always hide"

and it is in the system tray

Last edited by John VV; 11-27-2014 at 02:41 AM.
 
Old 11-27-2014, 09:59 AM   #11
rac8006
Member
 
Registered: Oct 2014
Posts: 39

Original Poster
Rep: Reputation: Disabled
Notification area

I appreciate your input. We seem to have a communication problem.
I don't seem to be explaining my problem very well.
My HP printer is working fine. I was just using the HP icon on the
system tray as an example of how I was trying to get my application
to work.
I've googled just about every combination you can think of the get
information on how to do this. About the only thing I think I have found
is that the area I want to add my icon to is called the system tray.
So far the directions that I have found don't work.
My KVMUtility did show up on the system tray. But it didn't start the
program. It looked like it did. The icon information was not in
/usr/share/application. But was in /home/rac/.local/share/application.

Thanks
RAC
 
Old 11-27-2014, 11:59 AM   #12
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,673

Rep: Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657
AS i said
that KVM tool MUST BE RAN AS ROOT!!!!!

that is why this is in the virt-manager.desktop file
----
X-SuSE-YaST-RootOnly=true

---
 
Old 11-28-2014, 07:30 PM   #13
rac8006
Member
 
Registered: Oct 2014
Posts: 39

Original Poster
Rep: Reputation: Disabled
Notification area

After hours googleing I finally found the answer to my problem. The following example
will put an icon on the systemtray. With this icon you can do different things when
the icon is clicked.

I've incorporated this in my program and it is working as I wanted it to run.

Thanks for the help. This is now closed

RAC

PS I knew it had to be run as root.

#include <stdlib.h>
#include <gtk/gtk.h>
void tray_icon_on_click(GtkStatusIcon *status_icon,
gpointer user_data)
{
printf("Clicked on tray icon\n");
}
void tray_icon_on_menu(GtkStatusIcon *status_icon, guint button,
guint activate_time, gpointer user_data)
{
printf("Popup menu\n");
}
static GtkStatusIcon *create_tray_icon() {
GtkStatusIcon *tray_icon;
const gchar *FileName = "/src/KVMUtility/USBKVM_128-10.png";

// tray_icon = gtk_status_icon_new();
tray_icon = gtk_status_icon_new_from_file(FileName);
g_signal_connect(G_OBJECT(tray_icon), "activate",
G_CALLBACK(tray_icon_on_click), NULL);
g_signal_connect(G_OBJECT(tray_icon),
"popup-menu",
G_CALLBACK(tray_icon_on_menu), NULL);
// gtk_status_icon_set_from_icon_name(tray_icon,
// GTK_STOCK_MEDIA_STOP);
gtk_status_icon_set_tooltip(tray_icon,
"Example Tray Icon");
gtk_status_icon_set_visible(tray_icon, TRUE);
return tray_icon;
}
int main(int argc, char **argv) {
GtkStatusIcon *tray_icon;
gtk_init(&argc, &argv);
tray_icon = create_tray_icon();
gtk_main();
return 0;
}
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Notification Area .. utanja Debian 5 08-31-2010 08:17 AM
notification-area-applet john.s Linux - General 1 06-26-2006 01:35 AM
Notification area (system tray) and other questions BobS0327 Programming 0 04-22-2006 02:59 PM
Things for KDE system tray in gnome system tray Boffy Linux - General 3 09-17-2004 08:56 AM
Notification Area in GNOME 2.4 Jose Muņiz Linux - Software 0 01-07-2004 02:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration