Как создать ярлык в Windows для запуска Urxvt с Cygwin bash, но также с некоторыми опциями заранее?

995
dar

Запутанный заголовок, я знаю. Вот проблема:

Чтобы запустить Urxvt таким образом, чтобы мои расширения работали, я бы открыл Cygwin и использовал, export DISPLAY=:0а затем urxvt. Если я запускаю urxvt только urxvtтогда, различные расширения, такие как буфер обмена, не работают, поскольку исходное окно Cygwin, из которого я запустил urxvt, получает входные данные расширения (именно поэтому export DISPLAY=:0это важно.

Было неприятно открывать Cygwin каждый раз, когда я хотел запустить окно Urxvt, поэтому я изменил свой Cygwin.bat из этого:

@echo off C: chdir C:\cygwin64\bin bash --login -i 

чтобы запустить Urxvt в качестве моего эмулятора терминала по умолчанию:

@echo off C: chdir C:\cygwin64\bin urxvt -e /bin/bash --login -i 

И он отлично работал для запуска Urxvt без необходимости открывать какие-либо другие окна, но единственная проблема заключается в том, что мои расширения не работают, так как я, очевидно, не включил что- set DISPLAY=:0то в процесс до запуска Urxvt.

Итак, мой вопрос, как я могу создать ярлык, который запускает Urxvt, но также предваряет запуск set DISPLAY=0?

1

1 ответ на вопрос

0
DavidPostill

How can I create a shortcut that launches Urxvt with set DISPLAY=0?

Add the following to ~/.bashrc:

export DISPLAY=:0 

Note:

  • DISPLAY should be set to :0 not 0

Making Permanent Environment Variables:

Environment variables are variables that any command, program, or script can access. If a variable is set in a script, only that script can use it. If a user creates a variable in a terminal, the variable can only be used in that terminal until it closes. Then, the variable is gone forever. Users can make permanent environment variables by putting them in the file ~/.bashrc. This file contains functions and variables that the shell sets up when the user opens a terminal. Because the file is in the user's home folder, only that user can access the data that is created from that file. Users may put aliases in here instead of the alias file. The bashrc file loads the alias file into itself. Users typically put their aliases in the alias file, but this is not required.

To create a permanent environment variable, open ~/.bashrc in a preferred text editor. If a user wanted to make a variable that contained the uppercase Greek alphabet, they would set this variable assignment with the other variables being set in this file. To prevent an accidental code mess up in this file, put the new variable at the very end of the file.

Source Customize BASH