Compare commits

...

2 commits

Author SHA1 Message Date
afonsofrancof
46be373805 Changed xmobar look to be cleaner 2022-10-31 21:01:21 +00:00
afonsofrancof
5168508b7e Changed xmobar look to be cleaner 2022-10-31 21:00:11 +00:00
20 changed files with 656 additions and 150 deletions

View file

@ -0,0 +1,18 @@
#!/bin/bash
regex="([0-9A-Z]*:)+"
DEVICES=$(bluetoothctl devices)
ICON=""
COLOR="#696B71"
for DEVICE in $DEVICES
do
if [[ $DEVICE =~ $regex ]]; then
STATUS=$(bluetoothctl info $DEVICE | grep "Connected" | awk '{print $2}')
if [ $STATUS = "yes" ]; then
ICON=""
COLOR="#DFDFDF"
fi
fi
done
echo "<fc=$COLOR><fn=4>$ICON</fn></fc>"

View file

@ -0,0 +1,22 @@
#!/bin/sh
temp1=70
temp2=85
amd_or_intel=$(sensors | grep 'Package id 0:')
if [$amd_or_intel == ""]
then
temp=$(sensors | grep 'AMD' | head -n 1 | grep -Po '\+\d+.+°C ' | sed -En 's/\+(.*)\..*°C/\1/p')
else
temp=$(sensors | grep 'Package id 0:' | awk '{print $4}' | sed 's/+//'| sed 's/.0°C//')
fi
if [ "$temp" -ge "$temp2" ] ; then
echo "Cpu: <fc=#C1514E>$temp</fc>°C"
elif [ "$temp" -ge "$temp1" ] ; then
echo "Cpu: <fc=#C1A24E>$temp</fc>°C"
else
echo "Cpu: <fc=#AAC0F0>$temp</fc>°C"
fi

View file

@ -0,0 +1,15 @@
#!/bin/sh
temp1=50
temp2=90
temp=$(nvidia-smi | grep 'Default' | awk '{print $2}' | sed 's/%//')
if [ "$temp" -ge "$temp2" ] ; then
echo "Gpu: <fc=#C1514E>$temp</fc>%"
elif [ "$temp" -ge "$temp1" ] ; then
echo "Gpu: <fc=#C1A24E>$temp</fc>%"
else
echo "Gpu: <fc=#AAC0F0>$temp</fc>%"
fi

View file

@ -0,0 +1,13 @@
#!/bin/bash
TYPES=($(nmcli device show | grep "GENERAL.TYPE" | awk '{print $2}'))
STATES=($(nmcli device show | grep "GENERAL.STATE" | awk '{print $3}'))
for ((i = 0; i < "${#TYPES[@]}"; i++)); do
if [[ ${STATES[$i]} = "(connected)" ]]; then
if [[ ${TYPES[$i]} == *"wifi"* ]]; then
echo "<fc=#DFDFDF><fn=4>直</fn></fc>"
else
echo "<fc=#DFDFDF><fn=5>ﯱ</fn></fc>"
fi
fi
done

View file

@ -0,0 +1,11 @@
#!/bin/bash
MUTE=$(pactl get-sink-mute @DEFAULT_SINK@ | sed -En 's/Mute: (.)/\1/p')
VOLUME=$(pactl get-sink-volume @DEFAULT_SINK@ | grep -Po '[0-9]*%' | sed -En 's/(.)\%/\1/p' | head -n1)
if [ "$MUTE" = "yes" ]; then
echo "<fc=#696B71><fn=3></fn></fc>"
elif [ "$VOLUME" -eq 0 ]; then
echo "<fc=#696B71><fn=3></fn></fc>"
else
echo "<fc=#DFDFDF><fn=3></fn><fn=2> $VOLUME</fn></fc>"
fi

View file

