Comments (4)
it must be possible to trigger the ChangeIcon function with every desktop change without the necessity for adding the code to each of the keyboard shortcut.
You don't need the ChangeIcon function, if you add
++++++++++++++++++++
Menu,TRAY, Icon, Path of the IconFile%desktopNum%.ico
++++++++++++++++++++
at the end of the function goToDesktopNum(desktopNum)
and your icon files are numbered.
from vd.ahk.
You don't need the ChangeIcon function, if you add ++++++++++++++++++++ Menu,TRAY, Icon, Path of the IconFile%desktopNum%.ico ++++++++++++++++++++ at the end of the function goToDesktopNum(desktopNum) and your icon files are numbered.
Thanks vlachig
That sounds good but I can't get it to work. Could you possibly give me the exact line of code?
I had already tried
++++++++++++++++++++++
^#numpad1::VD.goToDesktopNum(1), TraySetIcon("D:\Data\AutoHotkey2\icons\1.ico")
++++++++++++++++++++++
which worked fine for VD.goToDesktopNum(1) etc.
but didn't work for moving to a relative desktop with the right and left arrow keys e.g.
#!left::VD.goToDesktopNum(VD.MoveWindowToRelativeDesktopNum("A", -1))
I am also not not sure that your suggestion would work for that either as as the desktop number is not specifically specified .
Thanks again
from vd.ahk.
In the file _VD.ahk search for the function goToDesktopNum(desktopNum) and replace it by this one:
goToDesktopNum(desktopNum) { ; Lej77 https://github.com/Grabacr07/VirtualDesktop/pull/23#issuecomment-334918711
firstWindowId:=this._getFirstWindowInVD(desktopNum)
Gui VD_animation_gui:New, % "-Border -SysMenu +Owner -Caption +HwndVD_animation_gui_hwnd_tmp"
VD_animation_gui_hwnd:=VD_animation_gui_hwnd_tmp+0
IVirtualDesktop := this._GetDesktops_Obj().GetAt(desktopNum)
GetId:=this._vtable(IVirtualDesktop, 4)
VarSetCapacity(GUID_Desktop, 16)
DllCall(GetId, "Ptr", IVirtualDesktop, "Ptr", &GUID_Desktop)
DllCall(this.MoveWindowToDesktop, "Ptr", this.IVirtualDesktopManager, "Ptr", VD_animation_gui_hwnd, "Ptr", &GUID_Desktop)
DllCall("ShowWindow","Ptr",VD_animation_gui_hwnd,"Int",4) ;after gui on current desktop owned by current process became active window, Show gui on different desktop owned by current process
this._WinActivate_NewProcess(VD_animation_gui_hwnd)
loop 20 {
if (this.getCurrentDesktopNum()==desktopNum) { ; wildest hack ever..
if (firstWindowId) {
DllCall("SetForegroundWindow","Ptr",firstWindowId)
} else {
this._activateDesktopBackground()
}
break
}
Sleep 25
}
Gui VD_animation_gui:Destroy
Menu,TRAY, Icon, D:\Data\AutoHotkey2\icons\%desktopNum%.ico
}
from vd.ahk.
Another solution:
; === auto-execute section === (top of the script)
; ...
SetTimer Change_TRAY_Icon, 500
; ...
RETURN ; === end of auto-execute section ===
; ...
Change_TRAY_Icon:
Nr := VD.getCurrentDesktopNum()
If (CurrentDesktopNr != Nr)
{
Menu,TRAY, Icon, D:\Data\AutoHotkey2\icons\%Nr%.ico
CurrentDesktopNr := Nr
}
return
from vd.ahk.
Related Issues (20)
- After pinning with AH2 version, I get an error when switching desktops by number.
- Script sending "Q" to discord | Desktop switch failure. HOT 2
- getDesktopNumOfWindow sometimes returns -1 rather than the correct num HOT 4
- Error HOT 10
- open Application directly on one virtual desktop in background HOT 2
- "Error: (0x80004002) No such interface supported" after updating Windows 11 (Beta insider channel) HOT 13
- sending keypress to specified virtual desktop only.
- Ah2: Desktop Looping & Switching + Other Feature Regression from Commit ee2f54f626914273f00853306c1daaf803f756cb HOT 2
- It doesn't work on Windows 11 Build 22621.2215 (22H2) HOT 2
- A problem with the new Windows update 11 HOT 18
- renaming desktops HOT 1
- Switching to Relative Desktop fails initially HOT 2
- Current desktop count is always zero
- New Windows Build 23606: VD.getCurrentDesktopNum() always returns 0 HOT 4
- Windows Server 2022 version HOT 3
- It doesn't work on Windows 11 Build 22631.3085 (23H2) HOT 13
- v2_port分支没有 TogglePinApp,PinApp,UnPinApp HOT 2
- WinExist in another virtual desktop HOT 7
- Previous Desktop HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vd.ahk.