Forcing firefox to remember windows deskbar positions

For some reasons, maybe an issue related to memory or crashes,
my firefox windows position on the windows deskbar changes,
unpurposely. I actually need a way either through greasemonkey, stylish
or an addon to make firefox detect where i put my windows
on the taskbar manually.

Otherwise, what happens is that the session firefox or sessionstore keeps,
will keep the position of windows after the incident happened &
a window moved to another place … . so even if i move that window
to the previous place & restart firefox, that window will reappear
where it was right after the incident & not when i moved it
back to its place … .

my actual stupid workaround:

restoring windows one by one using sessionstore…

because neither sessionstore or firefox session file detects where i reposition windows on the deskbar … .

You’ll have to use js-ctypes with an algo like this:

var preferredPosition = Services.prefs.getIntPref('extensions.myExt@jetpack.preferredPosition');

if (winTaskbar.items.length < preferredPosition) {
    // put icon at last position
} else {
   // put icon at preferredPosition
}

// set up some kind of listener, that listens to when items in taskbar are add/removed, and run this code

Now to get the number of items in taskbar its easy on WinXp and XP+.

However moving items around is hard on XP. As an API for doesn’t exist.

If you want to support XP we can do it, Ive been meaning to get around to it but never did yet.

The APIs you use on XP+ should exist out there as an API in winapi, I havent looked, but this is where to start: http://stackoverflow.com/search?q=[winapi]+taskbar


I may not have totally understood your question, can you explain with screenshots.

Oh it seems that taskbar gets an icon if the Window is not owned and has style of WS_EX_APPWINDOW

Docs: https://msdn.microsoft.com/en-us/library/windows/desktop/cc144179(v=vs.85).aspx#Managing_Taskbar_But

So what you’ll want to do is iterate through all windows, and find the ones with style WS_EX_APPWINDOW you can do that like I did here: https://github.com/Noitidart/NativeShot/blob/master/modules/workers/MainWorker.js#L162-L226

What I did there was use EnumWindows with a delegate, and in the delegate I get the classes on the window with GetWindowLongPtr and there you will test for WS_EX_APPWINDOW. If it has that, the next issue is moving it around in the taskbar. That I don’t know how to do yet.


edit:
Heres how to move stuff around in the taskbar: https://msdn.microsoft.com/en-us/library/windows/desktop/dd391692(v=vs.85).aspx

ITaskbarList3 so you need to use COM. This is how to use COM from js-ctypes: https://developer.mozilla.org/en-US/docs/Mozilla/js-ctypes/Examples/Using_COM_from_js-ctypes

Nothing you’ve told me is helpfull Noitidart, thanks for your hard investigation but:

  1. I’m not a coder, so i don’t understand a single term of everything you shared
    in your long provided online infos

  2. I don’t even know where to put the code you gave me in your first response

  3. you discuss about icons apparently, i never did…

what haven’t you understood in my initial explanation ?

Ps: i’m on win8, not xp.

if i avoid the whole explanation… to resume it in a sentence…

my aim is to make sure when i move windows on the deskbar, firefox intercepts the position on the deskbar
with either a script, userstyle or addon, so if i restart the session, my manual reposition is remembered…

What’s a deskbar? Is that taskbar? Can you take screenshots and share?

If you right click on the icon in the taskbar for Firefox, and click on “Pin” it will stay in that position as long as all the items before it are always pinned. If they are not, then it will move to the spot after last pin, after you close out all your non-pinned programs.

“If you right click on the icon in the taskbar for Firefox, and click on
"Pin” it will stay in that position as long as all the items before it
are always pinned"

so true, but i don’t think anybody mentioned the desire to pin anything in the topic…
you seem to like to provide me all sorts of informations but always indirect replies
to the main topic i’ve explained twice.

and a deskbar is the right term that describes the windows main bottom bar
& that people started to call “taskbar” by mistake & everybody followed
believing a deskbar is a taskbar … .

the taskbar is the right section of a deskbar where you can’t move app’s icons
& where some apps put their icons with submenus to prevent populating the middle of the bar.

the deskbar is not the taskbar, & when ppl use the term deskbar, it’s to describe the middle section
of that bar in general, where firefox windows & other apps put icons, once the app is opened…

If I understood correctly, you’d like the position of individual Firefox windows (i.e. ungrouped taskbar items) to be remembered. As in, open a new firefox window, place it differently from the first window, remember both positions on restart. I do believe noitidart also misunderstood you on that point, but there’s no need to get defensive. :slight_smile:

I’m also sure this is not possible via either a userscript or userstyle. An add-on is your only choice, and it can become a fairly complex add-on at that, as evidenced by noitidart’s research so far (from what I’m seeing, he’s also the best person at the moment to know if this is possible or not).

The code noitidart posted earlier was just a sample code of how it could be done; you’re not meant to actually use it anywhere, as that code does nothing by itself. Remember that you’re looking for an add-on that doesn’t exist (I think?), so the best way to start work on one, by yourself or someone else, is to figure out if/how it would work first.

By the way, it is called taskbar, it is not called that by mistake. Even if the terminology was different in the past (I don’t remember), right now that’s its name; the icons on the right are in the Notification area that is shown at the right edge of the taskbar: http://windows.microsoft.com/en-us/windows-8/use-the-taskbar

1 Like