@ -1,52 +0,0 @@
-- Xmobar (http://projects.haskell.org/xmobar/)
-- This is the default xmobar configuration for DTOS.
-- This config is packaged in the DTOS repo as dtos-xmobar
-- Dependencies: otf-font-awesome ttf-mononoki ttf-ubuntu-font-family trayer
-- Also depends on scripts from dtos-local-bin from the dtos-core-repo.
Config { font = "xft:Ubuntu:weight=bold:pixelsize=14:antialias=true:hinting=true"
, additionalFonts = [ "xft:mononoki:pixelsize=14:antialias=true:hinting=true"
, "xft:Font Awesome 6 Free Solid:pixelsize=12"
, "xft:Font Awesome 6 Brands:pixelsize=12"
]
, bgColor = "#282c34"
, fgColor = "#ff6c6b"
-- Position TopSize and BottomSize take 3 arguments:
-- an alignment parameter (L/R/C) for Left, Right or Center.
-- an integer for the percentage width, so 100 would be 100%.
-- an integer for the minimum pixel height for xmobar, so 24 would force a height of at least 24 pixels.
-- NOTE: The height should be the same as the trayer (system tray) height.
, position = TopSize C 95 26
, lowerOnStart = True
, hideOnStart = False
, allDesktops = True
, persistent = True
, iconRoot = "/home/afonso/.config/xmobar/xpm/" -- default: "."
, commands = [
-- Cpu usage in percent
Run Cpu ["-t", "<fn=2>\xf108</fn> cpu: (<total>%)","-H","50","--high","red"] 20
-- Ram used number and percent
, Run Memory ["-t", "<fn=2>\xf233</fn> mem: <used>M (<usedratio>%)"] 20
-- Disk space free
, Run DiskU [("/", "<fn=2>\xf0c7</fn> disk: <free> free")] [] 60
-- Echos an "up arrow" icon in front of the uptime output.
, Run Com "echo" ["<fn=2>\xf0aa</fn>"] "uparrow" 3600
-- Uptime
, Run Uptime ["-t", "uptime: <days>d <hours>h"] 360
-- Echos a "battery" icon in front of the pacman updates.
, Run Com "echo" ["<fn=2>\xf242</fn>"] "baticon" 3600
-- Battery
, Run BatteryP ["BAT0"] ["-t", "<fn=2>\xf242</fn> AC:<acstatus> (<left>%)"] 360
-- Time and date
, Run Date "<fn=2>\xf017</fn> %b %d %Y - (%H:%M) " "date" 50
-- Volume
, Run Volume "default" "Master" [] 10
-- Script that dynamically adjusts xmobar padding depending on number of trayer icons.
, Run Com "/home/afonso/.config/xmobar/trayer-padding-icon.sh" [] "trayerpad" 20
-- Prints out the left side items such as workspaces, layout, etc.
, Run UnsafeStdinReader
]
, sepChar = "%"
, alignSep = "}{"
, template = " <icon=logo.xpm/> <fc=#666666>|</fc> %UnsafeStdinReader% }{ <box type=Bottom width=2 mb=2 color=#ecbe7b><fc=#ecbe7b><action=`alacritty -e htop`>%cpu%</action></fc></box> | <box type=Bottom width=2 mb=2 color=#ff6c6b><fc=#ff6c6b><action=`alacritty -e htop`>%memory%</action></fc></box> | <box type=Bottom width=2 mb=2 color=#a9a1e1><fc=#a9a1e1><action=`alacritty -e htop`>%disku%</action></fc></box> | <box type=Bottom width=2 mb=2 color=#46d9ff><fc=#46d9ff>%date%</fc></box> | <box type=Bottom width=2 mb=2 color=#da8548><fc=#da8548> <action=`alacritty -e sudo pacman -Syu`>%battery%</action></fc></box> | <box type=Bottom width=2 mb=2 color=#a677f2><fc=#a677f2>%default:Master%</fc></box> | %trayerpad% "
}

68
.config/xmobar/xmobarrc0 Normal file
View file

@ -0,0 +1,68 @@
-- Xmobar (http://projects.haskell.org/xmobar/)
-- This is the default xmobar configuration for DTOS.
-- This config is packaged in the DTOS repo as dtos-xmobar
-- Dependencies: otf-font-awesome ttf-mononoki ttf-ubuntu-font-family trayer
-- Also depends on scripts from dtos-local-bin from the dtos-core-repo.
Config {font = "xft:Ubuntu:weight=bold:pixelsize=14:antialias=true:hinting=true"
, additionalFonts =
[ "xft:Font Awesome 6 Free Solid:pixelsize=14"
, "xft:Font Awesome 6 Free Solid:pixelsize=12:bold"
, "xft:Font Awesome 6 Free Solid:pixelsize=16"
, "xft:Hack Nerd Font Mono:pixelsize=21"
, "xft:Hack Nerd Font Mono:pixelsize=25"
]
, bgColor = "#2B2E37"
, fgColor = "#929AAD"
-- Position TopSize and BottomSize take 3 arguments:
-- an alignment parameter (L/R/C) for Left, Right or Center.
-- an integer for the percentage width, so 100 would be 100%.
-- an integer for the minimum pixel height for xmobar, so 24 would force a height of at least 24 pixels.
-- NOTE: The height should be the same as the trayer (system tray) height.
, position = TopSize L 100 40
, lowerOnStart = True
, hideOnStart = False
, allDesktops = True
, persistent = False
, iconRoot = "/home/afonso/.config/xmobar/xpm/" -- default: "."
, commands = [
Run UnsafeXPropertyLog "_XMONAD_LOG_0"
, Run Date "%a, %d %b <fn=1></fn> %H:%M:%S" "date" 10
, Run Memory ["-t","Mem: <fc=#AAC0F0><usedratio></fc>%"] 10
, Run Com "/home/afonso/.config/xmobar/scripts/cpu_temp.sh" [] "cpu" 10
, Run Com "/home/afonso/.config/xmobar/scripts/gpu_util.sh" [] "gpu" 10
, Run Com "/home/afonso/.config/xmobar/scripts/volume.sh" [] "volume" 10
, Run Com "/home/afonso/.config/xmobar/scripts/bluetooth.sh" [] "bluetooth" 10
, Run Com "/home/afonso/.config/xmobar/scripts/network.sh" [] "network" 10
, Run Com "/home/afonso/.config/xmobar/scripts/trayer-padding-icon.sh" [] "trayerpad" 20
]
, sepChar = "%"
, alignSep = "}{"
, template = " <icon=logo.xpm/> \
\ \
\%_XMONAD_LOG_0%\
\}\
\%date%\
\{\
\ \
\%memory%\
\ \
\|\
\ \
\%cpu%\
\ \
\|\
\ \
\%gpu%\
\ \
\|\
\ \
\%network%\
\ \
\%bluetooth%\
\ \
\%volume%\
\ \
\|\
\%trayerpad%"
}

40
.config/xmobar/xmobarrc1 Normal file
View file

@ -0,0 +1,40 @@
-- Xmobar (http://projects.haskell.org/xmobar/)
-- This is the default xmobar configuration for DTOS.
-- This config is packaged in the DTOS repo as dtos-xmobar
-- Dependencies: otf-font-awesome ttf-mononoki ttf-ubuntu-font-family trayer
-- Also depends on scripts from dtos-local-bin from the dtos-core-repo.
Config { font = "xft:Ubuntu:weight=bold:pixelsize=12:antialias=true:hinting=true"
, additionalFonts =
[ "xft:Font Awesome 6 Free Solid:pixelsize=12"
, "xft:Font Awesome 6 Free Solid:pixelsize=10:bold"
, "xft:Font Awesome 6 Free Solid:pixelsize=14"
, "xft:Hack Nerd Font Mono:pixelsize=19"
, "xft:Hack Nerd Font Mono:pixelsize=23"
]
, bgColor = "#2B2E37"
, fgColor = "#929AAD"
-- Position TopSize and BottomSize take 3 arguments:
-- an alignment parameter (L/R/C) for Left, Right or Center.
-- an integer for the percentage width, so 100 would be 100%.
-- an integer for the minimum pixel height for xmobar, so 24 would force a height of at least 24 pixels.
-- NOTE: The height should be the same as the trayer (system tray) height.
, position = TopSize L 100 26
, lowerOnStart = True
, hideOnStart = False
, allDesktops = True
, persistent = False
, iconRoot = "/home/afonso/.config/xmobar/xpm/" -- default: "."
, commands = [
Run UnsafeXPropertyLog "_XMONAD_LOG_0"
, Run Date "%a, %d %b <fn=1></fn> %H:%M:%S" "date" 10
]
, sepChar = "%"
, alignSep = "}{"
, template = " <icon=logo.xpm/> \
\ \
\%_XMONAD_LOG_0%\
\}\
\%date%\
\{"
}

View file

@ -0,0 +1,23 @@
/* XPM */
static char * run_xpm[] = {
"16 16 2 1",
" c #2B2E37",
". c #555E70",
" ",
" .............. ",
" .............. ",
" .............. ",
" .............. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .............. ",
" .............. ",
" ",
" ",
" "};

View file

@ -0,0 +1,23 @@
/* XPM */
static char * run_xpm[] = {
"16 16 2 1",
" c #2B2E37",
". c #8BABF0",
" ",
" .............. ",
" .............. ",
" .............. ",
" .............. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .. .. ",
" .............. ",
" .............. ",
" ",
" ",
" "};

View file

@ -0,0 +1,23 @@
/* XPM */
static char * run_xpm[] = {
"16 16 2 1",
" c #2B2E37",
". c #555E70",
" ",
" ...... ...... ",
" ...... ...... ",
" ...... ...... ",
" ...... ...... ",
" ...... ...... ",
" ...... ...... ",
" ",
" ",
" ...... ...... ",
" ...... ...... ",
" ...... ...... ",
" ...... ...... ",
" ...... ...... ",
" ...... ...... ",
" ",
" ",
" "};

View file

@ -0,0 +1,23 @@
/* XPM */
static char * run_xpm[] = {
"16 16 2 1",
" c #2B2E37",
". c #8BABF0",
" ",
" ...... ...... ",
" ...... ...... ",
" ...... ...... ",
" ...... ...... ",
" ...... ...... ",
" ...... ...... ",
" ",
" ",
" ...... ...... ",
" ...... ...... ",
" ...... ...... ",
" ...... ...... ",
" ...... ...... ",
" ...... ...... ",
" ",
" ",
" "};

View file

@ -1,75 +1,127 @@
/* XPM */ /* XPM */
static char *logo[] = { static char *logo[] = {
/* columns rows colors chars-per-pixel */ /* columns rows colors chars-per-pixel */
"16 16 53 1 ", "24 24 97 2 ",
" c None", " c None",
". c #3A7F2A", ". c #377827",
"X c #F34E00", "X c #397D29",
"o c #F74F00", "o c #D24503",
"O c #FC5100", "O c #D04706",
"+ c #FD661D", "+ c #DB4700",
"@ c #FE671F", "@ c #CF4E10",
"# c #E4672C", "# c #E04800",
"$ c #E8682B", "$ c #FF5200",
"% c #EB692B", "% c #FF5301",
"& c #F46E2A", "& c #FF5B0D",
"* c #FE6E2A", "* c #FF6218",
"= c #E8712D", "= c #FF6A23",
"- c #E17230", "- c #FF7432",
"; c #FE7A3B", "; c #FE7A3B",
": c #FC7C3F", ": c #FD7C3E",
"> c #3B802A", "> c #F27B42",
", c #408B2E", ", c #F67C41",
"< c #418A2F", "< c #3E872D",
"1 c #408C2E", "1 c #3E892C",
"2 c #418C2E", "2 c #3F8A2D",
"3 c #418C2F", "3 c #3F882E",
"4 c #418D2F", "4 c #40882F",
"5 c #428C2F", "5 c #408B2E",
"6 c #448E31", "6 c #408C2F",
"7 c #4E8C3F", "7 c #418C2F",
"8 c #449131", "8 c #418D2F",
"9 c #459232", "9 c #418E2F",
"0 c #569746", "0 c #428E2F",
"q c #559845", "q c #458037",
"w c #569847", "w c #428B30",
"e c #569248", "e c #428E30",
"r c #5A994B", "r c #428F30",
"t c #599C49", "t c #438F30",
"y c #5A9C49", "y c #448D32",
"u c #5B9D4B", "u c #448F32",
"i c #5B994C", "i c #439031",
"p c #5C9A4D", "p c #459332",
"a c #5C9D4C", "a c #469433",
"s c #5F9F50", "s c #469534",
"d c #619853", "d c #479534",
"f c #619F52", "f c #479634",
"g c #649C56", "g c #479635",
"h c #73985F", "h c #489635",
"j c #67A159", "j c #4F963E",
"k c #68A05B", "k c #5E9451",
"l c #6BA45D", "l c #5E9C50",
"z c #70A763", "z c #5F9F50",
"x c #72A965", "x c #609653",
"c c #FD8147", "c c #609C51",
"v c #E98657", "v c #609D52",
"b c #8AB580", "b c #639A56",
"n c #C7C6B0", "n c #639F55",
"m c #649758",
"M c #659A58",
"N c #659A59",
"B c #679A5B",
"V c #6D9A5E",
"C c #789357",
"Z c #75985A",
"A c #64A055",
"S c #65A058",
"D c #66A058",
"F c #67A259",
"G c #68A05A",
"H c #6AA05D",
"J c #69A35C",
"K c #6DA55F",
"L c #6DA85E",
"P c #70A763",
"I c #71A565",
"U c #70AA62",
"Y c #73AA66",
"T c #78AE6B",
"R c #7AAD6E",
"E c #7EB072",
"W c #8D884F",
"Q c #868A51",
"! c #84AD7B",
"~ c #80B175",
"^ c #82B177",
"/ c #83B378",
"( c #86B57B",
") c #CF905F",
"_ c #E79567",
"` c #EE9368",
"' c #FA9768",
"] c #F29F77",
"[ c #FBA177",
"{ c #F8A279",
"} c #89A880",
"| c #8EBA83",
" . c #91BD86",
".. c #96BE8C",
"X. c #F4B698",
"o. c #B2C4AC",
"O. c #F8C7B0",
/* pixels */ /* pixels */
" ", " ",
" z0p ", " ",
" 188f ", " E 4 4 2 D ",
" j 188u ", " 0 0 0 p 4 R ",
" lq 188u q ", " T r r 0 h 0 D ",
" 6d188u < ", " K y L r r 0 h 0 c ",
" xe188sg1 ", " J 0 U r r 0 h 0 c ~ z ",
" b188r>a ", " P 0 I R r r 0 f 0 n A 0 ",
" 188i7 ", " | 0 < x r r 0 f r D z 2 ",
" 188k ", " / w k r r 0 f r G j 2 ",
" n.1<h ", " ( B i r 0 f r J q r y ",
" c&-=@ ", " ..i 0 0 f r b . r ~ ",
" #%%v ", " .r 0 0 f r B X Y ",
" OXo: ", " r 0 0 a r B m ",
" ;@* ", " r 0 0 a r ! ",
" " " o.2 0 0 a 0 } ",
" _ W C V Z Q ) O. ",
" * $ $ $ $ $ $ ",
" X.> : - ; , ] ",
" # o @ O + ` ",
" $ $ $ $ $ [ ",
" = $ $ $ & ",
" ' { ",
" "
}; };

View file

@ -0,0 +1,112 @@
/* XPM */
static char *logo[] = {
/* columns rows colors chars-per-pixel */
"22 22 84 1 ",
" c None",
". c #397D29",
"X c #F64F00",
"o c #FA5000",
"O c #FC5100",
"+ c #FF5200",
"@ c #FF5404",
"# c #FF5505",
"$ c #FF5E12",
"% c #D76B37",
"& c #D76E3C",
"* c #D96E3C",
"= c #DA713F",
"- c #DC703C",
"; c #D97B3D",
": c #FF702C",
"> c #E47A3C",
", c #FB7839",
"< c #C17F43",
"1 c #C77E41",
"2 c #3D842C",
"3 c #3E892D",
"4 c #3F8A2D",
"5 c #3F8B2D",
"6 c #40892E",
"7 c #408B2E",
"8 c #418C2F",
"9 c #428E2F",
"0 c #428D30",
"q c #438D31",
"w c #428E30",
"e c #428F30",
"r c #438F30",
"t c #448F32",
"y c #488D37",
"u c #488E37",
"i c #468138",
"p c #4A8B3A",
"a c #449032",
"s c #469033",
"d c #469133",
"f c #479433",
"g c #479533",
"h c #479534",
"j c #489634",
"k c #489735",
"l c #4C933A",
"z c #4E953D",
"x c #579B47",
"c c #5A914D",
"v c #5D9C4E",
"b c #5D9250",
"n c #5E9252",
"m c #629F54",
"M c #66965B",
"N c #65A056",
"B c #67A359",
"V c #68A15A",
"C c #68A35A",
"Z c #6BA25E",
"A c #6BA55D",
"S c #6DA75F",
"D c #6C9D61",
"F c #6F9E63",
"G c #6EA760",
"H c #6FA762",
"J c #70A064",
"K c #70A564",
"L c #71A864",
"P c #74A967",
"I c #7CAF70",
"U c #B98248",
"Y c #80B174",
"T c #FE8044",
"R c #FB8750",
"E c #FE8B54",
"W c #FA8E5C",
"Q c #FD9867",
"! c #FB9768",
"~ c #FAA379",
"^ c #A1BC9A",
"/ c #B4B497",
"( c #E8AD91",
") c #ECD5CA",
/* pixels */
" ",
" K ",
" I499v ",
" s00f9Y ",
" Z 000j9G ",
" 4C 000j9C ",
" 0m 000j9S 0N ",
" xtF000j9G 4B ",
" lc000j9P 4A ",
" F0a0h9Jp0L ",
" 0aah9n2z ",
" aaah0ny ",
" s00f0M ",
" y00f0^ ",
" )i60s./ ",
" Q>1U<;, ",
" ~$+++#E ",
" =&-*%( ",
" :+Xo+ ",
" T+++# ",
" !RW ",
" "
};

View file

@ -0,0 +1,23 @@
/* XPM */
static char * run_xpm[] = {
"16 16 2 1",
" c #2B2E37",
". c #555E70",
" ",
"................",
"................",
" ",
" ",
" ",
" ",
"................",
"................",
" ",
" ",
" ",
" ",
"................",
"................",
" ",
" ",
" "};

View file

@ -0,0 +1,23 @@
/* XPM */
static char * run_xpm[] = {
"16 16 2 1",
" c #2B2E37",
". c #555E70",
" ",
" ...... ...... ",
" ...... ...... ",
" ...... ...... ",
" ...... ...... ",
" ...... ...... ",
" ...... ...... ",
" ...... ",
" ...... ",
" ...... ...... ",
" ...... ...... ",
" ...... ...... ",
" ...... ...... ",
" ...... ...... ",
" ...... ...... ",
" ",
" ",
" "};

View file

@ -0,0 +1,22 @@
/* XPM */
static char * run_xpm[] = {
"16 16 2 1",
" c #2B2E37",
". c #8BABF0",
" ",
" ...... ...... ",
" ...... ...... ",
" ...... ...... ",
" ...... ...... ",
" ...... ...... ",
" ...... ...... ",
" ...... ",
" ...... ",
" ...... ...... ",
" ...... ...... ",
" ...... ...... ",
" ...... ...... ",
" ...... ...... ",
" ...... ...... ",
" ",
" "};

View file

@ -16,3 +16,10 @@ color05 = "#02CB9E"
colorTrayer :: String colorTrayer :: String
colorTrayer = "--tint 0x282c34" colorTrayer = "--tint 0x282c34"
grey1 = "#2B2E37"
grey2 = "#555E70"
grey3 = "#697180"
grey4 = "#8691A8"
cyan = "#8BABF0"
orange = "#C45500"

View file

@ -16,9 +16,11 @@
import XMonad import XMonad
import XMonad.Util.EZConfig (additionalKeysP,removeKeysP) import XMonad.Util.EZConfig (additionalKeysP,removeKeysP)
import XMonad.Hooks.DynamicLog (dynamicLogWithPP, wrap, xmobarPP, xmobarColor, shorten, PP(..)) import XMonad.Hooks.DynamicLog
import XMonad.Util.Loggers (logLayoutOnScreen, logTitleOnScreen, shortenL, wrapL, xmobarColorL)
import XMonad.Hooks.SetWMName import XMonad.Hooks.SetWMName
import XMonad.Actions.SpawnOn import XMonad.Actions.SpawnOn
import XMonad.Hooks.StatusBar
import qualified XMonad.StackSet as W import qualified XMonad.StackSet as W
import XMonad.Hooks.EwmhDesktops import XMonad.Hooks.EwmhDesktops
import XMonad.Util.Run import XMonad.Util.Run
@ -65,9 +67,6 @@
>myWorkspaces = ["main","web","text","code","social","mail"] >myWorkspaces = ["main","web","text","code","social","mail"]
>myWorkspaceIndices = M.fromList $ zipWith (,) myWorkspaces [1..] >myWorkspaceIndices = M.fromList $ zipWith (,) myWorkspaces [1..]
>clickable ws = "<action=xdotool key super+"++show i++">"++ws++"</action>"
> where i = fromJust $ M.lookup ws myWorkspaceIndices
\subsubsection{Keybindings} \subsubsection{Keybindings}
@ -81,7 +80,7 @@
launch rofi launch rofi
> , ("M-p", spawn "rofi -show run") > , ("M-p", spawn "rofi -show drun")
launch web browser launch web browser
@ -236,9 +235,9 @@ Percent of screen to increment by when resizing panes
\subsubsection{Startup Hook} \subsubsection{Startup Hook}
\begin{code} \begin{code}
myStartupHook = do myStartupHook = do
spawnOnce "setxkbmap -layout us,pt" spawn "setxkbmap -layout us,pt"
spawnOnce "setxkbmap -option grp:win_space_toggle" spawn "setxkbmap -option grp:win_space_toggle"
spawnOnce "setxkbmap -option caps:escape" spawn "setxkbmap -option caps:escape"
spawnOnce "pasystray" spawnOnce "pasystray"
spawnOnce "nitrogen --restore &" spawnOnce "nitrogen --restore &"
spawnOnce "picom &" spawnOnce "picom &"
@ -248,14 +247,71 @@ Percent of screen to increment by when resizing panes
spawnOnce "mailspring" spawnOnce "mailspring"
spawnOnce "qjackctl" spawnOnce "qjackctl"
spawnOnce("xsetroot -cursor_name left_ptr") spawnOnce("xsetroot -cursor_name left_ptr")
spawn ("killall trayer && sleep 1 && trayer --edge top --align right --widthtype request --margin 6 --padding 4 --SetDockType true --SetPartialStrut true --iconspacing 12 --expand true --monitor 0 --transparent true --alpha 0 " ++ colorTrayer ++ " --height 22 --distance 58 --distancefrom right") spawn ("killall trayer ;sleep 1 && trayer --monitor 0 --edge top --align right --widthtype request --padding 7 --iconspacing 12 --SetDockType true --SetPartialStrut true --expand true --transparent true --alpha 0 --tint 0x2B2E37 --height 26 --distance 5 &")
spawnOn "web" myWebBrowser spawnOn "web" myWebBrowser
spawnOn "main" myTerminal spawnOn "main" myTerminal
\end{code} \end{code}
\subsection{Xmobar}
\begin{code}
actionPrefix, actionButton, actionSuffix :: [Char]
actionPrefix = "<action=`xdotool key super+"
actionButton = "` button="
actionSuffix = "</action>"
addActions :: [(String, Int)] -> String -> String
addActions [] ws = ws
addActions (x:xs) ws = addActions xs (actionPrefix ++ k ++ actionButton ++ show b ++ ">" ++ ws ++ actionSuffix)
where k = fst x
b = snd x
clickable :: [Char] -> [Char] -> [Char]
clickable icon ws = addActions [ (show i, 1), ("q", 2), ("Left", 4), ("Right", 5) ] icon
where i = fromJust $ M.lookup ws myWorkspaceIndices
myStatusBarSpawner :: Applicative f => ScreenId -> f StatusBarConfig
myStatusBarSpawner (S s) = do
pure $ statusBarPropTo ("_XMONAD_LOG_" ++ show s)
("xmobar -x " ++ show s ++ " ~/.config/xmobar/xmobarrc" ++ show s)
(pure $ myXmobarPP (S s))
myXmobarPP :: ScreenId -> PP
myXmobarPP s = def
{ ppSep = ""
, ppWsSep = ""
, ppCurrent = xmobarColor cyan "" . clickable wsIconFull
, ppVisible = xmobarColor grey4 "" . clickable wsIconFull
, ppVisibleNoWindows = Just (xmobarColor grey4 "" . clickable wsIconFull)
, ppHidden = xmobarColor grey2 "" . clickable wsIconHidden
, ppHiddenNoWindows = xmobarColor grey2 "" . clickable wsIconEmpty
, ppUrgent = xmobarColor orange "" . clickable wsIconFull
, ppOrder = \(ws : _ : _ : extras) -> ws : extras
, ppExtras = [ wrapL " " " " $ layoutColorIsActive s (logLayoutOnScreen s)
,titleColorIsActive s (shortenL 81 $ logTitleOnScreen s)
]
}
where
wsIconFull = " <fn=2>\xf111</fn> "
wsIconHidden = " <fn=2>\xf111</fn> "
wsIconEmpty = " <fn=2>\xf10c</fn> "
titleColorIsActive n l = do
c <- withWindowSet $ return . W.screen . W.current
if n == c then xmobarColorL cyan "" l else xmobarColorL grey3 "" l
layoutColorIsActive n l = do
c <- withWindowSet $ return . W.screen . W.current
if n == c then wrapL "<icon=/home/afonso/.config/xmobar/xpm/" "_selected.xpm/>" l else wrapL "<icon=/home/afonso/.config/xmobar/xpm/" ".xpm/>" l
\end{code}
\subsection{Config Binding} \subsection{Config Binding}
\begin{code} \begin{code}
myConfig xmproc = def myConfig = def
{ {
terminal = myTerminal, terminal = myTerminal,
focusFollowsMouse = myFocusFollowsMouse, focusFollowsMouse = myFocusFollowsMouse,
@ -269,30 +325,14 @@ Percent of screen to increment by when resizing panes
layoutHook = spacingWithEdge 10 $ myLayout, layoutHook = spacingWithEdge 10 $ myLayout,
manageHook = manageSpawn <+> myManageHook <+> manageHook def, manageHook = manageSpawn <+> myManageHook <+> manageHook def,
handleEventHook = myEventHook <+> fullscreenEventHook, handleEventHook = myEventHook <+> fullscreenEventHook,
startupHook = myStartupHook, startupHook = myStartupHook}
logHook = dynamicLogWithPP $ xmobarPP
{ ppOutput = \x -> hPutStrLn xmproc x -- xmobar on monitor 1
, ppCurrent = xmobarColor color02 "" . wrap
("<box type=Bottom width=2 mb=2 color=" ++ color02 ++ ">") "</box>"
, ppVisible = xmobarColor color05 "" . clickable
, ppHidden = xmobarColor color01 "" . wrap
("<box type=Top width=2 mt=2 color=" ++ color01 ++ ">") "</box>" . clickable
, ppHiddenNoWindows = xmobarColor color01 "" . clickable
, ppTitle = xmobarColor color04 "" . shorten 60
, ppSep = "<fc=" ++ color03 ++ "> <fn=1>|</fn> </fc>"
, ppUrgent = xmobarColor color02 "" . wrap "!" "!"
, ppExtras = [windowCount]
, ppOrder = \(ws:l:t:ex) -> [ws]++ex++[t]
}
}
\end{code} \end{code}
\subsection{Main} \subsection{Main}
\begin{code} \begin{code}
main :: IO () main :: IO ()
main = do main = do
xmproc <- spawnPipe "xmobar -x 0 ~/.config/xmobar/xmobarrc" -- launch on monitor 1 xmonad . ewmh . ewmhFullscreen . dynamicSBs myStatusBarSpawner . docks $ additionalKeysP (removeKeysP myConfig myRemoveKeys) myKeys
xmonad $ ewmh $ ewmhFullscreen $ docks $ additionalKeysP (removeKeysP (myConfig xmproc) myRemoveKeys) myKeys
\end{code} \end{code}
\subsection{Default Bindings} \subsection{Default Bindings}