You are not logged in.

#1 2012-03-01 04:34:36

totte
Member
Registered: 2011-08-22
Posts: 64

[SOLVED] "Random" background transparency on urxvt (XMonad)

I came across this peculiar issue - every other urxvt window I spawn is either very light and transparent or dark and more opaque.
k8YWAEBuhMcyj.jpg

I'm using XMonad, xcompmgr and rxvt-unicode with the following settings in ~/.Xdefaults:

!urxvt
urxvt*geometry:			86x42
urxvt*depth:			32
urxvt*foreground:		#ffffff
urxvt*background:		rgba:1616/1616/1616/6464
urxvt*font:				xft:Inconsolata:size=18:antialias=true:hinting=true
urxvt*boldFont:			xft:Inconsolata:size=18:antialias=true:hinting=true
urxvt*italicFont:		xft:Inconsolata:size=18:antialias=true:hinting=true
urxvt*boldLtalicFont:	xft:Inconsolata:size=18:antialias=true:hinting=true
urxvt*urlLauncher:		chromium
urxvt*scrollBar:		true
urxvt*scrollBar_right:	true
urxvt*scrollstyle:		plain
urxvt*scrollColor:		#323232
urxvt*cursorColor:		#eeeeee

!*background:#161616
!black
*color0:    #000000
*color8:    #161616
!red
*color1:    #ee3216
*color9:    #ff6432
!green
*color2:    #96ca2c
*color10:   #c8d686
!yellow
*color3:    #89725b
*color11:   #e7e1b7
!blue
*color4:    #4192d9
*color12:   #a5cffc
!magenta
*color5:    #9900ff
*color13:   #cc99ff
!cyan
*color6:    #424242
*color14:   #868686
!white
*color7:    #dddddd
*color15:   #ffffff

...and ~/.xinitrc:

#!/bin/sh

