My current setup: I work in tmux (similar to GNU screen) on a server. I reattach to the session with `tmux a`, and detach with ctrl-b-d. This preserves my tmux windows between ssh sessions, and this captures my state of work where I stopped some code open, commands running, etc. I have command history and "go back" accessible in vim and my command panes. I find this is the best way to jump back in. I reboot weekly, after which I have to re-arrange my work area, but once a week is OK.
I find tmux much more effective for this than just arranging windows on my laptop, because ALL the tmux panes are work related, as opposed to windows on the desktop which get littered with email, websites, calendar, chats, etc. This is mentally hygienic for my productivity -- the terminal is where work happens similarly to how the bed is where sleep happens, so it is easy to get back into the flow based on the context.
I don't feel as productive and lose context a lot more when I had to load up an IDE each morning. If you have to use an IDE, I would recommend leaving it on overnight by hibernating the machine or similar, so you have all your code arranged, breakpoints set, navigation history/undo history etc. This helps me remember where I'm at when I start again in the morning. I'll even often leave the debugger at a breakpoint! I also recommend using the terminal within your IDE if it does not suck (I know it does suck in some IDEs). This allows you to keep all programming operations in one context similar to tmux.
You may want to have a look at Tmux resurrect[0]