Dots

Table of Contents

1. ⚠️ Working in Progress

xmonad.png

2. Xmonad

2.1. Import

import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.StatusBar
import XMonad.Hooks.StatusBar.PP
import XMonad.Util.EZConfig (additionalKeysP)
import XMonad.Util.Loggers
import XMonad.Layout.BinarySpacePartition
import XMonad.Layout.Spacing
import XMonad.Hooks.EwmhDesktops
import XMonad.Util.SpawnOnce
import XMonad.StackSet as W
import XMonad.ManageHook
import XMonad.Util.NamedScratchpad
import XMonad.Layout.Renamed
import XMonad.Hooks.ManageHelpers
-- Fix Spotify Float
import XMonad.Hooks.DynamicProperty

2.2. Main

main :: IO ()
main =
  xmonad
    . ewmhFullscreen
    . ewmh
    . withEasySB (statusBarProp "xmobar" (pure myXmobarPP)) defToggleStrutsKey
    $ myConfig

2.3. MyConfig

myConfig =
  def
    { modMask             = mod4Mask
      ,startupHook        = myStartupHook
      ,borderWidth        = 0
      ,focusedBorderColor = "#F08080"
      ,manageHook         = myManageHook
      ,layoutHook         = myLayout
      -- Fix Spotify Float
      ,handleEventHook    = dynamicPropertyChange "WM_NAME" (title =? "Spotify" --> doCenterFloat)
    }
    `additionalKeysP` [ ("<Print>", spawn "flameshot gui"),
                        ("M-<Space>", spawn "rofi -show drun"),
                        ("M-<Return>", spawn "env GLFW_IM_MODULE=ibus kitty"),
                        ("M-S-q", kill),
                        ("M-S-r", spawn "xmonad --restart"),
                        ("M-C-<Space>", namedScratchpadAction scratchpads "term"),
                        ("M-t", namedScratchpadAction scratchpads "todo"),
                        ("M-m", namedScratchpadAction scratchpads "music")
                      ]

2.4. MyLayout

myLayout = renamed [Replace "BSP"] $ spacingWithEdge 7 $ emptyBSP

2.5. Xmobar

myXmobarPP :: PP
myXmobarPP = def
    { ppSep             = magenta " • "
    , ppTitleSanitize   = xmobarStrip
    , ppCurrent         = wrap " " "" . xmobarBorder "Top" "#8be9fd" 2
    , ppHidden          = red . wrap " " ""
    , ppHiddenNoWindows = lowWhite . wrap " " ""
    , ppUrgent          = red . wrap (yellow "!") (yellow "!")
    , ppOrder           = \[ws, l, _, wins] -> [ws, l, wins]
    , ppExtras          = [logTitles formatFocused formatUnfocused]
    }
  where
    formatFocused   = wrap (red    "[") (red    "]") . magenta . ppWindow
    formatUnfocused = wrap (lowWhite "[") (lowWhite "]") . blue    . ppWindow
    ppWindow :: String -> String
    ppWindow = xmobarRaw . (\w -> if null w then "untitled" else w) . shorten 30
    blue, lowWhite, magenta, red, white, yellow :: String -> String
    magenta  = xmobarColor "#ff79c6" ""
    blue     = xmobarColor "#bd93f9" ""
    white    = xmobarColor "#f8f8f2" ""
    yellow   = xmobarColor "#f1fa8c" ""
    red      = xmobarColor "#ff5555" ""
    lowWhite = xmobarColor "#bbbbbb" ""

2.6. AutoStart

myStartupHook :: X ()
myStartupHook = do
  spawn "pkill trayer"
  spawn "pkill .xkeysnail-wrap"
  spawn ("sleep 2 && xkeysnail -q ~/.config/xkeysnail/config.py")
  spawnOnce "feh --bg-fill ~/Downloads/james-donovan-kFHz9Xh3PPU-unsplash.jpg"
  spawnOnce "systemctl --user restart picom.service"
  spawn ("sleep 2 && trayer --edge top --align right --widthtype request --SetDockType true --SetPartialStrut true --expand true --transparent true --alpha 0 --tint 0xfdf6e3 --height 25 --iconspacing 6 --distance 4 --padding 7")
  spawn ("sleep 3 && systemctl --user restart fcitx5-daemon.service")

2.7. ManageHook

myManageHook :: ManageHook
myManageHook = composeAll
    [ title =? "todo" --> doCenterFloat
    , title =? "term" --> doCenterFloat
    , isDialog        --> doCenterFloat
    ] <+> namedScratchpadManageHook scratchpads

2.8. Scratchpads

scratchpads =
  [ NS "term" "env GLFW_IM_MODULE=ibus kitty --title term" (title =? "term") defaultFloating,
    NS "music" "spotify" (title =? "Spotify") defaultFloating,
    NS "todo" "emacs --title todo --eval '(org-agenda-show-all-todo)' --eval '(delete-other-windows)'" (title =? "todo") defaultFloating
  ]
  where
    role = stringProperty "WM_WINDOW_ROLE"

2.9. Trayer-padding-icon

#!/usr/bin/env sh
# Detects the width of running trayer-srg window (xprop name 'panel')
# and creates an XPM icon of that width, 1px height, and transparent.
# Outputs an <icon>-tag for use in xmobar to display the generated
# XPM icon. 
#
# Run script from xmobar:
# `Run Com "/where/ever/trayer-padding-icon.sh" [] "trayerpad" 10`
# and use `%trayerpad%` in your template.


