Skip to content

Commit

Permalink
Add alt+meta+S as shortcut for orca
Browse files Browse the repository at this point in the history
  • Loading branch information
bigbruno committed Jan 2, 2025
1 parent 05a358a commit 942044d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions bigbashview/usr/lib/bbv/ui/qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ def __init__(self):
self.key_f12 = QShortcut(QKeySequence(Qt.Key_F12), self.web)
self.key_f12.activated.connect(self.devpage)
self.web.page().profile().downloadRequested.connect(self.onDownloadRequested)

# Meta+Alt+S Keyboard shortcut for run orca
self.key_meta_alt_s = QShortcut(QKeySequence("Meta+Alt+S"), self)
self.key_meta_alt_s.activated.connect(self.run_orca)

# Set up the layout and splitter for the main window
self.hbox = QHBoxLayout(self)
Expand All @@ -160,6 +164,22 @@ def __init__(self):
self.web.page().setWebChannel(self.channel)
self.channel.registerObject("windowControl", self.control)

def run_orca(self):
try:
# Use pgrep to check if there are any running processes named 'orca'
process_check = os.system("pgrep orca > /dev/null 2>&1")

if process_check == 0: # If pgrep returns 0, the Orca process is running
os.system("killall orca")
print("Orca process terminated.")
else:
os.system("orca &") # Start the Orca process in the background
print("Orca process started.")
except Exception as e:
# Handle any exceptions that occur while managing the Orca process
print(f"Error handling the Orca process: {e}")


def changeEvent(self, event):
super().changeEvent(event)
if event.type() == QEvent.WindowStateChange:
Expand Down

0 comments on commit 942044d

Please sign in to comment.