Add mako and update confs
This commit is contained in:
52
.config/sway/workspace_rename.py
Executable file
52
.config/sway/workspace_rename.py
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/bin/python3
|
||||
|
||||
import asyncio
|
||||
|
||||
from i3ipc import Event
|
||||
from i3ipc.aio import Connection
|
||||
|
||||
|
||||
async def main():
|
||||
sway = await Connection().connect()
|
||||
|
||||
def on(event, handler=None):
|
||||
def on_wrapped(handler):
|
||||
sway.on(event, handler)
|
||||
return handler
|
||||
if handler:
|
||||
return on_wrapped(handler)
|
||||
else:
|
||||
return on_wrapped
|
||||
|
||||
@on(Event.WINDOW_FOCUS)
|
||||
async def on_window_focus(sway, e):
|
||||
focused_window = (await sway.get_tree()).find_focused()
|
||||
focused_workspace = focused_window.workspace()
|
||||
|
||||
new_name = f'{focused_workspace.num}:'
|
||||
|
||||
app_name = e.container.app_id
|
||||
if not app_name:
|
||||
app_name = e.container.window_instance
|
||||
|
||||
if app_name == 'kitty':
|
||||
new_name += ''
|
||||
elif app_name in ['Chromium', 'google-chrome']:
|
||||
if 'YouTube' in e.container.name:
|
||||
new_name += ''
|
||||
else:
|
||||
new_name += ''
|
||||
elif app_name == 'discord':
|
||||
new_name += ''
|
||||
elif app_name == 'spotify':
|
||||
new_name += ''
|
||||
elif app_name in ['GEMOC Studio', 'code-oss']:
|
||||
new_name += ''
|
||||
elif app_name:
|
||||
new_name += app_name
|
||||
|
||||
await sway.command(f'rename workspace to "{new_name}"')
|
||||
|
||||
await sway.main()
|
||||
|
||||
asyncio.get_event_loop().run_until_complete(main())
|
||||
Reference in New Issue
Block a user