起因
从最开始的gnome/kde到xfce,再到fvwm,之后awesome,直到现在的xmonad,我都不知道自己为什么换那么多的wm干啥,如果非要说个理由,其实也很简单,就是在现在资源占用越来越大,硬件更新(money)跟不上的我,总是不爽电脑越用越慢的感觉,所以一直在找更小的更易用的wm,因为我用电脑的方式有时候很简单,就是上网,写报告,然后处理数据,能用最小资源启动系统,然后把其它资源留给其它程序是最好了。
本来用到fvwm是不打算折腾了,毕竟资源占用已经很低了,但是有一天突发奇想,想试着不用鼠标还能便捷的进行大多数的操作,这在float方式下的wm(如fvwm)实现起来不是不可能,只是稍微麻烦点,而且窗口排步方面手动的部分太多,所以换成了tile式的wm,最先使用的是i3,之后发现awesome的功能更完备些,然后又因为找到了一个很不错的config(可以看我的另一篇放弃Fvwm,拥抱Awesome),就用了有一年的awesome。
然后有一个周末闲的,没啥事,就想着还有没有打开程序更快,使用上便捷性和Awesome差不多的wm,就发现了xmonad。其实当时选择tile方式的wm时,就了解过xmonad,但是因为要连haskell环境一块安装,明显比awesome更占用空间(虽然占不了多少,强迫症吧),就没考虑用xmonad。不过抱着先试试,不行就删掉的心态,装了xmonad,从一开始使用就很反感,因为启动终端和Awesome的快捷键不一样,需要多按一个Shift键(Win+Shfit+回车),很是鄙视,而且没有panel,panel配置不好还会被窗口遮盖等等使得我差点就放弃使用它。不过在打开wps时,我就决定坚持使用xmonad,因为不是快一点点的问题(当然用固态硬盘的同学可以不考虑了)。
Xmonad
之后开始一点点的配置整个桌面,整个配置下来后,发现xmonad真心有很多不错的地方,最主要的有以下几个地方:
1. 和Fvwm类似,有标准的模块,模块的调用很方便,import就行,而且官网上的API写的还是比较清楚的;当然Awesome的API介绍写的也不错,但Xmonad的和Awesome的有比较本质的区别,Awesome更多的是涉及基本功能和操作的API,但是Xmonad更多的是扩展功能,可以这么理解,Awesome涉及WM本身,而Xmonad提供的是扩展插件。Awesome也有一些好用的util和lain这些扩展模块,但是在具体使用的时候就不是那么友好了(可能我比较挫),有了这些扩展(xmoand-contrib)才构成了Xmonad的使用优势;
2. 稳定,配置文件相对清晰易用(直接就是Haskell编程)。
3. 没有了。。。
总之,除了扩展就没什么特别的优势了。
Tile这类wm,除了i3和Awesome都有一个明显短板,虽然我不太受影响,就是panel的使用上一开始非常不友好,除了要调用第三方panel外,还得给第三方panel写配置,当然fvwm也有这个问题。好在有一个panel还比较配合,叫xmobar,看名称就知道主要是配合xmonad使用的。说实在的xmobar,很好用,配合bash脚本,可以有很多的用处,但是xmobar有个软肋,还得单独开个程序启用tray,否则没有tray,对我而言,tray是比较有用的。好在最后找到了一个叫polybar的程序,自带tray,(当然用tint2也可以,但是polybar有我更需要的一些东西,比如声音控制,大小写显示)。但是polybar在显示xmonad的窗口信息和workspace信息时,很是麻烦(反正我没搞成),而且没有xmobar对于bash脚本支持那么易用,怎么办?简单粗暴的解决办法,都用咯。且看我的桌面。
在上方用xmobar,下方呢用polybar,最好把xmobar放上边,这个xmobar有点娇气,如果有程序和其重叠或者是反复刷新它显示/隐藏,冷不丁的就会自动退出,毫无征兆,难以重现,至今本人没有解决。。。,只是尽量减少其出现次数,如果出现,重启一下xmonad,也很方便,设置一个快捷键就是了,反正以后会经常重启,为了重启不反复开启更多的xmobar和polybar先要把相应的进程杀死,例如添加:
-- kill all polybar xmobar before executing default restart command
myRestart = "for pid in `pgrep polybar`; do kill -9 $pid; done && " ++
"for pid in `pgrep xmobar`; do kill -9 $pid; done && " ++
"for pid in `pgrep compton`; do kill -9 $pid; done && " ++
"for pid in `pgrep redshift`; do kill -9 $pid; done && " ++
"xmonad --recompile && xmonad --restart"
应该可以写的更简洁,比如把polybar这些程序清单用一个list函数表示就是了,不过懒得写了,先这么着吧,反正都是复制粘贴,也不容易出错,感兴趣优化的童鞋可以帮个忙。然后在设置快捷键的位置设置快捷键调用myRestart就是了,同理像compton,redshift这种不想重复启动的,也这么写就是了,还有一个办法,就是要随wm启动的程序写到.xinitrc文件里,这样wm重启时不会重启相应程序,这也可以,看个人喜好。
配置文件
要用好Awesome和Xmonad这类WM其实很大程度上就是在优化配置文件,xmonad的配置文件在$HOME路径下的.xmonad文件下,如果你用的vim/gvim,可以$vim ~/.xmoand/xmonad.hs应该就可以编辑配置文件了。如果没有这个配置文件,可以从/usr/share/xmonad/man/xmonad.hs里拷贝一个到上面那个.xmonad路径下,然后xmonad --recomplie & xmonad --restart 然后此文件基础上配置就成。不建议直接拷贝我的配置文件去用,因为我在两台电脑上实验过,并不一定能用,至少我在DELL机子上的配置文件复制到我HP机子上就不能用,也不知道是哪的问题,不想细究了。那配置文件怎么用?
首先要弄清楚哪些位置的配置都代表什么功能,可以怎么修改,然后找到对应的模块拷贝,重启调试,确定能用再调其它的内容,当然也可以直接拷贝,看运气咯。
说起来配置文件可以分几个方式去看:
第一部分:import的引用部分。
这个很好理解,就是装插件,你想用插件,不安装是用不了的,import就相当于安装,怎么import可以看官网的api文件,链接如下[图片上传失败...(image-38a09e-1536736014156)]
比如我的import就有这些
import System.IO
import System.Exit
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.SetWMName
import XMonad.Hooks.Place
import XMonad.Layout.Fullscreen
--import XMonad.Layout.NoBorders
import XMonad.Layout.Spiral
import XMonad.Layout.Circle
--import XMonad.Layout.Tabbed
import XMonad.Layout.CenteredMaster
import XMonad.Layout.ThreeColumns
--import XMonad.Layout.Magnifier
import XMonad.Layout.Accordion
import XMonad.Layout.MagicFocus
import XMonad.Layout.Grid
import XMonad.Layout.Drawer
import XMonad.Layout.DragPane
import XMonad.Layout.MultiToggle
import XMonad.Layout.MultiToggle.Instances
import XMonad.Layout.SimplestFloat
import XMonad.Layout.PerWorkspace
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import Graphics.X11.ExtraTypes.XF86
import XMonad.ManageHook
import XMonad.Util.NamedScratchpad
import qualified XMonad.StackSet as W
import qualified Data.Map as M
-- import class use to show workspace-tree
import XMonad.Actions.GridSelect
import XMonad.Actions.FloatKeys
import XMonad.Actions.Submap
import XMonad.Actions.WindowMenu
import XMonad.Actions.Warp
import XMonad.Actions.TagWindows
import XMonad.Actions.FocusNth
import XMonad.Actions.DynamicProjects (Project(..), dynamicProjects, shiftToProjectPrompt, switchProjectPrompt)
import XMonad.Actions.Search
import XMonad.Prompt
import XMonad.Prompt.ConfirmPrompt
import XMonad.Prompt.Input
import XMonad.Prompt.Shell
import XMonad.Prompt.Window
有点多哈,其实分几个部分来看就好了,一个是不用考虑的部分,就是Xmonad.Hook之前(包括Hook)的部分,还有Util部分一般都装上就是,一个是常修改部分,就是Layout,Action,Prompt这类模块。
其中Layout很好理解就是窗口的排布方式,比如tiled,比如Tabbed,比如Full,比如下边这种排布,为mirror排布,就是上下分屏,然后上是主窗口,即Master窗口
排布方式根据默认快捷键操作,可以用win+空格键进行切换,和Awesome类似。
然后就是Action模块,Action模块很有用,最有用的是这么几个Submap,Gridselect,Warp
Submap是可以设置类似引导(Leader)键,比如我想用键盘控制mpd的播放,可是键盘上快捷键组合不够怎么办,那我们就设置一个方式,比如win+z 激活控制,然后1,2,3数字键分别代表播放,暂停和停止,也就是说如果要暂停音乐,只需要按win+z组合键后,再敲击2就可以暂停了,这样可以用的快捷键就多了。
Gridselect是调出一个辐射状的菜单,用来选择已经开启的窗口,或者是打开某个程序(相当于Dashboard)。
效果如下:
然后是Warp,Warp的主要作用是在不同的显示器切换鼠标,Xmonad的机制和Awesome不太一样,Awesome是根据你选择的workspace,指针跳到你选择的Workspace,然后Xmonad是把窗口拉到指针所在的显示器,如果你有多屏,体验一下就知道了,刚开始可能有点不习惯,不过有个好处,就是如果中途退出一个屏,这个屏上显示的内容Awesome可能显示不出来(因为那个workspace还在那个屏上。。。),但是xmonad就不存在这个问题了,另外可以比较专注在一个屏上。
其它的一些Stack之类的也很重要,直接用吧,这里就不多做解释了,要注意这里是import后As成了S,也就是后边在调用的时候要用S来调用,这个有一定编程基础的都清楚,话说这点和python挺像的。
然后安装完插件,往下就是主要程序了,也分几部分来说:
- 各种自定函数
自定函数就像前面myrestart这类需要在原先默认命令上添加功能的函数咯,包括定义xmobar的路径(myXmobarrc)等等
在用别人的配置文件时,要注意自定函数,因为缺少这部分肯定会出错的,所以要自己消化和理解,不能照搬,这点要比Fvwm麻烦不少,Awesome也存在这样的问题。当然如果遇到自定函数就绕道走,也不失为一个办法,就是可能会错过一些好功能,比如全屏切换或者Float属性切换等。 - 定义快捷键
最重要的部分,可以说要用Xmonad,尤其是像我基本90%的时候都是用键盘完成基本操作的时候,没有一个适合自己的快捷键布局基本就残废了。
快捷键一般有两种方式,我也不知道怎么描述这两种方式,一种是EZ方式,一种是默认方式,姑且这么说吧,我也不是很专业。
EZ是什么样的呢:
-- my custom keybindings.
myKeys h host = myKeymap host (byorgeyConfig h host)
myKeymap host conf =
-- mod-[1..], Switch to workspace N
-- mod-shift-[1..], Move client to workspace N
-- mod-ctrl-[1..], Switch to workspace N on other screen
[ (m ++ "M-" ++ [k], f i) -- (0)
| (i, k) <- zip (XMonad.workspaces conf) "1234567890-=[]\" -- (0)
, (f, m) <- [ (goto', "") -- (0a)
, (windows . W.shift, "S-")
, (\ws -> nextScreen >> (goto' $ ws), "C-")
]
]
++
[ ("M-S-x", spawnShell host) -- (0)
, ("M-S-b", spawn "urxvt-big")
, ("M-g", promptedGoto host)
, ("M-C-g", promptedGotoOtherScreen host)
, ("M-S-g", promptedShift)
, ("M-S-C-g", workspacePrompt myXPConfig $ \ws -> -- (27)
withAll' (W.shiftWin ws) >> goto host ws) -- (22)
-- in conjunction with manageHook, open a small temporary
-- floating terminal
, ("M-a s", namedScratchpadAction scratchpads "term") -- (30)
, ("M-a d", namedScratchpadAction scratchpads "term2")
, ("M-a g", namedScratchpadAction scratchpads "ghci")
, ("M-a t", namedScratchpadAction scratchpads "top")
默认方式呢:
myModMask = mod4Mask
myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
[ ((modMask .|. shiftMask, xK_Return),
spawn $ XMonad.terminal conf)
-- Lock the screen using command specified by myScreensaver.
, ((modMask .|. controlMask, xK_l),
spawn "slimlock")
--control window ,workspace and layout by using prompt
,((modMask,xK_p), switchProjectPrompt warmPromptTheme)
, ((modMask,xK_grave), windowPromptBring myXPConfig)
, ((modMask , xK_n), submap . mySearchMap $ myPromptSearch )
, ((modMask .|. shiftMask, xK_b), safePrompt "wyeb" myXPConfig)
-- Spawn the launcher using command specified by myLauncher.
-- Use this to launch programs without a key binding.
, ((modMask, xK_o),
....(不完整)
这两种方式应该是不通用的,EZ方式下submap也没用了,我用的是默认方式,因此EZ方式感兴趣的童鞋研究吧。
我定义了modMask为win键,也就是mod4Mask,在有的配置文件中你可能会看到是modM而不是modMask,这个就看你定义的是啥了,不一致要修改,否则用不了,默认的modMask是alt键。然后要用shift和control组合自己看吧,用默认方式还得注意用的是按键的英文名称,也就是说`不能直接xK_`,而要用xK_grave,具体特殊符号的名称是啥可以大致对照一下下边的名称,特殊符号自己英文翻译一下应该就能搞定。
xK_VoidSymbol, xK_BackSpace, xK_Tab, xK_Linefeed, xK_Clear, xK_Return, xK_Pause, xK_Scroll_Lock, xK_Sys_Req, xK_Escape, xK_Delete, xK_Multi_key, xK_Home, xK_Left, xK_Up, xK_Right, xK_Down, xK_Prior, xK_Page_Up, xK_Next, xK_Page_Down, xK_End, xK_Begin, xK_Select, xK_Print, xK_Execute, xK_Insert, xK_Undo, xK_Redo, xK_Menu, xK_Find, xK_Cancel, xK_Help, xK_Break, xK_Mode_switch, xK_script_switch, xK_Num_Lock, xK_KP_Space, xK_KP_Tab, xK_KP_Enter, xK_KP_F1, xK_KP_F2, xK_KP_F3, xK_KP_F4, xK_KP_Home, xK_KP_Left, xK_KP_Up, xK_KP_Right, xK_KP_Down, xK_KP_Prior, xK_KP_Page_Up, xK_KP_Next, xK_KP_Page_Down, xK_KP_End, xK_KP_Begin, xK_KP_Insert, xK_KP_Delete, xK_KP_Equal, xK_KP_Multiply, xK_KP_Add, xK_KP_Separator, xK_KP_Subtract, xK_KP_Decimal, xK_KP_Divide, xK_KP_0, xK_KP_1, xK_KP_2, xK_KP_3, xK_KP_4, xK_KP_5, xK_KP_6, xK_KP_7, xK_KP_8, xK_KP_9, xK_F1, xK_F2, xK_F3, xK_F4, xK_F5, xK_F6, xK_F7, xK_F8, xK_F9, xK_F10, xK_F11, xK_L1, xK_F12, xK_L2, xK_F13, xK_L3, xK_F14, xK_L4, xK_F15, xK_L5, xK_F16, xK_L6, xK_F17, xK_L7, xK_F18, xK_L8, xK_F19, xK_L9, xK_F20, xK_L10, xK_F21, xK_R1, xK_F22, xK_R2, xK_F23, xK_R3, xK_F24, xK_R4, xK_F25, xK_R5, xK_F26, xK_R6, xK_F27, xK_R7, xK_F28, xK_R8, xK_F29, xK_R9, xK_F30, xK_R10, xK_F31, xK_R11, xK_F32, xK_R12, xK_F33, xK_R13, xK_F34, xK_R14, xK_F35, xK_R15, xK_Shift_L, xK_Shift_R, xK_Control_L, xK_Control_R, xK_Caps_Lock, xK_Shift_Lock, xK_Meta_L, xK_Meta_R, xK_Alt_L, xK_Alt_R, xK_Super_L, xK_Super_R, xK_Hyper_L, xK_Hyper_R, xK_space, xK_exclam, xK_quotedbl, xK_numbersign, xK_dollar, xK_percent, xK_ampersand, xK_apostrophe, xK_quoteright, xK_parenleft, xK_parenright, xK_asterisk, xK_plus, xK_comma, xK_minus, xK_period, xK_slash, xK_0, xK_1, xK_2, xK_3, xK_4, xK_5, xK_6, xK_7, xK_8, xK_9, xK_colon, xK_semicolon, xK_less, xK_equal, xK_greater, xK_question, xK_at, xK_A, xK_B, xK_C, xK_D, xK_E, xK_F, xK_G, xK_H, xK_I, xK_J, xK_K, xK_L, xK_M, xK_N, xK_O, xK_P, xK_Q, xK_R, xK_S, xK_T, xK_U, xK_V, xK_W, xK_X, xK_Y, xK_Z, xK_bracketleft, xK_backslash, xK_bracketright, xK_asciicircum, xK_underscore, xK_grave, xK_quoteleft, xK_a, xK_b, xK_c, xK_d, xK_e, xK_f, xK_g, xK_h, xK_i, xK_j, xK_k, xK_l, xK_m, xK_n, xK_o, xK_p, xK_q, xK_r, xK_s, xK_t, xK_u, xK_v, xK_w, xK_x, xK_y, xK_z, xK_braceleft, xK_bar, xK_braceright, xK_asciitilde, xK_nobreakspace, xK_exclamdown, xK_cent, xK_sterling, xK_currency, xK_yen, xK_brokenbar, xK_section, xK_diaeresis, xK_copyright, xK_ordfeminine, xK_guillemotleft, xK_notsign, xK_hyphen, xK_registered, xK_macron, xK_degree, xK_plusminus, xK_twosuperior, xK_threesuperior, xK_acute, xK_mu, xK_paragraph, xK_periodcentered, xK_cedilla, xK_onesuperior, xK_masculine, xK_guillemotright, xK_onequarter, xK_onehalf, xK_threequarters, xK_questiondown, xK_Agrave, xK_Aacute, xK_Acircumflex, xK_Atilde, xK_Adiaeresis, xK_Aring, xK_AE, xK_Ccedilla, xK_Egrave, xK_Eacute, xK_Ecircumflex, xK_Ediaeresis, xK_Igrave, xK_Iacute, xK_Icircumflex, xK_Idiaeresis, xK_ETH, xK_Eth, xK_Ntilde, xK_Ograve, xK_Oacute, xK_Ocircumflex, xK_Otilde, xK_Odiaeresis, xK_multiply, xK_Ooblique, xK_Ugrave, xK_Uacute, xK_Ucircumflex, xK_Udiaeresis, xK_Yacute, xK_THORN, xK_Thorn, xK_ssharp, xK_agrave, xK_aacute, xK_acircumflex, xK_atilde, xK_adiaeresis, xK_aring, xK_ae, xK_ccedilla, xK_egrave, xK_eacute, xK_ecircumflex, xK_ediaeresis, xK_igrave, xK_iacute, xK_icircumflex, xK_idiaeresis, xK_eth, xK_ntilde, xK_ograve, xK_oacute, xK_ocircumflex, xK_otilde, xK_odiaeresis, xK_division, xK_oslash, xK_ugrave, xK_uacute, xK_ucircumflex, xK_udiaeresis, xK_yacute, xK_thorn, xK_ydiaeresis
- 主配置main部分和defaults部分的配置
重点说三个部分,一个是scratchpad,一个是xmonad的自动启动程序,一个是xmobar的配置。
scratchpad 就是呼之寄来,挥之即去的程序,挺方便的,不用来回来去的切换程序了。
具体配置:
首先要安装插件,import XMonad.Util.NamedScratchpad
之后定义scratchpad
-- scratchpads property
scratchpads = [
-- run htop in xterm, find it by title, use default floating window placement
NS "htop" "termite -e htop" (title =? "htop") defaultFloating ,
NS "notes" "gvim --role notes ~/Documents/notes.txt" (role =? "notes") (customFloating $ W.RationalRect (1/6) (1/6) (2/3) (2/3))
] where role = stringProperty "WM_WINDOW_ROLE"
这里我定义了两个pad,一个是htop监控系统进程,一个是notes随时记录
然后定义快捷键
-- scratchpads keys
, ((modMask , xK_F1), submap . M.fromList $
[
((0 ,xK_h), namedScratchpadAction scratchpads "htop")
, ((0 , xK_t), namedScratchpadAction scratchpads "trans")
, ((0 , xK_c), namedScratchpadAction scratchpads "calc")
, ((0 , xK_p), namedScratchpadAction scratchpads "project")
, ((0 , xK_b), namedScratchpadAction scratchpads "books")
, ((0, xK_n), namedScratchpadAction scratchpads "notes")
])
最后在manageHook那添加scratchpads设定
manageHook = manageDocks <+> myManageHook <+> placeHook simpleSmart <+> namedScratchpadManageHook scratchpads
和scratchpads有关的是namedScratchpadManageHook scratchpads,其它的根据实际情况修改。
随WM启动:
, startupHook = setWMName "LG3D" <+> spawn "polybar -c /home/lincoo/.config/polybar/config bar1" <+> spawn "guake" <+> spawn "compton --config /home/lincoo/.config/compton/compton.conf" <+> spawn "redshift-gtk -l 39.92:116.46 -t 5500:4500e"
我另外还有几个写在.xinitrc中的随机启动程序:
feh --bg-fill +“壁纸路径” 用来显示壁纸。
keynav 用键盘控制鼠标移动
nm-applet 网络设置
输入法用的小小输入法,yong
xmobar的设置,没太深的研究,直接贴配置吧
xmproc <- spawnPipe ("xmobar " ++ myXmobarrc)
xmonad $ defaults {
logHook = dynamicLogWithPP $ xmobarPP {
ppOutput = hPutStrLn xmproc
, ppTitle = xmobarColor xmobarTitleColor "" . shorten 50
, ppCurrent = xmobarColor xmobarCurrentWorkspaceColor ""
, ppSep = " "
}
记得在myXmobarrc函数那定义xmobar的路径。
几个小事儿
- 记得定义运行程序用的RUN程序,可选的dmenu,rofi,synapse也可以,不过我现在用dmenu,好处是快
- 默认配置文件打开的是xterm,如果你没有记得安装或者修改,打开方式是alt+shift+回车
- 重启WM默认是alt+Q,我改成了win+b
- 快捷键自己读吧,实在是不想再打一遍了,中间因为各种原因,文章重写了好几回,实在没耐心了
最后,附上本人的配置文件,强调一下,配置文件中有太多和本人机器相关联的程序和路径,还请自行修改调整。此配置是在Vic Fryzel的配置文件上进行的修改,感谢Vic Fryzel。
附上网址
-- xmonad config used by lincoo-- Author: lincoo
import System.IO
import System.Exit
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.SetWMName
import XMonad.Hooks.Place
import XMonad.Layout.Fullscreen
--import XMonad.Layout.NoBorders
import XMonad.Layout.Spiral
import XMonad.Layout.Circle
--import XMonad.Layout.Tabbed
import XMonad.Layout.CenteredMaster
import XMonad.Layout.ThreeColumns
--import XMonad.Layout.Magnifier
import XMonad.Layout.Accordion
import XMonad.Layout.MagicFocus
import XMonad.Layout.Grid
import XMonad.Layout.Drawer
import XMonad.Layout.DragPane
import XMonad.Layout.MultiToggle
import XMonad.Layout.MultiToggle.Instances
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import Graphics.X11.ExtraTypes.XF86
import XMonad.ManageHook
import XMonad.Util.NamedScratchpad
import qualified XMonad.StackSet as W
import qualified Data.Map as M
-- import class use to show workspace-tree
import XMonad.Actions.GridSelect
import XMonad.Actions.FloatKeys
import XMonad.Actions.Submap
import XMonad.Actions.WindowMenu
import XMonad.Actions.Warp
import XMonad.Actions.TagWindows
import XMonad.Actions.FocusNth
import XMonad.Actions.DynamicProjects (Project(..), dynamicProjects, shiftToProjectPrompt, switchProjectPrompt)
import XMonad.Actions.Search
import XMonad.Layout.SimplestFloat
import XMonad.Layout.PerWorkspace
import XMonad.Prompt
import XMonad.Prompt.ConfirmPrompt
import XMonad.Prompt.Input
import XMonad.Prompt.Shell
import XMonad.Prompt.Window
-- Terminal
-- The preferred terminal program, which is used in a binding below and by
-- certain contrib modules.
--
myTerminal = "/usr/bin/termite"
-- The command to lock the screen or show the screensaver.
myScreensaver = "/usr/bin/xscreensaver-command -l"
-- The command to take a selective screenshot, where you select
-- what you'd like to capture on the screen.
mySelectScreenshot = "scrot -s"
-- The command to take a fullscreen screenshot.
myScreenshot = "scrot -d 3"
-- The command to use as a launcher, to launch commands that don't have
-- preset keybindings.
myLauncher = "$(rofi -show run)"
-- Location of your xmobar.hs / xmobarrc
myXmobarrc = "~/.xmonad/xmobar-single.hs"
--Promte property
base03 = "#002b36"
base02 = "#073642"
base01 = "#586e75"
base00 = "#657b83"
base0 = "#839496"
base1 = "#93a1a1"
base2 = "#eee8d5"
base3 = "#fdf6e3"
yellow = "#b58900"
orange = "#cb4b16"
red = "#dc322f"
magenta = "#d33682"
violet = "#6c71c4"
blue = "#268bd2"
cyan = "#2aa198"
green = "#859900"
active = blue
activeWarn = red
inactive = base02
focusColor = blue
unfocusColor = base02
myFont = "xft:WenQuanYi Micro Hei"
myBigFont = "xft:WenQuanYi Zen Hei:pixelsize=24"
myWideFont = "xft:WenQuanYi Zen Hei:pixelsize=16"
myPromptTheme = def
{ font = myFont
, bgColor = base03
, fgColor = active
, fgHLight = base03
, bgHLight = active
, borderColor = base03
, promptBorderWidth = 0
, height = 20
, position = Top
}
warmPromptTheme = myPromptTheme
{ bgColor = yellow
, fgColor = base03
, position = Top
}
mySearchMap method = M.fromList $
[((0, xK_w), method wikipedia)
, ((0, xK_b), method bing)
, ((0, xK_e), method dogpile)
, ((0, xK_c), method excite)
, ((0, xK_d), method baidu)
]
--search custom set
bing = searchEngine "bing" "https://www.bing.com/search?q="
dogpile = searchEngine "dogpile" "http://results.dogpile.com/search/web?q="
baidu = searchEngine "baidu" "https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=0&rsv_idx=1&tn=baidu&wd="
excite = searchEngine "excite" "http://msxml.excite.com/search/web?q="
myPromptSearch (SearchEngine _ site)
= inputPrompt myXPConfig "Search" ?+ \s ->
(search "wyeb" site s >> viewWeb)
-- Select search: do a search based on the X selection
mySelectSearch eng = selectSearch eng >> viewWeb
-- Switch to the "web" workspace
viewWeb = windows (W.view "web")
-- kill all polybar xmobar before executing default restart command
myRestart = "for pid in `pgrep polybar`; do kill -9 $pid; done && " ++
"for pid in `pgrep xmobar`; do kill -9 $pid; done && " ++
"for pid in `pgrep compton`; do kill -9 $pid; done && " ++
"for pid in `pgrep redshift`; do kill -9 $pid; done && " ++
"xmonad --recompile && xmonad --restart"
-- Workspaces
-- The default number of workspaces (virtual screens) and their names.
--
myWorkspaces = ["<","web","office","vm","~"] ++ map show [6..9]
-- Window rules
-- Execute arbitrary actions and WindowSet manipulations when managing
-- a new window. You can use this to, for example, always float a
-- particular program, or have a client always appear on a particular
-- workspace.
--
-- To find the property name associated with a program, use
-- > xprop | grep WM_CLASS
-- and click on the client you're interested in.
--
-- To match on the WM_NAME, you can use 'title' in the same way that
-- 'className' and 'resource' are used below.
--
myManageHook = composeAll
[ className =? "Opera" --> doShift "web"
, className =? "Chromium" --> doShift "web"
, className =? "Wyeb." --> doShift "web"
-- , className =? "Termite" --> doShift "<"
, className =? "Wps" --> doShift "office"
, className =? "Wpp" --> doShift "office"
, className =? "Et" --> doShift "office"
, resource =? "desktop_window" --> doIgnore
, className =? "Dia" --> doFloat
-- , className =? "Et" --> doFloat
-- , className =? "Wpp" --> doFloat
, className =? "Guake" --> doFloat
, className =? "Steam" --> doFloat
, className =? "Gimp" --> doFloat
, resource =? "gpicview" --> doFloat
, className =? "mpv" --> doFloat
-- , className =? "VirtualBox" --> doShift "vm"
, className =? "trayer" --> doIgnore
, className =? "polybar" --> doIgnore
, isFullscreen --> (doF W.focusDown <+> doFullFloat)]
-- Layouts
-- You can specify and transform your layouts by modifying these values.
-- If you change layout bindings be sure to use 'mod-shift-space' after
-- restarting (with 'mod-q') to reset your layout state to the new
-- defaults, as xmonad preserves your old layout settings by default.
--
-- The available layouts. Note that each layout is separated by |||,
-- which denotes layout choice.
-- Colors for text and backgrounds of each tab when in "Tabbed" layout.
--tabConfig = defaultTheme {
-- activeBorderColor = "#7C7C7C",
-- activeTextColor = "#CEFFAC",
-- activeColor = "#000000",
-- inactiveBorderColor = "#7C7C7C",
-- inactiveTextColor = "#EEEEEE",
-- inactiveColor = "#000000",
-- decoHeight = 14 ,
-- fontName = "WenQuanYi Micro Hei" ,
-- decoWidth = 20
-- }
myLayout = avoidStruts (
magicFocus(centerMaster (Tall 1 (20/100) (1/2))) |||
drawer `onLeft` (Tall 1 0.03 0.5) |||
Circle ||| ThreeColMid 1 (3/100) (1/2) ||| magicFocus(Mirror (Tall 1 (3/100) (1/1.5))) |||
Accordion |||
-- magnifier (Tall 1 (3/100) (1/2)) |||
Mirror (Tall 1 (3/100) (1/1.5)) |||
-- tabbed shrinkText tabConfig |||
Full ||| dragPane Horizontal 0.1 0.3)
where
drawer = simpleDrawer 0.01 0.3 (ClassName "termite" `Or` ClassName "Termite")
-- Colors and borders
-- Currently based on the ir_black theme.
--
myNormalBorderColor = "#F2F2F2"
myFocusedBorderColor = "#7F7F7F"
-- Color of current window title in xmobar.
xmobarTitleColor = "#FFD700"
-- Color of current workspace in xmobar.
xmobarCurrentWorkspaceColor = "#A2CD32"
-- Width of the window border in pixels.
myBorderWidth = 4
-- scratchpads property
scratchpads = [
-- run htop in xterm, find it by title, use default floating window placement
NS "htop" "termite -e htop" (title =? "htop") defaultFloating ,
-- run trans
NS "trans" "termite -e trans " (title =?"trans") defaultFloating ,
-- run calc
NS "calc" "termite -e calc " (title=?"calc") defaultFloating ,
-- open project 目录
NS "project" "termite -d /home/lincoo/edisk/慧智兴达/project -t project" (title =? "project") defaultFloating ,
-- open books 目录
NS "books" "termite -d /home/lincoo/edisk/books -t books " (title =? "books") defaultFloating ,
-- run gvim, find by role, don't float
NS "notes" "gvim --role notes ~/Documents/notes.txt" (role =? "notes") (customFloating $ W.RationalRect (1/6) (1/6) (2/3) (2/3))
] where role = stringProperty "WM_WINDOW_ROLE"
--
-- Key bindings
--
-- modMask lets you specify which modkey you want to use. The default
-- is mod1Mask ("left alt"). You may also consider using mod3Mask
-- ("right alt"), which does not conflict with emacs keybindings. The
-- "windows key" is usually mod4Mask.
--
toggleFloat w = windows (\s -> if M.member w (W.floating s)
then W.sink w s
else (W.float w (W.RationalRect (1/3) (1/4) (1/2) (4/5)) s))
myModMask = mod4Mask
myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
----------------------------------------------------------------------
-- Custom key bindings
--
-- Start a terminal. Terminal to start is specified by myTerminal variable.
[ ((modMask .|. shiftMask, xK_Return),
spawn $ XMonad.terminal conf)
-- Lock the screen using command specified by myScreensaver.
, ((modMask .|. controlMask, xK_l),
spawn "slimlock")
--control window ,workspace and layout by using prompt
,((modMask,xK_p), switchProjectPrompt warmPromptTheme)
, ((modMask,xK_grave), windowPromptBring myXPConfig)
, ((modMask , xK_n), submap . mySearchMap
[
((0 ,xK_h), namedScratchpadAction scratchpads "htop")
, ((0 , xK_t), namedScratchpadAction scratchpads "trans")
, ((0 , xK_c), namedScratchpadAction scratchpads "calc")
, ((0 , xK_p), namedScratchpadAction scratchpads "project")
, ((0 , xK_b), namedScratchpadAction scratchpads "books")
, ((0, xK_n), namedScratchpadAction scratchpads "notes")
])
-- control touchpad on/off
,((modMask , xK_F2), submap . M.fromList $
[
((0,xK_0),spawn "synclient touchpadoff=1")
,((0,xK_1),spawn "synclient touchpadoff=0")
])
--control origin Dell Keyborad on/off
,((modMask , xK_F3), submap . M.fromList $
[
((0,xK_0),spawn "sleep 0.1 ; xinput set-prop 'AT Translated Set 2 keyboard' 'Device Enabled' 0")
,((0,xK_1),spawn "sleep 0.1 ; xinput set-prop 'AT Translated Set 2 keyboard' 'Device Enabled' 1")
])
-- transparents
,((modMask , xK_F4), submap . M.fromList $
[
((0,xK_1), spawn "transset-df -a 0.5")
,((0,xK_2), spawn "transset-df -a 0.1")
,((0,xK_0), spawn "transset-df -a 1")
])
,((modMask , xK_equal), spawn "transset-df -a --inc 0.2")
,((modMask , xK_minus), spawn "transset-df -a --dec 0.2")
-- Mark windows And do actions
,((modMask , xK_m), withFocused (addTag "mark"))
,((modMask .|. controlMask, xK_m), withFocused (delTag "mark"))
,((modMask .|. shiftMask, xK_m), withTaggedGlobalP "mark" W.sink)
,((modMask , xK_a), withTaggedP "mark" (W.shiftWin "7"))
,((modMask .|. controlMask, xK_a), withTaggedGlobalP "mark" shiftHere)
-- Mute volume.
, ((0, xF86XK_AudioMute),
spawn "amixer -q set Master toggle")
-- Decrease volume.
, ((0, xF86XK_AudioLowerVolume),
spawn "amixer -q set Master 5%-")
-- Increase volume.
, ((0, xF86XK_AudioRaiseVolume),
spawn "amixer -q set Master 5%+")
-- Mute volume.
, ((modMask .|. controlMask, xK_i),
spawn "amixer -q set Master toggle")
-- Decrease volume.
, ((modMask .|. controlMask, xK_j),
spawn "amixer -q set Master 5%-")
-- Increase volume.
, ((modMask .|. controlMask, xK_k),
spawn "amixer -q set Master 5%+")
-- Audio previous.
, ((0, 0x1008FF16),
spawn "")
-- Play/pause.
, ((0, 0x1008FF14),
spawn "")
-- Audio next.
, ((0, 0x1008FF17),
spawn "")
-- Eject CD tray.
, ((0, 0x1008FF2C),
spawn "eject -T")
--------------------------------------------------------------------
--use xdotool to virtual mouse move,click is use win+d then d or a
,((modMask,xK_Left), spawn "xdotool mousemove_relative -- -20 0")
,((modMask,xK_Down), spawn "xdotool mousemove_relative 0 20")
,((modMask,xK_Up), spawn "xdotool mousemove_relative -- 0 -20")
,((modMask,xK_Right), spawn "xdotool mousemove_relative 20 0")
,((modMask,xK_y), spawn "xdotool click 4")
,((modMask,xK_u), spawn "xdotool click 5")
, ((modMask , xK_d), submap . M.fromList $
[ ((0, xK_d), spawn "xdotool click 1")
, ((0, xK_s), spawn "xdotool click 3")
])
, ((modMask , xK_z), submap . M.fromList $
[ ((0, xK_1), spawn "mpc play")
, ((0, xK_2), spawn "mpc pause")
, ((0, xK_3), spawn "mpc stop")
, ((0, xK_4), spawn "mpc prev")
, ((0, xK_5), spawn "mpc next")
, ((0, xK_0), spawn "mpc single")
])
-------------------------------------------------------------------
, ((modMask, xK_q ), warpToScreen 0 (1/2) (1/2)) -- @@ Move pointer to currently focused window
, ((modMask, xK_r ), warpToScreen 1 (1/2) (1/2)) -- @@ Move pointer to currently focused window
--------------------------------------------------------------------
-- "Standard" xmonad key bindings
--
, ((modMask, xK_x), goToSelected defaultGSConfig)
, ((modMask, xK_s), spawnSelected defaultGSConfig ["termite -e mutt","termite -e ncmpc","termite -e ranger","termite -d ~/edisk/books","termite -d ~/edisk/慧智兴达","udiskie","termite -d ~/edisk/慧智兴达/project","pyweather"])
, ((modMask, xK_g), spawnSelected defaultGSConfig ["pcmanfm","thunderbird","wps","wpp","retext","FBReader","gimp","opera"])
-- Close focused window.
, ((modMask .|. shiftMask, xK_c),
kill)
-- Cycle through the available layout algorithms.
-- , ((modMask, xK_space),
-- sendMessage NextLayout)
--maxmize
,((modMask, xK_f), sendMessage $ Toggle FULL)
--windowmenu
, ((modMask, xK_v ), windowMenu)
-- Reset the layouts on the current workspace to default.
, ((modMask .|. shiftMask, xK_space),
setLayout windows . W.sink)
withFocused toggleFloat)
-- Increment the number of windows in the master area.
, ((modMask, xK_comma),
sendMessage (IncMasterN 1))
-- Decrement the number of windows in the master area.
, ((modMask, xK_period),
sendMessage (IncMasterN (-1)))
-- Toggle the status bar gap.
-- TODO: update this binding with avoidStruts, ((modMask, xK_b),
-- Quit xmonad.
, ((modMask .|. shiftMask, xK_q),
io (exitWith ExitSuccess))
-- Restart xmonad.
, ((modMask, xK_b),
spawn myRestart)
]
++
-- mod-[1..9], Switch to workspace N
-- mod-shift-[1..9], Move client to workspace N
[((m .|. modMask , k), windows $ f i)
| (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
++
-- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
-- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3
[((m .|. modMask, key), screenWorkspace sc >>= flip whenJust (windows . f))
| (key, sc) <- zip [xK_w, xK_e] [0..]
, (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
-- switch to Window N of the current workspace
++ [((modMask .|. controlMask, k), focusNth i)
| (i, k) <- zip [0 .. 8] [xK_1 ..]]
-- Mouse bindings
-- Focus rules
-- True if your focus should follow your mouse cursor.
myFocusFollowsMouse :: Bool
myFocusFollowsMouse = False
myMouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $
[
-- mod-button1, Set the window to floating mode and move by dragging
((modMask, button1),
(\w -> focus w >> mouseMoveWindow w))
-- mod-button2, Raise the window to the top of the stack
, ((modMask, button2),
(\w -> focus w >> windows W.swapMaster))
-- mod-button3, Set the window to floating mode and resize by dragging
, ((modMask, button3),
(\w -> focus w >> mouseResizeWindow w))
-- you may also bind events to the mouse scroll wheel (button4 and button5)
]
myPromptKeymap = M.union defaultXPKeymap $ M.fromList
[
((controlMask, xK_g), quit)
, ((controlMask, xK_m), setSuccess True >> setDone True)
, ((controlMask, xK_j), setSuccess True >> setDone True)
, ((controlMask, xK_h), deleteString Prev)
, ((controlMask, xK_f), moveCursor Next)
, ((controlMask, xK_b), moveCursor Prev)
, ((controlMask, xK_p), moveHistory W.focusDown')
, ((controlMask, xK_n), moveHistory W.focusUp')
, ((mod1Mask, xK_p), moveHistory W.focusDown')
, ((mod1Mask, xK_n), moveHistory W.focusUp')
, ((mod1Mask, xK_b), moveWord Prev)
, ((mod1Mask, xK_f), moveWord Next)
]
myXPConfig = defaultXPConfig
{ font = "xft:WenQuanYi Micro Hei:pixelsize=16"
, bgColor = "#0c1021"
, fgColor = "#f8f8f8"
, fgHLight = "#f8f8f8"
, bgHLight = "steelblue3"
, borderColor = "DarkOrange"
, promptBorderWidth = 1
, position = Top
, historyFilter = deleteConsecutive
, promptKeymap = myPromptKeymap
}
-- engines = [mk "bi" "https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=0&rsv_idx=1&tn=baidu&wd="
-- ,mk "b" "https://cn.bing.com/search?q="
-- ,mk "d" "http://results.dogpile.com/search/web?q="
-- ,mk "e" "http://msxml.excite.com/search/web?q="
-- Status bars and logging
-- Perform an arbitrary action on each internal state change or X event.
-- See the 'DynamicLog' extension for examples.
--
-- To emulate dwm's status bar
--
-- > logHook = dynamicLogDzen
--
-- Startup hook
-- Perform an arbitrary action each time xmonad starts or is restarted
-- with mod-q. Used by, e.g., XMonad.Layout.PerWorkspace to initialize
-- per-workspace layout choices.
--
-- By default, do nothing.
myStartupHook = return ()
-- Run xmonad with all the defaults we set up.
--
main = do
xmproc <- spawnPipe ("xmobar " ++ myXmobarrc)
xmonad $ defaults {
logHook = dynamicLogWithPP $ xmobarPP {
ppOutput = hPutStrLn xmproc
, ppTitle = xmobarColor xmobarTitleColor "" . shorten 50
, ppCurrent = xmobarColor xmobarCurrentWorkspaceColor ""
, ppSep = " "
}
,manageHook = manageDocks <+> myManageHook <+> placeHook simpleSmart <+> namedScratchpadManageHook scratchpads
-- , startupHook = docksStartupHook <+> setWMName "LG3D"
, startupHook = setWMName "LG3D" <+> spawn "polybar -c /home/lincoo/.config/polybar/config bar1" <+> spawn "guake" <+> spawn "compton --config /home/lincoo/.config/compton/compton.conf" <+> spawn "redshift-gtk -l 39.92:116.46 -t 5500:4500e", handleEventHook = docksEventHook
}
-- Combine it all together
-- A structure containing your configuration settings, overriding
-- fields in the default config. Any you don't override, will
-- use the defaults defined in xmonad/XMonad/Config.hs
--
-- No need to modify this.
--
defaults = defaultConfig {
-- simple stuff
terminal = myTerminal,
focusFollowsMouse = myFocusFollowsMouse,
borderWidth = myBorderWidth,
modMask = myModMask,
workspaces = myWorkspaces,
normalBorderColor = myNormalBorderColor,
focusedBorderColor = myFocusedBorderColor,
-- key bindings
keys = myKeys,
mouseBindings = myMouseBindings,
-- hooks, layouts
layoutHook = onWorkspaces ["web"] (avoidStruts(magicFocus(Mirror (Tall 1 0.13 0.75)))) $ onWorkspace "float" simplestFloat $ mkToggle (single FULL) $ myLayout ,
manageHook = myManageHook,
startupHook = myStartupHook
}
xmobar的配置
Config {
-- appearance
font = "xft:WenQuanYi Micro Hei:size=9:bold:antialias=true"
, bgColor = "#7a7a7a"
, fgColor = "white"
, position = Top
, border = TopB
, borderColor = "#646464"
,additionalFonts = []
, alpha = 255
, textOffset = -1
, iconOffset = -1
, iconRoot = "."
-- layout
, sepChar = "%" -- delineator between plugin names and straight text
, alignSep = "}{" -- separator between left-right alignment
, template = "%StdinReader% }{ %dynnetwork% %mpd% %ZBAA%"
-- 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 = False -- 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 =
[
Run StdinReader
-- network activity monitor (dynamic interface resolution)
, Run DynNetwork [ "--template" , "<dev>: <tx>kB/s|<rx>kB/s"
, "--Low" , "1000" -- units: B/s
, "--High" , "5000" -- units: B/s
, "--low" , "darkgreen"
, "--normal" , "darkorange"
, "--high" , "darkred"
] 10
, Run MPD ["-t","<composer><file> <remaining> /<plength> <statei> [<flags>]", "--", "-P", ">>", "-Z", "|", "-S", "><"] 10
-- -- cpu activity monitor
-- , Run MultiCpu [ "--template" , "Cpu: <total0>%|<total1>%"
-- , "--Low" , "50" -- units: %
-- , "--High" , "85" -- units: %
-- , "--low" , "darkgreen"
-- , "--normal" , "darkorange"
-- , "--high" , "darkred"
-- ] 10
-- cpu core temperature monitor
-- , Run CoreTemp [ "--template" , "Temp: <core0>°C| <core1>°C"
-- , "--Low" , "70" -- units: °C
-- , "--High" , "80" -- units: °C
-- , "--low" , "darkgreen"
-- , "--normal" , "darkorange"
-- , "--high" , "darkred"
-- ] 50
--
-- -- memory usage monitor
-- , Run Memory [ "--template" ,"Mem: <usedratio>%"
-- , "--Low" , "20" -- units: %
-- , "--High" , "90" -- units: %
-- , "--low" , "darkgreen"
-- , "--normal" , "darkorange"
-- , "--high" , "darkred"
-- ] 10
--
-- -- battery monitor
-- , Run Battery [ "--template" , "Batt: <acstatus>"
-- , "--Low" , "10" -- units: %
-- , "--High" , "80" -- units: %
-- , "--low" , "darkred"
-- , "--normal" , "darkorange"
-- , "--high" , "darkgreen"
--
-- , "--" -- battery specific options
-- discharging status
-- , "-o" , "<left>% (<timeleft>)"
-- -- AC "on" status
-- , "-O" , "<fc=#dAA520>Charging</fc>"
-- -- charged status
-- , "-i" , "<fc=#006000>Charged</fc>"
-- ] 50
--
-- time and date indicator
-- (%F = y-m-d date, %a = day of week, %T = h:m:s time)
-- ,Run Com "~/.xmonad/bin/getMasterVolume" [] "vol" 10
-- , Run Date "<fc=#FFA500>%F (%a) %T</fc>" "date" 10
,Run Weather "ZBAA" [ "--template", "<station>: | <fc=#FFFFFF><tempC></fc>°C | <windMs>"
] 36000
]
}
polybar的配置
[colors]
;background = ${xrdb:color0:#222}
background = #222
background-alt = #444
;foreground = ${xrdb:color7:#222}
foreground = #dfdfdf
foreground-alt = #555
primary = #ffb52a
secondary = #e60053
alert = #bd2c40
[bar/bar1]
monitor = ${env:MONITOR:eDP-1}
;monitor = ${env:MONITOR:HDMI-1}
width = 100%
height = 27
;offset-x = 1%
;offset-y = 1%
radius = 6.0
fixed-center = false
background = ${colors.background}
foreground = ${colors.foreground}
line-size = 3
line-color = #f00
border-size = 4
border-color = #00000000
padding-left = 0
padding-right = 2
module-margin-left = 1
module-margin-right = 2
font-0 = fixed:pixelsize=10;1
font-1 = unifont:fontformat=truetype:size=8:antialias=false;0
font-2 = siji:pixelsize=10;1
modules-left = wlan eth battery
modules-center = date
modules-right = xkeyboard volume memory cpu
tray-position = right
tray-padding = 1
;tray-transparent = true
;tray-background = #0063ff
;wm-restack = bspwm
;wm-restack = i3
override-redirect = true
;scroll-up = bspwm-desknext
;scroll-down = bspwm-deskprev
;scroll-up = i3wm-wsnext
;scroll-down = i3wm-wsprev
cursor-click = pointer
cursor-scroll = ns-resize
bottom = true
[module/xwindow]
type = internal/xwindow
label = %title:0:30:...%
[module/xkeyboard]
type = internal/xkeyboard
blacklist-0 = num lock
format-prefix = " "
format-prefix-foreground = ${colors.foreground-alt}
format-prefix-underline = ${colors.secondary}
label-layout = %layout%
label-layout-underline = ${colors.secondary}
label-indicator-padding = 2
label-indicator-margin = 1
label-indicator-background = ${colors.secondary}
label-indicator-underline = ${colors.secondary}
;[module/filesystem]
; type = internal/fs
;interval = 25
;
;mount-0 = /
;
; label-mounted = %{F#0a81f5}%mountpoint%%{F-}: %percentage_used%%
;label-unmounted = %mountpoint% not mounted
;label-unmounted-foreground = ${colors.foreground-alt}
;
; [module/bspwm]
;type = internal/bspwm
;
;label-focused = %index%
;label-focused-background = ${colors.background-alt}
;label-focused-underline= ${colors.primary}
;label-focused-padding = 2
;
;label-occupied = %index%
;label-occupied-padding = 2
;
;label-urgent = %index%!
;label-urgent-background = ${colors.alert}
;label-urgent-padding = 2
;
; label-empty = %index%
;label-empty-foreground = ${colors.foreground-alt}
;label-empty-padding = 2
;
;[module/i3]
;type = internal/i3
;format = <label-state> <label-mode>
;index-sort = true
;wrapping-scroll = false
;
;; Only show workspaces on the same output as the bar
;;pin-workspaces = true
;
;label-mode-padding = 2
;label-mode-foreground = #000
;label-mode-background = ${colors.primary}
;
;; focused = Active workspace on focused monitor
;label-focused = %index%
;label-focused-background = ${module/bspwm.label-focused-background}
;label-focused-underline = ${module/bspwm.label-focused-underline}
;label-focused-padding = ${module/bspwm.label-focused-padding}
;
;; unfocused = Inactive workspace on any monitor
;label-unfocused = %index%
;label-unfocused-padding = ${module/bspwm.label-occupied-padding}
;
;; visible = Active workspace on unfocused monitor
;label-visible = %index%
;label-visible-background = ${self.label-focused-background}
;label-visible-underline = ${self.label-focused-underline}
;label-visible-padding = ${self.label-focused-padding}
;
;; urgent = Workspace with urgency hint set
;label-urgent = %index%
;label-urgent-background = ${module/bspwm.label-urgent-background}
;label-urgent-padding = ${module/bspwm.label-urgent-padding}
;[module/mpd]
;type = internal/mpd
;format-online = <label-song> <icon-[random|repeat|repeatone]> <icon-prev> <icon-play> <icon-stop> <toggle> <icon-next> <bar-progress>
;;; Only applies if <bar-progress> is used
;bar-progress-width = 45
;bar-progress-indicator = |
;bar-progress-fill = ─
;bar-progress-empty = ─
;label-song = 𝄞 %artist% - %title% %elapsed% / %total%
;label-offline = 🎜 mpd is offline
;;
;; Only applies if <icon-X> is used
;icon-play = ⏵
;icon-pause = ⏸
;icon-stop = ⏹
;icon-prev = ⏮
;icon-next = ⏭
;icon-seekb = ⏪
;icon-seekf = ⏩
;;; Used to display the state of random/repeat/repeatone
;;; Only applies if <icon-[random|repeat|repeatone]> is used
;toggle-on-foreground = #ff
;toggle-off-foreground = #55
;;
;label-song-maxlen = 25
;label-song-ellipsis = true
;[module/xbacklight]
;type = internal/xbacklight
;
;format = <label> <bar>
;label = BL
;
;bar-width = 10
;bar-indicator = |
;bar-indicator-foreground = #ff
;bar-indicator-font = 2
;bar-fill = ─
;bar-fill-font = 2
;bar-fill-foreground = #9f78e1
;bar-empty = ─
;bar-empty-font = 2
;bar-empty-foreground = ${colors.foreground-alt}
;
;[module/backlight-acpi]
;inherit = module/xbacklight
;type = internal/backlight
;card = intel_backlight
[module/cpu]
type = internal/cpu
interval = 2
format-prefix = " "
format-prefix-foreground = ${colors.foreground-alt}
format-underline = #f90000
label = %percentage:2%%
[module/memory]
type = internal/memory
interval = 2
format-prefix = " "
format-prefix-foreground = ${colors.foreground-alt}
format-underline = #4bffdc
label = %percentage_used%%
[module/wlan]
type = internal/network
interface = wlp2s0
interval = 3.0
format-connected = <ramp-signal> <label-connected>
format-connected-underline = #9f78e1
label-connected = %essid%
format-disconnected =
;format-disconnected = <label-disconnected>
;format-disconnected-underline = ${self.format-connected-underline}
;label-disconnected = %ifname% disconnected
;label-disconnected-foreground = ${colors.foreground-alt}
ramp-signal-0 =
ramp-signal-1 =
ramp-signal-2 =
ramp-signal-3 =
ramp-signal-4 =
ramp-signal-foreground = ${colors.foreground-alt}
[module/eth]
type = internal/network
interface = enp3s0
interval = 3.0
format-connected-underline = #55aa55
format-connected-prefix = " "
format-connected-prefix-foreground = ${colors.foreground-alt}
label-connected = %local_ip%
format-disconnected =
;format-disconnected = <label-disconnected>
;format-disconnected-underline = ${self.format-connected-underline}
;label-disconnected = %ifname% disconnected
;label-disconnected-foreground = ${colors.foreground-alt}
[module/date]
type = internal/date
interval = 5
date =
date-alt = " %Y-%m-%d"
time = %H:%M
time-alt = %H:%M:%S
format-prefix =
format-prefix-foreground = ${colors.foreground-alt}
format-underline = #0a6cf5
label = %date% %time%
[module/volume]
type = internal/volume
format-volume = <label-volume> <bar-volume>
label-volume = VOL
label-volume-foreground = ${root.foreground}
format-muted-prefix = " "
format-muted-foreground = ${colors.foreground-alt}
label-muted = sound muted
bar-volume-width = 10
bar-volume-foreground-0 = #55aa55
bar-volume-foreground-1 = #55aa55
bar-volume-foreground-2 = #55aa55
bar-volume-foreground-3 = #55aa55
bar-volume-foreground-4 = #55aa55
bar-volume-foreground-5 = #f5a70a
bar-volume-foreground-6 = #ff5555
bar-volume-gradient = false
bar-volume-indicator = |
bar-volume-indicator-font = 2
bar-volume-fill = ─
bar-volume-fill-font = 2
bar-volume-empty = ─
bar-volume-empty-font = 2
bar-volume-empty-foreground = ${colors.foreground-alt}
[module/battery]
type = internal/battery
battery = BAT0
adapter = ADP1
full-at = 98
format-charging = <animation-charging> <label-charging>
format-charging-underline = #ffb52a
format-discharging = <ramp-capacity> <label-discharging>
format-discharging-underline = ${self.format-charging-underline}
format-full-prefix = " "
format-full-prefix-foreground = ${colors.foreground-alt}
format-full-underline = ${self.format-charging-underline}
ramp-capacity-0 =
ramp-capacity-1 =
ramp-capacity-2 =
ramp-capacity-foreground = ${colors.foreground-alt}
animation-charging-0 =
animation-charging-1 =
animation-charging-2 =
animation-charging-foreground = ${colors.foreground-alt}
animation-charging-framerate = 750
[module/temperature]
type = internal/temperature
thermal-zone = 0
warn-temperature = 60
format = <ramp> <label>
format-underline = #f50a4d
format-warn = <ramp> <label-warn>
format-warn-underline = ${self.format-underline}
label = %temperature%
label-warn = %temperature%
label-warn-foreground = ${colors.secondary}
ramp-0 =
ramp-1 =
ramp-2 =
ramp-foreground = ${colors.foreground-alt}
;[module/powermenu]
;type = custom/menu
;
;expand-right = true
;
;format-spacing = 1
;
;label-open =
;label-open-foreground = ${colors.secondary}
;label-close = cancel
;label-close-foreground = ${colors.secondary}
;label-separator = |
;label-separator-foreground = ${colors.foreground-alt}
;
;menu-0-0 = reboot
;menu-0-0-exec = menu-open-1
;menu-0-1 = power off
;menu-0-1-exec = menu-open-2
;
;menu-1-0 = cancel
;menu-1-0-exec = menu-open-0
;menu-1-1 = reboot
;menu-1-1-exec = sudo reboot
;
;menu-2-0 = power off
;menu-2-0-exec = sudo poweroff
;menu-2-1 = cancel
;menu-2-1-exec = menu-open-0
[settings]
screenchange-reload = true
;compositing-background = xor
;compositing-background = screen
;compositing-foreground = source
;compositing-border = over
[global/wm]
margin-top = 5
margin-bottom = 5
; vim:ft=dosini