init commit

This commit is contained in:
unknown
2025-08-19 08:06:37 -04:00
commit 2957b5515a
743 changed files with 45495 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
from talon import Module, app
mod = Module()
@mod.action_class
class Actions:
def desktop(number: int):
"""change the current desktop"""
app.notify("Not supported on this operating system")
def desktop_show():
"""shows the current desktops"""
app.notify("Not supported on this operating system")
def desktop_next():
"""move to next desktop"""
app.notify("Not supported on this operating system")
def desktop_last():
"""move to previous desktop"""
app.notify("Not supported on this operating system")
def window_move_desktop_left():
"""move the current window to the desktop to the left"""
app.notify("Not supported on this operating system")
def window_move_desktop_right():
"""move the current window to the desktop to the right"""
app.notify("Not supported on this operating system")
def window_move_desktop(desktop_number: int):
"""move the current window to a different desktop"""
app.notify("Not supported on this operating system")
+7
View File
@@ -0,0 +1,7 @@
desk <number_small>: user.desktop(number_small)
desk next: user.desktop_next()
desk last: user.desktop_last()
desk show: user.desktop_show()
window move desk <number>: user.window_move_desktop(number)
window move desk left: user.window_move_desktop_left()
window move desk right: user.window_move_desktop_right()
@@ -0,0 +1,31 @@
from talon import Context, actions, ui
ctx = Context()
ctx.matches = r"""
os: linux
"""
@ctx.action_class("user")
class Actions:
def desktop(number: int):
ui.switch_workspace(number)
def desktop_next():
actions.user.desktop(ui.active_workspace() + 1)
def desktop_last():
actions.user.desktop(ui.active_workspace() - 1)
def desktop_show():
actions.key("super")
def window_move_desktop(desktop_number: int):
ui.active_window().workspace = desktop_number
actions.user.desktop(desktop_number)
def window_move_desktop_left():
actions.user.window_move_desktop(ui.active_workspace() - 1)
def window_move_desktop_right():
actions.user.window_move_desktop(ui.active_workspace() + 1)
+58
View File
@@ -0,0 +1,58 @@
import contextlib
import time
from talon import Context, actions, ctrl, ui
ctx = Context()
ctx.matches = r"""
os: mac
"""
@contextlib.contextmanager
def _drag_window_mac(win=None):
if win is None:
win = ui.active_window()
fs = win.children.find(AXSubrole="AXFullScreenButton")[0]
rect = fs.AXFrame
x = rect.x + rect.width + 5
y = rect.y + rect.height / 2
previous_position = ctrl.mouse_pos()
ctrl.mouse_move(x, y)
ctrl.mouse_click(button=0, down=True)
yield
time.sleep(0.1)
ctrl.mouse_click(button=0, up=True)
ctrl.mouse_move(*previous_position)
@ctx.action_class("user")
class MacActions:
def desktop(number: int):
if number < 10:
actions.key(f"ctrl-{number}")
def desktop_next():
actions.key("ctrl-right")
def desktop_last():
actions.key("ctrl-left")
def desktop_show():
actions.key("ctrl-up")
def window_move_desktop_left():
with _drag_window_mac():
actions.user.desktop_last()
def window_move_desktop_right():
with _drag_window_mac():
actions.user.desktop_next()
def window_move_desktop(desktop_number: int):
# TODO: amethyst stuff should be pulled out into a separate file
if ui.apps(bundle="com.amethyst.Amethyst"):
actions.key(f"ctrl-alt-shift-{desktop_number}")
else:
with _drag_window_mac():
actions.user.desktop(desktop_number)
+26
View File
@@ -0,0 +1,26 @@
from talon import Context, actions
ctx = Context()
ctx.matches = r"""
os: windows
"""
@ctx.action_class("user")
class Actions:
# def desktop(number: int):
def desktop_next():
actions.key("super-ctrl-right")
def desktop_last():
actions.key("super-ctrl-left")
def desktop_show():
actions.key("super-tab")
# def window_move_desktop_left():
# def window_move_desktop_right():
# def window_move_desktop(desktop_number: int):