summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.xmobarrc65
-rw-r--r--.xmonad/xmonad.hs96
2 files changed, 161 insertions, 0 deletions
diff --git a/.xmobarrc b/.xmobarrc
new file mode 100644
index 0000000..dcbbc59
--- /dev/null
+++ b/.xmobarrc
@@ -0,0 +1,65 @@
+-- TODO: Use stdin reader to show workspaces.
+
+Config
+ -- appearance
+ { font = "xft:DejaVu Sans Mono:size=10:bold:antialias=true"
+ , bgColor = "black"
+ , fgColor = "#646464"
+ , position = Top
+ , borderColor = "#646464"
+
+ -- layout
+ , sepChar = "%" -- delineator between plugin names and straight text
+ , alignSep = "}{" -- separator between left-right alignment
+ , template = "%memory% | %dynnetwork% }{<action=`xdotool set_desktop --relative -- -1` button=4><action=`xdotool set_desktop --relative -- +1` button=5> %date% || %kbd% </action></action>"
+
+ -- general behavior
+ , lowerOnStart = True -- send to bottom of window stack on start
+ , hideOnStart = False -- start with window unmapped (hidden)
+ , allDesktops = True -- show on all desktops
+ , overrideRedirect = True -- set the Override Redirect flag (Xlib)
+ , pickBroadest = False -- choose widest display (multi-monitor)
+ , persistent = True -- enable/disable hiding (True = disabled)
+
+ -- plugins
+ -- Numbers can be automatically colored according to their value. xmobar
+ -- decides color based on a three-tier/two-cutoff system, controlled by
+ -- command options:
+ -- --Low sets the low cutoff
+ -- --High sets the high cutoff
+ --
+ -- --low sets the color below --Low cutoff
+ -- --normal sets the color between --Low and --High cutoffs
+ -- --High sets the color above --High cutoff
+ --
+ -- The --template option controls how the plugin is displayed. Text
+ -- color can be set by enclosing in <fc></fc> tags. For more details
+ -- see http://projects.haskell.org/xmobar/#system-monitor-plugins.
+ , commands =
+
+ -- network activity monitor (dynamic interface resolution)
+ [ Run DynNetwork [ "--template" , "<dev>: <tx> / <rx> Kio/s"
+ , "--Low" , "1000" -- units: B/s
+ , "--High" , "5000" -- units: B/s
+ , "--low" , "#88bb88"
+ , "--normal" , "#bbbb66"
+ , "--high" , "#ddaaaa"
+ ] 10
+
+ -- memory usage monitor
+ , Run Memory [ "--template" ,"Mem: <usedratio>%"
+ , "--Low" , "20" -- units: %
+ , "--High" , "90" -- units: %
+ , "--low" , "#88bb88"
+ , "--normal" , "#bbbb66"
+ , "--high" , "#ddaaaa"
+ ] 10
+
+ -- time and date indicator
+ -- (%F = y-m-d date, %a = day of week, %T = h:m:s time)
+ , Run Date "<fc=#ABABAB>%F (%a) %T</fc>" "date" 10
+
+ -- keyboard layout indicator
+ , Run Kbd []
+ ]
+ }
diff --git a/.xmonad/xmonad.hs b/.xmonad/xmonad.hs
new file mode 100644
index 0000000..cec291c
--- /dev/null
+++ b/.xmonad/xmonad.hs
@@ -0,0 +1,96 @@
+-- TODO: remove `killall xmobar` once xmobar will use stdin reader.
+
+import XMonad
+import XMonad.Hooks.DynamicLog
+import XMonad.Hooks.ManageDocks
+import XMonad.Hooks.EwmhDesktops
+import XMonad.Actions.Submap
+import XMonad.Config
+import qualified Data.Map as M
+import XMonad.Util.SpawnOnce
+import XMonad.Util.EZConfig
+
+
+-- | Prefixes everything with mod+t instead of a mod key, so that
+-- mod+1 becomes mod+t 1 (e.g., C-1 -> C-t 1), for instance.
+myKeys :: (XConfig Layout -> M.Map (KeyMask, KeySym) (X ()))
+ -> XConfig Layout
+ -> M.Map (KeyMask, KeySym) (X ())
+myKeys oldKeys conf@(XConfig {XMonad.modMask = modMask}) =
+ M.fromList [((modMask, xK_t), submap (oldKeys conf { modMask = noModMask }))]
+
+
+{- | On CentOS 7, with GeForce GTX 660 and a proprietary NVIDIA driver,
+with vsync enabled in nvidia-settings:
+
+- default: white flash when switching to FF, and screen tearing on
+ smooth scrolling there
+- compton --backend glx: screen tearing in emacs on scroll/text
+ movement, apparently happens just after some time (may be a bug)
+- compton --backend glx --vsync opengl-swc: same
+- compton --backend glx --paint-on-overlay: same
+- compton --backend glx --vsync opengl --paint-on-overlay: same
+- compton --backend glx --vsync opengl-swc --sw-opti: same, probably
+ FF scrolling gets less smooth
+- compton with
+ <https://bbs.archlinux.org/viewtopic.php?pid=1541023#p1541023>
+ configuration: same, probably FF scrolling got worse
+- compton with that and `glx-swap-method = "buffer-age"`, as suggested
+ further in that thread: some text bits in emacs begin changing back
+ and forth even without scrolling (apparently that's what is
+ described even further there).
+- compton --backend xrender: same as with no compton
+- compton --dbe: same
+- compton --backend xrender --vsync opengl-oml: same
+- compton --backend xrender --vsync opengl: same, but reduces the
+ flashing
+- compton --backend xrender --vsync opengl --paint-on-overlay: same
+- compton --backend xrender --vsync opengl --dbe: same
+- compton --backend xrender -cf: eliminates the white flash, though a
+ bit slower; same as without -cf otherwise
+- with --vsync drm: "VBlank ioctl did not work, unimplemented in this
+ drmver?"
+
+Apparently these and similar issues are not uncommon (and not specific
+to xmonad), and there's a bunch of different solutions -- some of them
+probably working for some users, but they tend to have side effects as
+well. Pretty much as described on
+<https://github.com/chjj/compton/wiki/vsync-guide>.
+
+Using 'spawnOnce' here, so that it wouldn't run multiple compton
+processes on xmonad restart: that would load CPU and make the display
+unusable. A drawback is that restarting xmonad doesn't suffice to
+restart a killed compton. This actually shouldn't be an issue, since
+compton is supposed to handle it:
+
+- https://specifications.freedesktop.org/wm-spec/latest/ar01s08.html#idm139870829889072
+- https://github.com/chjj/compton/issues/301
+
+But I've got an old version from repositories (apparently they don't
+do much of versioning or releases, or of other conventional things,
+but the package update date is 2014-10-16). I still don't see why this
+happens (would probably have to debug, or at least to try a newer
+version), but it does.
+-}
+runCompton = spawnOnce "compton --backend xrender -cf"
+
+
+main = do
+ -- This is awkward, but apparently there's no better standard way to
+ -- avoid multiple xmobar instances.
+ c <- statusBar "killall --quiet --exact xmobar; xmobar" xmobarPP
+ (\(XConfig {XMonad.modMask = modMask}) -> (modMask, xK_b))
+ def
+ -- EWMH (extended window manager hints) are used to control xmonad
+ -- with xdotool from xmobar.
+ xmonad $ ewmh c
+ { layoutHook = avoidStruts $ layoutHook c
+ , manageHook = manageHook c <+> manageDocks
+ , keys = myKeys $ keys $ c `additionalKeys`
+ -- C-t C-t would send C-t to a focused window.
+ [((controlMask, xK_t), spawn "xdotool key ctrl+t")]
+ , modMask = controlMask
+ , focusedBorderColor = "#444"
+ , normalBorderColor = "#000"
+ , startupHook = runCompton
+ }