Skip to content

Commit

Permalink
Ahk updates. Fixed bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
bedware committed Aug 28, 2024
1 parent 82c6432 commit 4d507e4
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 19 deletions.
1 change: 1 addition & 0 deletions win/ahk/actions.json
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@
},
"turm": {
"desktop": "Dev",
"title": "ubuntu",
"run": "C:\\Program Files\\Alacritty\\alacritty.exe",
"runArgs": "--config-file C:\\Users\\dmitr\\.dotfiles\\all\\alacritty\\alacritty-work-profile.yml --title ubuntu --command wsl -d Ubuntu-22.04 --cd ~",
"initFunction": "makeAnyWindowCenteredThenMaximized",
Expand Down
17 changes: 12 additions & 5 deletions win/ahk/alfred.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,24 @@ executeInput(apps, userInput) {
}
; If nothing to activate
else {
if (app.run && IsAppInTray(app.run)) {
; Check in tray
if (app.title) {
if (IsAppInTrayByTitle(app.title)) {
RemoveAppFromTrayByTitle(app.title)
return
}
} else
if (app.run && IsAppInTrayByPath(app.run)) {
RemoveAppFromTrayByPath(app.run)
return
}

; Try to run
runCmd := app.run
if (app.runArgs != "") {
if (app.runArgs) {
runCmd := runCmd . " " . app.runArgs
}

; Try to run
Run % runCmd
WinWait % app.selector,, 10
if ErrorLevel {
Expand All @@ -78,14 +85,14 @@ executeInput(apps, userInput) {
}

; Call init function
if (app.initFunction != "") {
if (app.initFunction) {
retval := Func(app.initFunction).Call()
}
}
}
; there is no selector for the app
else {
if (app.run && IsAppInTray(app.run)) {
if (app.run && IsAppInTrayByPath(app.run)) {
RemoveAppFromTrayByPath(app.run)
return
}
Expand Down
21 changes: 11 additions & 10 deletions win/ahk/remap/per-app/browser.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,26 @@
; Workspace switcher popup

#if ScopeIs("ahk_exe msedge.exe")
~s::
if (GetKeyState("Space", "P")) {
createPopUp("select workspace", "C:\Users\dmitr\.dotfiles\win\pwsh\bin\Switch-BrowserWorkspace.ps1", false)
}
return
#s::
createPopUp("select workspace", "C:\Users\dmitr\.dotfiles\win\pwsh\bin\Switch-BrowserWorkspace.ps1", false)
return
#if
#if ScopeIs("ahk_exe msedge.exe") && HYPER_PRESSED
s::
createPopUp("select workspace", "C:\Users\dmitr\.dotfiles\win\pwsh\bin\Switch-BrowserWorkspace.ps1", false)
return
#if


#if ScopeIs("select workspace ahk_class Window Class ahk_exe alacritty.exe")
~s::
if (GetKeyState("Space", "P")) {
HideAppToTray()
}
return
#s::
~*Enter::
HideAppToTray()
return
#if

#if ScopeIs("select workspace ahk_class Window Class ahk_exe alacritty.exe") && HYPER_PRESSED
s::
HideAppToTray()
return
#if
4 changes: 2 additions & 2 deletions win/ahk/remap/per-app/devtools.ahk
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#if ScopeIs("^Dev") && GetKeyState("Space", "P")
#if ScopeIs("^Dev ahk_exe msedge.exe") && HYPER_PRESSED
a::Send ^+p
f::Send ^p
#if

on := false
#if ScopeIs("^Dev")
#if ScopeIs("^Dev ahk_exe msedge.exe")
; Debug
`;:: ; Step
global on
Expand Down
13 changes: 11 additions & 2 deletions win/ahk/utils/tray.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,19 @@ AddAppToTray(winTitle, winID, pathToExe) {
}

; Function to check if a window is already in the tray menu
IsAppInTray(pathToExe) {
IsAppInTrayByPath(path) {
global appsInTray
for _, win in appsInTray {
if (win.pathToExe = pathToExe) {
if (win.pathToExe = path) {
return true
}
}
return false
}
IsAppInTrayByTitle(title) {
global appsInTray
for _, win in appsInTray {
if (win.winTitle = title) {
return true
}
}
Expand Down

0 comments on commit 4d507e4

Please sign in to comment.