summaryrefslogtreecommitdiff
path: root/_windows
diff options
context:
space:
mode:
Diffstat (limited to '_windows')
-rw-r--r--_windows/ahk/c-w.ahk9
-rw-r--r--_windows/ahk/capslock.ahk101
-rw-r--r--_windows/ahk/discord.ahk11
-rw-r--r--_windows/ahk/element.ahk11
-rw-r--r--_windows/ahk/firefox.ahk6
-rw-r--r--_windows/ahk/media.ahk2
-rw-r--r--_windows/ahk/run.ps14
-rw-r--r--_windows/ahk/super.ahk121
8 files changed, 51 insertions, 214 deletions
diff --git a/_windows/ahk/c-w.ahk b/_windows/ahk/c-w.ahk
deleted file mode 100644
index edd3dfb..0000000
--- a/_windows/ahk/c-w.ahk
+++ /dev/null
@@ -1,9 +0,0 @@
-#Requires AutoHotkey v2
-#SingleInstance Force
-
-#HotIf WinActive("ahk_exe Discord.exe") ||
- WinActive("ahk_exe firefox.exe") ||
- WinActive("ahk_exe Element.exe") ||
- WinActive("ahk_exe wps.exe")
-^w::^Backspace
-#HotIf
diff --git a/_windows/ahk/capslock.ahk b/_windows/ahk/capslock.ahk
index 0c775ee..0f03daf 100644
--- a/_windows/ahk/capslock.ahk
+++ b/_windows/ahk/capslock.ahk
@@ -1,69 +1,70 @@
#Requires AutoHotkey v2
#SingleInstance Force
-GroupAdd("IDE", "ahk_exe rider64.exe")
-GroupAdd("IDE", "ahk_exe code.exe")
-GroupAdd("IDE", "ahk_exe code-insiders.exe")
-GroupAdd("IDE", "ahk_exe webstorm64.exe")
-GroupAdd("IDE", "ahk_exe devenv.exe")
+CapsLock::Esc
-GroupAdd("Browser", "ahk_exe msedge.exe")
-GroupAdd("Browser", "ahk_exe firefox.exe")
+SetKeyDelay 1
-CapsLockState := false
-HarpoonLastWindowIndex := 0
+global CurrentDesktop := 1
-HarpoonRun(winTitle) {
- SetTitleMatchMode 2
- DetectHiddenWindows false
+ShowCurrentWindows() {
+ titles := []
+ text := ""
- windows := WinGetList(winTitle)
+ hwnds := WinGetList()
+ for hwnd in hwnds {
+ ; skip tool windows
+ style := DllCall("GetWindowLongPtr", "Ptr", hwnd, "Int", -20, "Ptr")
+ WS_EX_TOOLWINDOW := 0x80
+ if style & WS_EX_TOOLWINDOW
+ continue
- if windows.Length = 0 {
- return
- }
+ title := WinGetTitle("ahk_id " hwnd)
+ if title = ""
+ continue
- if WinActive(winTitle) {
- global HarpoonLastWindowIndex := Mod((HarpoonLastWindowIndex + 1), windows.Length)
- } else {
- global HarpoonLastWindowIndex := 0
+ titles.Push(title)
+ text .= title
+ text .= "`n"
}
-
- WinActivate windows[HarpoonLastWindowIndex + 1]
+ ToolTip text, 0, 0
+ SetTimer ToolTip, -1000
}
-HarpoonRunAndClick(winTitle) {
- HarpoonRun(winTitle)
- CoordMode "Mouse"
- ; don't judge me for that, visual studio tweaks out a lot when interacting with ahk
- MouseGetPos(&xpos, &ypos)
- MouseClick("left", A_ScreenWidth - 300, 10)
- MouseMove(xpos, ypos)
+SwitchDesktop(num) {
+ global CurrentDesktop
+ While CurrentDesktop > num {
+ SendEvent "{Ctrl down}{LWin down}{Left}{LWin up}{Ctrl up}"
+ CurrentDesktop--
+ }
+ While CurrentDesktop < num {
+ SendEvent "{Ctrl down}{LWin down}{Right}{LWin up}{Ctrl up}"
+ CurrentDesktop++
+ }
+ ShowCurrentWindows()
}
-CapsLock::LCtrl
-<^[::Esc
-
-RAlt & `::HarpoonRun("ahk_exe WindowsTerminal.exe")
-RAlt & 1::HarpoonRun("ahk_exe Discord.exe")
-RAlt & 2::HarpoonRunAndClick("ahk_group IDE")
-RAlt & 3::HarpoonRun("ahk_group Browser")
-RAlt & 4::HarpoonRun("ahk_exe Element.exe")
-RAlt & 5::HarpoonRun("ahk_exe code.exe")
-RAlt & 0::HarpoonRun("ahk_exe WINWORD.EXE")
-RAlt & 9::HarpoonRun("ahk_class CabinetWClass")
+!1::SwitchDesktop(1)
+!2::SwitchDesktop(2)
+!3::SwitchDesktop(3)
+!4::SwitchDesktop(4)
+!5::SwitchDesktop(5)
+!6::SwitchDesktop(6)
+!7::SwitchDesktop(7)
+!8::SwitchDesktop(8)
+!9::SwitchDesktop(9)
+!0::SwitchDesktop(10)
-RAlt & k::Send "#{Up}"
-RAlt & j::Send "#{Down}"
-RAlt & \::{
- global CapsLockState := not CapsLockState
- SetCapsLockState CapsLockState
+~^#Left::{
+ global CurrentDesktop
+ if (CurrentDesktop > 1)
+ CurrentDesktop--
}
-Tab & h::Left
-Tab & j::Down
-Tab & k::Up
-Tab & l::Right
-Tab::Tab
+~^#Right::{
+ global CurrentDesktop
+ if (CurrentDesktop < 10)
+ CurrentDesktop++
+}
RCtrl & Backspace::Reload
diff --git a/_windows/ahk/discord.ahk b/_windows/ahk/discord.ahk
deleted file mode 100644
index 4375ce0..0000000
--- a/_windows/ahk/discord.ahk
+++ /dev/null
@@ -1,11 +0,0 @@
-#Requires AutoHotkey v2
-#SingleInstance Force
-
-#HotIf WinActive("ahk_exe Discord.exe")
-!k::!Up
-!j::!Down
-^!k::^!Up
-^!j::^!Down
-+!k::+!Up
-+!j::+!Down
-#HotIf
diff --git a/_windows/ahk/element.ahk b/_windows/ahk/element.ahk
deleted file mode 100644
index 8e5c1a7..0000000
--- a/_windows/ahk/element.ahk
+++ /dev/null
@@ -1,11 +0,0 @@
-#Requires AutoHotkey v2
-#SingleInstance Force
-
-#HotIf WinActive("ahk_exe Element.exe")
-!k::!Up
-!j::!Down
-^!k::^!Up
-^!j::^!Down
-+!k::+!Up
-+!j::+!Down
-#HotIf
diff --git a/_windows/ahk/firefox.ahk b/_windows/ahk/firefox.ahk
deleted file mode 100644
index 2a32317..0000000
--- a/_windows/ahk/firefox.ahk
+++ /dev/null
@@ -1,6 +0,0 @@
-#Requires AutoHotkey v2
-#SingleInstance Force
-
-#HotIf WinActive("ahk_exe firefox.exe")
-^+l::F6
-#HotIf
diff --git a/_windows/ahk/media.ahk b/_windows/ahk/media.ahk
index 6e4495d..155088b 100644
--- a/_windows/ahk/media.ahk
+++ b/_windows/ahk/media.ahk
@@ -2,7 +2,5 @@
#SingleInstance Force
^#Space::Send "{Media_Play_Pause}"
-^#x::Send "{Media_Next}"
-^#z::Send "{Media_Prev}"
^#Up::Send "{Volume_Up}"
^#Down::Send "{Volume_Down}"
diff --git a/_windows/ahk/run.ps1 b/_windows/ahk/run.ps1
index 6570e95..c802d23 100644
--- a/_windows/ahk/run.ps1
+++ b/_windows/ahk/run.ps1
@@ -1,8 +1,4 @@
Push-Location $PSScriptRoot
.\capslock.ahk
.\media.ahk
-.\discord.ahk
-.\element.ahk
-.\c-w.ahk
-.\firefox.ahk
Pop-Location
diff --git a/_windows/ahk/super.ahk b/_windows/ahk/super.ahk
deleted file mode 100644
index ac2d015..0000000
--- a/_windows/ahk/super.ahk
+++ /dev/null
@@ -1,121 +0,0 @@
-#Requires AutoHotkey v2
-#SingleInstance Force
-
-; https://stackoverflow.com/a/68547452
-GetWindowMonitorIndex(hwnd) {
- ;Get number of monitor
- monCount := MonitorGetCount()
-
- windowX := 0
- windowY := 0
- windowWidth := 0
- windowHeight := 0
-
- ;Get the position of the focus window
- WinGetPos(&windowX, &windowY, &windowWidth, &windowHeight, hwnd)
-
- ;Make an array to hold the sub-areas of the window contained within each monitor
- monitorSubAreas := []
-
- ;Iterate through each monitor
- Loop monCount {
- ;Get Monitor working area
-
- monitorLeft := 0
- monitorTop := 0
- monitorRight := 0
- monitorBottom := 0
-
- MonitorGet(A_Index, &monitorLeft, &monitorTop, &monitorRight, &monitorBottom)
-
- ;Calculate sub-area of the window contained within each monitor
- xStart := max(windowX, monitorLeft)
- xEnd := min(windowX + windowWidth, monitorRight)
- yStart := max(windowY, monitorTop)
- yEnd := min(windowY + windowHeight, monitorBottom)
- area := (xEnd - xStart) * (yEnd - yStart)
-
- ;Remember these areas, and which monitor they were associated with
- monitorSubAreas.push({area: area, index: A_Index})
- }
-
- ;Loop to figure out which monitor's recorded sub-area was largest
- winningMonitor := 0
- winningArea := 0
- for index, monitor in monitorSubAreas {
- winningMonitor := monitor.area > winningArea ? monitor.index : winningMonitor
- winningArea := monitor.area > winningArea ? monitor.area : winningArea
- }
- return winningMonitor
-}
-
-monitorCount := MonitorGetCount()
-
-;; contains hwnds of all windows in the workspace
-workspaces
-workspaces := [
- [], ; 1
- [], ; 2
- [], ; 3
- [], ; 4
- [], ; 5
- [], ; 6
- [], ; 7
- [], ; 8
- [], ; 9
- [], ; 10 (0)
-]
-
-monitorWorkspaces := []
-
-if (monitorCount == 2) {
- monitorWorkspaces := [
- [1, 2, 3, 4, 5, 6], ; 1
- [7, 8, 9, 10] ; 2
- ]
-} else {
- for i in range(1, monitorCount) {
- monitorWorkspaces.push([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
- }
-}
-
-UpdateWorkspaceIds(workspace_id) {
- global workspaces
- global monitorWorkspaces
- global monitorCount
-
- ; get all windows
- ids := WinGetList(,, "Program Manager") ; tbh idk why program manager
-
- ; loop through all windows
- for windowId in windowList {
-
- ; get window's monitor
- windowMonitor := GetWindowMonitor(windowId)
-
- ; if window is on the workspace we're updating
- if (windowMonitor == workspace_id) {
- ; add it to the workspace
- workspaces[workspace_id].push(windowId)
- }
- }
-}
-
-ids := WinGetList(,, "Program Manager")
-for this_id in ids {
- this_class := WinGetClass(this_id)
- this_title := WinGetTitle(this_id)
- result := MsgBox(
- (
- "Visiting All Windows
- " A_Index " of " ids.Length "
- ahk_id " this_id "
- ahk_class " this_class "
- " this_title "
- monitor " GetWindowMonitorIndex(this_id) "
-
- Continue?"
- ),, 4)
- if (result = "No")
- break
-}