From 3e05c1d4dda93e05aad2ef37900754f77c026d82 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sun, 4 May 2014 16:59:56 +0200 Subject: [PATCH] enable real transparency in urxvt with compton --- Xdefaults.in | 16 ++++++++++++---- setup.sh | 7 +++++++ xinitrc | 6 ++++++ 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/Xdefaults.in b/Xdefaults.in index 9ecdaae..f2938b4 100644 --- a/Xdefaults.in +++ b/Xdefaults.in @@ -5,7 +5,7 @@ ! "Term" is an alias for all supported terminal emulators; it is automatically ! replaced by setup.sh. -! Copyright (C) 2011-2012 Simon Ruderich +! Copyright (C) 2011-2014 Simon Ruderich ! ! This file is free software: you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by @@ -26,6 +26,14 @@ Term*foreground: #cccccc Term*background: #000000 Term*cursorColor: #ffff66 +! Special case for urxvt to get transparent background. This requires a +! compositing manager which supports transparency like compton. Thanks to eto +! and adaedra in #herblstuftwm on Freenode (2014-05-04 15:50 ff) for their +! awesome help regarding transparency. +Rxvt*background: [90]#000000 +! Necessary for transparency, see man page. +Rxvt*depth: 32 + ! Disable the scrollback buffer. I use screen/tmux so it is not necessary. XTerm*saveLines: 0 Rxvt*saveLines: 0 @@ -41,9 +49,9 @@ XTerm.termName: xterm-256color ! #stumpwm on Freenode (2009-05-18 22:05). !XTerm*allowSendEvents: true -! Enable transparency. -Rxvt*transparent: true -Rxvt*shading: 10 +! Enable pseudo transparency. Only used if compton is not available. +!NO_COMPTON Rxvt*transparent: true +!NO_COMPTON Rxvt*shading: 10 ! Do not use any perl extension scripts. Rxvt*perl-ext-common: diff --git a/setup.sh b/setup.sh index 45a469b..9e330d1 100755 --- a/setup.sh +++ b/setup.sh @@ -52,6 +52,13 @@ if installed X; then }' # Xdefaults uses ! as comment instead of #. sed_i 's/^#/!/' Xdefaults + # Use urxvt's pseudo-transparency if compton is not available. Better than + # nothing. + if ! installed compton; then + echo 'Xdefaults: no compton found, enabling pseudo-transparency' + sed_i 's/^Rxvt\*background/!&/' Xdefaults + sed_i 's/^!NO_COMPTON //' Xdefaults + fi if test ! "x`os`" = xdarwin; then link xinitrc ~/.xinitrc diff --git a/xinitrc b/xinitrc index 387614d..858cbaa 100755 --- a/xinitrc +++ b/xinitrc @@ -144,6 +144,12 @@ elif test -n "$screen_lock_force"; then error "'xautolock' not found. Auto lock won't work!" fi +# Use compton to get transparent windows. See ~/.Xdefaults for configuration +# of urxvt. +if installed compton; then + compton & +fi + # My window managers doesn't start a terminal emulator on its own, start one # when I login. -- 2.43.2