no flip flop between last used workspace

This commit is contained in:
Paul Wilde 2022-05-17 16:12:32 +01:00
parent f93a90d8f9
commit 6543416654

View file

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