mirror of
https://github.com/AquaMorph/dotfiles.git
synced 2025-04-30 09:45:34 +00:00
Display correct monitors on startup
This commit is contained in:
parent
410bf4d56a
commit
dcfc056cb0
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
from i3ipc import Connection, Event
|
from i3ipc import Connection, Event
|
||||||
import os
|
import os, time
|
||||||
|
|
||||||
# moveWindowToWorkspace() moves a given window to a given workspace.
|
# moveWindowToWorkspace() moves a given window to a given workspace.
|
||||||
def moveWindowToWorkspace(window, workspace):
|
def moveWindowToWorkspace(window, workspace):
|
||||||
@ -30,9 +30,18 @@ def filterWindowsByClass(windowClass, windows):
|
|||||||
def doesWindowExist(window):
|
def doesWindowExist(window):
|
||||||
return window != None
|
return window != None
|
||||||
|
|
||||||
|
# switchWorkspace() switches currently selected workspace.
|
||||||
|
def switchWorkspace(workspace):
|
||||||
|
i3.command('workspace ' + workspace)
|
||||||
|
|
||||||
|
# execI3() runs a command from i3wm.
|
||||||
|
def execI3(program):
|
||||||
|
i3.command('exec ' + program)
|
||||||
|
|
||||||
# launchProgram() launches a program on a given workspace.
|
# launchProgram() launches a program on a given workspace.
|
||||||
def launchProgram(program, workspace):
|
def launchProgram(program, workspace):
|
||||||
i3.command('workspace ' + workspace + '; exec ' + program)
|
switchWorkspace(workspace)
|
||||||
|
execI3(program)
|
||||||
|
|
||||||
# isProgramRunning() returns if a program is running and if it is
|
# isProgramRunning() returns if a program is running and if it is
|
||||||
# moves it to a given workspace.
|
# moves it to a given workspace.
|
||||||
@ -45,10 +54,12 @@ def isProgramRunning(name, windows, workspace):
|
|||||||
|
|
||||||
i3 = Connection()
|
i3 = Connection()
|
||||||
firefoxWindows = filterWindowsByClass('Firefox', getWindows(i3))
|
firefoxWindows = filterWindowsByClass('Firefox', getWindows(i3))
|
||||||
|
switchWorkspace('10')
|
||||||
|
switchWorkspace('1')
|
||||||
|
|
||||||
# Music
|
# Music
|
||||||
if not isProgramRunning('YouTube Music', firefoxWindows, '10'):
|
if not isProgramRunning('YouTube Music', firefoxWindows, '10'):
|
||||||
launchProgram('exec firefox --new-window music.youtube.com', '10')
|
launchProgram('firefox --new-window music.youtube.com', '10')
|
||||||
|
|
||||||
# Stocks
|
# Stocks
|
||||||
if not isProgramRunning('Robinhood', firefoxWindows, '10'):
|
if not isProgramRunning('Robinhood', firefoxWindows, '10'):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user