Giter VIP home page Giter VIP logo

Comments (7)

APotOfSoup avatar APotOfSoup commented on June 10, 2024 1

Short form:

  • I found another issue about sendtomouse during program launch. I did a bad temp fix that reduces performance.
  • I fixed a focusing issue that only happens with my force option
  • I reduced total i3get's used when renaming the window
  • I uploaded the full fill down near the bottom of this post
  • I may have found some stuff broken in i3get options ( specifically when using -n 'container id' -r f )
  • Thanks for the i3term example

LONG FORM

I probably am just creating an issue that doesn't exist with all this but I did actually get it figured out now.

I've only been using linux again for about 2 weeks now so I have a lot to figure out; Before I used linux mint with KDE so it's a big departure for me to move to arch and i3. Your videos are one of the biggest reason I decided to take this seriously again haha

I am currently using Termite but haven't actually settled on an terminal yet. I tried URvxt out at first and did enjoy it but am still testing things out.

I do agree with the solution you use to rename every window that we launch and I do that myself but I've noticed one issue with how focus will be designated when the instances renamed with successive i3run's.

I know you never intended for i3run to launch multiple windows with specific instance or class names but I did have my reasons to try this.

Termite doesn't have a command line option to change the class or instance name. It does have the ability to change the window title but decided against using that as I wasn't sure it would work in the long run.

I was having trouble getting xdotool to work at first but now see that I need to supply the window id and not the container id.

I originally added the --force option to i3run because I was having all that trouble and thought it would be easy to throw in a || statement and get i3run to launch the command even if a window with that name already exists.

That may seem silly but do see value in it in situations like I am using it.

For example I have my terminal commands set up very similar to what I seen in your old config files I found. The first line is the one that has the force command. It will always lay down a terminal in the currently focused container. Nothing special.

$super+Control+Return 	$exe i3run -f -i tiledterm -x termite -e termite
$super+$alt+Return 	$exe i3run -s -i floatterm -x termite -e termite 
$super+Shift+Return 	$exe i3run -i topterm -x termite -e termite
$super+Return 		$exe i3run -i cornterm -x termite -e termite

With urxvt the name could be set on that line quite easy, and I'm sure I could do it with xdotool quite easy now as well, all without i3run; But now with the change I've made that --force flag and the already included '--rename' is all that is needed to launch any number of programs with specific class or instance names, even if the user is like me and couldn't figure out how to rename a terminal themselves haha

At first the --force flag was just a quick way to get the main function to always run. After adding it to the getopts stuff the only real change I made at first was one line in the main function.

  if (( $nowin==1 )) || [[ -n ${__o[force]} ]]; then
    launchcommand
  else
    focuswindow
  fi

Now i3run -f -i mynamedinstance -x 'some_instance' -e 'some_command' will just keep running the -e command and renaming every single instance that was created like I wanted.

That was great! I thought I added a good feature that might help others.

Until using it for a couple hours I figured out that I created a new issue because it would consistently focus a different instance then the newly created one.

This is why I asked about making i3get look for the newest instance so I could make sure the i3run command would focus the newest instance.

I figure out now that I could solve this a much simpler way.

I made the i3get that is run during the rename section of launchcommand store the results into a array. I made it return both the container id and the window id so I could use those pointers in i3-msg or xdotool respectively. This one will always be the newest instance because it returns the results before renaming it.

Now I just added a check to the line to set i3list[TWC] to either the container id that we already found or run the i3get that finds the container id with the acri array.

That was all the important changes to get this working as I wanted.

I made a couple more change that actually fixes the send to mouse command when it's ran during the launchcommand section.

i3list[TWF] is never set before attempting to use it in a check
Because of this I moved the eval i3list outside that check and changed the options like this eval "$(i3list -n "${i3list[TWC]}")".

I know that we do not need the full list unless we are actually running the sendtomouse function but I was just testing i3get and I think it might be broken with certain -r options like f. I'm just about to investigate that haha I am pretty positive I have the current i3get that you put up recently.

I'll post the whole i3run as I have it so you can have a look over it. I know you'll have no need of the changes I've made yourself but I think there is technically a performance improvement when renaming as it would no longer run another an extra i3get.

i3run.txt

I know there is also performance drop moving the i3list to always run and will probably remove that personally as I don't have current plans to actually us it, but I did identify that it was broken and looked into a fix lol

from i3ass.

APotOfSoup avatar APotOfSoup commented on June 10, 2024

I just noticed that what i did only works properly when its tabbed or stacked. If they are in a split either way I'm getting some weird interactions.

So say i have a

AB
CD

setup and I have C in a splith layout and I run i3flip --move n it changes the splits to a splitv or something weird

from i3ass.

budRich avatar budRich commented on June 10, 2024

big ups for this report. I will try to fix this tomorrow. Regarding, thunaropen and foldermen. I am currently making a series on youtube about how i have customized thunar, and both those scripts will get recreated in that series. i3term is just a wrapper for i3run that starts urxvt with a specific app and or instance name. I used to have it public but got a lot of issue reports on it... i can see if i cant dig it up for you. foldermen was btw just a i3menu(rofi) menu with directories, the selected directory got passed as an argument to thunaropen, which, yeah opened the directory.

keep an eye on this repo for the thunar scripts:
https://github.com/budlabs/youtube/tree/master/thunar
i thought i would release one part every day, and i guess it will be at least 15 parts...

from i3ass.

APotOfSoup avatar APotOfSoup commented on June 10, 2024

Thanks, I saw your thunar videos and am excited for the folder specific view handling you have set up.

And I'm just going along trying to figure out anything that doesn't seem to be working properly in i3fyra so I'll keep reporting with what I find.

I won't submit a new issue but I added a --force flag to i3run that will run the -e command and still handle renaming is found so I could rename several instances of the same program for cases like opening multiple terminals in the focus container. I don't know if you already had a way to do this but it really simplified renaming programs for me as I couldn't figure out xdotool very well yet.

I'm sure you can figure out how to do it but just ask if you want me to post my changes

EDIT: I do think this might be a good feature to include as it brings more control over windows to i3ass but I've just noticed with some more testing that the changes I've made to i3run to force the launch command it will always focus the first window of that name or instance, I am going to try and change i3run or add something like a --reverse flag to i3get or i3list to find the newest instance. I don't know if that is feasible yet as awk is really difficult for me so far

from i3ass.

budRich avatar budRich commented on June 10, 2024

i am not sure i follow how you set up the --force option. And yes the last focused window is the one that will be renamed if there are multiple matches. I don't think that the creation order of the windows is available in the output of i3-msg -t get_tree which is what i use in i3list, and in turn i3run to rename the windows. There might be a way though, by instead using the window id ([id] instead of [con_id], i3 language) to figure out which the newest window is.

But if your issue with renaming multiple windows is what i think it is, the solution (what i use myself) is to rename every window, so fi. thunar, the only time a window with the class name Thunar exist, it is before it is renamed, by doing this, targeting ^Thunar$ when renaming will always point to the new unrenamed window.

Also terminals. I don't know which terminal emulator you use. But with URxvt, you can rename the instance name directly when executing the URxvt command, this is much faster and reliable then using i3run/xdotool:

# this will create a urxvt window with the instance 'htop' (-name) with the command htop (-e) running
urxvt -name htop -e htop

# to use i3fyra (to get the run/raise/minimize goodies it could be written like this
i3run --instance htop --rename urxvt --command 'urxvt -e htop'

# that would however be:
# 1. slower
# 2. have the issue you describe, 
# not always renaming the right window if more then one urxvt window with the instance name urxvt exist.

# so to get the best out of two worlds use the one below:
i3run --instance htop --command 'urxvt -name htop -e htop'

# a simple version of i3term could look something like this:
i3term() {
  prg="$1"
  termcommand="urxvt -name $prg -e \"$prg\""
  runcommand="i3run --instance '$prg' --command '$termcommand'"
  eval "${runcommand}"
}

from i3ass.

budRich avatar budRich commented on June 10, 2024

wow! Now i understands the --force option in i3run completely and i think we should implement it. And yes, i kind of rushed the latest change of i3get (to make it work in the video where i rename thunar), it is quite important that i3get is working properly so i will put this at the top of the list.

I will also break this issue into three:
[i3flip]
[i3run] add force flag (feature request)
[i3get] issues, with print.

I have also been thinking about a complete reorganization of the i3ass project, so it will be easier to contribute and maintain, and breaking all the scripts in to individiual dev repos, by doing so it will be much easier to track changes and navigate commit history of individual scripts. I think today, will be a good day for that.

from i3ass.

budRich avatar budRich commented on June 10, 2024

i fixed the option parsing (so move works), but i decided to temporarily disable moving for containers other then tabbed or stacked. i will close this issue, and open a new one specific to that. see: https://github.com/i3ass-dev/i3flip/pull/1

from i3ass.

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.