where is the config or code behind the desktop "suspend" button?
I'm running Mint-12 with Cinnamon. When I open the SysMenu from my tray, I see a button for Shutdown and friends. When I select that button, I get a dialog with more buttons:
Does the tray item run a program that draws the dialog? Which program and where can I find it? I may want to "decorate" that dialog to suit my own tastes. Does the dialog launch programs or scripts in response to each button? If so, which programs and where do I find them? Does the dialog throw an event which upstart uses to match with a job to accomplish the requested actions? NOTE -- Ubuntu and Mint rely on Upstart, running as pid=1 with the name 'init' for all sorts of things including system startup and system shutdown.Are we really required to read the code for our Desktop Environment -- in my case Cinnamon -- to get answers to these questions? I have not found any documentation anywhere. (I suspect I have not looked in the right places.) Merci d'avance, ~~~ 0;-Dan |
This article does not go into the details of the code, but it might be a good start:
http://www.advogato.org/article/913.html If you do Code:
apropos acpi |
Normally the acpid daemon handles events. In debian the scripts for the events are located at /etc/acpi/events/. YMMV
|
Thanks to shadow_7 and frankbell for their replies and references.
Let's take shutdown as an example.
From the desktop, with my mouse, I click twice:
Code:
// Merci d'avance, ~~~ 0;-Dan |
In debian the power button event, as in you push the button for power on the computer. It triggers a script /etc/acpi/powerbtn-acpi-support.sh. Which checks for other scripts to run, but ultimately issues the following command.
# shutdown -h -P now "Power button pressed" I normally just enter a "shutdown -h now" as root when I shutdown. It's easy enough and I normally have a root shell open, even on the desktop. But I like knowing what my computer is doing and normally take a minimalist approach. If I'm not using it, it's not running. With cpu and net meters in the task bar, so I know when things are not as I wish them at a glance. |
Quote:
I know?!? I know !! Read the code for my desktop environment, ... and we wonder why few but thoroughbred geeks use Linux. (Well, maybe we don't wonder after all.) Heavy sigh, ~~~ 8d;-/ Dan |
Quote:
Code:
.....It is derived from Ubuntu.
|
At least there is code to reference to actually know "for sure" what likely happens. If we take the time to audit the code. In most other OSes, in apple you trust, in microsoft you trust, in the NSA you trust. I say likely because even CPUs have bugs that do unintended things, throw in some questionable ram and underpowered circuitry and it's a tech lottery.
|
Quote:
I heard this in a keynote speech years ago. I cannot remember who said it. They were talking about the test-ability of software systems and showed how even trivial, event-driven, GUI based applications can count the test cases with large enough numbers to be effectively infinite. The speaker went on to say that it was no wonder so many software publishers were letting their end-users do most of the testing in the manner of open source projects. ~~~ 8d;-Dan |
NOTE: I will be talking about terminal commands below, I expect the actual calls from the GUI to be made using the corresponding library functions, as you suggested in one of your posts.
To my best understanding, the command "/sbin/shutdown" will use init (the deprecated(?) "-n" option bypasses init for the shutdown - see "man shutdown"). /etc/init.d - all (most?) service scripts for all runlevels /etc/rc0.d - scripts to be run at runlevel 0 (halt/poweroff) /etc/rc5.d - the usual full-desktop running level /etc/rc6.d - reboot /sbin/halt, /sbin/poweroff and /sbin/reboot seem to be respectivelly equivalent to "shutdown -h -H -t now", "shutdown -h -P -t now" and "shutdown -r" (they are binary files though, not just wrapper-scripts) For suspending and hibernating, "pm-suspend" and "pm-hibernate" might be used (though there are definitelly other options). Check "man pm-is-supported" to check whether those abilities are available on your system. Not sure this is the kind of information you were looking for but... there it goes. |
Quote:
~~~ 0;-Dan |
That was a gentle post of yours, Dan! *grin*
Yes, last I checked about all that was several years ago (I'll hardly ever get the need, professionally, to go any deeper than database structuring, no need to touch the OS). And yes, by that time, the SystemV-init technology was rather "current". When the upstart "thing" came up - or maybe just when I took notice of it (I think about the time I switched from Mandrake/Mandriva to Ubuntu) - I noticed it still used the init system, so gave it no more thought... Now I'm realising the init scripts are rather "legacy support". :D |
Quote:
I did not intend "criticism" but clarification. ASIDE -- I find that many technical people function at the level of "unconscious competence" -- we don't know what we know. They can look at a pile of technical details and pluck out answers. When asked, they are hard pressed to tell anyone "how did you know/do that?" Quote:
Cordialement, ~~~ 0;-Dan |
Quote:
Quote:
Quote:
Quote:
Jean-D. Ackle |
Quote:
Even complex information starts with something simple, "Can I do XYZ?" An affirmative leads folks to the next logical steps, "How do I do XYZ?" and "How will it take?" Often, simple knowledge that a solution exists is enough to inform a person to research. All they need is the location of the first brick on the path* to the solution. ==My== next step usually takes the form of Socratic questions, "Have you tried ...?" and "Have you thought about ...?" Cheers, ~~~ 0;-Dan __________ * "path" -- I recently stopped saying "yellow brick road" because too few folks recognized the reference. Sigh, the grey hair is catching up with me. |
All times are GMT -5. The time now is 11:37 PM. |