Added more emojis.
This commit is contained in:
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🇦🇷"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Add Argentina flag emoji to clipboard"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added Argentina flag to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🇦🇺"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Add Australia flag emoji to clipboard"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added Australia flag to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🇧🇪"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Add Belgium flag emoji to clipboard"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added Belgium flag to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🇧🇷"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Add Brazil flag emoji to clipboard"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added Brazil flag to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🇨🇳"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Add China flag emoji to clipboard"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added China flag to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🇩🇰"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Add Denmark flag emoji to clipboard"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added Denmark flag to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🇫🇮"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Add Finland flag emoji to clipboard"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added Finland flag to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🇫🇷"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Add France flag emoji to clipboard"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added France flag to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🇩🇪"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Add Germany flag emoji to clipboard"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added Germany flag to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🇬🇷"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Add Greece flag emoji to clipboard"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added Greece flag to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🇮🇳"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Add India flag emoji to clipboard"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added India flag to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🇮🇪"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Add Ireland flag emoji to clipboard"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added Ireland flag to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🇮🇱"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Add Israel flag emoji to clipboard"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added Israel flag to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🇮🇹"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Add Italy flag emoji to clipboard"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added Italy flag to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🇯🇵"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Add Japan flag emoji to clipboard"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added Japan flag to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🇲🇽"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Add Mexico flag emoji to clipboard"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added Mexico flag to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🇳🇱"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Add Netherlands flag emoji to clipboard"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added Netherlands flag to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🇳🇴"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Add Norway flag emoji to clipboard"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added Norway flag to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🇵🇱"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Add Poland flag emoji to clipboard"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added Poland flag to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🇵🇹"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Add Portugal flag emoji to clipboard"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added Portugal flag to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🇷🇺"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Add Russia flag emoji to clipboard"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added Russia flag to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🇿🇦"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Add South Africa flag emoji to clipboard"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added South Africa flag to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🇰🇷"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Add South Korea flag emoji to clipboard"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added South Korea flag to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🇪🇸"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Add Spain flag emoji to clipboard"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added Spain flag to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🇸🇪"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Add Sweden flag emoji to clipboard"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added Sweden flag to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🇨🇭"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Add Switzerland flag emoji to clipboard"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added Switzerland flag to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🇹🇷"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Add Turkey flag emoji to clipboard"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added Turkey flag to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🇺🇦"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Add Ukraine flag emoji to clipboard"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added Ukraine flag to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🍎"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Red apple emoji"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added red apple to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🥑"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Avocado emoji"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added avocado to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🎂"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Birthday cake emoji"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added birthday cake to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🍓"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Strawberry emoji"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added strawberry to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🐈⬛"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Black cat emoji"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added black cat to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🧙"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Magic cauldron emoji"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added magic cauldron to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🧛"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Vampire emoji"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added vampire to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🧙♀️"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Witch emoji"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added witch to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🦋"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Butterfly emoji"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added butterfly to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🌸"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Cherry blossom emoji"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added cherry blossom to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🌹"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Rose emoji"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added rose to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🌻"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Sunflower emoji"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added sunflower to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🐺"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Wolf emoji - The mighty Fenrir!"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added the mighty wolf Fenrir to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "😀"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Grinning face emoji"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added grinning face to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "😁"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Beaming face with smiling eyes emoji"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added beaming face to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "😘"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Face blowing a kiss emoji"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added face blowing kiss to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "😅"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Grinning face with sweat emoji"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added grinning face with sweat to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "😍"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Smiling face with heart-eyes emoji"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added heart-eyes face to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🥰"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Smiling face with hearts emoji"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added smiling face with hearts to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🥺"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Pleading face emoji"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added pleading face to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🤣"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Rolling on floor laughing emoji"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added rolling on floor laughing to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "😋"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Face savoring food emoji"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added face savoring food to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "😏"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Smirking face emoji"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added smirking face to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "🙏"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Folded hands emoji"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added folded hands to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "💯"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Hundred points symbol emoji"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added hundred points to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -0,0 +1,22 @@
|
||||
class command():
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.emoji = "✨"
|
||||
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
|
||||
def getDescription(self):
|
||||
return "Sparkles emoji"
|
||||
|
||||
def run(self):
|
||||
self.env["runtime"]["MemoryManager"].add_value_to_first_index(
|
||||
"clipboardHistory", self.emoji
|
||||
)
|
||||
self.env["runtime"]["OutputManager"].present_text(
|
||||
"Added sparkles to clipboard",
|
||||
interrupt=False, flush=False
|
||||
)
|
@ -4,6 +4,6 @@
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
version = "2025.07.16"
|
||||
version = "2025.07.17"
|
||||
codeName = "testing"
|
||||
code_name = "testing"
|
||||
|
@ -772,10 +772,11 @@ class driver(screenDriver):
|
||||
import re
|
||||
|
||||
# Find all application processes (non-bash, non-screen)
|
||||
app_pattern = r'([a-zA-Z0-9_-]+)\((\d+)\)'
|
||||
# Pattern excludes --- prefix from pstree connection lines
|
||||
app_pattern = r'([a-zA-Z0-9_]+)\((\d+)\)'
|
||||
matches = re.findall(app_pattern, pstree_output)
|
||||
|
||||
skip_processes = {'screen', 'bash', 'sh', 'grep', 'ps'}
|
||||
skip_processes = {'screen', 'bash', 'sh', 'grep', 'ps', 'sudo', 'sleep', 'clipboard_sync'}
|
||||
applications = []
|
||||
|
||||
for app_name, pid in matches:
|
||||
@ -788,16 +789,30 @@ class driver(screenDriver):
|
||||
|
||||
if ps_result.returncode == 0:
|
||||
stat = ps_result.stdout.strip()
|
||||
# Look for processes that are active (S+ state or similar)
|
||||
if '+' in stat or 'l' in stat.lower():
|
||||
applications.append((app_name, pid, stat))
|
||||
# Prioritize active processes
|
||||
priority = 0
|
||||
if 'S' in stat or 'R' in stat: # Active processes
|
||||
priority += 10
|
||||
if '+' in stat: # Foreground processes
|
||||
priority += 20
|
||||
if 'l' in stat.lower(): # Locked processes
|
||||
priority += 5
|
||||
|
||||
applications.append((app_name, pid, priority, stat))
|
||||
except:
|
||||
# If we can't check status, still consider it
|
||||
applications.append((app_name, pid, 'unknown'))
|
||||
# If we can't check status, still consider it with low priority
|
||||
applications.append((app_name, pid, 1, 'unknown'))
|
||||
|
||||
# Return the first active application found
|
||||
# Sort by priority and return the highest priority application
|
||||
if applications:
|
||||
return applications[0][0].upper()
|
||||
applications.sort(key=lambda x: (x[2], int(x[1])), reverse=True)
|
||||
best_app = applications[0][0].upper()
|
||||
|
||||
self.env["runtime"]["DebugManager"].write_debug_out(
|
||||
f"parse_active_app_from_pstree found {len(applications)} apps, selected: {best_app}",
|
||||
debug.DebugLevel.INFO
|
||||
)
|
||||
return best_app
|
||||
|
||||
except Exception as e:
|
||||
self.env["runtime"]["DebugManager"].write_debug_out(
|
||||
@ -806,39 +821,95 @@ class driver(screenDriver):
|
||||
return None
|
||||
|
||||
def get_app_from_screen_session(self, tty_num):
|
||||
"""Get current application from screen session on specific TTY"""
|
||||
"""Get current application from active screen window on specific TTY"""
|
||||
try:
|
||||
# Step 1: Find screen process for this TTY
|
||||
screen_tty_pid = self.get_screen_process_for_tty(tty_num)
|
||||
if not screen_tty_pid:
|
||||
return None
|
||||
|
||||
self.env["runtime"]["DebugManager"].write_debug_out(
|
||||
f"Found screen TTY process: {screen_tty_pid} for TTY{tty_num}",
|
||||
debug.DebugLevel.INFO
|
||||
)
|
||||
|
||||
# Step 2: Find session manager process
|
||||
session_pid = self.get_screen_session_process(screen_tty_pid)
|
||||
if not session_pid:
|
||||
return None
|
||||
|
||||
self.env["runtime"]["DebugManager"].write_debug_out(
|
||||
f"Found screen session process: {session_pid}",
|
||||
debug.DebugLevel.INFO
|
||||
)
|
||||
|
||||
# Step 3: Get process tree and find active app
|
||||
result = subprocess.run([
|
||||
'pstree', '-p', session_pid
|
||||
], capture_output=True, text=True, timeout=3)
|
||||
# Find the screen session PID for this TTY
|
||||
ps_result = subprocess.run([
|
||||
'ps', '-eo', 'pid,ppid,comm,tty,args', '--no-headers'
|
||||
], capture_output=True, text=True, timeout=2)
|
||||
|
||||
if result.returncode == 0:
|
||||
if ps_result.returncode == 0:
|
||||
# Find the main screen process for our TTY
|
||||
screen_pid = None
|
||||
for line in ps_result.stdout.split('\n'):
|
||||
if not line.strip():
|
||||
continue
|
||||
parts = line.split(None, 4)
|
||||
if len(parts) >= 4 and parts[2] == 'screen' and f'tty{tty_num}' in parts[3]:
|
||||
screen_pid = parts[0]
|
||||
break
|
||||
|
||||
if not screen_pid:
|
||||
return None
|
||||
|
||||
# Get the session manager screen process (child of TTY screen)
|
||||
session_pid = None
|
||||
for line in ps_result.stdout.split('\n'):
|
||||
if not line.strip():
|
||||
continue
|
||||
parts = line.split(None, 4)
|
||||
if len(parts) >= 3 and parts[1] == screen_pid and parts[2] == 'screen':
|
||||
session_pid = parts[0]
|
||||
break
|
||||
|
||||
if not session_pid:
|
||||
return None
|
||||
|
||||
self.env["runtime"]["DebugManager"].write_debug_out(
|
||||
f"Pstree output: {result.stdout[:200]}...",
|
||||
f"Found screen session PID: {session_pid}",
|
||||
debug.DebugLevel.INFO
|
||||
)
|
||||
return self.parse_active_app_from_pstree(result.stdout)
|
||||
|
||||
# Get all bash processes under this screen session
|
||||
bash_processes = []
|
||||
for line in ps_result.stdout.split('\n'):
|
||||
if not line.strip():
|
||||
continue
|
||||
parts = line.split(None, 4)
|
||||
if len(parts) >= 3 and parts[1] == session_pid and parts[2] == 'bash':
|
||||
bash_processes.append(parts[0])
|
||||
|
||||
# Check each bash for child applications, prioritizing active ones
|
||||
best_app = None
|
||||
best_priority = 0
|
||||
|
||||
for bash_pid in bash_processes:
|
||||
child_result = subprocess.run([
|
||||
'ps', '--ppid', bash_pid, '-o', 'comm,stat', '--no-headers'
|
||||
], capture_output=True, text=True, timeout=1)
|
||||
|
||||
if child_result.returncode == 0:
|
||||
for child_line in child_result.stdout.split('\n'):
|
||||
if not child_line.strip():
|
||||
continue
|
||||
child_parts = child_line.split()
|
||||
if len(child_parts) >= 2:
|
||||
child_comm, child_stat = child_parts[0], child_parts[1]
|
||||
if child_comm.lower() not in ['grep', 'ps', 'bash', 'sh', 'sudo', 'sleep']:
|
||||
# Calculate priority based on process state
|
||||
priority = 0
|
||||
if 'R' in child_stat: # Running
|
||||
priority += 30
|
||||
elif 'S' in child_stat: # Sleeping
|
||||
priority += 20
|
||||
if '+' in child_stat: # Foreground
|
||||
priority += 20
|
||||
|
||||
self.env["runtime"]["DebugManager"].write_debug_out(
|
||||
f"Found child process: {child_comm} ({child_stat}) priority: {priority}",
|
||||
debug.DebugLevel.INFO
|
||||
)
|
||||
|
||||
if priority > best_priority:
|
||||
best_app = child_comm.upper()
|
||||
best_priority = priority
|
||||
|
||||
if best_app:
|
||||
self.env["runtime"]["DebugManager"].write_debug_out(
|
||||
f"Selected best app: {best_app} (priority: {best_priority})",
|
||||
debug.DebugLevel.INFO
|
||||
)
|
||||
return best_app
|
||||
|
||||
except (subprocess.TimeoutExpired, subprocess.CalledProcessError, FileNotFoundError) as e:
|
||||
self.env["runtime"]["DebugManager"].write_debug_out(
|
||||
@ -846,6 +917,62 @@ class driver(screenDriver):
|
||||
)
|
||||
return None
|
||||
|
||||
def parse_latest_active_app_from_pstree(self, pstree_output):
|
||||
"""Parse pstree output to find the most recently active application"""
|
||||
try:
|
||||
import re
|
||||
|
||||
# Find all application processes with PIDs
|
||||
app_pattern = r'([a-zA-Z0-9_]+)\((\d+)\)'
|
||||
matches = re.findall(app_pattern, pstree_output)
|
||||
|
||||
skip_processes = {'screen', 'bash', 'sh', 'grep', 'ps', 'sudo', 'sleep', 'clipboard_sync'}
|
||||
applications = []
|
||||
|
||||
for app_name, pid in matches:
|
||||
if app_name.lower() not in skip_processes:
|
||||
# Check if this process is still active and get its start time
|
||||
try:
|
||||
ps_result = subprocess.run([
|
||||
'ps', '-p', pid, '-o', 'stat,lstart', '--no-headers'
|
||||
], capture_output=True, text=True, timeout=1)
|
||||
|
||||
if ps_result.returncode == 0:
|
||||
stat_info = ps_result.stdout.strip().split(None, 1)
|
||||
if len(stat_info) >= 2:
|
||||
stat = stat_info[0]
|
||||
start_time = stat_info[1]
|
||||
|
||||
# Prioritize processes that are active or have recent activity
|
||||
priority = 0
|
||||
if 'S' in stat or 'R' in stat: # Running or sleeping (active)
|
||||
priority += 10
|
||||
if '+' in stat: # Foreground process
|
||||
priority += 20
|
||||
|
||||
applications.append((app_name, pid, priority, start_time))
|
||||
except:
|
||||
# If we can't get status, still consider it but with low priority
|
||||
applications.append((app_name, pid, 1, 'unknown'))
|
||||
|
||||
# Sort by priority (highest first), then by PID (most recent)
|
||||
if applications:
|
||||
applications.sort(key=lambda x: (x[2], int(x[1])), reverse=True)
|
||||
best_app = applications[0][0].upper()
|
||||
|
||||
self.env["runtime"]["DebugManager"].write_debug_out(
|
||||
f"Found {len(applications)} applications, selected: {best_app}",
|
||||
debug.DebugLevel.INFO
|
||||
)
|
||||
return best_app
|
||||
|
||||
except Exception as e:
|
||||
self.env["runtime"]["DebugManager"].write_debug_out(
|
||||
f"Error parsing latest active app from pstree: {str(e)}",
|
||||
debug.DebugLevel.ERROR
|
||||
)
|
||||
return None
|
||||
|
||||
def get_app_from_tmux_session(self, tty_num):
|
||||
"""Get current application from tmux session on specific TTY"""
|
||||
try:
|
||||
@ -948,28 +1075,26 @@ class driver(screenDriver):
|
||||
)
|
||||
|
||||
def get_app_via_standard_ps(self, curr_screen):
|
||||
"""Original ps-based application detection as fallback"""
|
||||
"""Fallback ps-based application detection for non-screen/tmux environments"""
|
||||
try:
|
||||
apps = (
|
||||
subprocess.Popen(
|
||||
"ps -t tty" + curr_screen + " -o comm,tty,stat",
|
||||
shell=True,
|
||||
stdout=subprocess.PIPE,
|
||||
)
|
||||
.stdout.read()
|
||||
.decode()[:-1]
|
||||
.split("\n")
|
||||
)
|
||||
# Simple TTY-specific detection as fallback
|
||||
result = subprocess.run([
|
||||
'ps', '-t', f'tty{curr_screen}', '-o', 'comm,stat', '--no-headers'
|
||||
], capture_output=True, text=True, timeout=2)
|
||||
|
||||
for i in apps:
|
||||
i = i.upper()
|
||||
i = i.split()
|
||||
if len(i) >= 3:
|
||||
comm, tty, stat = i[0], i[1], i[2]
|
||||
if "+" in stat and comm != "":
|
||||
if comm not in ["GREP", "SH", "PS", "BASH"]:
|
||||
if "TTY" + curr_screen in tty:
|
||||
return comm
|
||||
if result.returncode == 0:
|
||||
for line in result.stdout.split('\n'):
|
||||
if not line.strip():
|
||||
continue
|
||||
parts = line.split()
|
||||
if len(parts) >= 2:
|
||||
comm, stat = parts[0], parts[1]
|
||||
if '+' in stat and comm.upper() not in ['BASH', 'SH', 'SCREEN', 'GREP', 'PS']:
|
||||
self.env["runtime"]["DebugManager"].write_debug_out(
|
||||
f"Fallback detection found: {comm}",
|
||||
debug.DebugLevel.INFO
|
||||
)
|
||||
return comm.upper()
|
||||
except Exception as e:
|
||||
self.env["runtime"]["DebugManager"].write_debug_out(
|
||||
f"Standard ps detection error: {str(e)}", debug.DebugLevel.ERROR
|
||||
|
Reference in New Issue
Block a user