File: command-on-exit.py

package info (click to toggle)
python-i3ipc 2.2.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 580 kB
  • sloc: python: 2,968; makefile: 222; sh: 4
file content (22 lines) | stat: -rw-r--r-- 371 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env python3

# This example shows how to run a command when i3 exits
#
# https://faq.i3wm.org/question/3468/run-a-command-when-i3-exits/

# This is the command to run
COMMAND = ['echo', 'hello, world']

from subprocess import Popen
import i3ipc


def on_shutdown(i3):
    Popen(COMMAND)


i3 = i3ipc.Connection()

i3.on('ipc_shutdown', on_shutdown)

i3.main()