I'm amazed they are both still functioning as well as they are.
Cheers
]]>An issue was brought up on github about snapwm crashing once the number of keyboard shortcuts reached a point.
That's been fixed.
Cheers
]]>The right click button on my laptop died and I couldn't find an existing solution for mapping a key to be the right click, so I wrote a little program and mapped it to keys in snapwm. Now Super+z is middle click and Super+x is right click.
/* Build with gcc button_click.c -o button_click -lX11
Usage : button_click 1 for left click
button_click 2 for middle click
button_click 3 for right click
*/
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
void button_click(int button) {
Display *display = XOpenDisplay(NULL);
if(display == NULL) {
puts("Display Fail");
exit(1);
}
XEvent event;
memset(&event, 0x00, sizeof(event));
event.type = ButtonPress;
event.xbutton.button = button;
event.xbutton.same_screen = True;
event.xbutton.subwindow = DefaultRootWindow (display);
while (event.xbutton.subwindow) {
event.xbutton.window = event.xbutton.subwindow;
XQueryPointer (display, event.xbutton.window,
&event.xbutton.root, &event.xbutton.subwindow,
&event.xbutton.x_root, &event.xbutton.y_root,
&event.xbutton.x, &event.xbutton.y,
&event.xbutton.state);
}
if(XSendEvent(display, PointerWindow, True, ButtonPressMask, &event) == 0)
puts("Button Click Fail");
//puts("Button Clicked");
XFlush(display);
event.type = ButtonRelease;
event.xbutton.state = 0x100;
if(XSendEvent(display, PointerWindow, True, ButtonReleaseMask, &event) == 0)
puts("Button Release Fail");
XFlush(display);
XCloseDisplay(display);
}
int main(int argc, char **argv) {
int button = 3;
if(argc < 2) {
puts("Value Needed : 1, 2 or 3");
exit(1);
} else button = atoi(argv[1]);
button = (button > 0) ? button : 3;
button = (button < 4) ? button : 3;
//printf("%d\n", button);
button_click(button);
exit(0);
}
Thought it might be handy for someone.
Cheers
]]>Fixed up the popped window still being visible after sending it to another desktop.
Cheers
]]>Cheers
]]>Fixed up the windows from the first desktop being shown when updating and tidied up some code.
Cheers
]]>Cheers
]]>Cheers
]]>Cheers
]]>import java.awt.*;
import java.awt.event.*;
public class win2 {
private Frame mainFrame;
private Label headerLabel;
private Label statusLabel;
private Panel controlPanel;
public win2(){
prepareGUI();
}
public static void main(String[] args){
win2 win2_1 = new win2();
win2_1.showEventDemo();
}
private void prepareGUI(){
mainFrame = new Frame("WOOT");
mainFrame.setSize(400,400);
mainFrame.setLayout(new GridLayout(3, 1));
mainFrame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent windowEvent){
System.exit(0);
}
});
headerLabel = new Label();
headerLabel.setAlignment(Label.CENTER);
statusLabel = new Label();
statusLabel.setAlignment(Label.CENTER);
statusLabel.setSize(350,100);
controlPanel = new Panel();
controlPanel.setLayout(new FlowLayout());
mainFrame.add(headerLabel);
mainFrame.add(controlPanel);
mainFrame.add(statusLabel);
mainFrame.setVisible(true);
}
private void showEventDemo(){
headerLabel.setText("Control in action: Button");
Button okButton = new Button("OK");
Button submitButton = new Button("Submit");
Button cancelButton = new Button("Cancel");
okButton.setActionCommand("OK");
submitButton.setActionCommand("Submit");
cancelButton.setActionCommand("Cancel");
okButton.addActionListener(new ButtonClickListener());
submitButton.addActionListener(new ButtonClickListener());
cancelButton.addActionListener(new ButtonClickListener());
controlPanel.add(okButton);
controlPanel.add(submitButton);
controlPanel.add(cancelButton);
mainFrame.setVisible(true);
}
private class ButtonClickListener implements ActionListener{
public void actionPerformed(ActionEvent e) {
String command = e.getActionCommand();
if( command.equals( "OK" )) {
statusLabel.setText("Ok Button clicked.");
}
else if( command.equals( "Submit" ) ) {
statusLabel.setText("Submit Button clicked.");
}
else {
statusLabel.setText("Cancel Button clicked.");
}
}
}
}
The extra window with java awt programs on start is an icon window. snapwm will ignore those now.
There is still a problem with gtk apps making an extra window on start. I'm using leafpad to check that.
I'm sure I'll have that sorted soon.
Cheers
]]>The window recovery thing sort of work. It throws a segfault if there are any "odd" windows (i.e. Java AWT applications), and seems to create some sort of dummy window for each. Closing some of the dummy window crashes SnapWM.
Moving the dummy windows to a unused workspace sort of solves the issue, and makes recovering from a crash possible.
There's are new options in rc.conf to set the minimum width and height for all windows in stacking mode
...
#MINW_W 30
#MINW_H 30
...
If it's not needed don't set it.
snapwm should now find any open windows when it starts too.
It took a bit of work to sort out what windows were ok to map so if there's any programs that used to work and now don't let me know...
Cheers
]]>I've been thinking for a little while now that I could make it easier to start applications from .xinitrc by having snapwm look for apps already running. That would help with your issue too.
I'd rather have it so the wm doesn't crash at all so if you get a batter idea of what causes it let me know.
Adding a minimum size for windows to open at shouldn't be too hard, testing it on my end will be an issue since I don't have a program that doesn't work properly in snapwm.... But I'll come up with something, give me a couple of days.
Cheers
]]>