Creating a floating menu that pops like normal menu but appears at mouse position - linux

Some context
I've recently switched to ubuntu budgie (from unity), and I am really tired of the Plank/panel menu combo. I cannot find a setting that suits me, because depending on my screen setup, there's always something in the wrong place.
I am literally unable to show the menu on certain edges if I activate auto-hide, and if I don't activate it, it's not nice at all, to the point that I have removed the plank thing altogether. (Am I having strange bugs on this OS, or is it really messy?)
My idea
With great frustrations come new ideas. I thought again about one I had in the past. I would like to have a circle menu that pops around my mouse cursor when I press a given key combination (very much the kind of thing you would find in some games).
The main use case is to get "pined" application shortcuts easily when I need them, but perhaps other things would fit well with them (commands ...).
Questions
So my questions are:
Does such a thing already exist?
If it doesn't, is it difficult to realize? (How much time, complexity, ...)
What tools/libraries are needed for such a project? I know I'll find plenty of explanations on the gnome developer website but I could really use some more help.

Since you mention a buggy behaviour on Plank, depending on the screen configuration, I suspect you are suffering from this bug. In short: Plank's returned values for the space it needs are not always correct in multi monitor setup.
A neat option to replace at least part of the functionality is Ulauncher, by default called from a shortcut, but you could trigger it from anything that is capable of running its command.
Since Ulauncher's window simply identifies in the window list, you can easily write a script to move it to the current mouse position.
In case you'd need any help in that, just leave a comment.
Not sure if you are also referring to quick access of the window list, but for that you could use the Window Previews applet, or even the Workspace Overview applet, so life without Plank is possible.

Related

unwanted: APL keyboard overlay enabled?

I've been trying out APL. I'm running Windows 10 and I've installed Dyalog 18.0, and the APL Language and APL Backtick Symbols extentions for VS Code.
But even though I'm not running any of these programs, sometimes suddenly my keyboard is hyjacked! All my ctrl commands are replaced by APL symbols.
E.g. ctrl-Z (undo) becomes ⊂ and ctrl-A (select all) becomes ⍺. I have no idea why and how to disable this again. This makes it very hard to do my work!!!
I've been googling for this, but haven't found an answer so far. I've looked at the Windows keyboard settings, but it looks normal. The locale settings are also correct.
I'm now just de-installing everything, but that way I need to reinstall every time I want to try out APL.
Can somebody tell me what is happening and how to fix it? (And tell me who to complain to that this is a very hostile feature)
I am sorry that our Unicode IME is causing you confusion.
I do like using it, but there are some Windows settings which I set to make things easier.
Start button->Settings
In the "Find a setting" edit field, type Advanced keyboard settings
Click on the icon with that text on it
Under Switching input methods:
Tick the “Let me set a different input method for each app window”
Tick the "Use the desktop language bar when it's available". This option will show the orange D icon when our Dyalog Unicode IME is active.
On this same dialog, there is a Input language hot keys.
I find it convenient to select a hot key combination to activate our Unicode IME, and another one to go back to the default Windows keyboard layout.
Close this dialog with the X button in the top right.
If you have further problems or questions, you can always ask us at support#dyalog.com
By the way, we put links to advice pages about keyboards on our website under Resources->Fonts and Keyboards.
Regards,
Vince
When installing the standard Dyalog IME, there is a new keyboard input method on Windows. Have you checked WinKey+Space? This should cycle through available keyboard layouts and you should find your previous/default layout available there.
I personally agree that this is not a good way to handle keyboarding and causes many issues for newcomers to APL. Dyalog is aware and are looking into alternatives that can be comfortable for both new and existing users.
You can uninstall the standard IME without uninstalling the entire interpreter by running the Dyalog uninstaller (search "uninstall Dyalog" in your start menu) and selecting just the IME.
For now, I recommend the APL Wiki article on Typing Glyphs for some ideas for alternatives to the standard IME: https://aplwiki.com/wiki/Typing_glyphs#Windows
I personally use the abrudz keyboard with Alt Gr as the switching key.
I just wanted to add that your complaint has reached the people who need to be complained to. This is a difficult problem space, between changing technologies, multiple platforms, new or casual users of APL and the folks who use APL all the time and want to type APL symbols into e-mail messages, etc. It is most definitely time for an overhaul of the keyboard technologies that we use and this will be on the to do list for the next development cycle. Until then, I hope you manage to get by with the advice that has been offered so far!
Thanks for the shout,
Morten Kromberg, CTO, Dyalog

MFC CListCtrl does not appear after minimise-restore

Let me say at outset that I'm using old technology by today's standards! This happens in MFC on Visual Studio 2005 and running under WinXP. (If it 'aint broke.... ;-) )
I have a dialog based app which has a CTabCtrl with two tabs. Each contains a CListCtrl. These work perfectly under normal circumstances. They populate correctly and show and hide as they should. When I first open the application the display selection is correct. If I then minimize the dialog and restore, the CList Ctrl does not show, the tab is blank. It is the only control which has this problem. Another CListCtrl outside of the CTabCtrl does show up correctly. If I then swap tabs and back again, the other tab shows up then the first appears as normal.
This does not happen if I access any other part of the dialog before minimising, it is only when minimising is the absolute first action I take. It also happens with the CListCtrl I have in the other tab if I set this tab to be selected on startup in OnInitDialog where I set up the CTabCtrl.
I have actually solved the effect of this problem by adding into my OnSysCommand(...) the following:
if ((nID & 0xFFF0) == SC_RESTORE)
{
m_ctrlReadList.Invalidate();
}
but it bugs me that I'm adding code to solve a problem which only happens in such odd circumstances. I can't help thinking that there is something I have missed in the setup which is leading to this behaviour. Can anyone offer any explanation as to what is causing it in the first place?
My explanation is based on the facts of what I have found but this has been a learning experience for me so apologies if I get some of it a little confused, I'm still letting it settle in my mind.
Along with this problem I found another which turned out to be relevant. From the nature of the program I'm writing, my CListCtrls needed fixed width headers. Now that turned out to be another thing I couldn't set up! I just needed to prevent the user from grabbing and resizing the header's dividers or double clicking them to autosize, and of course there is functionality in the CListCtrl based on its child CHeaderCtrl to set this up isn't there? Well apparently not. LVS_EX_HEADERDRAGDROP for example isn't the way.
So I explored trying to capture messages which would allow me to myself, and what do you know, I couldn't! I could trap a few but not the ones I needed. I was looking for HDN_BEGINTRACK and HDN_DIVIDERDBLCLICK. (We won't go into the fact that you HAVE TO deal with both A and W versions of those separately!) The CHeaderCtrl is a child of the CListCtrl but it sends its messages back to the CDialog as the CListCtrl's parent. I tried there using both my list's and 0 as ID which headers apparently use. Many of them just plain didn't appear there at all.
So I created my own CListCtrl class inheriting from CListCtrl, overrode OnNotify and they turned up there. I simply prevented CListCtrl::On Notify from being called for those messages and it worked, no resize functionality at all.
I also played with the Z-order too which could have been relevant. I didn't explain earlier but this and another list are on two tabs, exactly aligned over each other. Selecting the tabs HIDEs and SHOWs each of the lists in turn. The other list had no display problems even when I changed the default display in OnInitDialog to show it at start up.
It was under the problematic one. So changing the Z-order in OnInitDialog where I set them up - did nothing! And to rub it in that second list was also unresizeable by default just as I wanted and I couldn't find out why. Their Properties listed exactly the same and there was nowhere in the code where any different aspect was set manually for either, they were effectively theoretically identical, but practically not so. So frustrating!!!
And the upshot of it is that now that the header resize issue is solved my display problem has vanished too! It looks to me and to a few others out there too who report similar symptoms as myself as though the CListCtrl is another one of the slightly flaky ones and needs a little massaging to get the best out of it.
I hope that makes sense to those of you out there who know this control well. I was surprised how simple the solution was, but it also surprised me that the diagnostic process was so difficult. It may of course come down to the ageing system I work within. Nowadays I do this only for fun and the expense of updating VS from 2005 for occasional use is not a high priority. I am sure that some of the symptoms will not show under other build and run environments but it may be worth having the issue and my solution on record somewhere for Google to find for others.

Linux - Any way to configure or create a script/program to make right click not select menu item?

The default behavior for right-clicking on most recent Linux distros is to select a menu item in a right-click menu upon releasing the right mouse button. While this saves some mouse presses, it is driving some of my Windows-trained (and rather vocal) coworkers completely bonkers, and a lot of searching has told me that there is no option to change this behavior in the distros they are using (mostly RHEL 6).
To make my work environment a little less volatile I would like to try to program a fix or patch for their systems to make right clicking work like they are used to (the menu does not even appear until the right mouse button is released), but I don't know what kinds of tutorials I should be looking for (shell scripts? C? etc.) in order to do this.
If I could be pointed in the right direction that would be lovely! (or if someone by chance already knows of a fix, that would work too, though a lot of Googling has told me that there does not appear to be one currently)
Follow the directions here:
https://unix.stackexchange.com/questions/20550/how-to-disable-the-forward-back-buttons-on-my-mouse
But instead of disabling the forward and back buttons, disable the right click mouse button. You can easily dump the resulting command into a shell script which calls xmodmap. Then you can make icons that disable and enable the right mouse button, for the times where they will need it.

What vimrc settings to speed up scrolling?

I use gvim pretty heavily at work, typically logged into a server farm. This works great while I'm directly on the corporate LAN, but when I VPN in from home and resume my sessions, gvim scrolls almost intolerably slow.
Every time I page up or down, the scrolling does a lot of unnecessary screen refreshes before it gets to the final spot.
I remember browsing other people's vimrc's and seeing a setting to help with this, but I don't remember what it is. I have ttyfast already set. Is there anything else?
I know this is mostly due to the VPN, but with a little tweaking, hopefully it can get better.
If you're not doing this already, you should at least be using CTRL+U and CTRL+D to scroll around, and I believe you can use the 'scroll' option to make CTRL+U and CTRL+D scroll a custom distance.
You might want to try the different tips given in :help slow-terminal.
For instance, the scrolljump setting can help reduce the number of screen refresh when scrolling. I have also found set nowrapto be useful, even on fast terminal when handling files with very long lines.
If possible, I would consider using console vim. Easier to pull over multiple hops.
Another non-vimrc technique to consider is Windows Control Panel:

Screen capture doesn't work on MFC application in Vista

We've got some in-house applications built in MFC, with OpenGL drawing routines. They all use the same code to draw on the screen and either print the screen or save it to a JPEG file. Everything's been working fine in Windows XP, and I need to find a way to make them work on Vista.
In three of our applications, everything works. In the remaining one, I can get the window border, title bar, menus, and task bar, but the interior never shows up. As I said, these applications use the exact same code to write to the screen and capture the window image, and the only difference I see that looks like it might be relevant is that the problem application uses the MFC multiple document interface, while the ones that work use the single document interface.
Either the answer isn't on the net, or I'm worse at Googling than I thought. I asked on the MSDN forums, and the only practical suggestion I got was to use GDI+ rather than GDI, and that did nothing different. I have tried different things with every part of the code that captures and prints or save, given a pointer to the window, so apparently it's a matter of the window itself. I haven't rebuilt the offending application using SDI yet, and I really don't have any other ideas.
Has anybody seen anything like this?
What I've got is four applications. They use a lot of common code, and share the actual .h and .cpp files, so I know the drawing and screen capture code is identical.
There is a WindowtoDIB() routine that takes a *pWnd, and a source rectangle and destination size. It looks like very slightly adapted Microsoft code, and I've found other functions in this file on the Microsoft website. Of my four applications, three handle this just fine, but one doesn't. The most obvious difference is that the problem one is MDI.
It looks to me like the *pWnd is the problem. I'm not a MFC guru by a long shot, and it seems to me that the problem may be that we've got one window setup in the SDIs, and more than one in the MDI. I may be passing the wrong *pWnd to the function.
In the meantime, it has started working properly on the 64-bit Vista test machine, although it still doesn't work on the 32-bit Vista machine. I have no idea why. I haven't changed anything since the last tests, and I didn't think anybody else had. (On the 32-bit version, the Print Screen key works as expected, but it does not save the screen as a JPEG.)
Your question title mentions screen capture but your actual question doesn't. Please elaborate more clearly. Is the problem that you can do screen capture of three of your applications, but not the fourth one? You can use different screen capture software that can capture OpenGL/DirectX windows. Those surfaces are handled directly by the Window Manager and won't show up with a simple 'PrtScn'.
Switching to GDI+ won't solve it, nor will switching to SDI.
If it's the content of the CView that you want, then yes, that should be right one. If it's the content of the whole screen (at least the content, without the toolbar(s) and status bar), then you should pass it the CMainFrame (that's the default name which may have been changed, the one that is derived from CMDIFrameWnd).
Can you post the code of WindowToDIB()? I've just tried it and It Works For Me (TM), but without OpenGL code in the view. Try passing the following windows to your WindowToDIB() function:
CMainFrame* mainfrm = static_cast<CMainFrame*>(::AfxGetMainWnd());
- mainfrm
- mainfrm->MDIGetActive()
- mainfrm->MDIGetActive()->GetActiveView()
and see what you get.
The contents of each window are directX surfaces and are only assembled by the window manager in the graphics card. You'd not be able to capture this unless you switch off the new interface (DWM) or code specifically for screen capture from the DWM.
Wikipedia has a good description of the Desktop Window Manager (DWM)
Sorry, I still don't understand. You're trying to get the Print Screen key to work on all four applications? Or you're trying to get the WindowtoDIB() function to work, which takes a 'screenshot' (from within your own application) of the application itself, so that it can be saved as an image file?
Also, what do you mean with 'he Print Screen key works as expected, but it does not save the screen as a JPEG.'? Print Screen only copies to the clipboard, what happens when you paste in Paint?
If your WindowtoDIB() function only 'captures' the window you pass to it, then yes, your MDI child windows are not going to show up.
We eventually solved this by creating a different OpenGL context, and drawing everything to that. We gave up on the screen capture.

Resources