diff --git a/i3_workspaces.nim b/i3_workspaces.nim index 832022a..ccf400c 100644 --- a/i3_workspaces.nim +++ b/i3_workspaces.nim @@ -26,6 +26,7 @@ type urgent: bool var my_workspaces: seq[Workspace] +var current_workspace: int = 0 proc showWorkspaces() @@ -37,6 +38,7 @@ proc buildString(ws: Workspace): string = else: str &= " " if ws.focused or ws.application.focused: + current_workspace = ws.num str &= FOCUSED # elif ws.visible: # str &= VISIBLE @@ -60,6 +62,8 @@ proc switchWorkspace(workspace: string) = if workspace.contains("%"): return let ws = findWorkspace(workspace) + if ws.num == current_workspace: + return let cmd = "i3-msg workspace " & $ws.num discard execCmd(cmd) showWorkspaces()