Skip to content

Instantly share code, notes, and snippets.

@maxbane
Last active November 11, 2020 07:37
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxbane/9521612 to your computer and use it in GitHub Desktop.
Save maxbane/9521612 to your computer and use it in GitHub Desktop.
My xmonad config
#!/bin/bash
xmodmap ~/.Xmodmap
-- xmobar configuration file
--
-- Mess with this file to change the appearance of the contents of the
-- status bar which are not directly controlled by xmonad. You can see your
-- changes immediately by recompiling xmonad using "super-q".
--
-- There's a lot you can do here. Refer to "man xmobar".
--
-- Author: David Brewer
-- Repository: https://github.com/davidbrewer/xmonad-ubuntu-conf
Config {
-- Set font and default foreground/background colors. Note that
-- the height of xmobar is controlled by the font you use.
font = "xft:Ubuntu Mono-12",
bgColor = "black",
fgColor = "grey",
-- Position is top left, taking up 95% of screen.
-- You are likely to have to tweak the width here based on the width
-- of your screen to make it play nicely with stalonetray, which we
-- want to be taking up the remainer of the space on the right side
-- of your screen.
position = TopW L 100,
-- list of commands which gather information about your system for
-- presentation in the bar.
commands = [
-- Gather and format CPU usage information.
-- If it's above 50%, we consider it high usage and make it red.
Run Cpu [
"-H","50",
"--high","red"
] 10,
-- Gather and format memory usage information
Run Memory [
"-t","Mem: <usedratio>%"
] 10,
-- Date formatting
Run Date "%a %b %_d %l:%M" "date" 10,
-- Battery information. This is likely to require some customization
-- based upon your specific hardware. Or, for a desktop you may want
-- to just remove this section entirely.
-- Run Battery [
-- "-t", "<acstatus>: <left>%",
-- "--",
-- "-c", "charge_full",
-- "-O", "AC",
-- "-o", "Bat",
-- "-h", "green",
-- "-l", "red"
-- ] 10,
-- To get volume information, we run a custom bash script.
-- This is because the built-in volume support in xmobar is disabled
-- in Debian and derivatives like Ubuntu.
Run Com "~/bin/get-volume" [] "myvolume" 10,
Run Com "~/bin/babbage-latency" [] "babbageLatency" 10,
Run Com "~/bin/google-latency" [] "googleLatency" 10,
Run Com "~/bin/hs0-latency" [] "hs0Latency" 10,
Run Weather "KNYC" ["-t", "KNYC: <tempF>F/<skyCondition>"] 36000,
Run Network "eth0" [] 36000,
-- This line tells xmobar to read input from stdin. That's how we
-- get the information that xmonad is sending it for display.
Run StdinReader
],
-- Separator character used to wrape variables in the xmobar template
sepChar = "%",
-- Alignment separater characer used in the xmobar template. Everything
-- before this will be aligned left, everything after aligned right.
alignSep = "}{",
-- Overall template for the layout of the xmobar contents. Note that
-- space is significant and can be used to add padding.
-- template = "%StdinReader% }{ %battery% | %cpu% | %memory% | Vol: %myvolume% <fc=#e6744c>%date%</fc> "
template = "%StdinReader% }{ Vol: %myvolume% | %cpu% | %memory% | babbage: %babbageLatency% | hs0: %hs0Latency% | google: %googleLatency% <fc=#e6744c>%date%</fc> %KNYC%"
}
clear Lock
keycode 0x42 = Escape
#!/bin/bash
xsetbg -fullscreen -center -zoom 75 ~/Pictures/Andromeda_galaxy_2.jpg
xmonad
#!/bin/bash
# Get the maximum volume of any pulseaudio sink channel
pacmd list-sinks | grep "^\s\+volume:" | grep -o "[[:digit:]]\+%" | \
sort -nr | head -n 1
#!/bin/bash
RES="$(ping -c 1 google.com 2>&1 | grep -o "[0-9]\+\.[0-9]\+ ms" | head -n 1)"
if [ "x$RES" = "x" ]; then
echo "DOWN"
else
echo "$RES"
fi
import XMonad
import XMonad.Util.EZConfig
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.EwmhDesktops
import XMonad.Layout.NoBorders
import XMonad.Layout.Circle
import XMonad.Layout.Grid
import XMonad.Layout.ResizableTile
import XMonad.Layout.ThreeColumns
-- import XMonad.Layout.Fullscreen
-- See https://github.com/davidbrewer/xmonad-ubuntu-conf
-- The main function.
main = xmonad =<< statusBar myBar myPP toggleStrutsKey myConfig
-- Command to launch the bar.
myBar = "xmobar"
{-
Xmobar configuration variables. These settings control the appearance
of text which xmonad is sending to xmobar via the DynamicLog hook.
-}
myTitleColor = "#eeeeee" -- color of window title
myTitleLength = 80 -- truncate window title to this length
myCurrentWSColor = "#e6744c" -- color of active workspace
myVisibleWSColor = "#c185a7" -- color of inactive workspace
myUrgentWSColor = "#cc0000" -- color of workspace with 'urgent' window
myCurrentWSLeft = "[" -- wrap active workspace with these
myCurrentWSRight = "]"
myVisibleWSLeft = "(" -- wrap inactive workspace with these
myVisibleWSRight = ")"
myUrgentWSLeft = "{" -- wrap urgent workspace with these
myUrgentWSRight = "}"
-- Custom PP, configure it as you like. It determines what is being written to the bar.
myPP = xmobarPP {
-- ppCurrent = xmobarColor "#429942" "" . wrap "<" ">"
ppTitle = xmobarColor myTitleColor "" . shorten myTitleLength
, ppCurrent = xmobarColor myCurrentWSColor ""
. wrap myCurrentWSLeft myCurrentWSRight
, ppVisible = xmobarColor myVisibleWSColor ""
. wrap myVisibleWSLeft myVisibleWSRight
, ppUrgent = xmobarColor myUrgentWSColor ""
. wrap myUrgentWSLeft myUrgentWSRight
}
-- Key binding to toggle the gap for the bar.
toggleStrutsKey XConfig {XMonad.modMask = modMask} = (modMask, xK_b)
-- Main configuration, override the defaults to your liking.
myConfig = defaultConfig {
modMask = mod4Mask,
--terminal = "xterm -bg black -fg gray -fa \"Ubuntu Mono\" -fs 12 -e '/usr/bin/env -u TMUX tmux -2'",
terminal = "gnome-terminal -e '/usr/bin/env -u TMUX tmux -2'",
handleEventHook = fullscreenEventHook,
-- border colors from solarized dark palette
focusedBorderColor = "#268bd2",
normalBorderColor = "#586e75",
layoutHook = smartBorders(avoidStruts(
ResizableTall 1 (3/100) (1/2) []
||| Mirror (ResizableTall 1 (3/100) (1/2) [])
||| noBorders Full
||| Grid
||| ThreeColMid 1 (3/100) (3/4)
||| Circle
))
-- manageHook = composeAll [
-- className =? "Gimp" --> doFloat,
-- className =? "MPlayer" --> doFloat,
-- isFullscreen --> doFullFloat
-- ]
}
`additionalKeys`
[
((mod4Mask .|. shiftMask, xK_l), spawn "slock")
, ((mod4Mask, xK_minus),
spawn "pactl set-sink-volume bluez_sink.FC_58_FA_01_4F_BD -- -5%")
, ((mod4Mask, xK_equal),
spawn "pactl set-sink-volume bluez_sink.FC_58_FA_01_4F_BD -- +5%")
, ((mod4Mask, xK_0),
spawn "pactl set-sink-volume bluez_sink.FC_58_FA_01_4F_BD -- 0%")
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment