dparker2 / disperse Goto Github PK
View Code? Open in Web Editor NEWLightweight window mover and resizer for Windows via keyboard shortcuts (inspired by Spectacle)
Lightweight window mover and resizer for Windows via keyboard shortcuts (inspired by Spectacle)
With the settings file, there should be a section to specify specific hotkeys for specific actions, overriding the typical formula (activation+modifiers+action)
Disperse should swallow input that it recognizes as a hotkey for itself.
This is not possible with the raw input api, which disperse uses. However it is possible with a keyboard hook, except that keyboard hooks will get dropped by the OS if they take too long (even a couple ms), so recognizing and swallowing the inputs should be all it does.
Keyboard hooks also cannot run in the same process as raw input capture... so a complete solution would be two separate processes: one for the raw input and resizing, and one for the keyboard hook to swallow input โ assuming the hook would never get dropped by the OS.
Upon clicking the icon in the tray, a window should open with the state of the settings file with descriptions and a way to change the hotkeys
No idea why this isn't working currently
First step towards customization is moving the hotkeys to a settings file
Hi, ParkerD559
I have compiled your code and run the program. Everything works well until I tried "Quit" in the tray menu. Then the program prints "terminate called without an active exceptionโ and crashed.
This is because the main thread terminated while the worker thread is still running. Then the thread destructor will be called. However, the thread is still joinable(), and terminate() will be called, which leads to this issue.
The join() method should be called before the worker thread is destructed.
Reference: https://stackoverflow.com/questions/7381757/c-terminate-called-without-an-active-exception
Here is my fix:
std::atomic<bool> quit(false);
void workerMain() {
while (true) {
mutex.lock();
if (!queue.empty()) {
Tailor::command command = queue.front();
queue.pop();
Tailor::alter(command);
}
mutex.unlock();
API::sleep(50);
if(quit) {
break;
}
}
}
Worker::~Worker() {
quit = true;
this->thread_obj.join();
}
I use a atomic bool to escape the loop, and call join() in Worker::~Worker()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.