Giter VIP home page Giter VIP logo

alfred2-layout's Introduction

!!!Looking for new owner/maintainer!!!

I kind of gave up on Apple as they no longer provide the Hardware I want/need and switched to Linux which already has several very powerful tiling window-managers (i3, xmonad, awesome ...).

I'll do my best to maintain this project for the time being. But since I no longer actively use it myself bug-fixing will be somewhat slow.

Alfred 2 layout workflow

A simple window layouter based on an Alfred 2 workflow.

Installation

Experimental

Also via Packal:

Description

The workflow itself is quite simple just typ in the keyword "lay" (or chose another of your liking) followed by:

  • full = Maximize
  • left, right, top, bottom = Halves of screen
  • topleft, topright, bottomleft, bottomright = Quaters of screen
  • center = Center of screen (with 10% border)
  • 11,12,13,21,22,23,31,32,33 = Thrids of screen
  • 11-12,11-13,11-21,11-22 ... = Some other sizes based on thrids
  • togglefullscreen = Toggle full screen mode of active window (if possible)
  • movecenter = Move window to center of screen (no resize)
  • movetopleft, movetopright, movebottomleft, movebottomright = Move window to edges of screen (no resize)
  • grow, shrink = resize window by 1/6 of screen size with sticky screen edges
  • ... well the script is quite flexible, so I'm waiting for suggestions

It is multi-screen-able. Even though you cannot move windows from one screen to another (yet?) the scripts tries to figure out with screen you mean (depending on the size of the visible area).

Additional notes for the Mavericks version

The Mavericks version now additionally support the "layother" keyword that moves and layout the current window to the other/next screen.

Examples:

  • layother full = Move the current window to the other screen full size
  • layother topleft = Move the current window to the top-left quarter of the other screen
  • ... and so on

Screenshots

Screenshot1 Screenshot2

Implementation notes

  • The script is written in python using PyObjC and the ScriptingBridge. This should be no problem as both is shiped as part of MacOS since 10.5.
  • It the application supports scripting, the window is moved "directly". Unluckily some Applications do not support this, so there is a fallback using "SystemEvents". his workflow only works if Alfred is included in the list of Accessibility applications, which can be found under System Preferences > Security & Privacy > Privacy > Accessibility (in previous MaxOS Versions this was done via Graphic User Interface (GUI) Scripting)
  • At the moment there are no hotkeys defined, which should be straight forward though ...

Hacking

If you are keen on adventures feel free to tweak the workflow any way you like. As a starter refer to the following wiki pages:

Also take a look at the corresponding thread on the Alfred forums: http://www.alfredforum.com/topic/3154-yet-another-window-layout-workflow

Licence

MIT Licence

alfred2-layout's People

Contributors

benziahamed avatar leyyinad avatar omriza avatar untoldwind avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

alfred2-layout's Issues

Move between displays

I know you mentioned that the workflow can't do this (yet) in your readme, but I wanted to add it as an official feature request. :)

seems alfred3's layout workflows not working after upgrade to MacOS Sierra

Hey, I realized that all the actions in alfred2-layout couldn't work properly after my OS update from OSX EI Capitan to OSX Sierra.

I've tried other similar workflows and found alfred3 cannot operate any window resize actions.
div and layouts v2.0

I noticed this shouldn't be the truth since someone has discussed about this.
#12 #13 #15

And I'm sure I've enable Alfred 3 in System's privacy settings.

image

I've tried disable it and re-enable it. I've tried uninstall alfred3 and re-install it, but not working still.

I open the debug info.
The action will be run by my self-defined trigger key, debug info like below.

[2017-05-14 15:34:09][trigger.hotkey] Processing output of 'action.script' with arg 'fullscreen:toggle'

but nothing happens.

And when I leave the debug window alone and say surf the internet for a while and get back to the debug info, it reveals some error info like below.

[2017-05-14 15:35:36][ERROR: action.script] given is experimental at layout.pl line 274.
when is experimental at layout.pl line 275.
when is experimental at layout.pl line 281.
when is experimental at layout.pl line 291.
when is experimental at layout.pl line 311.
when is experimental at layout.pl line 349.
when is experimental at layout.pl line 373.
Can't call method "attributes" on unblessed reference at layout.pl line 148.
[2017-05-14 15:37:37][ERROR: action.script] given is experimental at layout.pl line 274.
when is experimental at layout.pl line 275.
when is experimental at layout.pl line 281.
when is experimental at layout.pl line 291.
when is experimental at layout.pl line 311.
when is experimental at layout.pl line 349.
when is experimental at layout.pl line 373.
Can't call method "attributes" on unblessed reference at layout.pl line 148.
[2017-05-14 15:39:37][ERROR: action.script] given is experimental at layout.pl line 274.
when is experimental at layout.pl line 275.
when is experimental at layout.pl line 281.
when is experimental at layout.pl line 291.
when is experimental at layout.pl line 311.
when is experimental at layout.pl line 349.
when is experimental at layout.pl line 373.
Can't call method "attributes" on unblessed reference at layout.pl line 148.

Any idea?

Thanks for reading.

Can not run on macos mojave...

Below is Error Message. I've tried to fix, but not familiar with Perl and macos's System Event.

[2018-09-27 16:24:26][ERROR: action.script] given is experimental at layout.pl line 274.
when is experimental at layout.pl line 275.
when is experimental at layout.pl line 281.
when is experimental at layout.pl line 289.
when is experimental at layout.pl line 299.
when is experimental at layout.pl line 319.
when is experimental at layout.pl line 357.
when is experimental at layout.pl line 381.
**** ERROR **** PerlObjCBridge:: sendObjcMessage: Can't get NSMethodSignature for message "get"
**** ERROR **** PerlObjCBridge: error [1] sending message [NSObject get] at /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level/PerlObjCBridge.pm line 248.

Lay Full - doesn’t handle dock on the right side

Hello,

I have an external monitor connected with my laptop. When I remove my external connection, my browser is resized correctly to my monitor. However, the browser is also visible below my dock, which is placed on the right side of the monitor.

When I choose "Lay Full", it doesn’t resize correctly and my browser is still behind the dock. However, when I try "Lay Left", and then "Lay Full", then the browser is correctly set with the dock being transparent.

Hope, the bug report is clear.

error when using script, debug info inside

Hi,

I get the following output on a new mac

Starting debug for 'Layout'

[2017-04-08 14:38:04][ERROR: action.script] given is experimental at layout.pl line 274.
when is experimental at layout.pl line 275.
when is experimental at layout.pl line 281.
when is experimental at layout.pl line 289.
when is experimental at layout.pl line 299.
when is experimental at layout.pl line 319.
when is experimental at layout.pl line 357.
when is experimental at layout.pl line 381.
2017-04-08 14:38:04.388 perl5.18[8461:428656] Can't find app with identifier com.apple.systemevents
Can't call method "processes" on unblessed reference at layout.pl line 232.

What could be wrong ? Anyone know ?

Not work in 10.10.5

Thanks for wrote this tool! 👍

But it not works in my mac with OSX version 10.10.5, and alfred2-layout version 1.2/1.3

Below is detail info:

  1. When debug in alfred, it says:
    Can't call method "position" on unblessed reference at layout.pl line 229

  2. There's error in syslog:

    AppleEvents: Send port for process has no send right, port=( port:16911/0x420f rcv:1,send:0,d:0 limit:5) (findOrCreate()/AEMachUtils.cp #526) com.apple.main-thread
    
  3. I found that findMainWindow returns a SCALAR(SCALAR(0x7fa5120089c0)) but not a reference.

I don't know how to fix it. Can you help to fix this issue?

Wrong path for layouts.yaml

I was trying to add some new layouts by editing layouts.yaml in the workflow path.
When testing the new layouts I saw that this file is never being read by the layout_select.pl script.
Only then I figured out that there's a keyword for that purpose (lay_config), but yet, when using Alfred3, this keyword's logic will create the files in a wrong path (which will still work, but won't be as nice).

Absolute paths for files, like in this line from lay_config bash script:
if [ ! -d ~/Library/Application\ Support/Alfred\ 2/Workflow\ Data/de.leanovate.alfred.layout ]; then
Makes the target files being created in wrong paths for Alfred3 users.
In addition, layout_select.pl uses this same absolute path to load custom layouts.

This issue can be easily fixed by using relative paths, Alfred runs embedded scripts from the main workflow path so ./Data/de.leanovate.alfred.layout/layouts.yaml will suite the case.

Thanks for this very useful workflow!

Move window to another screen

As title, can we add such feature to allow user move certain application's window to another screen?
It is really useful when using multiple monitors.
Thanks.

El Capitan

The windows do not span on the whole screen, when the automatic hiding of the menu bar is on. When using multiple displays, this seems to affect only the main one. On the other screen the windows are maximized properly.

Not work in 10.11.4

* I got exception when i debug it*

Starting debug for 'Layout'

[ERROR: alfred.workflow.action.script] given is experimental at layout.pl line 274.
when is experimental at layout.pl line 275.
when is experimental at layout.pl line 281.
when is experimental at layout.pl line 291.
when is experimental at layout.pl line 311.
when is experimental at layout.pl line 349.
when is experimental at layout.pl line 373.
Can't call method "position" on unblessed reference at layout.pl line 247.

Build docs

Are there docs about how to build the src into a workflow? Maybe I just didn't search enough?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.