Thursday, October 18, 2018
KCMOUSE - Minimal Window Manager for X11
I recently updated my minimal window manager for X11 that I made a couple years ago. I had stopped using it because for some reason the cpu usage was going to 100% occasionally when using one particular program. I decided to look at the code again and discovered the issue. It was because a window was not properly raised to the top of the stack after calling the XCirculateSubwindowsDown and XCirculateSubwindowsUp commands. It wasn't noticable during normal use, due to the XsetInputFocus command proving focus to the new window.
The fix was to query the mouse pointer after the window cycle to find the new focused window and add it to the focuswin variable. Then I added the XraiseWindow command to raise the newly focused window. Now all my programs are happy, and when they are happy I'm happy :} Here is a snipplet of the code I'm talking about:
XCirculateSubwindowsDown(display, root);
XQueryPointer(display, root, &unusedwin, &focuswin, &unusedint, &unusedint, &unusedint, &unusedint, &unusedint);
XSetInputFocus(display, focuswin, RevertToNone, CurrentTime);
XRaiseWindow(display, focuswin);
I've updated the source code on Github here: https://github.com/netfun81/kcmouse
You are welcome to it Microsoft :}
Friday, October 12, 2018
Free VPN's
One of the many anti-privacy things that have happened in recent years is that web browsers have moved beyond just detecting your IP location, which pinpoints your location to within your city, to now detecting geo location which is very accurate. They use wifi and other means to detect your actual location. You can find sites on the web that will show you what information websites have access to. Sites like https://ipleak.net/ will remind you of the amount of information that is collected by many websites.
In my pursuit of limiting the amount of personal information I share with the world, it was evident that along with a safe DNS I also need a way to hide my location. This led me to needing a vpn. I tried many free vpns and discovered there is a reason they are free. They typically leak your dns or sell to 3rd party companies to make money. It was interesting to find that the biggest supporter of freevpns was Google...they really want your data :) Luckily there are sites that check for dns leaks, for instance https://www.dnsleaktest.com/ It is easy to check how many leaks your vpn or dns is involved with.
After many hours of searching for a free vpn that isnt bandwidth or download GB restricted, and doesnt sell my data, I turned to browser plugins. There are several browser vpn plugins for firefox, however some want permission for viewing everything even clipboard data. I finally settled for a plugin called Hoxx vpn proxy https://addons.mozilla.org/en-US/firefox/addon/hoxx-vpn-proxy/?src=search It's a easy to use and safe vpn client that has only one drawback that I can find, it requires a confirmed email address. It does log files and it will ban you if you try to go to illegal sites. It's not for people that want to do illegal activity, like watching pirated movies, as it will ban or report you, but it is for those that want privacy and at least make it harder for governments and others to track each site you visit to obtain your political, spiritual, purchasing history, hobbies, etc, and to obtain a complete snapshot of your online life.
We may not be able to stop the anti-privacy train from moving quickly down the tracks, but we can try to at least drag our feet and maybe slow it down a bit :)
*UPDATE: I wanted to find a more open source solution for a vpn client. I finally found https://www.vpngate.net/en/. It is an open source vpn client that uses volunteer servers from around the world to connect with. The servers at the top of the list are usually faster or have more open connections. You will need to have openvpn installed https://openvpn.net/ and then just download the openvpn config file and add it to your network connection manager (in my case NetworkManager, which needs the plugin "networkmanager-openvpn" installed also). Since there are quite a few shady vpn operations out there, I think having an open source solution with many server options is the best way to protect yourself online. However, its still important to check out the servers you connect with using the tools I mentioned above.
In my pursuit of limiting the amount of personal information I share with the world, it was evident that along with a safe DNS I also need a way to hide my location. This led me to needing a vpn. I tried many free vpns and discovered there is a reason they are free. They typically leak your dns or sell to 3rd party companies to make money. It was interesting to find that the biggest supporter of freevpns was Google...they really want your data :) Luckily there are sites that check for dns leaks, for instance https://www.dnsleaktest.com/ It is easy to check how many leaks your vpn or dns is involved with.
After many hours of searching for a free vpn that isnt bandwidth or download GB restricted, and doesnt sell my data, I turned to browser plugins. There are several browser vpn plugins for firefox, however some want permission for viewing everything even clipboard data. I finally settled for a plugin called Hoxx vpn proxy https://addons.mozilla.org/en-US/firefox/addon/hoxx-vpn-proxy/?src=search It's a easy to use and safe vpn client that has only one drawback that I can find, it requires a confirmed email address. It does log files and it will ban you if you try to go to illegal sites. It's not for people that want to do illegal activity, like watching pirated movies, as it will ban or report you, but it is for those that want privacy and at least make it harder for governments and others to track each site you visit to obtain your political, spiritual, purchasing history, hobbies, etc, and to obtain a complete snapshot of your online life.
We may not be able to stop the anti-privacy train from moving quickly down the tracks, but we can try to at least drag our feet and maybe slow it down a bit :)
*UPDATE: I wanted to find a more open source solution for a vpn client. I finally found https://www.vpngate.net/en/. It is an open source vpn client that uses volunteer servers from around the world to connect with. The servers at the top of the list are usually faster or have more open connections. You will need to have openvpn installed https://openvpn.net/ and then just download the openvpn config file and add it to your network connection manager (in my case NetworkManager, which needs the plugin "networkmanager-openvpn" installed also). Since there are quite a few shady vpn operations out there, I think having an open source solution with many server options is the best way to protect yourself online. However, its still important to check out the servers you connect with using the tools I mentioned above.
Tuesday, September 12, 2017
DNS Public Servers
I know I'm only supposed to post once a year on here, but well I guess I'm feeling ambitious. :} Today's topic is DNS servers. I've been using Comcast as my ISP for some time, mainly because there are no other decent choices in the area I live in. It's not horrible, however the main DNS servers are not that reliable and they don't support IPv6. I like having IPv6 support mainly due to the fact it's impossible to know what IPv6 only sites are available if it isn't supported. Whenever I install a new linux version one of the first things i do is go to http://ipv6-test.com/ and see if my ipv6 is working. That is how i first noticed my ISP was not supporting IPv6. I then searched for a public DNS server that would support IPv6. I have been using Google's free DNS servers for a number of years now, set to dns 8.8.8.8 and secondary dns of 8.8.4.4. It has been more reliable and faster than Comcast's DNS servers. So what's the issue then? The issue is really Google's relentless data collection policies. Along with the fact they make their money primarily by selling advertising.
This led me onto a quest for a DNS server that wasn't so interesting in selling my data but might actually be interested in providing a good DNS experience. There are several good ones, https://www.opendns.com/ worked well but is mostly focused on DNS filtering which was not my primary reason for changing. I then tried https://dns.watch/ which worked well and I liked they don't log or sell information but after reading an article about DNS latency, it mentioned that it is very important to find one in your country because every time you type in a url it has to go to that server to resolve the ip address. Looking up the information on dns.watch it appears to be located in Germany. Having a DNS server in Germany can add latency and slow down your requests. That led me to looking for a more open-source solution.
Which led me to https://www.opennic.org/ where anyone can run their own DNS server. I thought about doing that, all you need is a Linux server, which I could easily set up. That would be the best solution, however they mentioned on their wiki they don't recommend running a DNS server from ones home, again its about latency. The less hops is always better. So instead of running my own DNS server I found one that is near that supports both ipv4 and ipv6 and does not log and supports dnscrypt. Been using it for a couple weeks and it is fast and been awesome so far.
I doubt the average person really cares about what DNS server they use, but why make it easier for huge companies to monitor what sites you visit in order to provide you with more ads. Of course DNS logging is only one way they collect information and certainly won't make you anonymous on the web. It may be impossible to stay anonymous in todays' world but you don't need to hand them all your personal information on a silver platter either :}
This led me onto a quest for a DNS server that wasn't so interesting in selling my data but might actually be interested in providing a good DNS experience. There are several good ones, https://www.opendns.com/ worked well but is mostly focused on DNS filtering which was not my primary reason for changing. I then tried https://dns.watch/ which worked well and I liked they don't log or sell information but after reading an article about DNS latency, it mentioned that it is very important to find one in your country because every time you type in a url it has to go to that server to resolve the ip address. Looking up the information on dns.watch it appears to be located in Germany. Having a DNS server in Germany can add latency and slow down your requests. That led me to looking for a more open-source solution.
Which led me to https://www.opennic.org/ where anyone can run their own DNS server. I thought about doing that, all you need is a Linux server, which I could easily set up. That would be the best solution, however they mentioned on their wiki they don't recommend running a DNS server from ones home, again its about latency. The less hops is always better. So instead of running my own DNS server I found one that is near that supports both ipv4 and ipv6 and does not log and supports dnscrypt. Been using it for a couple weeks and it is fast and been awesome so far.
I doubt the average person really cares about what DNS server they use, but why make it easier for huge companies to monitor what sites you visit in order to provide you with more ads. Of course DNS logging is only one way they collect information and certainly won't make you anonymous on the web. It may be impossible to stay anonymous in todays' world but you don't need to hand them all your personal information on a silver platter either :}
Tuesday, July 18, 2017
Linux and SystemD
Anyone following or using Linux has noticed that the systemd init system has been pushed into more and more distributions. Most of the popular distributions have switched to it and offer little choice of using anything else. It was originally developed by a redhat employee and first appeared in fedora several years ago. I have used distros that are based on systemd and it seems to work fine and does provide a faster startup. The concern is that by standardizing the init system it allows Linux to become less fragmented (which could be good, but) and thereby easier to monitor. I remember seeing a video analysis of the systemd documentation a couple years ago where in one area the developer had a comment "this was added to keep the 3-letter agencies happy". The guys doing the analysis only said.. not sure what he means by that but it might be a good idea to stay far away from this. This along with the fact that systemd is not too unix like (do one thing and do it well is the unix motto) has created some push back in the linux community and therefore this wiki page was created:
without-systemd.org
I have tried several of the distros listed on the wiki and there are two that really stand out as being more stable and tested.
manjaro-openrc and devuan.org
I originally favored manjaro because its based on Arch linux which is my favorite distribution. However because it uses the Arch repos and the Arch Users Repository (AUR), i noticed that some programs wanted to install systemd back in as a dependency, which defeats its purpose.
After another run with Slackware i settled on Devuan as my distro of choice. Seems to work well, based on Debian but without systemd. Haven't noticed any negative effects yet, and have installed quite a lot of software. I did have to change to the testing repos instead of stable because the network driver and nvidia driver were too old in the stable repositories for my hardware.
Combine Devuan with i3 Window Manager and you end up with a pretty sweet fast OS that hopefully isn't full of spyware :}
UPDATE: After a few weeks on Devuan, I was disappointed that the distro is not updated regularly. Some of the software is quite old. Decided to go with a more bleeding edge distro Void Linux that uses runit for the init system. Install went well and all the packages I needed were available. Might keep this one for awhile :}
without-systemd.org
I have tried several of the distros listed on the wiki and there are two that really stand out as being more stable and tested.
manjaro-openrc and devuan.org
I originally favored manjaro because its based on Arch linux which is my favorite distribution. However because it uses the Arch repos and the Arch Users Repository (AUR), i noticed that some programs wanted to install systemd back in as a dependency, which defeats its purpose.
After another run with Slackware i settled on Devuan as my distro of choice. Seems to work well, based on Debian but without systemd. Haven't noticed any negative effects yet, and have installed quite a lot of software. I did have to change to the testing repos instead of stable because the network driver and nvidia driver were too old in the stable repositories for my hardware.
Combine Devuan with i3 Window Manager and you end up with a pretty sweet fast OS that hopefully isn't full of spyware :}
UPDATE: After a few weeks on Devuan, I was disappointed that the distro is not updated regularly. Some of the software is quite old. Decided to go with a more bleeding edge distro Void Linux that uses runit for the init system. Install went well and all the packages I needed were available. Might keep this one for awhile :}
Sunday, April 10, 2016
Windows 10 and Virtual Desks
I'm happy that Microsoft finally added virtual desktops to windows. They could have made the hotkeys customizable to make it more user friendly but then maybe I expect too much :}
Luckily there is my old friend AutoHotKey: http://ahkscript.org/
install the program to allow launching any .ahk file or compiling it to an .exe file to run on computers that don't have AutoHotKey installed.
I made a simple script that does 3 things:
1. Provides a popup menu of applications and functions with the middle mouse button
2. Shows all the desktops when X2 (forward button on 5 button mouse) is pressed
3. Moves forward and backward through the desktops by holding X2 and using the mouse wheel
Heres the code, simply copy/paste to notepad and save as vdesk.ahk It can be run by double clicking from explorer or compiled to a .exe by rightclicking the file and selecting the option. Add to the start menu startup folder for loading at windows login.
Menu, MyMenu, Add, Firefox
Menu, MyMenu, Add, Explorer
Menu, MyMenu, Add, CCleaner
Menu, MyMenu, Add
Menu, MyMenu, Add, Desktop
Menu, MyMenu, Add, Programs
Menu, MyMenu, Add
Menu, MyMenu, Add, Logoff
Menu, MyMenu, Add, Shutdown
return
Explorer:
Run, explorer.exe
Return
Firefox:
Run, C:\Program Files (x86)\Mozilla Firefox\firefox.exe
Return
CCleaner:
Run, C:\Program Files\CCleaner\ccleaner64.exe
Return
Desktop:
Run, C:\Users\Public\Desktop
Return
Programs:
Run, C:\Users\kcair\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
Return
Logoff:
Shutdown, 0
Return
Shutdown:
Shutdown, 1
Return
Mbutton::Menu, MyMenu, Show
XButton2 & Wheelup::Send, ^#{Left}
XButton2 & Wheeldown::Send, ^#{Right}
XButton2::Send, #{Tab}
Luckily there is my old friend AutoHotKey: http://ahkscript.org/
install the program to allow launching any .ahk file or compiling it to an .exe file to run on computers that don't have AutoHotKey installed.
I made a simple script that does 3 things:
1. Provides a popup menu of applications and functions with the middle mouse button
2. Shows all the desktops when X2 (forward button on 5 button mouse) is pressed
3. Moves forward and backward through the desktops by holding X2 and using the mouse wheel
Heres the code, simply copy/paste to notepad and save as vdesk.ahk It can be run by double clicking from explorer or compiled to a .exe by rightclicking the file and selecting the option. Add to the start menu startup folder for loading at windows login.
Menu, MyMenu, Add, Firefox
Menu, MyMenu, Add, Explorer
Menu, MyMenu, Add, CCleaner
Menu, MyMenu, Add
Menu, MyMenu, Add, Desktop
Menu, MyMenu, Add, Programs
Menu, MyMenu, Add
Menu, MyMenu, Add, Logoff
Menu, MyMenu, Add, Shutdown
return
Explorer:
Run, explorer.exe
Return
Firefox:
Run, C:\Program Files (x86)\Mozilla Firefox\firefox.exe
Return
CCleaner:
Run, C:\Program Files\CCleaner\ccleaner64.exe
Return
Desktop:
Run, C:\Users\Public\Desktop
Return
Programs:
Run, C:\Users\kcair\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
Return
Logoff:
Shutdown, 0
Return
Shutdown:
Shutdown, 1
Return
Mbutton::Menu, MyMenu, Show
XButton2 & Wheelup::Send, ^#{Left}
XButton2 & Wheeldown::Send, ^#{Right}
XButton2::Send, #{Tab}
Tuesday, March 03, 2015
XCB Minimal Window Manager
In my quest for a good minimal window manager, I have tried almost everything available for linux, including projects on https://github.com I havent found anything yet that works exactly as I want, but I enjoy hacking on the code to see if I can make them work more to my liking (or work at all). This is a recent attempt to hack some public domain xcb code to meet my needs. After my modifications it is only 134 sloc (single lines of code) and does the basic window manager functions I use. Here is the code:
#include <stdlib.h>
#include <sys/wait.h>
#include <xcb/xcb.h>
#ifdef COMPOSITE
#include <xcb/composite.h>
#endif
int main(int argc,char**argv){
static const uint32_t di[]={0,0,1440,900},cwa=XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT|XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY|XCB_EVENT_MASK_STRUCTURE_NOTIFY;
xcb_connection_t*d=xcb_connect(0,0);
void*p;
int32_t*x,*y,*tx=0,mx,my,rt=xcb_setup_roots_iterator(xcb_get_setup(d)).data->root,cs[255],*cz=cs+1;
uint8_t mz,mZ;
xcb_change_window_attributes(d,rt,XCB_CW_EVENT_MASK,&cwa);
xcb_grab_key(d,1,rt,0,133,XCB_GRAB_MODE_ASYNC,XCB_GRAB_MODE_ASYNC);
xcb_grab_button(d,1,rt,XCB_EVENT_MASK_BUTTON_PRESS,XCB_GRAB_MODE_ASYNC,XCB_GRAB_MODE_ASYNC,XCB_NONE,XCB_NONE,XCB_GRAB_ANY,XCB_MOD_MASK_4);
#ifdef COMPOSITE
xcb_composite_redirect_subwindows(d,rt,XCB_COMPOSITE_REDIRECT_AUTOMATIC);
#endif
xcb_generic_event_t*e=0;
main:xcb_flush(d);
waitpid(-1,0,WNOHANG);
noflush:x=y=cz-1;
again:free(e);
switch((e=xcb_wait_for_event(d))->response_type&127){
case XCB_BUTTON_PRESS:
for(;x>cs;x--)
if(*x==((xcb_button_press_event_t*)e)->child){
if(((xcb_key_press_event_t*)e)->detail==2)goto pocus;
case XCB_KEY_PRESS:
mz=128|((xcb_key_press_event_t*)e)->detail;
my=((xcb_key_press_event_t*)e)->state;
goto*(cz==cs+1?&&kcode:&&stack);
}
goto noflush;
case XCB_KEY_RELEASE:
if(((xcb_key_press_event_t*)e)->detail!=133||!tx)default:goto again;
xt:x=tx;
tx=0;
goto stack;
case XCB_CONFIGURE_REQUEST:;
uint32_t c[7];
p=c;
for(mz=0;mz<5;mz++)
if(((xcb_configure_request_event_t*)e)->value_mask&1<<mz){*(uint32_t*)p=*(int16_t*)(((void*)e)+16+mz*2);p+=4;}
if(((xcb_configure_request_event_t*)e)->value_mask&XCB_CONFIG_WINDOW_SIBLING){*(uint32_t*)p=((xcb_configure_request_event_t*)e)->sibling;p+=4;}
if(mz=((xcb_configure_request_event_t*)e)->value_mask&XCB_CONFIG_WINDOW_STACK_MODE)*(uint32_t*)p=((xcb_configure_request_event_t*)e)->stack_mode;
xcb_configure_window(d,((xcb_configure_request_event_t*)e)->window,((xcb_configure_request_event_t*)e)->value_mask,c);
if(mz){
p=xcb_query_tree_reply(d,xcb_query_tree_unchecked(d,rt),0);
int32_t*cl=p+32+((xcb_query_tree_reply_t*)p)->children_len*4;
for(y=p+32;y<cl;y++){
for(x=cs+1;x<cz;x++)
if(*x==*y)goto nono;
*y=0;
nono:;
}
x=cs;
for(y=p+32;y<cl;y++)
if(*y)*++x=*y;
free(p);
goto pocus;
}else goto main;
case XCB_MAP_REQUEST:
p=xcb_get_window_attributes_reply(d,xcb_get_window_attributes_unchecked(d,((xcb_map_request_event_t*)e)->window),0);
if(((xcb_get_window_attributes_reply_t*)p)->override_redirect)goto freeflush;
free(p);
for(;x>cs;x--)
if(*x==((xcb_map_request_event_t*)e)->window)goto noflush;
xcb_map_window(d,*cz++=((xcb_map_request_event_t*)e)->window);
goto hocus;
if(0)case XCB_MOTION_NOTIFY:xcb_configure_window(d,*x,mZ?XCB_CONFIG_WINDOW_WIDTH|XCB_CONFIG_WINDOW_HEIGHT:XCB_CONFIG_WINDOW_X|XCB_CONFIG_WINDOW_Y,(int32_t[]){mZ&&((xcb_motion_notify_event_t*)e)->root_x<=mx?:((xcb_motion_notify_event_t*)e)->root_x-mx,mZ&&((xcb_motion_notify_event_t*)e)->root_y<=my?:((xcb_motion_notify_event_t*)e)->root_y-my});
else case XCB_BUTTON_RELEASE:xcb_ungrab_pointer(d,XCB_CURRENT_TIME);
goto main;
case XCB_UNMAP_NOTIFY:unmap:goto*(x==cs?&&noflush:*x==((xcb_unmap_notify_event_t*)e)->window&&--cz>cs+1?&&stack:(x--,&&unmap));
}
mvsz:p=xcb_grab_pointer_reply(d,xcb_grab_pointer_unchecked(d,0,rt,XCB_EVENT_MASK_BUTTON_RELEASE|XCB_EVENT_MASK_POINTER_MOTION,XCB_GRAB_MODE_ASYNC,XCB_GRAB_MODE_ASYNC,XCB_NONE,XCB_NONE,XCB_CURRENT_TIME),0);
if(((xcb_grab_pointer_reply_t*)p)->status!=XCB_GRAB_STATUS_SUCCESS)goto freeflush;
free(p);
p=xcb_get_geometry_reply(d,xcb_get_geometry_unchecked(d,*y),0);
mx=((xcb_get_geometry_reply_t*)p)->x;
my=((xcb_get_geometry_reply_t*)p)->y;
free(p);
if(mZ=mz!=1)goto noflush;
p=xcb_query_pointer_reply(d,xcb_query_pointer_unchecked(d,rt),0);
mx=((xcb_query_pointer_reply_t*)p)->root_x-mx;
my=((xcb_query_pointer_reply_t*)p)->root_y-my;
freeflush:free(p);
goto noflush;
stack:mx=*x;
for(;x!=y;x+=x<y?:-1)*x=x[x<y?:-1];
*x=mx;
hocus:x=cz-1;
xcb_configure_window(d,*x,XCB_CONFIG_WINDOW_STACK_MODE,di);
pocus:xcb_set_input_focus(d,XCB_INPUT_FOCUS_POINTER_ROOT,*x,XCB_CURRENT_TIME);
if(!(mz&128))goto main;
kcode:switch(mz&=127){
case 1:case 3:goto mvsz;
case 23:case 49:
if(cz-cs<3)goto main;
y=tx;
tx=mz==23?(y!=cs+1?(y?:x)-1:x):!y||y==x?cs+1:y+1;
if(y&&y<cz-1)xcb_configure_window(d,*y,XCB_CONFIG_WINDOW_SIBLING|XCB_CONFIG_WINDOW_STACK_MODE,(uint32_t[]){y[mz==23?:-1],mz==23});
xcb_configure_window(d,*tx,XCB_CONFIG_WINDOW_STACK_MODE,di);
goto main;
case 25:goto*(p="firefox&",&&cmd);
case 26:goto*(p="thunar&",&&cmd);
case 27:goto*(p="dmenu_run&",&&cmd);
case 28:goto*(p="urxvt&",&&cmd);
case 38:goto*(p="xfce4-mixer&",&&cmd);
case 39:goto*(p="slock&",&&cmd);
case 53:full:
if(cz>cs+1)xcb_configure_window(d,*y,XCB_CONFIG_WINDOW_X|XCB_CONFIG_WINDOW_Y|XCB_CONFIG_WINDOW_WIDTH|XCB_CONFIG_WINDOW_HEIGHT,di);
goto main;
case 24:shut:
if(cz==cs+1)goto main;
if(tx)goto*(mz|=128,&&xt);
p=xcb_intern_atom_reply(d,xcb_intern_atom_unchecked(d,0,12,"WM_PROTOCOLS"),0);
mx=((xcb_intern_atom_reply_t*)p)->atom;
free(p);
p=xcb_intern_atom_reply(d,xcb_intern_atom_unchecked(d,0,16,"WM_DELETE_WINDOW"),0);
my=((xcb_intern_atom_reply_t*)p)->atom;
free(p);
p=xcb_get_property_reply(d,xcb_get_property_unchecked(d,0,*y,mx,XCB_ATOM_ATOM,0,-1),0);
xcb_send_event(d,0,*y,XCB_EVENT_MASK_NO_EVENT,(void*)(xcb_client_message_event_t[]){{.response_type=XCB_CLIENT_MESSAGE,.window=*y,.type=mx,.format=32,.data.data32={my,XCB_CURRENT_TIME}}});
for(mx=(((xcb_get_property_reply_t*)p)->value_len<<2)-4;mx>=0&&*(uint32_t*)(p+sizeof(xcb_get_property_reply_t)+mx)!=my;mx-=4);
if(mx==-1)killit:xcb_kill_client(d,*y);
free(p);
goto main;
case 9:goto*(cz==cs+1?&&main:(p=0,&&killit));
case 54:p="urxvt +sb -fn xft:monospace-16 -geometry 32x2+500+500 -e sh -c 'date;sleep 5'&";
cmd:system(p);
default:goto main;
}
}
AND here is what it does:
source code is configured to use the following keys:
WinKey - keycode 133 - Hold windows key and then press any of the following keys:
ESC - 9 - kills client window
q - 24 - asks to close client window normally
w - 25 - launches firefox
e - 26 - launches thunar
r - 27 - launches dmenu_run
t - 28 - lauches urxvt
a - 38 - launches xfce4-mixer
s - 39 - launches slock
x - 53 - maximizes window
c - 54 - shows time for 5 seconds
Tab - 23 - cycles forward
grave (~) - 49 cycles backward
WinKey + mouse button1 moves window
WinKey + mouse button3 resizes window
To compile from a terminal use this command:
gcc -o kcwm kcwm.c -std=gnu99 -lxcb
This is all I need from a window manager and it accomplishes all this with under 2 Meg of ram usage. It also closes windows gracefully, Allows proper memory usage, and allows firefox menus to show.
#include <stdlib.h>
#include <sys/wait.h>
#include <xcb/xcb.h>
#ifdef COMPOSITE
#include <xcb/composite.h>
#endif
int main(int argc,char**argv){
static const uint32_t di[]={0,0,1440,900},cwa=XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT|XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY|XCB_EVENT_MASK_STRUCTURE_NOTIFY;
xcb_connection_t*d=xcb_connect(0,0);
void*p;
int32_t*x,*y,*tx=0,mx,my,rt=xcb_setup_roots_iterator(xcb_get_setup(d)).data->root,cs[255],*cz=cs+1;
uint8_t mz,mZ;
xcb_change_window_attributes(d,rt,XCB_CW_EVENT_MASK,&cwa);
xcb_grab_key(d,1,rt,0,133,XCB_GRAB_MODE_ASYNC,XCB_GRAB_MODE_ASYNC);
xcb_grab_button(d,1,rt,XCB_EVENT_MASK_BUTTON_PRESS,XCB_GRAB_MODE_ASYNC,XCB_GRAB_MODE_ASYNC,XCB_NONE,XCB_NONE,XCB_GRAB_ANY,XCB_MOD_MASK_4);
#ifdef COMPOSITE
xcb_composite_redirect_subwindows(d,rt,XCB_COMPOSITE_REDIRECT_AUTOMATIC);
#endif
xcb_generic_event_t*e=0;
main:xcb_flush(d);
waitpid(-1,0,WNOHANG);
noflush:x=y=cz-1;
again:free(e);
switch((e=xcb_wait_for_event(d))->response_type&127){
case XCB_BUTTON_PRESS:
for(;x>cs;x--)
if(*x==((xcb_button_press_event_t*)e)->child){
if(((xcb_key_press_event_t*)e)->detail==2)goto pocus;
case XCB_KEY_PRESS:
mz=128|((xcb_key_press_event_t*)e)->detail;
my=((xcb_key_press_event_t*)e)->state;
goto*(cz==cs+1?&&kcode:&&stack);
}
goto noflush;
case XCB_KEY_RELEASE:
if(((xcb_key_press_event_t*)e)->detail!=133||!tx)default:goto again;
xt:x=tx;
tx=0;
goto stack;
case XCB_CONFIGURE_REQUEST:;
uint32_t c[7];
p=c;
for(mz=0;mz<5;mz++)
if(((xcb_configure_request_event_t*)e)->value_mask&1<<mz){*(uint32_t*)p=*(int16_t*)(((void*)e)+16+mz*2);p+=4;}
if(((xcb_configure_request_event_t*)e)->value_mask&XCB_CONFIG_WINDOW_SIBLING){*(uint32_t*)p=((xcb_configure_request_event_t*)e)->sibling;p+=4;}
if(mz=((xcb_configure_request_event_t*)e)->value_mask&XCB_CONFIG_WINDOW_STACK_MODE)*(uint32_t*)p=((xcb_configure_request_event_t*)e)->stack_mode;
xcb_configure_window(d,((xcb_configure_request_event_t*)e)->window,((xcb_configure_request_event_t*)e)->value_mask,c);
if(mz){
p=xcb_query_tree_reply(d,xcb_query_tree_unchecked(d,rt),0);
int32_t*cl=p+32+((xcb_query_tree_reply_t*)p)->children_len*4;
for(y=p+32;y<cl;y++){
for(x=cs+1;x<cz;x++)
if(*x==*y)goto nono;
*y=0;
nono:;
}
x=cs;
for(y=p+32;y<cl;y++)
if(*y)*++x=*y;
free(p);
goto pocus;
}else goto main;
case XCB_MAP_REQUEST:
p=xcb_get_window_attributes_reply(d,xcb_get_window_attributes_unchecked(d,((xcb_map_request_event_t*)e)->window),0);
if(((xcb_get_window_attributes_reply_t*)p)->override_redirect)goto freeflush;
free(p);
for(;x>cs;x--)
if(*x==((xcb_map_request_event_t*)e)->window)goto noflush;
xcb_map_window(d,*cz++=((xcb_map_request_event_t*)e)->window);
goto hocus;
if(0)case XCB_MOTION_NOTIFY:xcb_configure_window(d,*x,mZ?XCB_CONFIG_WINDOW_WIDTH|XCB_CONFIG_WINDOW_HEIGHT:XCB_CONFIG_WINDOW_X|XCB_CONFIG_WINDOW_Y,(int32_t[]){mZ&&((xcb_motion_notify_event_t*)e)->root_x<=mx?:((xcb_motion_notify_event_t*)e)->root_x-mx,mZ&&((xcb_motion_notify_event_t*)e)->root_y<=my?:((xcb_motion_notify_event_t*)e)->root_y-my});
else case XCB_BUTTON_RELEASE:xcb_ungrab_pointer(d,XCB_CURRENT_TIME);
goto main;
case XCB_UNMAP_NOTIFY:unmap:goto*(x==cs?&&noflush:*x==((xcb_unmap_notify_event_t*)e)->window&&--cz>cs+1?&&stack:(x--,&&unmap));
}
mvsz:p=xcb_grab_pointer_reply(d,xcb_grab_pointer_unchecked(d,0,rt,XCB_EVENT_MASK_BUTTON_RELEASE|XCB_EVENT_MASK_POINTER_MOTION,XCB_GRAB_MODE_ASYNC,XCB_GRAB_MODE_ASYNC,XCB_NONE,XCB_NONE,XCB_CURRENT_TIME),0);
if(((xcb_grab_pointer_reply_t*)p)->status!=XCB_GRAB_STATUS_SUCCESS)goto freeflush;
free(p);
p=xcb_get_geometry_reply(d,xcb_get_geometry_unchecked(d,*y),0);
mx=((xcb_get_geometry_reply_t*)p)->x;
my=((xcb_get_geometry_reply_t*)p)->y;
free(p);
if(mZ=mz!=1)goto noflush;
p=xcb_query_pointer_reply(d,xcb_query_pointer_unchecked(d,rt),0);
mx=((xcb_query_pointer_reply_t*)p)->root_x-mx;
my=((xcb_query_pointer_reply_t*)p)->root_y-my;
freeflush:free(p);
goto noflush;
stack:mx=*x;
for(;x!=y;x+=x<y?:-1)*x=x[x<y?:-1];
*x=mx;
hocus:x=cz-1;
xcb_configure_window(d,*x,XCB_CONFIG_WINDOW_STACK_MODE,di);
pocus:xcb_set_input_focus(d,XCB_INPUT_FOCUS_POINTER_ROOT,*x,XCB_CURRENT_TIME);
if(!(mz&128))goto main;
kcode:switch(mz&=127){
case 1:case 3:goto mvsz;
case 23:case 49:
if(cz-cs<3)goto main;
y=tx;
tx=mz==23?(y!=cs+1?(y?:x)-1:x):!y||y==x?cs+1:y+1;
if(y&&y<cz-1)xcb_configure_window(d,*y,XCB_CONFIG_WINDOW_SIBLING|XCB_CONFIG_WINDOW_STACK_MODE,(uint32_t[]){y[mz==23?:-1],mz==23});
xcb_configure_window(d,*tx,XCB_CONFIG_WINDOW_STACK_MODE,di);
goto main;
case 25:goto*(p="firefox&",&&cmd);
case 26:goto*(p="thunar&",&&cmd);
case 27:goto*(p="dmenu_run&",&&cmd);
case 28:goto*(p="urxvt&",&&cmd);
case 38:goto*(p="xfce4-mixer&",&&cmd);
case 39:goto*(p="slock&",&&cmd);
case 53:full:
if(cz>cs+1)xcb_configure_window(d,*y,XCB_CONFIG_WINDOW_X|XCB_CONFIG_WINDOW_Y|XCB_CONFIG_WINDOW_WIDTH|XCB_CONFIG_WINDOW_HEIGHT,di);
goto main;
case 24:shut:
if(cz==cs+1)goto main;
if(tx)goto*(mz|=128,&&xt);
p=xcb_intern_atom_reply(d,xcb_intern_atom_unchecked(d,0,12,"WM_PROTOCOLS"),0);
mx=((xcb_intern_atom_reply_t*)p)->atom;
free(p);
p=xcb_intern_atom_reply(d,xcb_intern_atom_unchecked(d,0,16,"WM_DELETE_WINDOW"),0);
my=((xcb_intern_atom_reply_t*)p)->atom;
free(p);
p=xcb_get_property_reply(d,xcb_get_property_unchecked(d,0,*y,mx,XCB_ATOM_ATOM,0,-1),0);
xcb_send_event(d,0,*y,XCB_EVENT_MASK_NO_EVENT,(void*)(xcb_client_message_event_t[]){{.response_type=XCB_CLIENT_MESSAGE,.window=*y,.type=mx,.format=32,.data.data32={my,XCB_CURRENT_TIME}}});
for(mx=(((xcb_get_property_reply_t*)p)->value_len<<2)-4;mx>=0&&*(uint32_t*)(p+sizeof(xcb_get_property_reply_t)+mx)!=my;mx-=4);
if(mx==-1)killit:xcb_kill_client(d,*y);
free(p);
goto main;
case 9:goto*(cz==cs+1?&&main:(p=0,&&killit));
case 54:p="urxvt +sb -fn xft:monospace-16 -geometry 32x2+500+500 -e sh -c 'date;sleep 5'&";
cmd:system(p);
default:goto main;
}
}
AND here is what it does:
source code is configured to use the following keys:
WinKey - keycode 133 - Hold windows key and then press any of the following keys:
ESC - 9 - kills client window
q - 24 - asks to close client window normally
w - 25 - launches firefox
e - 26 - launches thunar
r - 27 - launches dmenu_run
t - 28 - lauches urxvt
a - 38 - launches xfce4-mixer
s - 39 - launches slock
x - 53 - maximizes window
c - 54 - shows time for 5 seconds
Tab - 23 - cycles forward
grave (~) - 49 cycles backward
WinKey + mouse button1 moves window
WinKey + mouse button3 resizes window
To compile from a terminal use this command:
gcc -o kcwm kcwm.c -std=gnu99 -lxcb
This is all I need from a window manager and it accomplishes all this with under 2 Meg of ram usage. It also closes windows gracefully, Allows proper memory usage, and allows firefox menus to show.
Tuesday, February 04, 2014
imac 27" and linux
It's only been a month with the new imac 27" I got for christmas. I LOVE the hardware, thin, quiet, doesn't get hot, beautiful non-reflective display etc. I believe Apple makes the best computer hardware and no other competitor even comes close including HP, Dell, and Samsung. Some think Apple prices are too high, however when you look at the full specs the 27" display is IPS and that kind of monitor would cost around $1000. The i5 processor, 8G ram, 2G vram nvidia 775, 1tb WD HD, Camera, Speakers, microphones, bluetooth keyboard, bluetooth mouse, etc., would be around $1000 for a pc. In an imac you get all that for $1800 so in a way its actually a bargain. Even though a high initial price.
Anyway after a month of doing almost everything possible in OSX including writing my own applescripts to automate things, installing Homebrew to install all my favorite linux apps, and running Linux in virtualbox. I still missed running linux native. So I downloaded and installed rEFInd and downloaded and installed all my favorite linux distributions. I thought Ubuntu would probably work best on this newest hardware but after trying several different distributions I found that Arch linux actually worked the best. I finally settled on an Arch linux distribution called Manjaro Linux. It even has EFI boot loader support and NVIDIA drivers included so install was quick. I am now writing this on Manjaro Linux and enjoying my iMac.
Some would say, why would you buy an Apple product that has a great OS based on UNIX (OSX) and then replace the OS? For me it's still about choice. 1. I can still not configure OSX to the level I want. 2. Apple wants to promote apps that cost you money (Many great free apps are not included in the Apple App store). 3. The performance I get from linux far exceeds what I can get from OSX.
Is OSX bad? no, its probably the best OS made to date. However, its "walled garden" approach means you have to do everything the Apple way and limits your true potential. The Apple way works and very good for those that want "just works" but very limiting to those that want "I can make it work better".
So in the end, I am a fan of Apple Hardware and appreciate their work to make an OS that works for the masses. However, the geek in me will not allow me to be content with an OS where I can't change the source code or modify every aspect to my liking. I know I am probably in the very minority of computer users these days but why spend
$1800 on the best hardware and settle for something less than gratifying. Now if only Apple would offer a Linux only version of iMac for $1600 :)
Anyway after a month of doing almost everything possible in OSX including writing my own applescripts to automate things, installing Homebrew to install all my favorite linux apps, and running Linux in virtualbox. I still missed running linux native. So I downloaded and installed rEFInd and downloaded and installed all my favorite linux distributions. I thought Ubuntu would probably work best on this newest hardware but after trying several different distributions I found that Arch linux actually worked the best. I finally settled on an Arch linux distribution called Manjaro Linux. It even has EFI boot loader support and NVIDIA drivers included so install was quick. I am now writing this on Manjaro Linux and enjoying my iMac.
Some would say, why would you buy an Apple product that has a great OS based on UNIX (OSX) and then replace the OS? For me it's still about choice. 1. I can still not configure OSX to the level I want. 2. Apple wants to promote apps that cost you money (Many great free apps are not included in the Apple App store). 3. The performance I get from linux far exceeds what I can get from OSX.
Is OSX bad? no, its probably the best OS made to date. However, its "walled garden" approach means you have to do everything the Apple way and limits your true potential. The Apple way works and very good for those that want "just works" but very limiting to those that want "I can make it work better".
So in the end, I am a fan of Apple Hardware and appreciate their work to make an OS that works for the masses. However, the geek in me will not allow me to be content with an OS where I can't change the source code or modify every aspect to my liking. I know I am probably in the very minority of computer users these days but why spend
$1800 on the best hardware and settle for something less than gratifying. Now if only Apple would offer a Linux only version of iMac for $1600 :)
Wednesday, December 04, 2013
My yearly update :}
Not updating as often as I used to which is probably a good thing :} I have tried several linux distributions and a few BSD distributions this year. Still love linux and the freedom and control you get. BSD is solid but more geared towards servers. I don't know why but I love getting into the nuts and bolts of my OS. I recently installed arch linux from the command line. It's about as low level as you can get. The nice thing about installing this way is you know the purpose of every file on your system and how to fix things if or when they break.
My favorite thing in linux is to download the source code of programs I like and change things to meet my needs. I'm getting good at reading C code and modifying parts of programs and recompiling. My computer rarely stays the same for two days in a row. There are days I've tried out 3 or 4 linux distributions. I feel sorry for my hard drive at times :}
Recently I discovered that someone involved with Tinycore linux had modified one of my favorite window managers called FLWM. They had moved the titlebar from the left side to the top and moved some buttons around. I decided to download the source code, I modified the config.h file to change the keybindings and compiled. It's now become my favorite window manager. Very fast and lean with unique mouse binds. Again that's the beauty of linux and open source is that anyone can modify or improve the original program.
I still hear from people that linux will never be mainstream, but what they don't know is it already is. So many mainstream programs borrow from linux or opensource software: Android, Webkit (Chrome and Safari browsers), CUPS (printing), Steam (gaming), etc. There are also many opensource programs that have been ported to windows and OSX i.e. The Gimp, VLC, 7zip, etc. Linux is heavily used in Healthcare, Scientific research, and servers. Linux may never be the OS for the average home user due to fact you can change everything including your user interface and there are 100's of distributions to choose from instead of one size fits all. Its opposite of the Apple locked down approach, which prevents the user from changing almost anything. OSX is popular because users that don't want to mess with their computers don't ever need to, things just work because there is only one way to do something. It's possible to install linux and configure it with a similar apple locked down interface, however that's not what Linux is about. It's about software choice and software freedom. I can change or modify even the source code of a program to make it how I choose. This will never be popular with the average user but it sure is with developers as they can simply borrow from someones program make a few changes and release. Some huge corporations are reaping the benefits.
My favorite thing in linux is to download the source code of programs I like and change things to meet my needs. I'm getting good at reading C code and modifying parts of programs and recompiling. My computer rarely stays the same for two days in a row. There are days I've tried out 3 or 4 linux distributions. I feel sorry for my hard drive at times :}
Recently I discovered that someone involved with Tinycore linux had modified one of my favorite window managers called FLWM. They had moved the titlebar from the left side to the top and moved some buttons around. I decided to download the source code, I modified the config.h file to change the keybindings and compiled. It's now become my favorite window manager. Very fast and lean with unique mouse binds. Again that's the beauty of linux and open source is that anyone can modify or improve the original program.
I still hear from people that linux will never be mainstream, but what they don't know is it already is. So many mainstream programs borrow from linux or opensource software: Android, Webkit (Chrome and Safari browsers), CUPS (printing), Steam (gaming), etc. There are also many opensource programs that have been ported to windows and OSX i.e. The Gimp, VLC, 7zip, etc. Linux is heavily used in Healthcare, Scientific research, and servers. Linux may never be the OS for the average home user due to fact you can change everything including your user interface and there are 100's of distributions to choose from instead of one size fits all. Its opposite of the Apple locked down approach, which prevents the user from changing almost anything. OSX is popular because users that don't want to mess with their computers don't ever need to, things just work because there is only one way to do something. It's possible to install linux and configure it with a similar apple locked down interface, however that's not what Linux is about. It's about software choice and software freedom. I can change or modify even the source code of a program to make it how I choose. This will never be popular with the average user but it sure is with developers as they can simply borrow from someones program make a few changes and release. Some huge corporations are reaping the benefits.
Friday, October 12, 2012
Slackware 14 released, must have it :}
Recently downloaded and installed Slackware 14 on my Desktop Dell i7 computer. Probably one of the easiest installs I've had with Slackware. Either I'm getting better at the command line or Slackware is getting easier. Probably both, however Slackware has one new added tool called "slackpkg". This makes it super easy to keep the distribution updated with security patches. Simply type at the command line as root: slackpkg update [return] slackpkg upgrade-all.
The other tool that has been in Slackware for a long time is called "pkgtool" When you run that as root, you can install new packages, change installation settings, and remove previously installed packages.
Another great tool for Slackware called "sbopkg" isn't part of the distribution but allows you to easily install software from a repository called SlackBuilds.org. It can be downloaded here: http://www.sbopkg.org/ Slackbuilds has most commonly used software programs that are actually tested for each slackware version. I like how I can browse the SlackBuilds web site or search directly from sbopkg.
I find that by using the above command line tools that Slackware is no harder to update or install new software than other common distributions like Debian or Fedora. The video driver installation programs from Nvidia and AMD also work well with Slackware. The beauty about Slackware is that they don't change things just to change things like most distributions. They update packages with each release, but the distribution tools and installation is almost the same as when I first installed it in the late '90s. Stability and Consistency is something rare these days in the world of beta software.
The other tool that has been in Slackware for a long time is called "pkgtool" When you run that as root, you can install new packages, change installation settings, and remove previously installed packages.
Another great tool for Slackware called "sbopkg" isn't part of the distribution but allows you to easily install software from a repository called SlackBuilds.org. It can be downloaded here: http://www.sbopkg.org/ Slackbuilds has most commonly used software programs that are actually tested for each slackware version. I like how I can browse the SlackBuilds web site or search directly from sbopkg.
I find that by using the above command line tools that Slackware is no harder to update or install new software than other common distributions like Debian or Fedora. The video driver installation programs from Nvidia and AMD also work well with Slackware. The beauty about Slackware is that they don't change things just to change things like most distributions. They update packages with each release, but the distribution tools and installation is almost the same as when I first installed it in the late '90s. Stability and Consistency is something rare these days in the world of beta software.
Saturday, May 28, 2011
Dual-boot OSX and LINUX on 2010 Mac Mini (4,1)
I've spent several nights loading various distributions of Linux on my Mac Mini. Since the Mini is based on Intel core2duo it should be easy for someone experienced with linux right? well...its not hard once you understand that the Mini does not use BIOS like PCs do. It uses EFI to boot and has a small 200MB partition that is used to install flash updates (sda1). The Hard drive uses GUID partitioning (GPT). Because of these new technologies and newer hardware, some distributions may not boot. The following covers how to install Ubuntu 11.04 and Debian testing, but will work for most distributions.
Lets start, the easiest and I think best way to dual-boot is to install a boot manager called rEFIt. rEFIt provides a nice icon menu at boot up in which you can select osx or Linux. It also has some nice tools. From OSX, download and install rEFIt. Reboot. Reboot again and the rEFIt screen should come up with icons for osx and various tools. Boot back into osx.
Next, download the 64 bit alternative ubuntu iso. You can use the standard 32 bit Ubuntu if you prefer, just remember to manually partition so that you can select the location for grub. If you prefer Debian, download Debian testing .iso (The stable version didn't recognize the mini's ethernet hardware). Use osx's disk utility to burn the .iso to a CD. Run Bootcamp and select a new partition size (the default 20GB should be fine) and then select "quit and install windows later". Make sure the newly created CD is in the drive and reboot.
When the rEFIt screen comes up select the CD-Rom icon. When the install Ubuntu/Debian screen comes up press F6 and select "nomodeset" or press e and type into boot options (debian). Otherwise you will get a blank screen due to the default nvidia driver that doesn't work fully on mini.
Begin the installation. When you get to the partitioning part, choose manual and then delete the Bootcamp partition. Create a / partition with ext4 and set the boot flag. If you have less than 4gig of ram also create a swap partition the size of your physical ram. You should now have an sda3 / partition and if you added a swap partition, it should be sda4. Towards the end of the installation you will need to install the grub boot loader. The only safe way for future updates is to install to the / or sda3 partition. Type in /dev/sda3 and finish the installation. Reboot...wait it wont reboot..we will fix that later. Hold down the power button for a few seconds to shut off. In case of errors..See Note 1 and 2 below.
Turn on mini and you should now have an icon for Linux on the rEFIt screen. Don't click it yet, instead click on the disk partition icon. Type Y to sync MBR. Click on the OSX icon to boot into osx. Reboot. Back at the rEFIt screen click the Linux icon and after a few seconds the grub menu should appear. Boot into linux. To fix the reboot issue, launch terminal and type "cd /etc/default" and then "sudo gedit grub". Find the line that reads GRUB_CMDLINE_LINUX_DEFAULT, and enter "reboot=pci" at the end of the line. Save the File and exit gedit. At the terminal prompt, type "sudo update-grub"
Now the fun part of configuring everything.. but thats too much to write here :) Enjoy the freedom that apple doesn't allow, such as tiling window managers, etc. P.S. Apple please add a reset button and CD eject button on next mac mini. It's not great having to boot into osx to eject a CD or to reboot by turning off power (i never thought i would miss CNTRL-ALT-DEL). But I guess I could have bought a PC :)
NOTE 1: If you accidently deleted or want to erase SDA1 (in case of corruption) you can restore it by resizing the Hard Drive using osx disk utility (good job apple).
NOTE 2: If you wrongfully installed grub to the MBR or sda, you can fix it by typing "sudo fdisk -u /dev/disk0" in osx terminal.
Lets start, the easiest and I think best way to dual-boot is to install a boot manager called rEFIt. rEFIt provides a nice icon menu at boot up in which you can select osx or Linux. It also has some nice tools. From OSX, download and install rEFIt. Reboot. Reboot again and the rEFIt screen should come up with icons for osx and various tools. Boot back into osx.
Next, download the 64 bit alternative ubuntu iso. You can use the standard 32 bit Ubuntu if you prefer, just remember to manually partition so that you can select the location for grub. If you prefer Debian, download Debian testing .iso (The stable version didn't recognize the mini's ethernet hardware). Use osx's disk utility to burn the .iso to a CD. Run Bootcamp and select a new partition size (the default 20GB should be fine) and then select "quit and install windows later". Make sure the newly created CD is in the drive and reboot.
When the rEFIt screen comes up select the CD-Rom icon. When the install Ubuntu/Debian screen comes up press F6 and select "nomodeset" or press e and type into boot options (debian). Otherwise you will get a blank screen due to the default nvidia driver that doesn't work fully on mini.
Begin the installation. When you get to the partitioning part, choose manual and then delete the Bootcamp partition. Create a / partition with ext4 and set the boot flag. If you have less than 4gig of ram also create a swap partition the size of your physical ram. You should now have an sda3 / partition and if you added a swap partition, it should be sda4. Towards the end of the installation you will need to install the grub boot loader. The only safe way for future updates is to install to the / or sda3 partition. Type in /dev/sda3 and finish the installation. Reboot...wait it wont reboot..we will fix that later. Hold down the power button for a few seconds to shut off. In case of errors..See Note 1 and 2 below.
Turn on mini and you should now have an icon for Linux on the rEFIt screen. Don't click it yet, instead click on the disk partition icon. Type Y to sync MBR. Click on the OSX icon to boot into osx. Reboot. Back at the rEFIt screen click the Linux icon and after a few seconds the grub menu should appear. Boot into linux. To fix the reboot issue, launch terminal and type "cd /etc/default" and then "sudo gedit grub". Find the line that reads GRUB_CMDLINE_LINUX_DEFAULT, and enter "reboot=pci" at the end of the line. Save the File and exit gedit. At the terminal prompt, type "sudo update-grub"
Now the fun part of configuring everything.. but thats too much to write here :) Enjoy the freedom that apple doesn't allow, such as tiling window managers, etc. P.S. Apple please add a reset button and CD eject button on next mac mini. It's not great having to boot into osx to eject a CD or to reboot by turning off power (i never thought i would miss CNTRL-ALT-DEL). But I guess I could have bought a PC :)
NOTE 1: If you accidently deleted or want to erase SDA1 (in case of corruption) you can restore it by resizing the Hard Drive using osx disk utility (good job apple).
NOTE 2: If you wrongfully installed grub to the MBR or sda, you can fix it by typing "sudo fdisk -u /dev/disk0" in osx terminal.
Monday, January 18, 2010
Another day, Another Launcher for Windows
I've made two more Windows launchers using Autohotkey. Both are activated by using the middle mouse button. The 8-ball or x in the middle hides the gui.
This one I call Picture Launcher:

Here is the graphic you need, copy it to where you put the script: Link
(right click on link, copy location and paste into address bar, then right click and save as)
Here is the source code: link
Here is the exe file: link
This one I call pie Launcher:

Here is the graphic you need, copy it to where you put the script: Link
(right click on link, copy location and paste into address bar, then right click and save as)
Here is the source code: Link
Here is the exe file: Link
This one I call Picture Launcher:

Here is the graphic you need, copy it to where you put the script: Link
(right click on link, copy location and paste into address bar, then right click and save as)
Here is the source code: link
Here is the exe file: link
This one I call pie Launcher:

Here is the graphic you need, copy it to where you put the script: Link
(right click on link, copy location and paste into address bar, then right click and save as)
Here is the source code: Link
Here is the exe file: Link
Wednesday, November 25, 2009
New programs for Windows
I have made a couple new programs lately with Autohotkey.
This one I call mini Radial:

It appears with middle mouse button under the mouse location and launches my favorite programs.
It uses this graphic: http://www.autohotkey.net/~netfun81/greenorb.png
If you get an error copy URL to address box of browser and paste. Save Graphic to the same folder as the .exe file.
Here is the Exe file: http://www.autohotkey.net/~netfun81/mini radial.exe
Here is the source code: http://www.autohotkey.net/~netfun81/mini%20radial.ahk
This program I call NirCmd Gui:

It is a front-end for NirCmd which is an excellent command line freeware tool.
You can get NirCmd here: http://www.nirsoft.net/utils/nircmd.html
Here is the gui .exe: http://www.autohotkey.net/~netfun81/nircmdgui.exe
Copy to the same folder as NirCmd.exe or copy NirCmd.exe to your windows folder.
Here is the source code: http://www.autohotkey.net/~netfun81/nircmdgui.ahk
Copy to the same folder as NirCmd.exe or copy NirCmd.exe to your windows folder.
This one I call mini Radial:

It appears with middle mouse button under the mouse location and launches my favorite programs.
It uses this graphic: http://www.autohotkey.net/~netfun81/greenorb.png
If you get an error copy URL to address box of browser and paste. Save Graphic to the same folder as the .exe file.
Here is the Exe file: http://www.autohotkey.net/~netfun81/mini radial.exe
Here is the source code: http://www.autohotkey.net/~netfun81/mini%20radial.ahk
This program I call NirCmd Gui:

It is a front-end for NirCmd which is an excellent command line freeware tool.
You can get NirCmd here: http://www.nirsoft.net/utils/nircmd.html
Here is the gui .exe: http://www.autohotkey.net/~netfun81/nircmdgui.exe
Copy to the same folder as NirCmd.exe or copy NirCmd.exe to your windows folder.
Here is the source code: http://www.autohotkey.net/~netfun81/nircmdgui.ahk
Copy to the same folder as NirCmd.exe or copy NirCmd.exe to your windows folder.
Tuesday, November 25, 2008
Arch Linux
It's been awhile again since I last posted. I finally got brave enough to load linux on my new Toshiba Satellite laptop. You know how it goes, when something is brand new you don't want to mess with it too much. Well it only took two months for the new to wear off and for me to feel comfortable installing linux and dual booting with Vista. What distribution did I pick? well you would think I would load Ubuntu since I had no idea if all the hardware was compatable, but since I'm a linux nutcase and never take the easy way out, I decided to install Arch Linux. Arch has become my favorite distribution over the last several months do to its simplicity and great package management. I like to think of it as Slackware with a good package manager that takes care of all the dependencies. However, Arch takes longer for me to install and setup than does Slackware since after installation all you have is core linux. You need to install Xorg, a window manager, firefox, pretty much every application you want.
How did my Toshiba fare? Sweeeeet! All the hardware was recognized. I have intel video, atheros wireless, and realtek audio. All of these are supported by linux. After many hours of installing software and setting everything up, I now have a fast, minimal, Arch setup with DWM as the window manger and Apwal as my launcher. I did have to edit the config.h file before compiling dwm to make it a little more mouse friendly (like close windows with middle click and start apwal with right click on clock).
I have noticed my laptop seems to run cooler running linux over Vista. I think its due to vistas constant thrashing of the hard drive to update its indexing and high memory requirements for the Aero look. I am really happy with Arch and love how easy it is to keep it updated. I find it easier to configure than Debian. Ubuntu and other easy to use distributions are not my cup of tea, since they work well until you need to get to the nuts and bolts and then you find they are messier than they need to be. I am not fond of distributions that are built on other distributions...since you find they sometimes deviate from the way the original distro set things up. Anyway thats all for now...next time I write, everything will probably have changed.
How did my Toshiba fare? Sweeeeet! All the hardware was recognized. I have intel video, atheros wireless, and realtek audio. All of these are supported by linux. After many hours of installing software and setting everything up, I now have a fast, minimal, Arch setup with DWM as the window manger and Apwal as my launcher. I did have to edit the config.h file before compiling dwm to make it a little more mouse friendly (like close windows with middle click and start apwal with right click on clock).
I have noticed my laptop seems to run cooler running linux over Vista. I think its due to vistas constant thrashing of the hard drive to update its indexing and high memory requirements for the Aero look. I am really happy with Arch and love how easy it is to keep it updated. I find it easier to configure than Debian. Ubuntu and other easy to use distributions are not my cup of tea, since they work well until you need to get to the nuts and bolts and then you find they are messier than they need to be. I am not fond of distributions that are built on other distributions...since you find they sometimes deviate from the way the original distro set things up. Anyway thats all for now...next time I write, everything will probably have changed.
Friday, September 19, 2008
Mouse Launch - small launcher for Windows
This is a small launcher program that I made to appear under the mouse pointer when the middle mouse button is clicked. The buttons are labeled with just one letter to keep the size very small.
Here is what it launches:
C: - ccleaner
E: - explorer
F: - firefox
I: - Internet Explorer
T: - task manager
V: - volume control
L: - logoff windows
R: - Restart windows
S: - Shutdown windows
Hotkeys:
Alt-Space: Hide all windows
Alt-X: Show hidden windows
Lctrl-wheelup: Maximize window
Lctrl-wheeldown: Minimize window
Lctrl-Mbutton: Close window
Lctrl-Rbutton: Switch to next open task
Here is the program: http://www.autohotkey.net/~netfun81/mouse%20launch.exe
Here is the source code: http://www.autohotkey.net/~netfun81/mouse%20launch.ahk
Here is a screenshot:
Here is what it launches:
C: - ccleaner
E: - explorer
F: - firefox
I: - Internet Explorer
T: - task manager
V: - volume control
L: - logoff windows
R: - Restart windows
S: - Shutdown windows
Hotkeys:
Alt-Space: Hide all windows
Alt-X: Show hidden windows
Lctrl-wheelup: Maximize window
Lctrl-wheeldown: Minimize window
Lctrl-Mbutton: Close window
Lctrl-Rbutton: Switch to next open task
Here is the program: http://www.autohotkey.net/~netfun81/mouse%20launch.exe
Here is the source code: http://www.autohotkey.net/~netfun81/mouse%20launch.ahk
Here is a screenshot:

Friday, September 12, 2008
KCmenu Vista Launcher
I've created a launcher program for Vista using Autohotkey. It has tabs for each category, shows running tasks, Has a clock and calendar. Has hotkey support for various functions such as controlling volume. It stays hidden in ur taskbar tray until you press the middle mouse button. Has a built in Boss Key for privacy.
This shows the main screen:

This shows the Help tab and some features:
You can download the program here: http://www.autohotkey.net/~netfun81/KCmenu%20Vista.exe
Here is the source code: http://www.autohotkey.net/~netfun81/KCmenu%20Vista.ahk
This shows the main screen:

This shows the Help tab and some features:

Here is the source code: http://www.autohotkey.net/~netfun81/KCmenu%20Vista.ahk
Wednesday, March 26, 2008
Linux update
It's been awhile since my last post. Since then, I have downloaded and tested about 100 linux distributions. My favorites are either based on Debian or Slackware. My all time favorite distribution has become Slackware, mainly because I love how I can so easily compile programs in it (includes most needed libraries) and that it keeps files where they should be (most unix like). Although I read that people think Slackware is hard to configure, i completely disagree. It is so easy to start/stop daemons (cd /etc/rc.d) (chmod -x rc.acpid), or tweak the inittab file to have it boot to a command prompt. It also comes with some great command line utilites that are more reliable than most gui utilities (pkgtool, netconfig, etc). Things just work with Slackware which I can't say for all the other distros. Debian is my second favorite with Ubuntu/Sidux third. Although I love mini distributions (Puppy, Zenwalk, Vector, Wolvix, NimbleX, DSL, etc) they don't work for me long-term because I like to install a lot of software and they are usually missing a lot of libraries and often make it difficult. For someone that doesn't install much, I would recommend Puppy Linux since it boots up and shuts down so fast and is light on memory.
As far as window managers go, Ive tried many from here: http://xwinman.org/ I prefer the light simple ones. Two of the latest I have tried are "Karmen" and "Awesome". I like both but for different reasons. Karmen is simple and doesn't have a config file or root menus so you need to use a launcher app with it. It does show running tasks by right clicking any titlebar or desktop. I like how it looks and its simplicity and stability. It manages windows in a very microsoft kind of way. In contrast, Awesome is a tiling window manager that has full keyboard support. It took me a couple hours of editing the .awesomerc file to get this one to my liking, but I eventually got the thing launching apps with mouse1,3 and Alt-mouse 1,2,3. Moving windows with Win-mouse1, sizing with Win-mouse3, and closing windows with Mouse2. You can really configure most anything with it. There are several other tiling window managers that are fun, such as Xmonad, Ion, and Wmii.
So I guess in summary I have wasted a lot of time loading and configuring software but its something I enjoy, and at times get tired of. I never use windows anymore and still believe Linux to be better due to its security, availability of free software, and configurability.
As far as window managers go, Ive tried many from here: http://xwinman.org/ I prefer the light simple ones. Two of the latest I have tried are "Karmen" and "Awesome". I like both but for different reasons. Karmen is simple and doesn't have a config file or root menus so you need to use a launcher app with it. It does show running tasks by right clicking any titlebar or desktop. I like how it looks and its simplicity and stability. It manages windows in a very microsoft kind of way. In contrast, Awesome is a tiling window manager that has full keyboard support. It took me a couple hours of editing the .awesomerc file to get this one to my liking, but I eventually got the thing launching apps with mouse1,3 and Alt-mouse 1,2,3. Moving windows with Win-mouse1, sizing with Win-mouse3, and closing windows with Mouse2. You can really configure most anything with it. There are several other tiling window managers that are fun, such as Xmonad, Ion, and Wmii.
So I guess in summary I have wasted a lot of time loading and configuring software but its something I enjoy, and at times get tired of. I never use windows anymore and still believe Linux to be better due to its security, availability of free software, and configurability.
Friday, August 24, 2007
Window Managers
Now that I've settled on a Linux distribution, I needed to get it all setup how I like it. The first choice is what window manager to use. I have tried them all (or a majority of them) from Desktop Enviroments like KDE, Gnome, XFCE, to minimal window managers like TWM, CTWM, FVWM, IceWM, Pekwm, Aewm, Fluxbox, Openbox, etc. Which one is the best? well it just depends on what you like. I like resource friendly, fast, and completely configurable. That rules out the desktop enviroments. So which of the minimal ones fit that bill? Several do, but most have annoyances like how the windows are placed or some things can't be configured like mouse operations or titlebar buttons.
So the winner for me, is OpenBox. It gives me everything i need in a window manager. It has good configurability, doesnt force me to use its taskbar or uneeded items, and is resource friendly. Add "apwal" launcher and bind it to the right mouse button and you have a fast light easy to use system.
So the winner for me, is OpenBox. It gives me everything i need in a window manager. It has good configurability, doesnt force me to use its taskbar or uneeded items, and is resource friendly. Add "apwal" launcher and bind it to the right mouse button and you have a fast light easy to use system.
Thursday, August 23, 2007
Linux update
I'm finally done with switching linux distributions. The one I settled with is Debian. Why you ask? For a couple reasons. 1. It just works. It boots fast and is solid and consistent. 2. Some other distributions I tried...including Fedora which I thought was excellent until I discovered that it and others had an issue when running Firefox where the whole OS would slow down. That is unacceptable to me and could be duplicated by visiting download.com. Debian doesn't have this issue.
Ubuntu is widely claimed as the "best distribution", but I disagree. Ubuntu is just Debian with a pretty face and some scars being hid under makeup. One of the main things about Ubuntu that made me wonder is it would ask for the user password when wanting root privileges. Hmmm, Debian asks for the root password. Whom do you trust for security? not to mention Ubuntu uses non-stable repositories, where Debian only uses stable ones unless you add others. There are some other differences, but to make this short Debian is clearly the winner. Ubuntu is only for beginners that don't know anything about Linux and once they learn they most likely will move on.
What makes Linux so great is that you don't have to settle for one distribution. Remember that "Linux" is just the kernal and that the rest of the OS is put together by the makers of the distribution. Sure there are similarities between all distributions but the subtleties are what makes the difference.
Ubuntu is widely claimed as the "best distribution", but I disagree. Ubuntu is just Debian with a pretty face and some scars being hid under makeup. One of the main things about Ubuntu that made me wonder is it would ask for the user password when wanting root privileges. Hmmm, Debian asks for the root password. Whom do you trust for security? not to mention Ubuntu uses non-stable repositories, where Debian only uses stable ones unless you add others. There are some other differences, but to make this short Debian is clearly the winner. Ubuntu is only for beginners that don't know anything about Linux and once they learn they most likely will move on.
What makes Linux so great is that you don't have to settle for one distribution. Remember that "Linux" is just the kernal and that the rest of the OS is put together by the makers of the distribution. Sure there are similarities between all distributions but the subtleties are what makes the difference.
Saturday, August 18, 2007
Linux Distributions
It's been awhile since I posted and I haven't spent much time with windows shells recently because I started using linux again. I originally started to use linux back in the redhat 4.1 days around '95. It was pretty basic back then and a lot of editing files had to be done. It has come a long way since then. I have tried several Linux distributions in the last few months. I started with Ubuntu since I heard it was the "best distribution" and then tried Absolute Linux, PClinuxOS, and Fedora linux. Out of this group I think Fedora wins hands down. It has the best installer of the group and best stability/security. All of the distributions have a lot of gui tools to help with administration tasks and pretty boot loaders, etc. I would rate these distributions in this order: 1. Fedora 2. Ubuntu 3. PClinuxOS 4. Absolute
My first criteria is stability, with the second being the ability to easily add applications, and third is looks. I think both Ubuntu and PClinuxOS were good looking distributions with fancy boot screens and backgrounds. However, they didn't quite live up to their looks when it came to performance and use.
I will probably try more distributions in the future and may change my mind :)
My first criteria is stability, with the second being the ability to easily add applications, and third is looks. I think both Ubuntu and PClinuxOS were good looking distributions with fancy boot screens and backgrounds. However, they didn't quite live up to their looks when it came to performance and use.
I will probably try more distributions in the future and may change my mind :)
Monday, April 24, 2006
Spring Update
Been awhile since I last posted so here is an update. A couple new shells have popped up on the web.
The first one is called Desktop Lite, it uses few resources ~4 meg and contains most of the things you need in a shell, task switching, tray, quicklaunch, access to programs etc. The real beauty of this app is that it is only one .exe file with no configuration...it doesnt get easier than that. Find it here: http://www.nymtec.com/
The second shell and one I find interesting is called Ciliegia, it is a scriptable shell and also light on resources. A bit hard to get started since you have to edit a text file and the documentation is all in Japanese :) but there are some samples to get you there. Just replace the login.scm file with your custom file (tweak the one from the examples folder) and you have a shell running. I really like how the tray is implemented in a popup menu. Find it here: http://nicht.s8.xrea.com/2006/02/ciliegia/
Here's proof that old shells never die :} I have always loved minimal shells.. there was one I liked a long time ago called EVWM, used to use it back in the win95/98 days. I was thinking about it so decided to download it again...was hard to find, but found a site that still had it here:
http://www.skinnables.org/apps.php?section=shells
the thing is it still works fine on XP... sure there are some missing XP tray icons, and the popup menu is loaded statically and not dynamically, also some startup programs dont load..but these are easy things to get around and I found I still like this shell. It is also extremely light in resources ~2-3 meg and just feels light and fast.
There is a lot of concern that the new Windows Vista will kill off the remaining shells being worked on...It might have some impact but I think there are still people like me out there that like changing their desktop and making a more minimal faster experience... At least I hope so :)
The first one is called Desktop Lite, it uses few resources ~4 meg and contains most of the things you need in a shell, task switching, tray, quicklaunch, access to programs etc. The real beauty of this app is that it is only one .exe file with no configuration...it doesnt get easier than that. Find it here: http://www.nymtec.com/
The second shell and one I find interesting is called Ciliegia, it is a scriptable shell and also light on resources. A bit hard to get started since you have to edit a text file and the documentation is all in Japanese :) but there are some samples to get you there. Just replace the login.scm file with your custom file (tweak the one from the examples folder) and you have a shell running. I really like how the tray is implemented in a popup menu. Find it here: http://nicht.s8.xrea.com/2006/02/ciliegia/
Here's proof that old shells never die :} I have always loved minimal shells.. there was one I liked a long time ago called EVWM, used to use it back in the win95/98 days. I was thinking about it so decided to download it again...was hard to find, but found a site that still had it here:
http://www.skinnables.org/apps.php?section=shells
the thing is it still works fine on XP... sure there are some missing XP tray icons, and the popup menu is loaded statically and not dynamically, also some startup programs dont load..but these are easy things to get around and I found I still like this shell. It is also extremely light in resources ~2-3 meg and just feels light and fast.
There is a lot of concern that the new Windows Vista will kill off the remaining shells being worked on...It might have some impact but I think there are still people like me out there that like changing their desktop and making a more minimal faster experience... At least I hope so :)
Subscribe to:
Posts (Atom)