Created
March 29, 2013 18:46
-
-
Save jaen/5272755 to your computer and use it in GitHub Desktop.
My xmonad config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# conky bar bottom | |
gap_y -1000 | |
#background yes | |
double_buffer yes | |
out_to_console yes | |
own_window yes | |
own_window_type override | |
update_interval 0.2 | |
TEXT | |
${if_match "${execi 1 amixer get Speaker | egrep -o "\[on\]|\[off\]" -m 1}" == "[on]"}^fg(green)${endif}^i(.dzen/bitmaps/spkr_01.xbm) \ | |
${execi 1 amixer get Master | egrep -o [0-9]+%} ^fg()| ^i(.dzen/bitmaps/note.xbm) ${mpd_status}${if_mpd_playing} - ${mpd_title} | Vol: ${mpd_vol}%${endif} | |
#conky bar top | |
gap_y -1000 | |
background yes | |
double_buffer yes | |
out_to_console yes | |
own_window yes | |
own_window_type override | |
update_interval 1.0 | |
TEXT | |
${if_match "${exec xset q | grep LED | awk '{print $10}'}" == "00000001"}^fg(green)CapsLock^fg() | ${else}\ | |
${if_match "${exec xset q | grep LED | awk '{print $10}'}" == "00000002"}^fg(\#0073FF)NumLock^fg() | ${else}\ | |
${if_match "${exec xset q | grep LED | awk '{print $10}'}" == "00000003"}^fg(green)CapsLock ^fg(\#0073FF)NumLock^fg() | ${endif}${endif}${endif}\ | |
\ | |
^i(.dzen/bitmaps/cpu.xbm) ${cpu cpu0}% \ | |
^i(.dzen/bitmaps/cpu.xbm) ${cpu cpu1}% \ | |
^i(.dzen/bitmaps/cpu.xbm) ${cpu cpu2}% \ | |
^i(.dzen/bitmaps/cpu.xbm) ${cpu cpu3}% \ | |
^i(.dzen/bitmaps/mem.xbm) $memperc% | \ | |
${if_up eth0}^i(.dzen/bitmaps/wifi_01.xbm) ${addr eth0} | ${endif}\ | |
^fg(green)^i(.dzen/bitmaps/net_up_03.xbm)^fg() ${upspeedf wlp3s0}K \ | |
^fg(red)^i(.dzen/bitmaps/net_down_03.xbm)^fg() ${downspeedf wlp3s0}K | \ | |
^i(.dzen/bitmaps/clock.xbm) ${time %a %d.%m.%Y ^fn(DejaVu Sans Mono Medium:size=7.5:bold)%H:%M:%S} ^fn() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'pry' | |
#in, out = IO.pipe | |
#std | |
#myDzenTitleBar = "dzen2 -w 1206 -h 16 -ta l -bg \"" ++ myBarColor ++ "\" -fg \"" ++ myBarInactiveTextColor ++ "\" -fn \"" ++ myFont ++ "\"" | |
#myDzenStatusBar = myTopBar ++ " | dzen2 -y 1184 -x 700 -h 16 -ta r -bg \"" ++ myBarColor ++ "\" -fn \"" ++ myFont ++ "\"" | |
#myDzenMusicBar = myMusicBar ++ " | dzen2 -y 1184 -h 16 -x 0 -w 700 -ta l -bg \"" ++ myBarColor ++ "\" -fn \"" ++ myFont ++ "\"" | |
#myTray = "trayer --edge top --align right --heighttype pixel --height 16 --widthtype pixels --width 160 --transparent true --alpha 0 --tint 0x111111" | |
myFont = "-*-dejavu sans mono-medium-r-*-*-10-*-*-*-*-*-iso8859-*" | |
myBarColor = "#111111" | |
myBarTextColor = "#babdb6" | |
myBarInactiveTextColor = "#555753" | |
myNormalBorderColor = "#555753" | |
myFocusedBorderColor = "#a40000" | |
myCurrentWorkspaceColor = "#73d216" | |
myDefaultBarColor = "#555753" | |
myUrgentWorkspaceColor = "#edd400" | |
my_status_bar = "~/.conky_bar_top" | |
my_music_bar = "~/.conky_bar_bottom" | |
title_bar_width_percentage = 0.9 | |
music_bar_width_percentage = 0.4 | |
#trayer_width_percentage = 1.0 - title_bar_width_percentage | |
#stats_bar_width_percentage = 1.0 - music_bar_width_percentage | |
my_bar_color = myBarColor | |
my_bar_inactive_text_color = myBarInactiveTextColor | |
my_font = myFont | |
# width, height = /^\s*dimensions:\s+(\d+)x(\d+).*$/.match(`xdpyinfo`).captures.map(&:to_i) | |
# title_bar_width = Integer(title_bar_width_percentage * width) | |
# music_bar_width = Integer(music_bar_width_percentage * width) | |
# trayer_width = width - title_bar_width #Integer(trayer_width_percentage * width) | |
# stats_bar_width = width - music_bar_width #Integer(stats_bar_width_percentage * width) | |
# top_offset = height - 16 | |
system "killall conky dzen2 trayer" # compton nm-applet batterymon" | |
# dzen_title_bar = "dzen2 -w #{title_bar_width} -h 16 -ta l -bg \"#{my_bar_color}\" -fg \"#{my_bar_inactive_text_color}\" -fn \"#{my_font}\"" | |
# trayer_bar = "trayer --edge top --align left --margin #{width-trayer_width} --heighttype pixel --height 16 --widthtype pixels --width #{trayer_width} --transparent true --alpha 0 --tint 0x111111" | |
# dzen_music_bar = "conky -c #{my_music_bar} | dzen2 -y #{top_offset} -h 16 -x 0 -w #{music_bar_width} -ta l -bg \"#{my_bar_color}\" -fn \"#{my_font}\"" | |
# dzen_status_bar = "conky -c #{my_status_bar} | dzen2 -y #{top_offset} -x #{music_bar_width} -w #{stats_bar_width} -h 16 -ta r -bg \"#{my_bar_color}\" -fn \"#{my_font}\"" | |
bars_on = :right | |
screens = `xrandr`.scan(/^[A-Z\d]+\s+connected\s+(\d+)x(\d+)\+(\d+)\+(\d+)/) | |
if screens.length == 2 then | |
left_id, right_id = nil | |
left = if screens[0][2] < screens[1][2] then left_id = 0; screens[0] else left_id = 1; screens[1] end.map { |dim| dim.to_i } | |
right = if screens[0][2] > screens[1][2] then right_id = 0; screens[0] else right_id = 1; screens[1] end.map { |dim| dim.to_i } | |
width, height, w_offset, h_offset = bars_on == :left ? left : right | |
title_bar_width = Integer(title_bar_width_percentage * width) | |
music_bar_width = Integer(music_bar_width_percentage * width) | |
trayer_width = width - title_bar_width #Integer(trayer_width_percentage * width.to_f) | |
stats_bar_width = width - music_bar_width #Integer(stats_bar_width_percentage * width.to_f) | |
top_offset = Integer(height - 16) | |
dzen_title_bar = "dzen2 -w #{title_bar_width} -h 16 -x #{w_offset} -ta l -bg \"#{my_bar_color}\" -fg \"#{my_bar_inactive_text_color}\" -fn \"#{my_font}\"" | |
trayer_bar = "trayer --edge top --align right --monitor #{bars_on == :right ? right_id : left_id} --heighttype pixel --height 16 --widthtype pixels --width #{trayer_width} --transparent true --alpha 0 --tint 0x111111" | |
puts trayer_bar | |
dzen_music_bar = "conky -c #{my_music_bar} | dzen2 -y #{top_offset} -h 16 -x #{w_offset} -w #{music_bar_width} -ta l -bg \"#{my_bar_color}\" -fn \"#{my_font}\"" | |
dzen_status_bar = "conky -c #{my_status_bar} | dzen2 -y #{top_offset} -x #{music_bar_width + w_offset} -w #{stats_bar_width} -h 16 -ta r -bg \"#{my_bar_color}\" -fn \"#{my_font}\"" | |
else | |
width, height, _, _ = screens[0] | |
title_bar_width = Integer(title_bar_width_percentage * width.to_f) | |
music_bar_width = Integer(music_bar_width_percentage * width.to_f) | |
trayer_width = width.to_i - title_bar_width #Integer(trayer_width_percentage * width.to_f) | |
stats_bar_width = width.to_i - music_bar_width #Integer(stats_bar_width_percentage * width.to_f) | |
top_offset = Integer(height) - 16 | |
dzen_title_bar = "dzen2 -w #{title_bar_width} -h 16 -ta l -bg \"#{my_bar_color}\" -fg \"#{my_bar_inactive_text_color}\" -fn \"#{my_font}\"" | |
trayer_bar = "trayer --edge top --align right --heighttype pixel --height 16 --widthtype pixels --width #{trayer_width} --transparent true --alpha 0 --tint 0x111111" | |
dzen_music_bar = "conky -c #{my_music_bar} | dzen2 -y #{top_offset} -h 16 -x 0 -w #{music_bar_width} -ta l -bg \"#{my_bar_color}\" -fn \"#{my_font}\"" | |
dzen_status_bar = "conky -c #{my_status_bar} | dzen2 -y #{top_offset} -x #{music_bar_width} -w #{stats_bar_width} -h 16 -ta r -bg \"#{my_bar_color}\" -fn \"#{my_font}\"" | |
end | |
#screens.each_with_index do |screen, id| | |
system "compton --vsync opengl --dbe -b" | |
#end | |
dzen_title = IO.popen(dzen_title_bar) | |
dzen_title.reopen($stdin) | |
dzen_status = IO.popen(dzen_status_bar) | |
dzen_music = IO.popen(dzen_music_bar) | |
trayer = IO.popen(trayer_bar) | |
#system("feh --bg-fill ~/Tapety/desktop_bg") | |
system "nitrogen --restore" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.IO | |
import qualified System.IO.UTF8 | |
import XMonad | |
import XMonad.Hooks.DynamicLog | |
import XMonad.Hooks.ManageDocks | |
import XMonad.Hooks.ManageHelpers | |
import XMonad.Hooks.UrgencyHook | |
import XMonad.Hooks.EwmhDesktops | |
import XMonad.Hooks.SetWMName | |
import XMonad.Util.Run | |
import Data.Ratio ((%)) | |
import qualified XMonad.StackSet as S | |
import XMonad.Util.EZConfig | |
import XMonad.Hooks.ICCCMFocus | |
import XMonad.Prompt | |
import XMonad.Prompt.Shell | |
-- layouts | |
import XMonad.Layout.NoBorders | |
import XMonad.Layout.ResizableTile | |
import XMonad.Layout.Reflect | |
import XMonad.Layout.IM | |
import XMonad.Layout.Tabbed | |
import XMonad.Layout.PerWorkspace (onWorkspace) | |
import XMonad.Layout.Grid | |
-------------------------------- | |
-- STUFF | |
-------------------------------- | |
withSpawnedPipe cmd f = do | |
pipe <- spawnPipe cmd | |
f pipe | |
hClose pipe | |
myRubyHack = "/home/jaen/.struts.rb" | |
main = do | |
withSpawnedPipe myRubyHack $ \ dzenTitleBarPipe -> do | |
xmonad $ withUrgencyHook NoUrgencyHook $ defaultConfig | |
{ terminal = myTerminal | |
, modMask = myModMask | |
, borderWidth = myBorderWidth | |
, startupHook = myStartupHook | |
, layoutHook = myLayout | |
, handleEventHook = fullscreenEventHook | |
, logHook = myLogHook dzenTitleBarPipe | |
, manageHook = myManageHook <+> manageHook defaultConfig | |
, normalBorderColor = myNormalBorderColor | |
, focusedBorderColor = myFocusedBorderColor | |
, focusFollowsMouse = myFocusFollowsMouse | |
, workspaces = myWorkspaces | |
} | |
`removeKeys` | |
[(myModMask, xK_p)] -- ++ | |
--[((m .|. myModMask, k), windows $ f i) | (i, k) <- zip myWorkspaces [xK_1 .. xK_9]] | |
`additionalKeys` | |
([((myModMask, xK_p), shellPrompt myXPConfig)] ++ | |
[((myModMask, xK_z), spawn "xscreensaver-command -lock & xset dpms force off")] ++ | |
[((m .|. myModMask, k), windows $ f i) | |
| (i, k) <- zip myWorkspaces [xK_1 .. xK_9], | |
(f, m) <- [(S.view, 0), (S.shift, shiftMask)]] ++ | |
[((controlMask .|. myModMask, k), windows $ S.greedyView i) | |
| (i, k) <- zip myWorkspaces [xK_1 .. xK_9]]) | |
`additionalKeysP` | |
( | |
[ ("<XF86Sleep>", spawn "xscreensaver-command -lock & sudo pm-suspend") | |
, ("<XF86PowerDown>", spawn "sudo hibernate") | |
, ("<XF86ScreenSaver>", spawn "xset dpms force off") | |
, ("<XF86AudioPlay>", spawn "mpc toggle") | |
, ("<XF86AudioStop>", spawn "mpc stop") | |
, ("<XF86AudioNext>", spawn "mpc next") | |
, ("<XF86AudioPrev>", spawn "mpc prev") | |
, ("<XF86AudioRaiseVolume>", spawn "amixer -q sset Master 1+ unmute") | |
, ("<XF86AudioLowerVolume>", spawn "amixer -q sset Master 1- unmute") | |
, ("<XF86AudioMute>", spawn "amixer sset Master toggle") | |
]) | |
--------------------------------- | |
-- CONSTANTS | |
---------------------------------i | |
myStartupHook = do | |
takeTopFocus | |
spawn "urxvt -T weechat -e weechat-curses" -- --> doShift "1:irc" | |
spawn "urxvt -T ncmpcpp -e ncmpcpp" -- --> doShift "9:mp3" | |
spawn "luakit" | |
spawn "pidgin" | |
-- spawn "urxvt -T URxvtConsole" | |
setWMName "LG3D" | |
myTerminal = "urxvt" | |
myModMask = mod4Mask | |
myBorderWidth = 2 | |
myWorkspaces = ["1:irc", "2:im", "3:www", "4:dev1", "5:dev2", "6:doc", "7:misc", "8:vid", "9:mp3"] | |
myFocusFollowsMouse = True | |
myFont = "-*-dejavu sans mono-medium-r-*-*-10-*-*-*-*-*-iso8859-*" | |
myImgDirectory = ".dzen/bitmaps/" | |
myGGNum = "26574751" | |
--------------------------------- | |
-- COLORS | |
-------------------------------- | |
myBarColor = "#111111" | |
myBarTextColor = "#babdb6" | |
myBarInactiveTextColor = "#555753" | |
myNormalBorderColor = "#555753" | |
myFocusedBorderColor = "#a40000" | |
myCurrentWorkspaceColor = "#73d216" | |
myDefaultBarColor = "#555753" | |
myUrgentWorkspaceColor = "#edd400" | |
myXPConfig = defaultXPConfig | |
{ | |
font = myFont, | |
fgColor = myBarInactiveTextColor, | |
bgColor = myBarColor, | |
bgHLight = myBarColor, | |
fgHLight = myBarTextColor, | |
position = Top, | |
historySize = 512, | |
showCompletionOnTab = True, | |
historyFilter = deleteConsecutive, | |
promptBorderWidth = 0, | |
height = 16 | |
} | |
--myLayout = avoidStruts(tiled ||| Mirror tiled ||| Full) ||| Full | |
myLayout = onWorkspace "8:vid" videoLayout $ smartBorders (onWorkspace "2:im" imLayout $ standardLayouts) | |
where | |
standardLayouts = avoidStruts(tiled ||| Mirror tiled ||| Full) ||| noBorders Full | |
where | |
tiled = Tall nmaster delta ratio | |
nmaster = 1 | |
ratio = 3/4 | |
delta = 3/100 | |
videoLayout = noBorders Full ||| avoidStruts(noBorders Full) | |
--imLayout = avoidStruts(reflectHoriz $ withIM (5%20) (Title ("Kadu: " ++ myGGNum)) Grid) | |
imLayout = avoidStruts(noBorders (reflectHoriz $ withIM (4%20) (Role "buddy_list") Grid)) | |
myLogHook pipe = dynamicLogWithPP $ myDzenPP pipe | |
-- | Move the window to the floating layer. | |
--doSink :: ManageHook | |
doSink = ask >>= \w -> doF (S.sink w) | |
myManageHook = composeAll | |
[isFullscreen --> doFullFloat, | |
isDialog --> doCenterFloat, | |
className =? "trayer" --> doIgnore, | |
className =? "Conky" --> doIgnore, | |
title =? "weechat" --> doShift "1:irc", | |
title =? "URxvtConsole" --> doShift "7:misc", | |
className =? "Chromium" --> doShift "3:www", | |
className =? "Chromium-browser" --> doShift "3:www", | |
className =? "luakit" --> doShift "3:www", | |
className =? "Firefox" --> doShift "3:www", | |
className =? "Pidgin" --> doShift "2:im", | |
className =? "Evince" --> doShift "6:doc", | |
className =? "Nautilus" --> doShift "7:misc", | |
className =? "MPlayer" --> doShift "8:vid" <+> doSink, | |
className =? "Smplayer" --> doShift "8:vid" <+> doSink, | |
title =? "ncmpcpp" --> doShift "9:mp3"] | |
where | |
ignore = ["trayer"] | |
--myDzenTitleBar = "dzen2 -w 1206 -h 16 -ta l -bg \"" ++ myBarColor ++ "\" -fg \"" ++ myBarInactiveTextColor ++ "\" -fn \"" ++ myFont ++ "\"" | |
--myDzenStatusBar = myTopBar ++ " | dzen2 -y 1184 -x 600 -h 16 -ta r -bg \"" ++ myBarColor ++ "\" -fn \"" ++ myFont ++ "\"" | |
--myDzenMusicBar = myMusicBar ++ " | dzen2 -y 1184 -h 16 -x 0 -w 600 -ta l -bg \"" ++ myBarColor ++ "\" -fn \"" ++ myFont ++ "\"" | |
--myTray = "trayer --monitor 1 --edge top --align right --heighttype pixel --height 16 --widthtype pixels --width 160 --transparent true --alpha 0 --tint 0x111111" | |
--myWirelessApplet = "nm-applet" | |
--myTopBar = "conky -c ~.conky_bar_top" | |
--myMusicBar = "conky -c ~.conky_bar_bottom" | |
myDzenPP h = defaultPP | |
{ | |
ppOutput = System.IO.hPutStrLn h, --UTF8.hPutStrLn h, | |
ppCurrent = (\x -> wrapFgColor myCurrentWorkspaceColor ++ wrapImg "corner.xbm" ++ x ++ " ^fg()^bg()"), | |
ppHidden = (\x -> "^ca(1, xdotool key Super+" ++ [x!!0] ++ ")" ++ wrapImg "corner.xbm" ++ x ++ " ^ca()^fg()^bg()"), --(\x -> wrapFgColor myPopulatedWorkspaceColor ++ wrapImg "corner.xbm" ++ x ++ "^fg()"), | |
ppUrgent = (\x -> wrapBgColor myUrgentWorkspaceColor ++ wrapFgColor "#000000" ++ "^ca(1, xdotool key Super+" ++ [x!!0] ++ ")" ++ wrapImg "corner.xbm" ++ x ++ " ^ca()^fg()^bg()" ), | |
ppSep = wrapFgColor myBarTextColor ++ " | ", --hack, so that rest is proper color | |
ppWsSep = "", | |
ppTitle = (\x -> x) | |
} | |
where | |
wrapFgColor color = "^fg(" ++ color ++ ")" | |
wrapBgColor color = "^bg(" ++ color ++ ")" | |
wrapImg img = "^i(" ++ myImgDirectory ++ img ++ ")" | |
wrapImgCol img color = "^fg(" ++ color ++ ")^i(" ++ myImgDirectory ++ img ++ ")" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment