Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6851185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:13:01+00:00 2026-05-27T01:13:01+00:00

In a Java Swing desktop application running on Linux (e.g., Ubuntu), how can the

  • 0

In a Java Swing desktop application running on Linux (e.g., Ubuntu), how can the application be notified that the PC has just resumed from the sleep/suspended/hibernated state?

Screen blanking is not a concern. All other suspended or hibernated states (suspend to RAM or suspend to disk) are of interest (and for my purposes they will all be treated the same).

My goal is to invoke a class method automatically when the PC or device is resumed. (That method needs to restart rxtxSerial, fwiw.)

EDIT: A comment from Thorbjørn Ravn Andersen made me realize my question is not clear. My goal is to listen to an operating system event (or utilize a system log file) that would indication the system has just resumed from a suspended state.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T01:13:01+00:00Added an answer on May 27, 2026 at 1:13 am

    Here’s what the Canonical support engineer suggested.


    20/11/2011 22:53 | Jason
    My suggestion is to create a script under the /etc/pm/sleep.d/. The script will be execute when resume from suspend. Please reference to the /usr/share/doc/pm-utils/HOWTO.hooks.gz for the details.


    Here’s the intro from that file:

    How to write a pm-utils hook:

    PARAMETERS

    A pm-utils hook is simply an executable file that accepts at least one
    parameter.

    For hooks in sleep.d, the potential values of the first parameter are:

    suspend — The hook MUST perform whatever action is appropriate when the
    system is preparing for memory sleep (or its equivalent).

    resume — The hook MUST perform whatever action is appropriate when the
    system is coming out of suspend.

    hibernate — The hook MUST perform whatever action is appropriate when
    the system is preparing for suspend-to-disk.

    thaw — The hook MUST perform whatever action is appropriate when the system
    is coming out of suspend-to-disk.

    help — If your hook parses the PM_CMDLINE environment variable for switches,
    this function SHOULD output text describing the parameters it parses
    in a format easily understandable by an end-user.

    The actual sleep method being used will be passed as the second parameter —
    if your hook needs to handle suspend-hybrid (or any other platform-specific
    sleep method), it should examine the second parameter.

    For hooks in power.d, the potential values of that parameter are:
    true — the hook MUST perform whatever action is appropriate when the system
    transitions TO battery power.
    false — The hook MUST perform whatever action is appropriate when the system
    transitions FROM battery power.

    And here’s an example:

    #!/bin/bash
    case "$1" in
    hibernate|suspend)
        ACTION BEFORE SUSPEND/HIBERNATE
        ;;
    thaw|resume)
        ACTION AFTER RESUME
        ;;
    *)
        ;;
    esac
    exit $?
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Java web application that has a 'disconnected' Java Swing desktop app.
I need to build Java Swing Desktop Application in which JPEGs from a particular
We are developing a desktop application using Java Swing that requires to show width
We have a desktop application written in Java Swing that currently uses Java Web
I am writing a desktop application written in Swing developed using Java 1.5. Some
I have a Java swing application with a panel that contains three JComboBoxe s
I've creating a Java Swing application and I realized that I have many many
Developing a desktop application based on Java + Swing I faced the problem of
I am developing a Java Desktop Application with GUI implemented in SWING. I hava
I am developing a Java desktop application and I use Swing to build the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.