wmutils / contrib

Useful bits and pieces
Other
93 stars 16 forks source link

add: workspace.sh #31

Closed agloo closed 8 years ago

agloo commented 8 years ago

Made a script to handle a workspace idiom by mapping lists of focused windows to files in /tmp/workspaces.

greduan commented 8 years ago

Cool. What mechanism does it use to figure out what workspace to put the current window in? A window doesn't get automatically added to a workspace, does it?

agloo commented 8 years ago

It actually doesn't add any WIDs to any workspaces when a window is created, no. I did this because in testing it seemed like a lot of WIDs were being thrown up that didn't correspond to actual windows I cared about and they were lingering around. Instead, I decided to just save whatever windows are currently mapped (using lsw) to a workspace's list of windows whenever I switch workspaces. In other words, window is put in a workspace implicitly by being mapped to display while /tmp/workspaces/curr contains that workspace's ID. This is nice, since I don't have to worry about regexing over all $NUM_WS workspace files whenever I delete a window. It does introduce the possibility that we drop some windows on switches, but in testing I've found that barring 100-calls/second spamming that isn't really an issue.

z3bra commented 8 years ago

agloo wrote:

Made a script to handle a workspace idiom by mapping lists of focused windows to files in /tmp/workspaces. You can view, comment on, or merge this pull request online at:

https://github.com/wmutils/contrib/pull/31

-- Commit Summary --

  • add: workspace.sh

-- File Changes --

A workspace.sh (100)

-- Patch Links --

https://github.com/wmutils/contrib/pull/31.patch https://github.com/wmutils/contrib/pull/31.diff


You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/wmutils/contrib/pull/31

Could you also include a change to the README, specifying what your script does and how to use it?

Anachron commented 8 years ago

I like this, do you mind updating this? @agloo

agloo commented 8 years ago

Sure, what needs updating? The last commit should have the readme up, and I was waiting on you guys.

z3bra commented 8 years ago

It's on me now, I need to test the script to ensure it works properly

z3bra commented 8 years ago

I didn't expect for it to fail this fast!

$ workspace.sh -i
/home/z3bra/bin/workspace.sh: 22: /home/z3bra/bin/workspace.sh: i: not found
/home/z3bra/bin/workspace.sh: 23: [: Illegal number:
agloo commented 8 years ago

Gah, sorry about the amount of poor bash syntax you've had to sift through! That should be fixed, alongside another bit of poor error handling in move_focused_window.

z3bra commented 8 years ago

Got an other error when moving to an empty workspace:

$ workspace.sh -n
usage: mapw [-h] [-mut <wid> [wid..]]