X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=i3-split-push;h=f78ca9acde1dec0cbe5240d22a0bd754bbf1386e;hb=refs%2Fheads%2Fmaster;hp=a9f76e52afece96693ddfb3b876b0d56d289de76;hpb=dab96f8fa4c701db13ba734fa0c07b5d12fc8fae;p=distro-setup diff --git a/i3-split-push b/i3-split-push index a9f76e5..c760738 100755 --- a/i3-split-push +++ b/i3-split-push @@ -1,5 +1,27 @@ #!/usr/bin/python3 +# I, Ian Kelling, follow the GNU license recommendations at +# https://www.gnu.org/licenses/license-recommendations.en.html. They +# recommend that small programs, < 300 lines, be licensed under the +# Apache License 2.0. This file contains or is part of one or more small +# programs. If a small program grows beyond 300 lines, I plan to change +# to a recommended GPL license. + +# Copyright 2024 Ian Kelling + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + # There are only 2 cases where I want single window split containers. # # * just before creating a new window in it. @@ -14,7 +36,8 @@ # direction to move the current window. Since we have a hook that erases # all single window split containers on focus change, we can consider a # single window split container to indicate the split we want. - +# +# import sys from i3ipc import Connection, Event # for debugging @@ -53,13 +76,13 @@ def set_layout(i3): layout = parent.layout if (parent and gp and len(parent.nodes) == 1): - i3.command('focus ' + direction) - exists = False if os.path.exists('/tmp/iank-i3-no-auto'): exists = True else: open('/tmp/iank-i3-no-auto', 'a') + i3.command('focus ' + direction) + if (layout == 'splith'): i3.command('split horizontal') @@ -77,7 +100,6 @@ def set_layout(i3): i3.command('move ' + direction) - def main(): i3 = Connection() set_layout(i3)