Install AutoHotkey2 using wine on Linux.

Python3 Code is the following that then runs an AutoHotkey2 program:

#!/usr/bin/python3

import os

ahk_location = '/home/pc/.wine/drive_c/Program Files/AutoHotkey2/AutoHotkey64.exe'

ahk_center_script = '/home/pc/Desktop/Business_Automation/AutoHotKey2/center.ahk
os.system(f'wine "{ahk_location}" "{ahk_center_script}" ')

AutoHotkey2 code:


SetTitleMatchMode "Fast"
SetTitleMatchMode 2
SetWinDelay 0
DetectHiddenWindows 1



	a:= 1

	Loop
	{
		if a == '1'
		{

			try 
			{
				if WinActive("A")
				{
					WinGetPos ,, &Width, &Height, WinExist("A")
					WinMove (A_ScreenWidth/2)-(Width/2), (A_ScreenHeight/2)-(Height/2),,, WinActive("A")
					Sleep 1000
				}
			}
			catch as e 
			{

			}

		}
		
	Sleep 1000
	}



	+p::
	{

		if a = '1'
		{
			global a:= '0'
			MsgBox "off"
		}
		else if a = '0'
		{
			global a:= '1'
			MsgBox "on"
		}

	}

Therefore, shift and the p key will toggle the center effect on any windows of a program that is running wine within the Linux Operating System.

If you like this post of value, send a comment. Thank you.

By admin

Leave a Reply

Your email address will not be published. Required fields are marked *