LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 03-15-2011, 01:23 AM   #1
chadwick
Member
 
Registered: Apr 2005
Location: At the 100th Meridian where the great plains begin
Distribution: Debian Testing on T60 laptop
Posts: 105

Rep: Reputation: 17
Turn off close window in Gnome 2.22.3


I'm using Gnome. I wrote a program with ncurses that runs in a terminal. Currently I'm running it from gnome-terminal.

It's important for the program to exit properly, so I wrote some functions that force the program to exit cleanly. For example, if the user chooses to exit or hits Ctrl-C, then a function gets called that cleans everything up and exits properly. Yesterday someone came along and without even knowing what the program was, hit the X (close window) button and that was the end of that. I guess I should have seen that one coming.

A simple solution to that problem if it exists could be to just get rid of the close window option when calling the instance of gnome-terminal that will run my program. Since the program is started rarely and runs continuously most of the time, this would be a good solution for me.
Typically the close window command is available by clicking the X at the top right of the window, or by using alt-(right button) to get a menu, or by alt-f4. I already call gnome-terminal with option "--hide-menubar" to get rid of the ability to close it via the menu bar. I realize it's not the desktop's job to make up for my lack of foresight, but if it is possible to open a window with such properties, then I would appreciate knowing how it's done. Back in the days of fvwm this would have almost definitely been possible, but I'm not sure how to do it in Gnome. Also, if it's possible to just eliminate the X button but not the other things, then that might go far enough to fixing the problem.

I'm working in Gnome version 2.22.3 with build date 07/01/2008 (not sure if that means July or January). It's a bit of an old version since I'm using some special hardware that only has drivers that work with certain kernels, and since the system is currently working with all of the hardware, I don't want to upgrade the system.

By the way, I prefer not to use the /apps/gnome-terminal/global/confirm_window_close option of gconftool-2 since if that is set then someone might just decide to unset it since it would be applied to all instances of gnome-terminal, not just the ones I want it to apply to. Also, the command:
gconftool-2 --type bool --set /apps/gnome-terminal/global/confirm_window_close "true"
actually doesn't seem to work for my setup anyway. Maybe that option doesn't exist in my version of Gnome or maybe the syntax is different.

Last edited by chadwick; 03-15-2011 at 01:25 AM.
 
Old 03-15-2011, 01:54 AM   #2
chadwick
Member
 
Registered: Apr 2005
Location: At the 100th Meridian where the great plains begin
Distribution: Debian Testing on T60 laptop
Posts: 105

Original Poster
Rep: Reputation: 17
I'm not sure why I didn't think of this, but I guess there is probably a specific signal associated with the "close window" button which I can work from to force the program to close cleanly when it closes that way, but I imagine this will still unequivocally force the program to close. Part of the problem that I had yesterday was that the program was supposed to be running, and someone just closed it without knowing what they were doing. So I would also like to make the user aware through the "close window" button that shutting down the program might not be a cool thing to do. In case you're wondering what kind of program it is, it's a data acquisition program that continually displays data about a system and logs the data to a file. So you could imagine it being similar to top except that it logs the data that it displays.
 
  


Reply



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
laptop screen doesn't turn back on after i close the lid elninio Slackware 5 07-23-2008 09:16 AM
Close all window in a window manager zghh Linux - Software 1 12-20-2006 03:18 PM
Why NOT this Tiny Window Close ? bedi-beparwah SUSE / openSUSE 2 06-19-2005 05:04 AM
Javascript - what to use rather than window.close() then window.open() davee Programming 2 04-11-2005 08:28 AM
How do I prevent my laptop to turn off/stand by when I close the lid? bursjo Linux - Laptop and Netbook 0 03-24-2004 07:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 04:51 PM.

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