diff --git a/.config/xmobar/scripts/bluetooth.sh b/.config/xmobar/scripts/bluetooth.sh new file mode 100755 index 0000000..4b4304d --- /dev/null +++ b/.config/xmobar/scripts/bluetooth.sh @@ -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 "$ICON" diff --git a/.config/xmobar/scripts/cpu_temp.sh b/.config/xmobar/scripts/cpu_temp.sh new file mode 100755 index 0000000..02fb6d8 --- /dev/null +++ b/.config/xmobar/scripts/cpu_temp.sh @@ -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: $temp°C" +elif [ "$temp" -ge "$temp1" ] ; then + echo "Cpu: $temp°C" +else + echo "Cpu: $temp°C" + +fi diff --git a/.config/xmobar/scripts/gpu_util.sh b/.config/xmobar/scripts/gpu_util.sh new file mode 100755 index 0000000..c371a24 --- /dev/null +++ b/.config/xmobar/scripts/gpu_util.sh @@ -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: $temp%" +elif [ "$temp" -ge "$temp1" ] ; then + echo "Gpu: $temp%" +else + echo "Gpu: $temp%" + +fi diff --git a/.config/xmobar/scripts/network.sh b/.config/xmobar/scripts/network.sh new file mode 100755 index 0000000..de1e837 --- /dev/null +++ b/.config/xmobar/scripts/network.sh @@ -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 "直" + else + echo "ﯱ" + fi + fi +done diff --git a/.config/xmobar/trayer-padding-icon.sh b/.config/xmobar/scripts/trayer-padding-icon.sh similarity index 100% rename from .config/xmobar/trayer-padding-icon.sh rename to .config/xmobar/scripts/trayer-padding-icon.sh diff --git a/.config/xmobar/scripts/volume.sh b/.config/xmobar/scripts/volume.sh new file mode 100755 index 0000000..6814b3e --- /dev/null +++ b/.config/xmobar/scripts/volume.sh @@ -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 "" +elif [ "$VOLUME" -eq 0 ]; then + echo "" +else + echo " $VOLUME" +fi diff --git a/.config/xmobar/xmobarrc b/.config/xmobar/xmobarrc deleted file mode 100644 index f027313..0000000 --- a/.config/xmobar/xmobarrc +++ /dev/null @@ -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", "\xf108 cpu: (%)","-H","50","--high","red"] 20 - -- Ram used number and percent - , Run Memory ["-t", "\xf233 mem: M (%)"] 20 - -- Disk space free - , Run DiskU [("/", "\xf0c7 disk: free")] [] 60 - -- Echos an "up arrow" icon in front of the uptime output. - , Run Com "echo" ["\xf0aa"] "uparrow" 3600 - -- Uptime - , Run Uptime ["-t", "uptime: d h"] 360 - -- Echos a "battery" icon in front of the pacman updates. - , Run Com "echo" ["\xf242"] "baticon" 3600 - -- Battery - , Run BatteryP ["BAT0"] ["-t", "\xf242 AC: (%)"] 360 - -- Time and date - , Run Date "\xf017 %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 = " | %UnsafeStdinReader% }{ %cpu% | %memory% | %disku% | %date% | %battery% | %default:Master% | %trayerpad% " - } diff --git a/.config/xmobar/xmobarrc0 b/.config/xmobar/xmobarrc0 new file mode 100644 index 0000000..91d10c8 --- /dev/null +++ b/.config/xmobar/xmobarrc0 @@ -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  %H:%M:%S" "date" 10 + , Run Memory ["-t","Mem: %"] 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 = " \ + \ \ + \%_XMONAD_LOG_0%\ + \}\ + \%date%\ + \{\ + \ \ + \%memory%\ + \ \ + \|\ + \ \ + \%cpu%\ + \ \ + \|\ + \ \ + \%gpu%\ + \ \ + \|\ + \ \ + \%network%\ + \ \ + \%bluetooth%\ + \ \ + \%volume%\ + \ \ + \|\ + \%trayerpad%" + } diff --git a/.config/xmobar/xmobarrc1 b/.config/xmobar/xmobarrc1 new file mode 100644 index 0000000..a152fec --- /dev/null +++ b/.config/xmobar/xmobarrc1 @@ -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  %H:%M:%S" "date" 10 + ] + , sepChar = "%" + , alignSep = "}{" + , template = " \ + \ \ + \%_XMONAD_LOG_0%\ + \}\ + \%date%\ + \{" + } diff --git a/.config/xmobar/xpm/full.xpm b/.config/xmobar/xpm/full.xpm new file mode 100644 index 0000000..eac214c --- /dev/null +++ b/.config/xmobar/xpm/full.xpm @@ -0,0 +1,23 @@ +/* XPM */ +static char * run_xpm[] = { +"16 16 2 1", +" c #2B2E37", +". c #555E70", +" ", +" .............. ", +" .............. ", +" .............. ", +" .............. ", +" .. .. ", +" .. .. ", +" .. .. ", +" .. .. ", +" .. .. ", +" .. .. ", +" .. .. ", +" .. .. ", +" .............. ", +" .............. ", +" ", +" ", +" "}; diff --git a/.config/xmobar/xpm/full_selected.xpm b/.config/xmobar/xpm/full_selected.xpm new file mode 100644 index 0000000..fda5280 --- /dev/null +++ b/.config/xmobar/xpm/full_selected.xpm @@ -0,0 +1,23 @@ +/* XPM */ +static char * run_xpm[] = { +"16 16 2 1", +" c #2B2E37", +". c #8BABF0", +" ", +" .............. ", +" .............. ", +" .............. ", +" .............. ", +" .. .. ", +" .. .. ", +" .. .. ", +" .. .. ", +" .. .. ", +" .. .. ", +" .. .. ", +" .. .. ", +" .............. ", +" .............. ", +" ", +" ", +" "}; diff --git a/.config/xmobar/xpm/grid.xpm b/.config/xmobar/xpm/grid.xpm new file mode 100644 index 0000000..3a55ef2 --- /dev/null +++ b/.config/xmobar/xpm/grid.xpm @@ -0,0 +1,23 @@ +/* XPM */ +static char * run_xpm[] = { +"16 16 2 1", +" c #2B2E37", +". c #555E70", +" ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ", +" ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ", +" ", +" "}; diff --git a/.config/xmobar/xpm/grid_selected.xpm b/.config/xmobar/xpm/grid_selected.xpm new file mode 100644 index 0000000..9cb37be --- /dev/null +++ b/.config/xmobar/xpm/grid_selected.xpm @@ -0,0 +1,23 @@ +/* XPM */ +static char * run_xpm[] = { +"16 16 2 1", +" c #2B2E37", +". c #8BABF0", +" ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ", +" ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ", +" ", +" "}; diff --git a/.config/xmobar/xpm/logo.xpm b/.config/xmobar/xpm/logo.xpm index 529a6a1..fbcd950 100644 --- a/.config/xmobar/xpm/logo.xpm +++ b/.config/xmobar/xpm/logo.xpm @@ -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 : - ; , ] ", +" # o @ O + ` ", +" $ $ $ $ $ [ ", +" = $ $ $ & ", +" ' { ", +" " }; diff --git a/.config/xmobar/xpm/logo.xpm.bak b/.config/xmobar/xpm/logo.xpm.bak new file mode 100644 index 0000000..79d95de --- /dev/null +++ b/.config/xmobar/xpm/logo.xpm.bak @@ -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 ", +" " +}; diff --git a/.config/xmobar/xpm/menu.xpm b/.config/xmobar/xpm/menu.xpm new file mode 100644 index 0000000..1f85d44 --- /dev/null +++ b/.config/xmobar/xpm/menu.xpm @@ -0,0 +1,23 @@ +/* XPM */ +static char * run_xpm[] = { +"16 16 2 1", +" c #2B2E37", +". c #555E70", +" ", +"................", +"................", +" ", +" ", +" ", +" ", +"................", +"................", +" ", +" ", +" ", +" ", +"................", +"................", +" ", +" ", +" "}; diff --git a/.config/xmobar/xpm/tall.xpm b/.config/xmobar/xpm/tall.xpm new file mode 100644 index 0000000..7e0613a --- /dev/null +++ b/.config/xmobar/xpm/tall.xpm @@ -0,0 +1,23 @@ +/* XPM */ +static char * run_xpm[] = { +"16 16 2 1", +" c #2B2E37", +". c #555E70", +" ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ...... ", +" ...... ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ", +" ", +" "}; diff --git a/.config/xmobar/xpm/tall_selected.xpm b/.config/xmobar/xpm/tall_selected.xpm new file mode 100644 index 0000000..790e7f7 --- /dev/null +++ b/.config/xmobar/xpm/tall_selected.xpm @@ -0,0 +1,22 @@ +/* XPM */ +static char * run_xpm[] = { +"16 16 2 1", +" c #2B2E37", +". c #8BABF0", +" ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ...... ", +" ...... ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ...... ...... ", +" ", +" "}; diff --git a/.config/xmonad/lib/Colors/Teal.hs b/.config/xmonad/lib/Colors/Teal.hs index 472e51a..a50e6e3 100644 --- a/.config/xmonad/lib/Colors/Teal.hs +++ b/.config/xmonad/lib/Colors/Teal.hs @@ -16,3 +16,10 @@ color05 = "#02CB9E" colorTrayer :: String colorTrayer = "--tint 0x282c34" + +grey1 = "#2B2E37" +grey2 = "#555E70" +grey3 = "#697180" +grey4 = "#8691A8" +cyan = "#8BABF0" +orange = "#C45500" diff --git a/.config/xmonad/xmonad.hs b/.config/xmonad/xmonad.hs new file mode 100644 index 0000000..4cad873 --- /dev/null +++ b/.config/xmonad/xmonad.hs @@ -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) + , ("", spawn "flameshot screen") + , ("S-", spawn "flameshot gui") + , ("", spawn "pamixer set --toggle-mute") + , ("", spawn "pamixer -d 5") + , ("", spawn "pamixer -i 5") + ,("", spawn "lux -a 10%") + ,("", spawn "lux -s 10%") + ,("M-n", spawn $ myTerminal ++ " -e nmtui") + , ("M-q", kill) + , ("M-S-", sendMessage NextLayout) + , ("M-", windows W.focusDown) + , ("M-", windows W.focusUp ) + , ("M-m", windows W.focusMaster ) + , ("M-", 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-","M-S-p","M-S-c","M-","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 = " 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 = " \xf111 " + wsIconHidden = " \xf111 " + wsIconEmpty = " \xf10c " + 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 "" l else wrapL "" 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"] + diff --git a/.config/xmonad/xmonad.lhs b/.config/xmonad/xmonad.lhs index e313e10..1770487 100644 --- a/.config/xmonad/xmonad.lhs +++ b/.config/xmonad/xmonad.lhs @@ -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 = ""++ws++"" -> 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 = " 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 = " \xf111 " + wsIconHidden = " \xf111 " + wsIconEmpty = " \xf10c " + 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 "" l else wrapL "" 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 - ("") "" - , ppVisible = xmobarColor color05 "" . clickable - , ppHidden = xmobarColor color01 "" . wrap - ("") "" . clickable - , ppHiddenNoWindows = xmobarColor color01 "" . clickable - , ppTitle = xmobarColor color04 "" . shorten 60 - , ppSep = " | " - , 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}