Comments (12)
Hey. Thanks for the suggestion. What do you mean by an expected session name?
Am I correct, that you want to allow smug stop
, which will terminate the current tmux session?
from smug.
Yes, exactly. Stop without arguments would kill the current session, along with any stop hooks defined.
You'd have to loop over the files in the config and find if any have the tmux session name matching the one you're in, based on my cursory investigation, since the name of the smug config file doesn't always match the tmux session it creates.
from smug.
Looping file content doesn't sound like a great idea, probably will be very slow if you have many files. I'll think about what's the best here.
from smug.
It's the only way I've been able to consider doing it so far, given that there's no way to look up a file by it's tmux session name, a field in the file.
from smug.
I have a PR half done, I can push it for you to check out if you're curious
from smug.
I've added this feature. However, it will only work if the session name is the same as the project name. Maybe I will change it when I have a better solution than iterating all files.
from smug.
Thanks!
Would you be open to a solution that iterates the files, but only after not finding one by project name?
I make heavy use of longer tmux session names, and short project names, and really there's no way to do it without either iterating them, or building some sort of out of band index.
However, it seems it could be acceptable if you know you're using the slower method, as the slower method would still be faster than having to type out the entire thing, and after failing to succeed in the faster method.
Thoughts?
from smug.
I don't mind that it's slow, but I also don't want to add a lot of new functionality right now, because I'm planning a refactoring. I'll keep it open and think about this.
from smug.
I have an idea!
Would it be possible to add $SMUG_SESSION_NAME
, $SMUG_SESSION_CONFIG_PATH
or something similar into all smug sessions when they start? That way, if you're running smug from within a tmux session, it can be aware of what config file generated the session, without needing to reverse engineer the config file from just the tmux session name, which as discussed would involve iterating over files.
I could try and throw a PR your way if you're interested in something along these lines.
Thoughts?
from smug.
Very good idea. Feel free to create a PR.
from smug.
Ok, check out PR #92 - I added an initial implementation that has been working for me.
from smug.
Thanks, @benyanke! I have adapted it and merged #95
from smug.
Related Issues (20)
- Support smug - donate to Ukrainian Army πΊπ¦ HOT 1
- Cannot open manual window with latest smug version HOT 4
- NixOS Package update
- Use default `.smug.yml` file when project param is empty
- features: swich new project HOT 3
- [BUG] error in arch as well as github installation HOT 4
- Support passing args HOT 5
- Error with 6 panels HOT 2
- smug list displays all files in .config/smug as projects HOT 1
- Request - Add to Homebrew HOT 5
- arm64 build HOT 1
- -i flag opens new sessions HOT 3
- Request for `-L` option HOT 5
- Name Conflict Resolution HOT 3
- [Question] How would I go about using variables from a .env file ? HOT 3
- [feature request] ready-command HOT 2
- Allow to group projects into directories
- Allow tmux-style short commands HOT 4
- Running smug list fails when no tmux is running HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from smug.