Changed xmobar look to be cleaner

This commit is contained in:
afonsofrancof 2022-10-31 21:00:11 +00:00
parent 666396c9ab
commit 5168508b7e
21 changed files with 900 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 */
static char *logo[] = {
/* columns rows colors chars-per-pixel */
"16 16 53 1 ",
" c None",
". c #3A7F2A",
"X c #F34E00",
"o c #F74F00",
"O c #FC5100",
"+ c #FD661D",
"@ c #FE671F",
"# c #E4672C",
"$ c #E8682B",
"% c #EB692B",
"& c #F46E2A",
"* c #FE6E2A",
"= c #E8712D",
"- c #E17230",
"; c #FE7A3B",
": c #FC7C3F",
"> c #3B802A",
", c #408B2E",
"< c #418A2F",
"1 c #408C2E",
"2 c #418C2E",
"3 c #418C2F",
"4 c #418D2F",
"5 c #428C2F",
"6 c #448E31",
"7 c #4E8C3F",
"8 c #449131",
"9 c #459232",
"0 c #569746",
"q c #559845",
"w c #569847",
"e c #569248",
"r c #5A994B",
"t c #599C49",
"y c #5A9C49",
"u c #5B9D4B",
"i c #5B994C",
"p c #5C9A4D",
"a c #5C9D4C",
"s c #5F9F50",
"d c #619853",
"f c #619F52",
"g c #649C56",
"h c #73985F",
"j c #67A159",
"k c #68A05B",
"l c #6BA45D",
"z c #70A763",
"x c #72A965",
"c c #FD8147",
"v c #E98657",
"b c #8AB580",
"n c #C7C6B0",
"24 24 97 2 ",
" c None",
". c #377827",
"X c #397D29",
"o c #D24503",
"O c #D04706",
"+ c #DB4700",
"@ c #CF4E10",
"# c #E04800",
"$ c #FF5200",
"% c #FF5301",
"& c #FF5B0D",
"* c #FF6218",
"= c #FF6A23",
"- c #FF7432",
"; c #FE7A3B",
": c #FD7C3E",
"> c #F27B42",
", c #F67C41",
"< c #3E872D",
"1 c #3E892C",
"2 c #3F8A2D",
"3 c #3F882E",
"4 c #40882F",
"5 c #408B2E",
"6 c #408C2F",
"7 c #418C2F",
"8 c #418D2F",
"9 c #418E2F",
"0 c #428E2F",
"q c #458037",
"w c #428B30",
"e c #428E30",
"r c #428F30",
"t c #438F30",
"y c #448D32",
"u c #448F32",
"i c #439031",
"p c #459332",
"a c #469433",
"s c #469534",
"d c #479534",
"f c #479634",
"g c #479635",
"h c #489635",
"j c #4F963E",
"k c #5E9451",
"l c #5E9C50",
"z c #5F9F50",
"x c #609653",
"c c #609C51",
"v c #609D52",
"b c #639A56",
"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 */
" ",
" z0p ",
" 188f ",
" j 188u ",
" lq 188u q ",
" 6d188u < ",
" xe188sg1 ",
" b188r>a ",
" 188i7 ",
" 188k ",
" n.1<h ",
" c&-=@ ",
" #%%v ",
" OXo: ",
" ;@* ",
" "
" ",
" ",
" E 4 4 2 D ",
" 0 0 0 p 4 R ",
" T r r 0 h 0 D ",
" K y L r r 0 h 0 c ",
" J 0 U r r 0 h 0 c ~ z ",
" P 0 I R r r 0 f 0 n A 0 ",
" | 0 < x r r 0 f r D z 2 ",
" / w k r r 0 f r G j 2 ",
" ( B i r 0 f r J q r y ",
" ..i 0 0 f r b . r ~ ",
" .r 0 0 f r B X Y ",
" 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 = "--tint 0x282c34"
grey1 = "#2B2E37"
grey2 = "#555E70"
grey3 = "#697180"
grey4 = "#8691A8"
cyan = "#8BABF0"
orange = "#C45500"

244
.config/xmonad/xmonad.hs Normal file
View file

@ -0,0 +1,244 @@
{-# OPTIONS_GHC -Wno-deprecations #-}
import XMonad
import XMonad.Util.EZConfig (additionalKeysP,removeKeysP)
import XMonad.Hooks.DynamicLog
import XMonad.Util.Loggers (logLayoutOnScreen, logTitleOnScreen, shortenL, wrapL, xmobarColorL)
import XMonad.Hooks.SetWMName
import XMonad.Actions.SpawnOn
import XMonad.Hooks.StatusBar
import qualified XMonad.StackSet as W
import XMonad.Hooks.EwmhDesktops
import XMonad.Util.Run
import Data.Maybe (fromJust)
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers
import Data.Monoid
import Colors.Teal
import System.Exit
import XMonad.Util.SpawnOnce
import XMonad.Layout.Spacing
--import XMonad.Layout.Fullscreen
import qualified XMonad.StackSet as W
import qualified Data.Map as M
myTerminal = "alacritty"
myTextEditor = "vim"
myWebBrowser = "firefox"
myFocusFollowsMouse :: Bool
myFocusFollowsMouse = True
myClickJustFocuses :: Bool
myClickJustFocuses = False
windowCount :: X (Maybe String)
windowCount = gets $ Just . show . length . W.integrate' . W.stack . W.workspace . W.current . windowset
myNormalBorderColor = "#008080"
myFocusedBorderColor = "#01F9C6"
myBorderWidth = 2
myWorkspaces = ["main","web","text","code","social","mail"]
myWorkspaceIndices = M.fromList $ zipWith (,) myWorkspaces [1..]
myModMask = mod4Mask
myKeys :: [(String, X ())]
myKeys =
[ ("M-x" ,spawn myTerminal )
, ("M-p", spawn "rofi -show drun")
, ("M-b", spawn myWebBrowser)
, ("<Print>", spawn "flameshot screen")
, ("S-<Print>", spawn "flameshot gui")
, ("<XF86AudioMute>", spawn "pamixer set --toggle-mute")
, ("<XF86AudioLowerVolume>", spawn "pamixer -d 5")
, ("<XF86AudioRaiseVolume>", spawn "pamixer -i 5")
,("<xf86monbrightnessup>", spawn "lux -a 10%")
,("<xf86monbrightnessdown>", spawn "lux -s 10%")
,("M-n", spawn $ myTerminal ++ " -e nmtui")
, ("M-q", kill)
, ("M-S-<Space>", sendMessage NextLayout)
, ("M-<Down>", windows W.focusDown)
, ("M-<Up>", windows W.focusUp )
, ("M-m", windows W.focusMaster )
, ("M-<Return>", windows W.swapMaster)
, ("M-h", sendMessage Shrink)
, ("M-l", sendMessage Expand)
, ("M-t", withFocused $ windows . W.sink)
, ("M-S-u", io (exitWith ExitSuccess))
, ("M-u", spawn "xmonad --recompile; xmonad --restart")
]
++
[("M-" ++ m ++ (show k), windows $ f i)
| (i, k) <- zip myWorkspaces [1..]
, (f, m) <- [(W.greedyView, "0"), (W.shift, "S-")]]
++
[("M-" ++ m ++ key, screenWorkspace sc >>= flip whenJust (windows . f))
| (key, sc) <- zip ["w", "e", "r"] [0..]
, (f, m) <- [(W.view, "0"), (W.shift, "S-")]]
myRemoveKeys = ["M-S-<Return>","M-S-p","M-S-c","M-<Space>","M-n","M-S-q"]
myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
[ ((modm, button1), (\w -> focus w >> mouseMoveWindow w
>> windows W.shiftMaster))
, ((modm, button2), (\w -> focus w >> windows W.shiftMaster))
, ((modm, button3), (\w -> focus w >> mouseResizeWindow w
>> windows W.shiftMaster))]
myLayout = avoidStruts(tiled ||| Mirror tiled ||| Full)
where
tiled = Tall nmaster delta ratio
nmaster = 1
ratio = 1/2
delta = 3/100
myManageHook = composeAll
[ className =? "MPlayer" --> doFloat
, className =? "Gimp" --> doFloat
, resource =? "desktop_window" --> doIgnore
, className =? "QjackCtl" --> doFloat
, resource =? "kdesktop" --> doIgnore
, className =? "firefox" --> doShift (myWorkspaces !! 1)
, className =? "Code" --> doShift (myWorkspaces !! 3)
, className =? "discord" --> doShift (myWorkspaces !! 4)
, title =? "JetBrains Toolbox" --> doShift (myWorkspaces !! 3)
, className =? "main" --> doFloat
, className =? "Mailspring" --> doShift (myWorkspaces !! 5)
, className =? "Xmessage" --> doFloat
, isFullscreen --> doFullFloat]
myEventHook = ewmhDesktopsEventHook
myStartupHook = do
spawn "setxkbmap -layout us,pt"
spawn "setxkbmap -option grp:win_space_toggle"
spawn "setxkbmap -option caps:escape"
spawnOnce "pasystray"
spawnOnce "nitrogen --restore &"
spawnOnce "picom &"
spawnOnce "optimus-manager-qt"
setWMName "LG3D"
spawnOnce "nm-applet"
spawnOnce "mailspring"
spawnOnce "qjackctl"
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 32 --distance 20 --distancefrom right")
spawnOn "web" myWebBrowser
spawnOn "main" myTerminal
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 ++ ".hs")
(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 (actionPrefix ++ "n" ++ actionButton ++ "1>") actionSuffix
$ wrapL (actionPrefix ++ "q" ++ actionButton ++ "2>") actionSuffix
$ wrapL (actionPrefix ++ "Left" ++ actionButton ++ "4>") actionSuffix
$ wrapL (actionPrefix ++ "Right" ++ actionButton ++ "5>") actionSuffix
$ wrapL " " " " $ layoutColorIsActive s (logLayoutOnScreen s)
, wrapL (actionPrefix ++ "q" ++ actionButton ++ "2>") actionSuffix
$ 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
myConfig = def
{
terminal = myTerminal,
focusFollowsMouse = myFocusFollowsMouse,
clickJustFocuses = myClickJustFocuses,
borderWidth = myBorderWidth,
modMask = myModMask,
workspaces = myWorkspaces,
normalBorderColor = myNormalBorderColor,
focusedBorderColor = myFocusedBorderColor,
-- keys = myKeys,
layoutHook = spacingWithEdge 10 $ myLayout,
manageHook = manageSpawn <+> myManageHook <+> manageHook def,
handleEventHook = myEventHook <+> fullscreenEventHook,
startupHook = myStartupHook}
main :: IO ()
main = do
xmonad . ewmh . ewmhFullscreen . dynamicSBs myStatusBarSpawner . docks $ additionalKeysP (removeKeysP myConfig myRemoveKeys) myKeys
help :: String
help = unlines ["The default modifier key is 'alt'. Default keybindings:",
"",
"-- launching and killing programs",
"mod-Shift-Enter Launch xterminal",
"mod-p Launch dmenu",
"mod-Shift-p Launch gmrun",
"mod-Shift-c Close/kill the focused window",
"mod-Space Rotate through the available layout algorithms",
"mod-Shift-Space Reset the layouts on the current workSpace to default",
"mod-n Resize/refresh viewed windows to the correct size",
"",
"-- move focus up or down the window stack",
"mod-Tab Move focus to the next window",
"mod-Shift-Tab Move focus to the previous window",
"mod-j Move focus to the next window",
"mod-k Move focus to the previous window",
"mod-m Move focus to the master window",
"",
"-- modifying the window order",
"mod-Return Swap the focused window and the master window",
"mod-Shift-j Swap the focused window with the next window",
"mod-Shift-k Swap the focused window with the previous window",
"",
"-- resizing the master/slave ratio",
"mod-h Shrink the master area",
"mod-l Expand the master area",
"",
"-- floating layer support",
"mod-t Push window back into tiling; unfloat and re-tile it",
"",
"-- increase or decrease number of windows in the master area",
"mod-comma (mod-,) Increment the number of windows in the master area",
"mod-period (mod-.) Deincrement the number of windows in the master area",
"",
"-- quit, or restart",
"mod-Shift-q Quit xmonad",
"mod-q Restart xmonad",
"mod-[1..9] Switch to workSpace N",
"",
"-- Workspaces & screens",
"mod-Shift-[1..9] Move client to workspace N",
"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",
"",
"-- Mouse bindings: default actions bound to mouse events",
"mod-button1 Set the window to floating mode and move by dragging",
"mod-button2 Raise the window to the top of the stack",
"mod-button3 Set the window to floating mode and resize by dragging"]

View file

@ -16,9 +16,11 @@
import XMonad
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.Actions.SpawnOn
import XMonad.Hooks.StatusBar
import qualified XMonad.StackSet as W
import XMonad.Hooks.EwmhDesktops
import XMonad.Util.Run
@ -65,9 +67,6 @@
>myWorkspaces = ["main","web","text","code","social","mail"]
>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}
@ -81,7 +80,7 @@
launch rofi
> , ("M-p", spawn "rofi -show run")
> , ("M-p", spawn "rofi -show drun")
launch web browser
@ -236,9 +235,9 @@ Percent of screen to increment by when resizing panes
\subsubsection{Startup Hook}
\begin{code}
myStartupHook = do
spawnOnce "setxkbmap -layout us,pt"
spawnOnce "setxkbmap -option grp:win_space_toggle"
spawnOnce "setxkbmap -option caps:escape"
spawn "setxkbmap -layout us,pt"
spawn "setxkbmap -option grp:win_space_toggle"
spawn "setxkbmap -option caps:escape"
spawnOnce "pasystray"
spawnOnce "nitrogen --restore &"
spawnOnce "picom &"
@ -248,14 +247,71 @@ Percent of screen to increment by when resizing panes
spawnOnce "mailspring"
spawnOnce "qjackctl"
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 "main" myTerminal
\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}
\begin{code}
myConfig xmproc = def
myConfig = def
{
terminal = myTerminal,
focusFollowsMouse = myFocusFollowsMouse,
@ -269,30 +325,14 @@ Percent of screen to increment by when resizing panes
layoutHook = spacingWithEdge 10 $ myLayout,
manageHook = manageSpawn <+> myManageHook <+> manageHook def,
handleEventHook = myEventHook <+> fullscreenEventHook,
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]
}
}
startupHook = myStartupHook}
\end{code}
\subsection{Main}
\begin{code}
main :: IO ()
main = do
xmproc <- spawnPipe "xmobar -x 0 ~/.config/xmobar/xmobarrc" -- launch on monitor 1
xmonad $ ewmh $ ewmhFullscreen $ docks $ additionalKeysP (removeKeysP (myConfig xmproc) myRemoveKeys) myKeys
xmonad . ewmh . ewmhFullscreen . dynamicSBs myStatusBarSpawner . docks $ additionalKeysP (removeKeysP myConfig myRemoveKeys) myKeys
\end{code}
\subsection{Default Bindings}