Skip to content

Commit

Permalink
open in mpv
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBestPessimist committed Dec 21, 2022
1 parent 8ca3417 commit 4c38f33
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 105 deletions.
23 changes: 23 additions & 0 deletions AutoHotkey_2.0.0/WinTitles.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
; WinTitle reference: https://autohotkey.com/docs/misc/WinTitle.htm#multi
class WinTitles
{
static ModernApp := "ahk_class ApplicationFrameWindow ahk_exe ApplicationFrameHost.exe"

static ModernSkype := [WinTitles.ModernApp, "Skype"]
static ModernPhotos := [WinTitles.ModernApp, "Photos"]
static Vlc := "ahk_exe vlc.exe"
static IntellijIdea := "ahk_exe idea64.exe"
static CorsairCUE := "ahk_class CUEBorderlessWindow ahk_exe iCUE.exe"
static BattleNet := "ahk_exe Battle.net.exe"
static Firefox := "ahk_class MozillaWindowClass"
static Chrome := "ahk_class Chrome_WidgetWin_1"
static Skype := "ahk_exe Skype.exe"
static TeamViewerSponsoredSession := "Sponsored session ahk_exe TeamViewer.exe"
static TeamViewer := "TeamViewer ahk_exe TeamViewer.exe"
static ACDSee := "ahk_exe ACDSeeProfessional2018.exe"
static Feces := "ahk_exe Teams.exe"
static Telegram := "ahk_exe telegram.exe ahk_class Qt5154QWindowIcon"
static SublimeText := "ahk_exe sublime_text.exe"
static tf2 := "ahk_exe hl2.exe"
static windowsCredentials := "Windows Security"
}
41 changes: 21 additions & 20 deletions AutoHotkey_2.0.0/app_handling.ahk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Include WinTitles.ahk
;#include lib/clipboard.ahk
#include lib/clipboard.ahk


;; There is no need for a standard ahk auto-execute area anymore because of this method.
Expand Down Expand Up @@ -236,25 +236,26 @@ Ctrl & Home::Home
Ctrl & End::End
#HotIf

;CapsLock & v::
; openInMpv() {
; saveClipboard()
;
; Send {Blind}^l
; Sleep 100
; Send {Blind}^a
; Sleep 100
; Send {Blind}^c
; ClipWait 1
;
; Tippy("Opening mpv with: " Clipboard)
; Run % "D:\all\all\mpv.net\mpvnet.exe " Clipboard
;
; restoreClipboard()
; }
;
;
;
;-----------------------
; Open an url in MPV
CapsLock & v:: {
saveClipboard()

Send "{Blind}^l"
Sleep 100
Send "{Blind}^a"
Sleep 100
Send "{Blind}^c"
ClipWait 1

; Tippy("Opening mpv with: " A_Clipboard)
Run("D:\all\all\mpv.net\mpvnet.exe " A_Clipboard)

restoreClipboard()
}



;-----------------------
; Microshitsoft Teams is fucking retarded
;
Expand Down
16 changes: 16 additions & 0 deletions AutoHotkey_2.0.0/lib/clipboard.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
saveClipboard() {
; Try is needed because I get an error "can't open clipboard for reading" while lock screen is on
Try {
global __ClipboardSaved := ClipboardAll()
A_Clipboard := ""
}
}

restoreClipboard()
{
Try {
global __ClipboardSaved
A_Clipboard := __ClipboardSaved ; Restore Clipboard
__ClipboardSaved := ""
}
}
85 changes: 0 additions & 85 deletions app_handling.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -41,62 +41,6 @@ startAndResizeTelegram()
x := A_ScreenWidth - w
y := 0
WinMove, % WinTitles.Telegram, , x, y, w, h



; another method of moving telegram to its desired position.
; this also bugges sometimes
; save initial mouse pos
; CoordMode Mouse, Screen
; MouseGetPos, initial_x, initial_y

; SetDefaultMouseSpeed 40
; CoordMode Mouse, Window

; ; move mouse to starting position of resize process
; MouseMove, 100, 16

; SendInput {LButton}
; SendInput {LButton}
; Sleep 90

; MouseMove, 100, 16


; ; do a windows right-snap (resize window to half the screen, right side)
; SendInput {LButton down}
; CoordMode Mouse, Screen ;; this coordMode trickery has to be done for each movement.
; MouseMove, A_ScreenWidth, A_ScreenHeight/2
; CoordMode Mouse, Window
; SendInput {LButton up}


; Sleep 90

; ; set the desired window size
; MouseMove, -1, 200
; SendInput {LButton down}
; CoordMode Mouse, Screen
; MouseMove, A_ScreenWidth - A_ScreenWidth/3, 200
; CoordMode Mouse, Window
; SendInput {LButton up}

; ; ; de-snap the window, so that the size is remembered.
; ; ; windows is retarded and does not remember the size/position for snapped windows.
; ; MouseMove, 200, 16
; ; SendInput {LButton down}
; ; MouseMove, -10, 0,,R
; ; SendInput {LButton up}
; ; Sleep 90
; ; SendInput {LButton down}
; ; MouseMove, 10, 0,,R
; ; SendInput {LButton up}
; ; Sleep 90


; ; move the mouse back to the original position
; CoordMode Mouse, Screen
; MouseMove, initial_x, initial_y
}
else {
WinActivate % WinTitles.Telegram
Expand All @@ -112,32 +56,3 @@ startAndResizeTelegram()
getTaskbarDimensions(ByRef tw, ByRef th) {
WinGetPos, x, y, tw, th, ahk_class Shell_TrayWnd
}













CapsLock & v::
openInMpv() {
saveClipboard()

Send {Blind}^l
Sleep 100
Send {Blind}^a
Sleep 100
Send {Blind}^c
ClipWait 1

Tippy("Opening mpv with: " Clipboard)
Run % "D:\all\all\mpv.net\mpvnet.exe " Clipboard

restoreClipboard()
}

0 comments on commit 4c38f33

Please sign in to comment.