# Function to create a transparent Wx1 px XPM icon
create_xpm_icon () {
timestamp=$(date)
pixels=$(for i in `seq $1`; do echo -n "."; done)

cat << EOF > "$2"
/* XPM *
static char * trayer_pad_xpm[] = {
/* This XPM icon is used for padding in xmobar to */
/* leave room for trayer-srg. It is dynamically   */
/* updated by by trayer-pad-icon.sh which is run  */
/* by xmobar.                                     */
/* Created: ${timestamp} */
/* <w/cols>  <h/rows>  <colors>  <chars per pixel> */
"$1 1 1 1",
/* Colors (none: transparent) */
". c none",
/* Pixels */
"$pixels"
};
EOF
}

# Width of the trayer window
width=$(xprop -name panel | grep 'program specified minimum size' | cut -d ' ' -f 5)

# Icon file name
iconfile="/tmp/trayer-padding-${width}px.xpm"

# If the desired icon does not exist create it
if [ ! -f $iconfile ]
then
    create_xpm_icon $width $iconfile
fi

# Output the icon tag for xmobar
echo "<icon=${iconfile}/>"

3. Xmobar

3.1. Xmobar

Config { overrideRedirect = False
       , font             = "xft:mononoki Nerd Font:pixelsize=18:antialias=true:hinting=true,Ping Fang SC:size=15:antialias=true:hinting=true,Noto Color Emoji:size=18:antialias=true:hinting=true"
       , additionalFonts  = []
       , bgColor          = "#fdf6e3"
       , fgColor          = "#657b83"
       , position         = TopW L 100
       , commands         = [Run Cpu
                            [ "-L", "3"
                            , "-H", "50"
                            , "--high"  , "red"
                            , "--normal", "green"
                            ] 10
                            , Run Memory ["--template", "Mem: <usedratio>%"] 10
                            , Run Swap [] 10
                            , Run Date "%a %Y-%m-%d <fc=#8be9fd>%H:%M</fc>" "date" 10
                            , Run Com "/home/me/.config/xmonad/trayer-padding-icon.sh" [] "trayerpad" 10
                            , Run XMonadLog
                          ]
       , sepChar          = "%"
       , alignSep         = "}{"
       , template         = "  %XMonadLog% }{  %cpu%  %memory%  %swap%  %date% %trayerpad%"
       }

xft:

4. Kitty

4.1. Main

4.1.1. Main

# BEGIN_KITTY_THEME
# Tokyo Night
include current-theme.conf
# END_KITTY_THEME
font_family mononoki Nerd Font Mono
bold_font        auto
italic_font      auto
bold_italic_font auto
font_size 13
background_opacity 0.85
remember_window_size  no
macos_quit_when_last_window_closed yes
term xterm-256color
window_margin_width 4
window_padding_width 4

4.2. Theme

4.2.1. Day

  1. Main
    # vim:ft=kitty
    
    ## name: Tokyo Night Day
    ## license: MIT
    ## author: Folke Lemaitre
    ## upstream: https://github.com/folke/tokyonight.nvim/raw/main/extras/kitty_tokyonight_day.conf
    
    background #e1e2e7
    foreground #3760bf
    selection_background #99a7df
    selection_foreground #3760bf
    url_color #387068
    cursor #3760bf
    
    # Tabs
    active_tab_background #2e7de9
    active_tab_foreground #d4d6e4
    inactive_tab_background #c4c8da
    inactive_tab_foreground #8990b3
    #tab_bar_background #e9e9ed
    
    # normal
    color0 #e9e9ed
    color1 #f52a65
    color2 #587539
    color3 #8c6c3e
    color4 #2e7de9
    color5 #9854f1
    color6 #007197
    color7 #6172b0
    
    # bright
    color8 #a1a6c5
    color9 #f52a65
    color10 #587539
    color11 #8c6c3e
    color12 #2e7de9
    color13 #9854f1
    color14 #007197
    color15 #3760bf
    
    # extended colors
    color16 #b15c00
    color17 #c64343
    
    

4.2.2. Night

  1. Main
    # vim:ft=kitty
    
    ## name: Tokyo Night
    ## license: MIT
    ## author: Folke Lemaitre
    ## upstream: https://github.com/folke/tokyonight.nvim/raw/main/extras/kitty_tokyonight_night.conf
    
    
    background #1a1b26
    foreground #c0caf5
    selection_background #33467C
    selection_foreground #c0caf5
    url_color #73daca
    cursor #c0caf5
    
    # Tabs
    active_tab_background #7aa2f7
    active_tab_foreground #1f2335
    inactive_tab_background #292e42
    inactive_tab_foreground #545c7e
    #tab_bar_background #15161E
    
    # normal
    color0 #15161E
    color1 #f7768e
    color2 #9ece6a
    color3 #e0af68
    color4 #7aa2f7
    color5 #bb9af7
    color6 #7dcfff
    color7 #a9b1d6
    
    # bright
    color8 #414868
    color9 #f7768e
    color10 #9ece6a
    color11 #e0af68
    color12 #7aa2f7
    color13 #bb9af7
    color14 #7dcfff
    color15 #c0caf5
    
    # extended colors
    color16 #ff9e64
    color17 #db4b4b
    
    

Author: NULL

Created: 2022-01-15 Sat 20:36

Validate