Add new symbols to xmobar
This commit is contained in:
parent
26d889cd4d
commit
e857efd65a
@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
|
||||
-- ░▀█▀░█▄█░█▀█░█▀█░█▀▄░▀█▀░█▀▀
|
||||
-- ░░█░░█░█░█▀▀░█░█░█▀▄░░█░░▀▀█
|
||||
@ -18,7 +19,7 @@ import qualified Data.Map as M
|
||||
|
||||
import XMonad.Util.Run (spawnPipe, hPutStrLn, runProcessWithInput)
|
||||
import XMonad.Util.NamedScratchpad
|
||||
-- import XMonad.Util.SpawnOnce
|
||||
import XMonad.Util.SpawnOnce
|
||||
|
||||
import XMonad.Layout.Spacing
|
||||
import XMonad.Layout.Fullscreen
|
||||
@ -72,7 +73,7 @@ myModMask :: KeyMask
|
||||
myModMask = mod4Mask
|
||||
|
||||
myWorkspaces :: [WorkspaceId]
|
||||
myWorkspaces = ["gen","www","emx","dev","slk","6","7","8","9"]
|
||||
myWorkspaces = ["gen","www","emx","dev","slk","6","7","8","com"]
|
||||
|
||||
myNormalBorderColor = "#dddddd"
|
||||
myFocusedBorderColor = "#ff0000"
|
||||
@ -126,7 +127,7 @@ myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
|
||||
, ((modm , xK_comma ), sendMessage (IncMasterN 1))
|
||||
, ((modm , xK_period), sendMessage (IncMasterN (-1)))
|
||||
-- , ((modm , xK_b ), sendMessage ToggleStruts)
|
||||
, ((modm .|. shiftMask, xK_q ), io (exitWith ExitSuccess))
|
||||
, ((modm .|. shiftMask, xK_q ), io exitSuccess)
|
||||
, ((modm , xK_c ), myRestartHook )
|
||||
]
|
||||
|
||||
@ -205,18 +206,17 @@ viewDropboxStatus = spawn =<< ((++) "notify-send -t 3000 " . unpack) <$> status
|
||||
------------------------------------------------------------------------
|
||||
-- Mouse bindings: default actions bound to mouse events
|
||||
--
|
||||
myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
|
||||
|
||||
myMouseBindings XConfig {XMonad.modMask = modm} = M.fromList
|
||||
-- mod-button1, Set the window to floating mode and move by dragging
|
||||
[ ((modm, button1), (\w -> focus w >> mouseMoveWindow w
|
||||
>> windows W.shiftMaster))
|
||||
[ ((modm, button1), \w -> focus w >> mouseMoveWindow w
|
||||
>> windows W.shiftMaster)
|
||||
|
||||
-- mod-button2, Raise the window to the top of the stack
|
||||
, ((modm, button2), (\w -> focus w >> windows W.shiftMaster))
|
||||
, ((modm, button2), \w -> focus w >> windows W.shiftMaster)
|
||||
|
||||
-- mod-button3, Set the window to floating mode and resize by dragging
|
||||
, ((modm, button3), (\w -> focus w >> mouseResizeWindow w
|
||||
>> windows W.shiftMaster))
|
||||
, ((modm, button3), \w -> focus w >> mouseResizeWindow w
|
||||
>> windows W.shiftMaster)
|
||||
|
||||
-- you may also bind events to the mouse scroll wheel (button4 and button5)
|
||||
]
|
||||
@ -274,6 +274,7 @@ myManageHook = composeAll
|
||||
, resource =? "kdesktop" --> doIgnore
|
||||
, resource =? "fcitx-config" --> doFloat
|
||||
, className =? "copyq" --> doFloat
|
||||
, className =? "discord" --> doShift "com"
|
||||
] <+> namedScratchpadManageHook myScratchpads
|
||||
|
||||
------------------------------------------------------------------------
|
||||
@ -311,6 +312,14 @@ myLogHook xmproc = dynamicLogWithPP $ xmobarPP
|
||||
, ppSep = "<fc=#666666> <fn=0>|</fn> </fc>"
|
||||
, ppUrgent = xmobarColor red "" . wrap "!" "!"
|
||||
, ppExtras = [windowCount]
|
||||
, ppLayout =
|
||||
wrap "<fn=4>" "</fn>" .
|
||||
(\case
|
||||
"Spacing Full" -> "🖵"
|
||||
"Spacing Tall" -> "🗗"
|
||||
"Spacing Magnifier Tall" -> "\128269" -- 🔍
|
||||
"Spacing Mirror Tall" -> "\129694" -- 🪞
|
||||
)
|
||||
, ppOrder = \(ws:l:t:ex) -> [ws,l] ++ ex ++ [t]
|
||||
}
|
||||
|
||||
@ -324,7 +333,7 @@ myLogHook xmproc = dynamicLogWithPP $ xmobarPP
|
||||
myStartupHook :: X ()
|
||||
myStartupHook = do
|
||||
spawn "stalonetray &"
|
||||
-- spawnOnce "$HOME/.xmonad/xinit.sh"
|
||||
spawnOnce "$HOME/.xmonad/setup-script/xinit.sh"
|
||||
|
||||
myRestartHook :: X ()
|
||||
myRestartHook = do
|
||||
|
18
laptop/.config/xmobar/scripts/mpd_status.sh
Executable file
18
laptop/.config/xmobar/scripts/mpd_status.sh
Executable file
@ -0,0 +1,18 @@
|
||||
MPD_STATUS=$(mpc 2>/dev/null | sed -n '2{p;q}' | cut -d ' ' -f1)
|
||||
case "$MPD_STATUS" in
|
||||
"[playing]")
|
||||
echo "<fn=2><fc=#00ff00>▶</fc></fn>"
|
||||
# echo "[<fn=2><fc=#00ff00>行</fc></fn>]"
|
||||
exit 0
|
||||
;;
|
||||
"[paused]")
|
||||
echo "<fn=2><fc=#ff0000>⏸</fc></fn>"
|
||||
# echo "[<fn=1><fc=#ff0000>止</fc></fn>]"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "<fn=2><fc=#AA0000>⏼</fc></fn>"
|
||||
# echo "[<fn=1><fc=#AA0000>無</fc></fn>]"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
43
laptop/.config/xmobar/scripts/volume.py
Executable file
43
laptop/.config/xmobar/scripts/volume.py
Executable file
@ -0,0 +1,43 @@
|
||||
#!/bin/python
|
||||
|
||||
import subprocess
|
||||
|
||||
USE_SYMBOLS = True
|
||||
VOLUME_COMMAND = 'amixer get Master'.split(' ')
|
||||
VOLUME_SYMBOLS = {
|
||||
"0": "𝒫", # "∅"
|
||||
"10": "−",
|
||||
"20": "=",
|
||||
"30": "≡",
|
||||
"40": "∫",
|
||||
"50": "∮",
|
||||
"60": "∬",
|
||||
"70": "∯",
|
||||
"80": "∭",
|
||||
"90": "∰",
|
||||
"100": "⨌",
|
||||
}
|
||||
|
||||
def get_volume():
|
||||
volumeData = subprocess \
|
||||
.check_output(VOLUME_COMMAND) \
|
||||
.decode() \
|
||||
.split('\n')[5] \
|
||||
.strip() \
|
||||
.split(' ')
|
||||
|
||||
volume_level = int(volumeData[-2][1:-2])
|
||||
|
||||
if USE_SYMBOLS:
|
||||
volume = VOLUME_SYMBOLS[str((volume_level // 10) * 10)]
|
||||
if volumeData[-1] == '[off]':
|
||||
volume = 'Ψ'
|
||||
else:
|
||||
volume = f'{volume_level}%'
|
||||
if volumeData[-1] == '[off]':
|
||||
volume = 'M'
|
||||
|
||||
return volume
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(get_volume())
|
33
laptop/.config/xmobar/scripts/wireless.sh
Executable file
33
laptop/.config/xmobar/scripts/wireless.sh
Executable file
@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
|
||||
NETWORK_CARD=$(ip -br link | grep UP | grep -v lo | head -n 1 | awk '{print $1}')
|
||||
|
||||
iwconfig $NETWORK_CARD 2>&1 | grep -q no\ wireless\ extensions\. && {
|
||||
echo wired
|
||||
exit 0
|
||||
}
|
||||
|
||||
essid=`iwconfig $NETWORK_CARD | awk -F '"' '/ESSID/ {print $2}'`
|
||||
stngth=`iwconfig $NETWORK_CARD | awk -F '=' '/Quality/ {print $2}' | cut -d '/' -f 1`
|
||||
bars=`expr $stngth / 20`
|
||||
|
||||
case $bars in
|
||||
# 0) bar='[-----]' ;;
|
||||
# 1) bar='[/----]' ;;
|
||||
# 2) bar='[//---]' ;;
|
||||
# 3) bar='[///--]' ;;
|
||||
# 4) bar='[////-]' ;;
|
||||
# 5) bar='[/////]' ;;
|
||||
# *) bar='[--!--]' ;;
|
||||
0) bar='[<fn=1>〇</fn>]' ;;
|
||||
1) bar='[<fn=1>壱</fn>]' ;;
|
||||
2) bar='[<fn=1>弐</fn>]' ;;
|
||||
3) bar='[<fn=1>参</fn>]' ;;
|
||||
4) bar='[<fn=1>肆</fn>]' ;;
|
||||
5) bar='[<fn=1>伍</fn>]' ;;
|
||||
*) bar='[<fn=1>無</fn>]' ;;
|
||||
esac
|
||||
|
||||
echo "$essid $bar"
|
||||
|
||||
exit 0
|
72
laptop/.config/xmobar/xmobarrc
Normal file
72
laptop/.config/xmobar/xmobarrc
Normal file
@ -0,0 +1,72 @@
|
||||
Config {
|
||||
font = "xft:Fira Code Retina:pixelsize=15:antialias=true:hinting=true"
|
||||
, additionalFonts = [
|
||||
"xft:Droid Sans Japanese:pixelsize=20:antialias=true:hinting=true",
|
||||
"xft:Symbola:pixelsize=20",
|
||||
"xft:Asana Math:pixelsize=20",
|
||||
"xft:Noto Sans Symbols2",
|
||||
"xft:FiraCode Nerd Font"
|
||||
]
|
||||
, borderColor = "black"
|
||||
, border = TopB
|
||||
, bgColor = "#272822"
|
||||
, fgColor = "grey"
|
||||
, alpha = 255
|
||||
, position = Static { xpos = 0 , ypos = 0, width = 1920, height = 40 }
|
||||
, textOffset = -1
|
||||
, iconOffset = -1
|
||||
, lowerOnStart = True
|
||||
, pickBroadest = False
|
||||
, persistent = False
|
||||
, hideOnStart = False
|
||||
, iconRoot = "/home/h7x4/.config/xmobar/"
|
||||
, allDesktops = True
|
||||
, overrideRedirect = True
|
||||
, commands = [
|
||||
-- Run Weather "ENVA"
|
||||
-- [
|
||||
-- "-t","<tempC>C",
|
||||
-- "-L","6",
|
||||
-- "-H","18",
|
||||
-- "--normal","green",
|
||||
-- "--high","red",
|
||||
-- "--low","lightblue"
|
||||
-- ] 36000,
|
||||
|
||||
Run Network "wlp59s0"
|
||||
[
|
||||
"-t", "<rx><fn=3>↓</fn> <tx><fn=3>↑</fn>",
|
||||
"-L","0",
|
||||
"-H","32",
|
||||
"--normal","green",
|
||||
"--high","red"
|
||||
] 10,
|
||||
|
||||
Run Memory ["-t","<usedratio>%"] 10,
|
||||
Run Swap ["-t", "<usedratio>%"] 100,
|
||||
Run Date "%a %_d %b %H:%M" "date" 10,
|
||||
Run Com "/home/h7x4/.config/xmobar/scripts/mpd_status.sh" [] "mpc" 10,
|
||||
-- Run Com "/home/h7x4/.config/xmobar/scripts/wireless.sh" [] "wi" 100,
|
||||
Run Com "/home/h7x4/.config/xmobar/scripts/volume.py" [] "vol" 10,
|
||||
Run UnsafeStdinReader,
|
||||
|
||||
Run BatteryP ["BAT0"]
|
||||
[
|
||||
"-t", "<fn=2><acstatus></fn> (<left>%)",
|
||||
"--Low", "20",
|
||||
"--High", "50",
|
||||
"--low", "red",
|
||||
"--normal", "yellow",
|
||||
"--high", "green",
|
||||
"--",
|
||||
"-O", "<fc=green>🔌</fc>",
|
||||
"-o", "<fc=yellow>🔋</fc>"
|
||||
] 50
|
||||
|
||||
]
|
||||
, sepChar = "%"
|
||||
, alignSep = "}{" -- <fc=#7700ff><icon=/home/h7x4/.config/xmobar/lambda-30.xbm/></fc>
|
||||
, template = " <icon=lambda_30.xpm/> %mpc% %UnsafeStdinReader% }\
|
||||
\ <fc=#ee9a00>%date%</fc> \
|
||||
\{ <fc=lightgreen><fn=2>🐏</fn> %memory%</fc> | <fc=cyan>%wlp59s0%</fc> | <fc=#f5f1bc><fn=3>%vol%</fn></fc> | %battery% "
|
||||
}
|
Loading…
Reference in New Issue
Block a user