“UbuntuHelp:TransparentTerminals”的版本间的差异
来自Ubuntu中文
小 |
小 |
||
第10行: | 第10行: | ||
'''2.''' Install the package with dpkg | '''2.''' Install the package with dpkg | ||
<pre><nowiki> | <pre><nowiki> | ||
− | sudo dpkg -i /path/to/file/alltray.ubuntu_0.60-1_i386.deb | + | sudo dpkg -i /path/to/file/alltray.ubuntu_0.60-1_i386.deb |
</nowiki></pre> | </nowiki></pre> | ||
'''3.''' Set up a new profile in gnome-terminal by hitting Edit / Profiles / New. I'll name it "tterm" here, you can name it whatever you like, but keep in mind that I'll refer to it as "tterm" in all commands in this howto. Edit the profile with the following options: uncheck the "Show menubar by default in new terminals" option in the "General" tab, in the "Effects" tab choose "Transparent Background" and set transparency level as you like, and in the "Scrolling" tab disable the scrollbar. | '''3.''' Set up a new profile in gnome-terminal by hitting Edit / Profiles / New. I'll name it "tterm" here, you can name it whatever you like, but keep in mind that I'll refer to it as "tterm" in all commands in this howto. Edit the profile with the following options: uncheck the "Show menubar by default in new terminals" option in the "General" tab, in the "Effects" tab choose "Transparent Background" and set transparency level as you like, and in the "Scrolling" tab disable the scrollbar. | ||
'''4.''' Now we'll determine the exact coordinates where your terminal will appear. To do this, launch gnome-terminal with your newly created profile, Alt+drag it to where you want it to stay, and type | '''4.''' Now we'll determine the exact coordinates where your terminal will appear. To do this, launch gnome-terminal with your newly created profile, Alt+drag it to where you want it to stay, and type | ||
<pre><nowiki> | <pre><nowiki> | ||
− | xwininfo | + | xwininfo |
</nowiki></pre> | </nowiki></pre> | ||
The mouse pointer will turn into a crosshair. Click the terminal window, and note first the value that appears in the "Corners:" line. | The mouse pointer will turn into a crosshair. Click the terminal window, and note first the value that appears in the "Corners:" line. | ||
'''5.''' Create a launcher with the following command and place it on your desktop or on a menu, or if you want your terminal to be launched on Gnome startup, go to System / Preferences / Session / Startup Programs, click the add button and enter this command there and set the order to something higher than 49. | '''5.''' Create a launcher with the following command and place it on your desktop or on a menu, or if you want your terminal to be launched on Gnome startup, go to System / Preferences / Session / Startup Programs, click the add button and enter this command there and set the order to something higher than 49. | ||
<pre><nowiki> | <pre><nowiki> | ||
− | alltray -x -st -g [geometry]"gnome-terminal --window-with-profile=tterm" | + | alltray -x -st -g [geometry]"gnome-terminal --window-with-profile=tterm" |
</nowiki></pre> | </nowiki></pre> | ||
Replace [geometry] with the value you found via xwininfo in the last step. | Replace [geometry] with the value you found via xwininfo in the last step. | ||
第34行: | 第34行: | ||
'''2.''' Install the package with dpkg | '''2.''' Install the package with dpkg | ||
<pre><nowiki> | <pre><nowiki> | ||
− | sudo dpkg -i /path/to/file/alltray.ubuntu_0.60-1_i386.deb | + | sudo dpkg -i /path/to/file/alltray.ubuntu_0.60-1_i386.deb |
</nowiki></pre> | </nowiki></pre> | ||
'''3.''' Download and install the X composite manager and the packages required for compiling transset-df, which is a modified version of the transset tool by Daniel Forchheimer for adjusting window transparency "the bash way" with parameters instead of clicking with the pointer as is the case with transset. | '''3.''' Download and install the X composite manager and the packages required for compiling transset-df, which is a modified version of the transset tool by Daniel Forchheimer for adjusting window transparency "the bash way" with parameters instead of clicking with the pointer as is the case with transset. | ||
<pre><nowiki> | <pre><nowiki> | ||
− | sudo apt-get install xcompmgr libxcomposite1 libxcomposite-dev libxfixes3 libxfixes-dev libxdamage1 libxdamage-dev libxrender1 libxrender-dev | + | sudo apt-get install xcompmgr libxcomposite1 libxcomposite-dev libxfixes3 libxfixes-dev libxdamage1 libxdamage-dev libxrender1 libxrender-dev |
</nowiki></pre> | </nowiki></pre> | ||
'''4.''' Download and compile transset-df. | '''4.''' Download and compile transset-df. | ||
<pre><nowiki> | <pre><nowiki> | ||
− | wget http://forchheimer.se/transset-df/transset-df-4.tar.gz | + | wget http://forchheimer.se/transset-df/transset-df-4.tar.gz |
− | tar zxf transset-df-4.tar.gz cd transset-df-4/ | + | tar zxf transset-df-4.tar.gz cd transset-df-4/ |
− | make | + | make |
− | sudo make install | + | sudo make install |
</nowiki></pre> | </nowiki></pre> | ||
''Tip: You can use checkinstall to add any compiled package into the apt database so that you can see it in Synaptic and perform all apt commands on it. To use it, install it with "sudo apt-get install checkinstall", and replace the last step of the compilation process with "sudo checkinstall".'' | ''Tip: You can use checkinstall to add any compiled package into the apt database so that you can see it in Synaptic and perform all apt commands on it. To use it, install it with "sudo apt-get install checkinstall", and replace the last step of the compilation process with "sudo checkinstall".'' | ||
'''5.''' Modify your xorg.conf file to enable compositing. Add the following lines after the "Modules" section in /etc/X11/xorg.conf | '''5.''' Modify your xorg.conf file to enable compositing. Add the following lines after the "Modules" section in /etc/X11/xorg.conf | ||
<pre><nowiki> | <pre><nowiki> | ||
− | Section "Extensions" | + | Section "Extensions" |
− | Option "Composite" "Enable" | + | Option "Composite" "Enable" |
− | EndSection | + | EndSection |
</nowiki></pre> | </nowiki></pre> | ||
Add the following to the "Device" section | Add the following to the "Device" section | ||
<pre><nowiki> | <pre><nowiki> | ||
− | Option "RenderAccel" "true" | + | Option "RenderAccel" "true" |
− | Option "AllowGLXWithComposite" "true" | + | Option "AllowGLXWithComposite" "true" |
</nowiki></pre> | </nowiki></pre> | ||
'''6.''' Add xcompmgr to your Gnome session startup in System / Preferences / Session / Startup Programs. "xcompmgr -n" should do the trick, but if you want more eye candy type "man xcompmgr" for more info on the other parameters. An order of 40 works best for me; if it doesn't, try 0. Again, refer to [http://www.ubuntuforums.org/showthread.php?t=75527 this howto] if you have any trouble. Now restart X with Ctrl+Alt+Backspace. If it works, go ahead. If you lose the ability to start x, boot into recovery console and reverse the changes you made. | '''6.''' Add xcompmgr to your Gnome session startup in System / Preferences / Session / Startup Programs. "xcompmgr -n" should do the trick, but if you want more eye candy type "man xcompmgr" for more info on the other parameters. An order of 40 works best for me; if it doesn't, try 0. Again, refer to [http://www.ubuntuforums.org/showthread.php?t=75527 this howto] if you have any trouble. Now restart X with Ctrl+Alt+Backspace. If it works, go ahead. If you lose the ability to start x, boot into recovery console and reverse the changes you made. | ||
第63行: | 第63行: | ||
'''8.''' Now we'll determine the exact coordinates where your terminal will appear. To do this, launch gnome-terminal with your newly created profile, Alt+drag it to where you want it to stay, and type | '''8.''' Now we'll determine the exact coordinates where your terminal will appear. To do this, launch gnome-terminal with your newly created profile, Alt+drag it to where you want it to stay, and type | ||
<pre><nowiki> | <pre><nowiki> | ||
− | xwininfo | + | xwininfo |
</nowiki></pre> | </nowiki></pre> | ||
The mouse pointer will turn into a crosshair. Click the terminal window, and note first the value that appears in the "Corners:" line. | The mouse pointer will turn into a crosshair. Click the terminal window, and note first the value that appears in the "Corners:" line. | ||
'''9.''' Launch gedit and paste the following: | '''9.''' Launch gedit and paste the following: | ||
<pre><nowiki> | <pre><nowiki> | ||
− | #!/bin/bash | + | #!/bin/bash |
− | alltray --borderless --sticky -g [geometry] "gnome-terminal --window-with-profile=tterm" & sleep 1 | + | alltray --borderless --sticky -g [geometry] "gnome-terminal --window-with-profile=tterm" & sleep 1 |
− | transset-df -n "tterm (AllTray)" [opacity] | + | transset-df -n "tterm (AllTray)" [opacity] |
</nowiki></pre> | </nowiki></pre> | ||
This will launch your terminal regardless of whether xcompmgr is running. If it's not running at the time you fire up the terminal, you'll get a pseudo-transparent one. If you want it to be launched only if xcompmgr is running, use the code below instead. | This will launch your terminal regardless of whether xcompmgr is running. If it's not running at the time you fire up the terminal, you'll get a pseudo-transparent one. If you want it to be launched only if xcompmgr is running, use the code below instead. | ||
第83行: | 第83行: | ||
alltray -x -st -g [geometry] "gnome-terminal --window-with-profile=tterm" & sleep 1 | alltray -x -st -g [geometry] "gnome-terminal --window-with-profile=tterm" & sleep 1 | ||
transset-df -n "tterm (AllTray)" [opacity] | transset-df -n "tterm (AllTray)" [opacity] | ||
+ | |||
fi | fi | ||
</nowiki></pre> | </nowiki></pre> |
2007年12月6日 (四) 10:57的版本
![]() |
点击翻译: |
English |
请不要直接编辑翻译本页,本页将定期与来源同步。 |
Transparent terminals are not just sexy eye candy; they also make a lot of sense in terms of GUI usability. Having terminal text appear as if it were on your desktop, or as a transparent pop-up layer that shows other windows beneath it that can be stashed away and recalled with a single click is very handy in daily Gnome usage. It's good when we need the terminal often, but also want it to blend nicely into the graphical environment -- and not take up any desktop space when not needed.
Don't think that you're limited to Gnome for transparent terminals, though. Plenty of other terminal emulators offer support for pseudo-transparency, and can run on systems that would otherwise be taxed by the Gnome framework.
目录
With Gnome-Terminal
The first part of this guide has instructions for setting up a pseudo-transparent pop-up gnome-terminal. The second part, however, is for getting true transparency, where you will actually see other windows beneath the terminal, and not just a replication of your underlying desktop, as is the case with pseudo-transparency. This requires that you correctly set up the composite extension for X.
Pseudo-Transparent Terminals with Alltray + gnome-terminal
Pseudo-transparency only replicates the part of the desktop that's directly underneath your window; as a result, if there's another window in between, it's ignored, and a true sense of depth is not attainable. However, by reserving a space for your window on your workspace, and having no desktop icons in that space, you can put pseudo-transparency to good use. Since our terminal will be a pop-up one that won't take permanent space, this is quite possible. Here's a screenshot. 1. Download Alltray. An Ubuntu deb package is available here. 2. Install the package with dpkg
sudo dpkg -i /path/to/file/alltray.ubuntu_0.60-1_i386.deb
3. Set up a new profile in gnome-terminal by hitting Edit / Profiles / New. I'll name it "tterm" here, you can name it whatever you like, but keep in mind that I'll refer to it as "tterm" in all commands in this howto. Edit the profile with the following options: uncheck the "Show menubar by default in new terminals" option in the "General" tab, in the "Effects" tab choose "Transparent Background" and set transparency level as you like, and in the "Scrolling" tab disable the scrollbar. 4. Now we'll determine the exact coordinates where your terminal will appear. To do this, launch gnome-terminal with your newly created profile, Alt+drag it to where you want it to stay, and type
xwininfo
The mouse pointer will turn into a crosshair. Click the terminal window, and note first the value that appears in the "Corners:" line. 5. Create a launcher with the following command and place it on your desktop or on a menu, or if you want your terminal to be launched on Gnome startup, go to System / Preferences / Session / Startup Programs, click the add button and enter this command there and set the order to something higher than 49.
alltray -x -st -g [geometry]"gnome-terminal --window-with-profile=tterm"
Replace [geometry] with the value you found via xwininfo in the last step. 6. Add a notification area to your Gnome panel if you don't have one. Now click your launcher or start your Gnome session if you added the command the startup, and you should see the gnome-terminal icon in the notification area. Click it and the terminal will pop up. Click it again, or hit the minimize button and it will be stashed. That's it. Now on to the more sophisticated true transparent terminal.
True Transparent Terminals with Alltray + gnome-terminal + Composite + transset-df
The only way to have true transparency in the X window system as of today is the Composite extension written by Keith Packard. It's in the standard x.org R6 distribution but since it's still experimental and buggy, it isn't enabled by default. As I've stated at the beginning, you can refer to this howto for detailed info on how to set it up to your liking, but for our purposes, simple client-side compositing with xcompmgr's -n option will be enough. However, if you want to run the extension with all its bells and whistles, without a noticeable performance hit, you'll need a recent NVIDIA card and a fast computer. ATI do not support compositing in their drivers at present, so the extension can't take advantage of the GPU, and that results in a performance loss. Here's a screenshot. 1. Download Alltray. An Ubuntu deb package is available here. 2. Install the package with dpkg
sudo dpkg -i /path/to/file/alltray.ubuntu_0.60-1_i386.deb
3. Download and install the X composite manager and the packages required for compiling transset-df, which is a modified version of the transset tool by Daniel Forchheimer for adjusting window transparency "the bash way" with parameters instead of clicking with the pointer as is the case with transset.
sudo apt-get install xcompmgr libxcomposite1 libxcomposite-dev libxfixes3 libxfixes-dev libxdamage1 libxdamage-dev libxrender1 libxrender-dev
4. Download and compile transset-df.
wget http://forchheimer.se/transset-df/transset-df-4.tar.gz tar zxf transset-df-4.tar.gz cd transset-df-4/ make sudo make install
Tip: You can use checkinstall to add any compiled package into the apt database so that you can see it in Synaptic and perform all apt commands on it. To use it, install it with "sudo apt-get install checkinstall", and replace the last step of the compilation process with "sudo checkinstall". 5. Modify your xorg.conf file to enable compositing. Add the following lines after the "Modules" section in /etc/X11/xorg.conf
Section "Extensions" Option "Composite" "Enable" EndSection
Add the following to the "Device" section
Option "RenderAccel" "true" Option "AllowGLXWithComposite" "true"
6. Add xcompmgr to your Gnome session startup in System / Preferences / Session / Startup Programs. "xcompmgr -n" should do the trick, but if you want more eye candy type "man xcompmgr" for more info on the other parameters. An order of 40 works best for me; if it doesn't, try 0. Again, refer to this howto if you have any trouble. Now restart X with Ctrl+Alt+Backspace. If it works, go ahead. If you lose the ability to start x, boot into recovery console and reverse the changes you made. 7. Set up a new profile in gnome-terminal by hitting Edit / Profiles / New. I'll name it "tterm" here, you can name it whatever you like, but keep in mind that I'll keep referring to it as "tterm". Edit the profile with the following options: uncheck the "Show menubar by default in new terminals" option in the "General" tab, set "Dynamically-set title" to "Isn't displayed" in the "Title and Command" tab, and in the "Scrolling" tab disable the scrollbar. 8. Now we'll determine the exact coordinates where your terminal will appear. To do this, launch gnome-terminal with your newly created profile, Alt+drag it to where you want it to stay, and type
xwininfo
The mouse pointer will turn into a crosshair. Click the terminal window, and note first the value that appears in the "Corners:" line. 9. Launch gedit and paste the following:
#!/bin/bash alltray --borderless --sticky -g [geometry] "gnome-terminal --window-with-profile=tterm" & sleep 1 transset-df -n "tterm (AllTray)" [opacity]
This will launch your terminal regardless of whether xcompmgr is running. If it's not running at the time you fire up the terminal, you'll get a pseudo-transparent one. If you want it to be launched only if xcompmgr is running, use the code below instead.
#!/bin/bash a=`ps -aef | grep -i xcompmgr | awk ' {if ($8 == "xcompmgr"){printf "2"}} '` if [[ $a = "" ]] then exit else #!/bin/bash alltray -x -st -g [geometry] "gnome-terminal --window-with-profile=tterm" & sleep 1 transset-df -n "tterm (AllTray)" [opacity] fi
Replace [geometry] with the first "Corners:" value you got with xwininfo, and [opacity] with the level of opacity you want on a decimal scale from 0 to 1 (Note: if for example 0.7 doesn't work, try 0.70; this seems to be a transset-df bug). Save the script with a .sh extension, and make it executable with "chmod +x". 10. Make sure you have a notification area on your Gnome panel. Create a launcher that points to the script or add it to your Gnome session startup in System / Preferences / Session / Startup Programs with an order value higher than 49. Click the launcher or start Gnome, and enjoy. Submitted by 23meg. Forum discussion page is here.
Using other terminal emulators
A number of other terminal emulators offer transparency support (albeit pseudo-transparency) as options.
xfce4-terminal
Perhaps the easiest to deal with is xfce4-terminal, which has menu options for removing the scrollbar completely, along with the window decorations and the title bar. You can access those through the options menus. For a final touch, set the background to transparent and adjust the opacity to your liking. For a screenshot of xfce4-terminal running on an Openbox setup, click here. As an added bonus, xfce4-terminal can handle tabbed emulator windows. The tabs, however, dispel the transparency effect: The window is still transparent, but the tabs are not.
aterm
aterm also handles pseudo transparency, but this time in the form of a command line argument. This makes it a little more tricky to deal with, but no less gratifying. After you install aterm, you can start it with the transparency option with this command:
aterm -tr
aterm also features pseudo-transparent scrollbars, background tinting and much more. Check the man pages for aterm for a list of options and descriptions.
urxvt
urxvt (called "rxvt-unicode" in the repositories) also has options for transparency, and has the added bonus of improved font support and can store and display most scripts in the world. If you use an alphabet other than the conventional set, this might be a bonus for you. urxvt calls its "transparency" a inheritPixmap option, which is to say, it sets its terminal background to a pixelmap of the X desktop beneath it. When the window moves, the pixelmap is updated. This isn't true transparency, but the effect is just as impressive. Here's an example of urxvt in action, again running on an Openbox installation. That snapshot was taken in Arch linux, but the result is no different than in Ubuntu. This command will start urxvt with a number of options, including an inherited pixelmap, tinting, faded color when moved, and some other options. The resulting effect is similar to the transparent terminal we got with xfce4-terminal.
urxvt -tr +sb -fg white -bg black -tint white -sh 75 -fade 15 -fadecolor black -pr black -pr2 white
Check the urxvt help pages for more options and additional font support.
The .Xdefaults file
Both aterm and urxvt can take global startup options in the .Xdefaults file in the home directory. Open a file called .Xdefaults and paste this into it, to get the same effects for urxvt as described above.
urxvt.font: xft: Dejavu Sans Mono:autohint=true:antialias=true:size=9 urxvt.background: black urxvt.foreground: white urxvt.scrollBar: false urxvt.tintColor: white urxvt.fading: 15 urxvt.fadeColor: black urxvt.shading: 75 urxvt.inheritPixmap: true urxvt.pointerColor: black urxvt.pointerColor2: white
Save and close.
You can still override those options by appending them to the startup command urxvt
, but giving just the urxvt
command alone will now give you a terminal box similar to the one in the previous screenshot.
For more .Xdefaults options, try checking the aterm and urxvt help pages.
Other terminal options
There are several other options for terminal emulators; some offer stronger or easier transparency support. Feel free to investigate these, as a start.
- xterm, the default X terminal emulator. You already have it installed! :)
- eterm, the Enlightened Terminal Emulator
- mrxvt, which has support for tabbed emulator windows