GithubHelp home page GithubHelp logo

Comments (4)

stilvoid avatar stilvoid commented on May 25, 2024

:+1: for this. I often want to windows arrange with one long window on the left with the right split vertically, like:

 _____
|  |  |
|  |__|
|  |  |
|__|__|

And it would be great to be able to do this before I need to start manually arranging frames.

from herbstluftwm.

ypnos avatar ypnos commented on May 25, 2024

I second this.

from herbstluftwm.

bklaase avatar bklaase commented on May 25, 2024

I would love this as well.

from herbstluftwm.

xxxserxxx avatar xxxserxxx commented on May 25, 2024

This depends on ripgrep, because it's what I've been using and I'm too lazy to convert it to sed/awk. It's only used in one place, and it is the only dependency that isn't POSIX (aside from herbstclient, which should be obvious).

#!/bin/bash
# NAME: hlwm_rotate.sh
# SYNOPSIS: Rotate the clients clockwise
#   The script dumps the current layout, swaps out the client IDs,
#   and loads the results; this effectively rotates the clients
#   clockwise in the current layout. If set executable, the script 
#   can be bound to a key. E.g.:
#     herbstclient keybind Mod4+Control+r spawn ${HOME}/hlwm_rotate.sh
# AUTHOR: Sean E. Russell <[email protected]>
# REVISION: v0.0.1
# DATE: 2023-06-15

# Get the currently focused client, so we can re-focus it after rotation
focused=$(herbstclient list_clients --frame=@)

# Get the list of clients
dump=$(herbstclient dump)
clients=($(<<<$dump rg -o '\(clients[^)]+(0x\w+)\)' -r '$1'))

# Rotate the clients IDs in the dump
# First, rename all of the client IDs
rotated=$dump
maxidx=$(expr ${#clients[@]} - 1)
for i in $(seq 0 $maxidx); do
  rotated=$(<<<$rotated sed "s/${clients[$i]}/X${i}X/")
done
# Next, replace the renames with the rotated values
rotvalues=("${clients[@]: -1}" "${clients[@]:0:${#clients[@]}-1}")
for i in $(seq 0 $maxidx); do
  rotated=$(<<<$rotated sed "s/X${i}X/${rotvalues[$i]}/")
done

# Load the dump
herbstclient load "$rotated"
herbstclient jumpto $focused

from herbstluftwm.

Related Issues (20)

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.