if [ -d /etc/X11/xinit/xinitrc.d ]; then
  for f in /etc/X11/xinit/xinitrc.d/*; do
    [ -x "$f" ] && . "$f"
  done
  unset f
fi

# Mouse cursor
xsetroot -cursor_name left_ptr

# Keyboard map
setxkbmap us -variant colemak

# VirtualBox guest
VBoxClient-all &

# Background image
sh $HOME/.fehbg &

# Compositing effects
xcompmgr -c &

# Window manager
xmonad

Any ideas what I'm missing here?

Edit: omploader didn't work, trying minus.

Last edited by totte (2012-03-01 18:57:48)

Offline

#2 2012-03-01 10:32:11

DSpider
Member
From: Romania
Registered: 2009-08-23
Posts: 2,273

Re: [SOLVED] "Random" background transparency on urxvt (XMonad)

I think it's because you're starting it twice in the same spot. They get layered and the transparency gives it a darker colour.


"How to Succeed with Linux"

I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).

Offline

#3 2012-03-01 11:45:04

Trilby
Banned
Registered: 2011-11-29
Posts: 30,330
Website

Re: [SOLVED] "Random" background transparency on urxvt (XMonad)

It should not be possible for them to be layered in xmonad (unless one is pulled to floating ... in which case it'd be highly unlikely that it'd land in exactly the same position as one underneath it).

How do you spawn the different instances?  Are you using default keybindings?  Do you use dmenu or another launcher?  What's in your Xmonad.hs?  Is it possible that one of these is an xterm?

I'm not sure if/how this would be related, but have you considered using urxvt's daemon mode?  You may get different symptoms that help in the trouibleshooting.  To do so you can put 'urxvtd' in your xinitrc (or 'urxvtd -q -f -o' is handy if you restart X much - check the man page for what these options do).  Then you change your terminal variable or key bindings in Xmonad.hs to 'urxvtc'.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#4 2012-03-01 15:34:22

totte
Member
Registered: 2011-08-22
Posts: 64

Re: [SOLVED] "Random" background transparency on urxvt (XMonad)

Sorry, forgot about .xinitrc and .xmonad.hs! I enabled the urxvt daemon mode but it doesn't seem to have changed anything. I spawn urxvt with the keybinding mod+/, running it from dmenu made no difference.

.xinitrc

#!/bin/sh

if [ -d /etc/X11/xinit/xinitrc.d ]; then
  for f in /etc/X11/xinit/xinitrc.d/*; do
    [ -x "$f" ] && . "$f"
  done
  unset f
fi

# Mouse cursor
xsetroot -cursor_name left_ptr

# Keyboard map
setxkbmap us -variant colemak

# VirtualBox guest
VBoxClient-all &

# Background image
sh $HOME/.fehbg &

# rxvt-unicode daemon
urxvtd -q -f -o &

# Compositing effects
xcompmgr -c &

# Window manager
xmonad

.xmonad/xmonad.hs
(Sorry about the weird spaces and tabs, it looks proper in Vim, not sure what happened to it when pasted from GitHub.)

import XMonad
import System.Exit
import XMonad.Actions.CycleWS
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Layout.ToggleLayouts
import XMonad.Layout.Spacing
import qualified XMonad.StackSet as W
import qualified Data.Map as M
 
myTerminal			=	"urxvtc"
myBorderWidth			=	2
myModMask			=	mod4Mask
myWorkspaces			=	["ZSH","VIM","WEB","IRC"]
myNormalBorderColor		=	"#161616"
myFocusedBorderColor		=	"#323232"
 
--------------------------------------------------------------------------------------
-- Key bindings
--------------------------------------------------------------------------------------

myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
	[
		((modm,	                	xK_slash ), spawn $ XMonad.terminal conf),			-- Init a terminal
        	((modm,				xK_space ), spawn "dmenu_run -fn 'Terminus:bold:size=16' -nb '#000' -nf '#868686' -sb '#868686' -sf '#fff'"),	-- Init dmenu_run
		((modm,				xK_Tab   ), windows W.focusDown),					-- Move focus to the next window
		((modm .|. shiftMask,		xK_Tab 	 ), sendMessage NextLayout),				-- Rotate through the available layout algorithms
		((modm,                 		xK_Return), sendMessage ToggleLayout),          			-- Toggle fullscreen mode
		((modm,                 		xK_n     ), prevWS),								-- 
		((modm,                 		xK_o     ), nextWS),								-- 
		((modm .|. shiftMask,   	xK_n     ), shiftToPrev >> prevWS),					-- 
		((modm .|. shiftMask,   	xK_o     ), shiftToNext >> nextWS),					-- 
		--((modm .|. shiftMask,	xK_c     ), kill),									-- close focused window
		--((modm .|. shiftMask,	xK_space ), setLayout $ XMonad.layoutHook conf),		-- Reset the layouts on current workspace to default
		--((modm,				xK_n     ), refresh),								-- Resize viewed windows to the correct size
		--((modm,				xK_j     ), windows W.focusDown),					-- Move focus to the next window
		--((modm,				xK_k     ), windows W.focusUp  ),					-- Move focus to the previous window
		--((modm,				xK_m     ), windows W.focusMaster  ),					-- Move focus to the master window
		--((modm,				xK_Return), windows W.swapMaster),					-- Swap the focused window and the master window
		--((modm .|. shiftMask,	xK_j     ), windows W.swapDown  ),					-- Swap the focused window with the next window
		--((modm .|. shiftMask,	xK_k     ), windows W.swapUp    ),					-- Swap the focused window with the previous window
		--((modm,				xK_h     ), sendMessage Shrink),					-- Shrink the master area
		--((modm,				xK_l     ), sendMessage Expand),					-- Expand the master area
		--((modm,				xK_t     ), withFocused $ windows . W.sink),			-- Push window back into tiling
		--((modm,				xK_comma ), sendMessage (IncMasterN 1)),			-- Increment number of windows in the master area
		--((modm,				xK_period), sendMessage (IncMasterN (-1))),			-- Deincrement number of windows in the master area
		((modm,	                	xK_comma ), io (exitWith ExitSuccess)),				-- Quit xmonad
		((modm,				xK_period), spawn "xmonad --recompile; xmonad --restart")	-- Restart xmonad
	]
    ++
 
    -- mod-[1..9], Switch to workspace N
    -- mod-shift-[1..9], Move client to workspace N
    [((m .|. modm, k), windows $ f i)
        | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
        , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
 
--------------------------------------------------------------------------------------
-- Mouse bindings
--------------------------------------------------------------------------------------

myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
	[
		((modm, button1),	(\w -> focus w	>>	mouseMoveWindow w
									>>	windows W.shiftMaster)),	-- mod-button1, float and move window
		((modm, button2),	(\w -> focus w	>> 	windows W.shiftMaster)),	-- mod-button2, raise window
		((modm, button3),	(\w -> focus w	>>	mouseResizeWindow w
									>>	windows W.shiftMaster))	-- mod-button3, float and resize window 
	]
 
--------------------------------------------------------------------------------------
-- Layouts
--------------------------------------------------------------------------------------

myLayout =
	avoidStruts $
	spacing 4 $
	toggleLayouts Full $
	tiled ||| Mirror tiled
	where
		tiled		=	Tall nmaster delta ratio	-- default tiling algorithm partitions the screen into two panes
		nmaster	=	1					-- The default number of windows in the master pane
		ratio		=	1/2					-- Default proportion of screen occupied by master pane
		delta		=	3/100				-- Percent of screen to increment by when resizing panes
 
--------------------------------------------------------------------------------------
-- Window rules
--------------------------------------------------------------------------------------

myManageHook = composeAll
	[
		className	=?	"MPlayer"			-->	doFloat,
		className	=?	"Gimp"				-->	doFloat,
		resource	=?	"desktop_window"	-->	doIgnore,
		resource	=?	"kdesktop"			-->	doIgnore
	]
 
--------------------------------------------------------------------------------------
-- Statusbar
--------------------------------------------------------------------------------------

myBar = "xmobar"
myPP = xmobarPP
		{
			ppCurrent			=	wrap "<fc=#ffffff,#868686> " " </fc>",
			ppVisible			=	xmobarColor "#ff0000" "",
			ppHidden			=	xmobarColor "#646464" "",
			ppHiddenNoWindows	=	xmobarColor "#646464" "",
			ppUrgent			=	xmobarColor "#ff0000" "",
			ppLayout			=	xmobarColor "#aaaaaa" "",
			ppTitle			=	xmobarColor "#ffffff" "",
			ppSep			=	" : ",
			ppWsSep			=	" "
		}

--------------------------------------------------------------------------------------
-- Run XMonad
--------------------------------------------------------------------------------------

main = xmonad =<< statusBar myBar myPP (\c -> (modMask c, xK_b)) myConfig

myConfig = defaultConfig
	{
		terminal			=	myTerminal,
		borderWidth		=	myBorderWidth,
		modMask			=	myModMask,
		workspaces		=	myWorkspaces,
		normalBorderColor	=	myNormalBorderColor,
		focusedBorderColor	=	myFocusedBorderColor,
		keys				=	myKeys,
		mouseBindings		=	myMouseBindings,
		layoutHook		=	myLayout,
		manageHook		=	myManageHook
	}

Offline

#5 2012-03-01 16:08:18

totte
Member
Registered: 2011-08-22
Posts: 64

Re: [SOLVED] "Random" background transparency on urxvt (XMonad)

Adding the -f option to xcompmgr in .xinitrc resolved the issue (seemingly), although I'm not sure why.

Offline

#6 2012-03-01 18:35:09

DSpider
Member
From: Romania
Registered: 2009-08-23
Posts: 2,273

Re: [SOLVED] "Random" background transparency on urxvt (XMonad)

Good to hear. You should mark this thread as solved then (by editing the title from the first post).

The manual says:

   ...
   -f     When -c is specified, enables a smooth fade effect for transient windows like menus, and for all windows on hide and restore events.

You posted .xinitrc twice.


"How to Succeed with Linux"

I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).

Offline

#7 2012-03-01 19:02:37

totte
Member
Registered: 2011-08-22
Posts: 64

Re: [SOLVED] "Random" background transparency on urxvt (XMonad)

DSpider wrote:

Good to hear. You should mark this thread as solved then (by editing the title from the first post).

The manual says:

...
-f     When -c is specified, enables a smooth fade effect for transient windows like menus, and for all windows on hide and restore events.

Yeah, I was just trying the fade effect out and it struck me that my previous issues were resolved by enabling it, although I don't see why...

DSpider wrote:

You posted .xinitrc twice.

I'm really absentminded.

Offline

#8 2012-03-01 20:26:57

Trilby
Banned
Registered: 2011-11-29
Posts: 30,330
Website

Re: [SOLVED] "Random" background transparency on urxvt (XMonad)

urxvt doesn't play nice with xcompmgr shadows (-c).  And shadows, in general, seem odd in a tiler.  You could drop both parameters from xcompmgr and just run it "vanilla" which gets the transparency.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB