- Switch to signal-exit for most exits
This commit is contained in:
parent
24e815b85e
commit
debad09705
3 changed files with 9 additions and 8 deletions
|
|
@ -23,7 +23,6 @@ CHANNEL - Often called 'Rooms'. Both voice and text channels are types of channe
|
||||||
import select
|
import select
|
||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
import sys
|
|
||||||
import logging
|
import logging
|
||||||
import calendar
|
import calendar
|
||||||
import websocket
|
import websocket
|
||||||
|
|
@ -110,7 +109,7 @@ class DiscordConnector:
|
||||||
log.error("No access token in json response")
|
log.error("No access token in json response")
|
||||||
log.error(response.text)
|
log.error(response.text)
|
||||||
log.error("The user most likely denied permission for this app")
|
log.error("The user most likely denied permission for this app")
|
||||||
sys.exit(1)
|
self.discover.exit()
|
||||||
|
|
||||||
def set_channel(self, channel, guild, need_req=True):
|
def set_channel(self, channel, guild, need_req=True):
|
||||||
"""
|
"""
|
||||||
|
|
@ -280,7 +279,7 @@ class DiscordConnector:
|
||||||
self.get_access_token_stage2(j["data"]["code"])
|
self.get_access_token_stage2(j["data"]["code"])
|
||||||
else:
|
else:
|
||||||
log.error("Authorization rejected")
|
log.error("Authorization rejected")
|
||||||
sys.exit(0)
|
self.discover.exit()
|
||||||
return
|
return
|
||||||
elif j["cmd"] == "DISPATCH":
|
elif j["cmd"] == "DISPATCH":
|
||||||
if j["evt"] == "READY":
|
if j["evt"] == "READY":
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@ class Discover:
|
||||||
if normal_close:
|
if normal_close:
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
if "--close" in data or "-x" in data:
|
if "--close" in data or "-x" in data:
|
||||||
os.kill(os.getpid(), signal.SIGTERM)
|
self.exit()
|
||||||
if "--steamos" in data or "-s" in data:
|
if "--steamos" in data or "-s" in data:
|
||||||
self.steamos = True
|
self.steamos = True
|
||||||
if "--hide" in data:
|
if "--hide" in data:
|
||||||
|
|
@ -156,6 +156,9 @@ class Discover:
|
||||||
if self.connection:
|
if self.connection:
|
||||||
self.connection.request_text_rooms_for_guild(match.group(1))
|
self.connection.request_text_rooms_for_guild(match.group(1))
|
||||||
|
|
||||||
|
def exit(self):
|
||||||
|
os.kill(os.getpid(), signal.SIGTERM)
|
||||||
|
|
||||||
def config_set(self, context, key, value):
|
def config_set(self, context, key, value):
|
||||||
"""Set a config value and save to disk"""
|
"""Set a config value and save to disk"""
|
||||||
config = self.config()
|
config = self.config()
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ Overlay parent class. Helpful if we need more overlay
|
||||||
types without copy-and-pasting too much code
|
types without copy-and-pasting too much code
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
import logging
|
import logging
|
||||||
import gi
|
import gi
|
||||||
import cairo
|
import cairo
|
||||||
|
|
@ -75,7 +74,7 @@ class OverlayWindow(Gtk.Window):
|
||||||
if not self.get_display().supports_input_shapes():
|
if not self.get_display().supports_input_shapes():
|
||||||
log.info(
|
log.info(
|
||||||
"Input shapes not available. Quitting")
|
"Input shapes not available. Quitting")
|
||||||
sys.exit(1)
|
self.discover.exit()
|
||||||
if visual:
|
if visual:
|
||||||
# Set the visual even if we can't use it right now
|
# Set the visual even if we can't use it right now
|
||||||
self.set_visual(visual)
|
self.set_visual(visual)
|
||||||
|
|
@ -125,7 +124,7 @@ class OverlayWindow(Gtk.Window):
|
||||||
|
|
||||||
def window_exited(self, _window=None):
|
def window_exited(self, _window=None):
|
||||||
"""Window closed. Exit app"""
|
"""Window closed. Exit app"""
|
||||||
sys.exit(1)
|
self.discover.exit()
|
||||||
|
|
||||||
def set_gamescope_xatom(self, enabled):
|
def set_gamescope_xatom(self, enabled):
|
||||||
"""Set Gamescope XAtom to identify self as an overlay candidate"""
|
"""Set Gamescope XAtom to identify self as an overlay candidate"""
|
||||||
|
|
@ -160,7 +159,7 @@ class OverlayWindow(Gtk.Window):
|
||||||
log.info(
|
log.info(
|
||||||
"GTK Layer Shell is not supported on this wayland compositor")
|
"GTK Layer Shell is not supported on this wayland compositor")
|
||||||
log.info("Currently not possible: Gnome, Weston")
|
log.info("Currently not possible: Gnome, Weston")
|
||||||
sys.exit(0)
|
self.discover.exit()
|
||||||
if not GtkLayerShell.is_layer_window(self):
|
if not GtkLayerShell.is_layer_window(self):
|
||||||
GtkLayerShell.init_for_window(self)
|
GtkLayerShell.init_for_window(self)
|
||||||
GtkLayerShell.set_layer(self, GtkLayerShell.Layer.OVERLAY)
|
GtkLayerShell.set_layer(self, GtkLayerShell.Layer.OVERLAY)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue