Skip to content

Instantly share code, notes, and snippets.

@syneart
Last active September 27, 2023 01:48
Show Gist options
  • Save syneart/aa8f2f27a103a7f1e1812329fa192e65 to your computer and use it in GitHub Desktop.
Save syneart/aa8f2f27a103a7f1e1812329fa192e65 to your computer and use it in GitHub Desktop.
Default start caffeine in active mode (patch for caffeine-indicator 2.9.4 [https://launchpad.net/caffeine])
27a28
> import subprocess
64,68d64
< # Handle command line arguments
< parser = argparse.ArgumentParser(prog=PROGRAM_NAME, description='Toggle desktop idleness inhibition')
< parser.add_argument('-V', '--version', action='version', version=PROGRAM_NAME + ' ' + VERSION)
< parser.parse_args()
<
179d174
<
187a183,195
>
> # Handle command line arguments
> parser = argparse.ArgumentParser(prog=PROGRAM_NAME, description='Toggle desktop idleness inhibition')
> parser.add_argument('-V', '--version', action='version', version=PROGRAM_NAME + ' ' + VERSION)
> parser.add_argument('-D', '--inactive', action="store_true", dest='inactive', help='Inactive desktop idleness inhibition')
> args = parser.parse_args()
>
> if (args.inactive):
> subprocess.call(["pkill", "-SIGINT", "caffeine"])
> sys.exit(1)
>
> caffeine.toggle_activated()
>
@syneart
Copy link
Author

syneart commented Jan 18, 2019

Use below command to download and patch it ! (Just only one line !)
sudo wget -O - https://gist.githubusercontent.com/syneart/aa8f2f27a103a7f1e1812329fa192e65/raw/caffeine-indicator.patch | sudo patch /usr/bin/caffeine-indicator

@johnthq
Copy link

johnthq commented Sep 9, 2023

WOW this is such a hidden gem! <3

@syneart
Copy link
Author

syneart commented Sep 27, 2023

WOW this is such a hidden gem! <3

I'm glad you found the results you were looking for ~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment