Sorry if this is duplicate, but my search did not help to answer this.
I need to start screen with vi file1.js in one tab, vi file2.js in other tab, and node myserver.js in the third tab. The first tab should be selected. How to do this?
create screen config file config:
welcome_message off
caption always "%-w%{+b kw}%t%{-}%+w"
screen bash -c "vi server.js"
screen bash -c "vi config.txt"
start screen:
screen -c config
Related
I would like to open xterm from a terminal with the command
xterm
and specify the parameter
allow-send-events(toggle)
set to true (without having to do ctrl+click and set it to True manually once xterm is open)
Yet, reading through the term documentation I can't figure out what argument I have to specify to do this. Could someone kindly point it out?
EDIT
I would also be happy if there is a way to toggle this setting directly in the xterm with a typed command e.g.
xterm > allow-send-events("ON")
Would this be possible?
This command sets the resource allowSendEvents when starting xterm:
xterm -xrm '*allowSendEvents:true'
There also is a menu entry (control-button-one shows the menu).
I'm doing some experiments and while I do it I have to turn a board off and on frequently (a program doesn't get killed properly probably with unclosed socket .. I installed signal handler and it worked and now it doesn't..) . Every time I turn on the board, I start vnc window (it starts xfce4 ) and have to open terminals in specific location. Is there any setup method through which the terminals are open automatically in specific locations? Or further with specific number of tabs? (I know how to give xwindow location and size : xwininfo -all. and use -geometry 1000x1000+300+300 for example).
From what I understand, you could add commands to the application autostart menu in Settings > Session and startup and give the command the working directory as an option as follows:
xfce4-terminal --default-working-directory="/home/$USER/Desktop"
The different options available are:
OPTIONS
Option Summary
Here is a summary of all the options, grouped by type. Explanations are in the following sections.
General Options
-h, --help; -V, --version; --disable-server; --color-table; --default-display=display;
--default-working-directory=directory
Window or Tab Separators
--tab; --window
Tab Options
-x, --execute; -e, --command=command; -T, --title=title; --dynamic-title-mode=mode;
--initial-title=title; --working-directory=directory; -H, --hold; --active-tab;
--color-text=color; --color-bg=color
Window Options
--display=display; --drop-down; --geometry=geometry; --role=role; --startup-id=string; -I,
--icon=icon; --fullscreen; --maximize; --minimize; --show-menubar, --hide-menubar;
--show-borders, --hide-borders; --show-toolbar, --hide-toolbar; --show-scrollbar,
--hide-scrollbar; --font=font; --zoom=zoom
Refer to the man page for more settings related to tabs and windows.
man xfce4-terminal
I'm struggling a little to launch xfce4-terminal from my WSL installation under VcXsrv from a button on the Windows taskbar. I don't want any DOS box/console/terminal other than the xfce4-terminal when I'm done. I have it working, but man is it ugly. Does anybody have a cleaner way of doing this?
Here is what I got working: I created a windows shortcut on the Desktop with this target (all in one line, broken with newlines for readability here):
C:\Windows\System32\wscript.exe
\\wsl$\Ubuntu-20.04\home\peter\bin\windows\startTerminal.vbs
startTerminal.vbs was inspired by from 10 Ways To Run Batch Files Silently And Hide The Console Window • Raymond.CC (one of the few solutions that didn't require installing a separate program for this!) and it contains:
CreateObject("Wscript.Shell").Run "C:\Windows\System32\wsl.exe -u peter --exec /home/peter/bin/windows/startTerminal.sh",0,True
and startTerminal.sh contains:
export DISPLAY=localhost:0.0
xfce4-terminal --command=/bin/zsh
Setting DISPLAY is apparently required, even though I set the DISPLAY environment in ~/.zshrc. wsl.exe apparently doesn't do that unless you run the login shell.
Once all of this is working, I can drag my shortcut to the taskbar and click on it there.
I count 3, three files cooperating to achieve this simple goal? Can I limit that to one or two without installing an external program?
Yes, I think you can do what I do in one shortcut file. I'll share what works for me then you'll have to fiddle for your program.
Try putting all your commands in the Target section of the Shortcut link file.
Step 1. Right click on desktop then New then Shortcut then name it (LaunchXFCE4)
Step 2. Right click LaunchXFCE4 select Properties
Step 3. Enter all your launch sequences in the Target section
Step 4. Right click LaunchXFCE4 select Pin to Taskbar
I'm launching Emacs 27.1 on WSL 2 with Ubuntu 20.10 on Windows 10 using this code which perhaps you can modify.
C:\Windows\System32\wsl.exe --distribution Ubuntu20 bash -c "export DISPLAY=$(ip route | awk '{print $3; exit}'):0 && export LIBGL_ALWAYS_INDIRECT=1 && export XCURSOR_SIZE=16 && setsid emacs"
The first export display is similar to your localhost:0.0 so replace it or try mine. Maybe your xfce4 replaces my emacs. Read this post about double ampersands. So possibly this
C:\Windows\System32\wsl.exe --distribution Ubuntu20 bash -c "export DISPLAY=localhost:0.0 && export LIBGL_ALWAYS_INDIRECT=1 && export XCURSOR_SIZE=16 && setsid xfce4-terminal --command=/bin/zsh"
Note, my VcXsrv starts when windows starts by putting a shortcut to config.xlaunch in my C:\Users\USERNAME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup.
By the way, Microsoft will provide a GUI for WSL in a few months, according to their blog
GUI app support in WSL is becoming a reality! We are getting closer to
an initial preview and happy to announce a preview release for Windows
Insiders within the next couple of months.
I removed the need for a startTerminal.sh file by:
Editing startTerminal.vbs to contain:
CreateObject("Wscript.Shell").Run "C:\Windows\System32\wsl.exe -u peter bash -l -c xfce4-terminal",0,True
And then I created a ~/.bash_profile to set the $DISPLAY variable, which probably should've been done anyway:
$ cat .bash_profile
if [ -z "$DISPLAY" ]; then
export DISPLAY=:0
fi
So now there is the shortcut and a startTerminal.vbs that starts it up. It still isn't very elegant...
One of the few good additions to Windows was WSL-2, it's much more capable now.
It's part of late Win 10 and Win 11.
Here is how to elegently create a terminal window, replace the terminal with any X app you want.
Linux: "apt-get install xfce4-terminal" (or equivalent)
Windows: Create a new Shortcut (right click in any windows folder)
2.1) Shortcut to -> C:\Windows\System32\wslg.exe -u root -- /usr/bin/xfce4-terminal
If you have multiple distributions use it like: "-d Debian"
That's it. You can give it a better icon and name it.
It will launch the application as if it was a windows application.
After experimenting with #Saj 's answer which did not work for me I resulted in the below:
C:\Windows\System32\wsl.exe --distribution Ubuntu-20.04 bash -c "export DISPLAY=$((route.exe print | Select-String 0.0.0.0 | select -first 1) -Split "\s+" | select -Index 4):0.0 && export LIBGL_ALWAYS_INDIRECT=1 && setsid emacs"
Note that my problem was that it could not use bash commands inside the parenthesis (grep, awk)
Environment: WSL2 on Windows 10
I would like to open all my useful stuff like here in iTerm2:
Not like this:
I'm using tmuxinator I've defined some tabs. I wonder if it's possible to get the former behaviour at all.
I just tried with tmux 1.8. Not totally obvious, but it works.
Here's what you do:
Open iTerm2 (latest, be sure to have at least tmux 1.8 installed).
In iTerm2, run command tmux <your tmuxinator profile>. Then detach ^b d.
In iTerm2, run command tmux -CC attach -t <your session>. You will see your tabs open in different windows.
Open menu Shell->Tmux->Dashboard
Select and hide all the windows.
Select all the hidden windows, and click Open in Tabs.
I'd like to know how to avoid the part about hiding and opening in tabs.
Just wanted to add some comments onto what justingordon mentioned (1).
This all works great. But I found how to streamline step 4-6 so it happens automatically.
Go to iTerm2's Preferences, under General, you will see a section titled tmux. There's an option that says When attaching, open unrecognized windows in. If you change the current selection from Windows to Tabs.
Two extra tips.
If you want you could select the option Automatically hide the tmux client session after connection. This will minimize the iTerm2 window in which you typed
tmux -CC attach
I also enabled the option Focus follows mouse. You can find this option under Preferences then Pointer. It should be the first option on the bottom left.
To use tmuxinator with iterm2 panes, use the following configuration:
attach: false
in combination with
on_project_exit:
- tmux -CC attach -t way
It looks like an issue in the documentations as told here
This is an example that I normally use:
# ~/.tmuxinator/way.yml
name: way
root: ~/learn/ruby/ruby-way/
attach: false
on_project_exit:
- tmux -CC attach -t way
# Runs before everything. Use it to start daemons etc.
on_project_start:
- export EDITOR="emacsclient --server-file=way -c"
- export VISUAL=$EDITOR
- emacs --daemon=way --title=RUBY-WAY
- $EDITOR &
windows:
- console:
- echo "A currar"
- testing:
- echo "A testear"
I hope that this helps.
Add this to your tmuxinator config:
attach: false
post: tmux -CC attach
https://github.com/tmuxinator/tmuxinator/pull/293
Is there way to set terminator (Version: 0.95ppa1) title of tabs to a different string via bash command-line (CLI)?
I plan to use this feature with AutoKey and I can open multiple machines at same time and set title to Name of the machine its connected to.
ORIG=$PS1
TITLE="\e]2;\"This is just crazy enough to work\"\a"
PS1=${ORIG}${TITLE}
Resets title to
"This is just crazy enough to work"
This should apply to all xterm-style terminal emulators.
From the Terminator man pages,
Ctrl+Alt+W
Rename window title.
Ctrl+Alt+A
Rename tab title.
Ctrl+Alt+X
Rename terminal title.
You can also launch a new instance with
$ terminator --title [title]
Add follwing in your .bashrc file by editing it using vim ~/.bashrc and use set_title to rename your tab:
set_title()
{
ORIG=$PS1
TITLE="\e]2;$*\a"
PS1=${ORIG}${TITLE}
}
run source ~/.bashrc command after editing your .bashrc file
Ex.: set_title newtab will rename your current tab to newtab
working Properly in Gnome3.14 terminal and terminator 0.97
On Terminator 1.91-6 double click terminal title enables edition
PS1 does not need to be set. Credit for this function goes to geirha on freenode #bash
set_title() { printf '\e]2;%s\a' "$*"; }
This seems to work for me. I'm using BASH on Crunchbang (Debian derived)
$ echo -en '\e]0;echo works too\a'
With Terminator 0.96 and GNU bash 4.2.25 the printf suggestion above worked for me, but I had to tweak it slightly to make it into a function that would just work for me in a new Terminator tab. I added this to the end of my ~/.bashrc file:
set_title() { printf "\e]2;$*\a"; }
The key was placing the \a at the end of the quoted string. Then when opening a new tab in Terminator I can use this like so:
set_title "My new tab title"
Apologies to those who already stated the essentials of this answer, but since I found that I had to make slight changes to get it to work for me, this my also benefit someone else.
Try add PROMPT_COMMAND='echo -en "\033]0; $("pwd") \a"' in your .bashrc
For terminator 0.98 (Ubuntu 16.04 MATE), right clicking the title enables renaming it.
Right click on terminator and choose preferences from the drop-down menu. Choose profiles tab and enable "show title bar" option. It works!!
Tip: You can actually rename each terminator window!!