sublimehq / sublime_text

Issue tracker for Sublime Text
https://www.sublimetext.com
807 stars 39 forks source link

open Settings split as Rows on rotated screens #2862

Open pdknsk opened 5 years ago

pdknsk commented 5 years ago

This has been bothering me for quite a while, ever since settings open in their own window, split into columns. On a rotated screen, this is completely unusable, and has to be manually changed to Layout Single or Rows every time. It should be trivial to detect a screen with Height > Width and adjust accordingly. (Personally I'd rather have settings always open as tabs in the current window, but that's a separate issue.)

keith-hall commented 5 years ago

see also https://github.com/SublimeTextIssues/Core/issues/1329 I guess it would be useful for you to learn how to write plugins, so you could achieve this yourself and share your solution for others whom might have the same workflows/screen orientations

kaste commented 5 years ago

You can try the following code

import sublime
import sublime_plugin

class KeyboardSettingsListener(sublime_plugin.EventListener):
    def on_activated(self, view):
        if view.settings().get('edit_settings_view'):
            x, y = view.viewport_extent()
            if x < y:
                self.action(view.window())

    def action(self, window):
        window.run_command(
            "set_layout",
            {
                "cols": [0.0, 1.0],
                "rows": [0.0, 0.5, 1.0],
                "cells": [[0, 0, 1, 1], [0, 1, 1, 2]],
            },
        )