add xmonad and polybar config

This commit is contained in:
JasterV 2025-04-12 00:54:31 +02:00
parent 691fa890b4
commit 8b0d93c401
9 changed files with 442 additions and 0 deletions

235
.config/polybar/config.ini Normal file
View file

@ -0,0 +1,235 @@
;==========================================================
;
;
; ██████╗ ██████╗ ██╗ ██╗ ██╗██████╗ █████╗ ██████╗
; ██╔══██╗██╔═══██╗██║ ╚██╗ ██╔╝██╔══██╗██╔══██╗██╔══██╗
; ██████╔╝██║ ██║██║ ╚████╔╝ ██████╔╝███████║██████╔╝
; ██╔═══╝ ██║ ██║██║ ╚██╔╝ ██╔══██╗██╔══██║██╔══██╗
; ██║ ╚██████╔╝███████╗██║ ██████╔╝██║ ██║██║ ██║
; ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝
;
;
; To learn more about how to configure Polybar
; go to https://github.com/polybar/polybar
;
; The README contains a lot of information
;
;==========================================================
[colors]
background = #282A2E
background-alt = #373B41
foreground = #C5C8C6
primary = #F0C674
secondary = #8ABEB7
alert = #A54242
disabled = #707880
[bar/example]
width = 100%
height = 24pt
radius = 6
; dpi = 96
background = ${colors.background}
foreground = ${colors.foreground}
line-size = 3pt
border-size = 4pt
border-color = #00000000
padding-left = 0
padding-right = 1
module-margin = 1
separator = |
separator-foreground = ${colors.disabled}
font-0 = monospace;2
font-1 = Font Awesome 5 Free: style=Solid: pixelsize=11
font-2 = Font Awesome 5 Brands: pixelsize=11
font-3 = Material Icons: style=Regular: pixelsize=11; 2
font-4 = "Symbols Nerd Font Mono:size=11"
modules-left = xworkspaces
modules-center = date
modules-right = pulseaudio-control-input pulseaudio-control-output bluetooth battery powermenu systray
cursor-click = pointer
cursor-scroll = ns-resize
enable-ipc = true
; wm-restack = generic
; wm-restack = bspwm
; wm-restack = i3
; override-redirect = true
[module/systray]
type = internal/tray
format-margin = 8pt
tray-spacing = 16pt
[module/xworkspaces]
type = internal/xworkspaces
label-active = %name%
label-active-background = ${colors.background-alt}
label-active-underline= ${colors.primary}
label-active-padding = 1
label-occupied = %name%
label-occupied-padding = 1
label-urgent = %name%
label-urgent-background = ${colors.alert}
label-urgent-padding = 1
label-empty = %name%
label-empty-foreground = ${colors.disabled}
label-empty-padding = 1
[network-base]
type = internal/network
interval = 5
format-connected = <label-connected>
format-disconnected = <label-disconnected>
label-disconnected = %{F#F0C674}%ifname%%{F#707880} disconnected
[module/wlan]
inherit = network-base
interface-type = wireless
label-connected = %{F#F0C674}%ifname%%{F-} %essid% %local_ip%
[module/eth]
inherit = network-base
interface-type = wired
label-connected = %{F#F0C674}%ifname%%{F-} %local_ip%
[module/date]
type = internal/date
interval = 1
date = %Y-%m-%d %H:%M:%S
date-alt = %H:%M
label = %date%
label-foreground = ${colors.primary}
[module/battery]
type = internal/battery
battery = BAT0
adapter = AC
full-at = 100
format-charging = <animation-charging> <label-charging>
format-charging-underline = #ffb52a
format-discharging = <ramp-capacity> <label-discharging>
format-discharging-underline = ${self.format-charging-underline}
format-full =  <label-full>
format-full-underline = ${self.format-charging-underline}
ramp-capacity-0 =
ramp-capacity-1 =
ramp-capacity-2 =
ramp-capacity-3 =
ramp-capacity-4 =
animation-charging-0 =
animation-charging-1 =
animation-charging-2 =
animation-charging-3 =
animation-charging-framerate = 750
[module/pulseaudio-control-output]
type = custom/script
tail = true
label-padding = 1
label-foreground = ${colors.foreground}
format-volume-prefix = "VOL "
# Icons mixed from Font Awesome 5 and Material Icons
# You can copy-paste your options for each possible action, which is more
# trouble-free but repetitive, or apply only the relevant ones (for example
# --node-blacklist is only needed for next-node).
exec = pulseaudio-control --format '$VOL_ICON ${VOL_LEVEL}% $ICON_NODE' --icons-volume " , " --icon-muted " " --node-nicknames-from "device.description" listen
click-right = exec pavucontrol &
click-left = pulseaudio-control togmute
click-middle = pulseaudio-control --node-blacklist "alsa_output.pci-0000_01_00.1.hdmi-stereo-extra2" next-node
scroll-up = pulseaudio-control --volume-max 130 up
scroll-down = pulseaudio-control --volume-max 130 down
[module/pulseaudio-control-input]
type = custom/script
tail = true
label-padding = 1
label-foreground = ${colors.foreground}
# Use --node-blacklist to remove the unwanted PulseAudio .monitor that are child of sinks
exec = pulseaudio-control --format '$VOL_ICON ${VOL_LEVEL}% $ICON_NODE' --node-type input --icons-volume "" --icon-muted "" --node-blacklist "*.monitor" listen
click-right = exec pavucontrol &
click-left = pulseaudio-control --node-type input togmute
click-middle = pulseaudio-control --node-type input next-node
scroll-up = pulseaudio-control --node-type input --volume-max 130 up
scroll-down = pulseaudio-control --node-type input --volume-max 130 down
[module/bluetooth]
type = custom/script
exec = "bluetoothctl devices Connected | awk -vORS=', ' '{for(i=3;i<=NF;i++){ printf("%s",( (i>3) ? OFS : "" ) $i) };print"";}' | sed -e 's/, $/\\n/'"
exec-if = "[ $(bluetoothctl show | grep 'Powered: yes' | wc -l) -gt 0 ]"
interval = 5
click-right = blueman-manager &
format-prefix = " "
[module/powermenu]
type = custom/menu
expand-right = true
format-spacing = 1
label-open = ""
label-close =  cancel
label-separator = |
label-separator-foreground = ${colors.foreground}
;Powermenu
menu-0-0 = "Reboot "
menu-0-0-exec = menu-open-1
menu-0-1 = "Power Off"
menu-0-1-exec = menu-open-2
menu-0-2 = "Hibernate"
menu-0-2-exec = menu-open-3
;Reboot
menu-1-0 = "Cancel "
menu-1-0-exec = menu-open-0
menu-1-1 = "Reboot"
menu-1-1-exec = systemctl reboot
;Shutdown
menu-2-0 = "Power off"
menu-2-0-exec = systemctl poweroff
menu-2-1 = "Cancel "
menu-2-1-exec = menu-open-0
;Hibernate
menu-3-0 = "Hibernate "
menu-3-0-exec = systemctl hibernate
menu-3-1 = "Cancel"
menu-3-1-exec = menu-open-0
[settings]
screenchange-reload = true
pseudo-transparency = true
; vim:ft=dosini

@ -0,0 +1 @@
Subproject commit ed03a1b85dd0e92f85bc7446b78e010b36be4606

29
.config/xmonad/.gitignore vendored Normal file
View file

@ -0,0 +1,29 @@
# Created by https://www.toptal.com/developers/gitignore/api/haskell
# Edit at https://www.toptal.com/developers/gitignore?templates=haskell
### Haskell ###
dist
dist-*
cabal-dev
*.o
*.hi
*.hie
*.chi
*.chs.h
*.dyn_o
*.dyn_hi
.hpc
.hsenv
.cabal-sandbox/
cabal.sandbox.config
*.prof
*.aux
*.hp
*.eventlog
.stack-work/
cabal.project.local
cabal.project.local~
.HTF/
.ghc.environment.*
# End of https://www.toptal.com/developers/gitignore/api/haskell

67
.config/xmonad/stack.yaml Normal file
View file

@ -0,0 +1,67 @@
# This file was automatically generated by 'stack init'
#
# Some commonly used options have been documented as comments in this file.
# For advanced use and comprehensive documentation of the format, please see:
# https://docs.haskellstack.org/en/stable/configure/yaml/
# A 'specific' Stackage snapshot or a compiler version.
# A snapshot resolver dictates the compiler version and the set of packages
# to be used for project dependencies. For example:
#
# snapshot: lts-23.14
# snapshot: nightly-2025-02-15
# snapshot: ghc-9.8.4
#
# The location of a snapshot can be provided as a file or url. Stack assumes
# a snapshot provided as a file might change, whereas a url resource does not.
#
# snapshot: ./custom-snapshot.yaml
# snapshot: https://example.com/snapshots/2024-01-01.yaml
snapshot: lts-22.43
# User packages to be built.
# Various formats can be used as shown in the example below.
#
# packages:
# - some-directory
# - https://example.com/foo/bar/baz-0.0.2.tar.gz
# subdirs:
# - auto-update
# - wai
packages:
- xmonad
- xmonad-contrib
# Dependency packages to be pulled from upstream that are not in the snapshot.
# These entries can reference officially published versions as well as
# forks / in-progress versions pinned to a git hash. For example:
#
# extra-deps:
# - acme-missiles-0.3
# - git: https://github.com/commercialhaskell/stack.git
# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
#
# extra-deps: []
# Override default flag values for project packages and extra-deps
# flags: {}
# Extra package databases containing global packages
# extra-package-dbs: []
# Control whether we use the GHC we find on the path
# system-ghc: true
#
# Require a specific version of Stack, using version ranges
# require-stack-version: -any # Default
# require-stack-version: ">=3.5"
#
# Override the architecture used by Stack, especially useful on Windows
# arch: i386
# arch: x86_64
#
# Extra directories used by Stack for building
# extra-include-dirs: [/path/to/dir]
# extra-lib-dirs: [/path/to/dir]
#
# Allow a newer minor version of GHC than the snapshot specifies
# compiler-check: newer-minor

View file

@ -0,0 +1,12 @@
# This file was autogenerated by Stack.
# You should not edit this file by hand.
# For more information, please see the documentation at:
# https://docs.haskellstack.org/en/stable/topics/lock_files
packages: []
snapshots:
- completed:
sha256: 08bd13ce621b41a8f5e51456b38d5b46d7783ce114a50ab604d6bbab0d002146
size: 720271
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/22/43.yaml
original: lts-22.43

1
.config/xmonad/xmonad Submodule

@ -0,0 +1 @@
Subproject commit 0d90d183a7f3f68dbf201c944c3608b2f44ca009

@ -0,0 +1 @@
Subproject commit a84f3e8540d7c85b456104aef86a38e9b6083e71

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

@ -0,0 +1,87 @@
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.StatusBar
import XMonad.Hooks.StatusBar.PP
import XMonad.Layout.Magnifier
import XMonad.Layout.ThreeColumns
import XMonad.Operations
import XMonad.Util.EZConfig
import XMonad.Util.Loggers
import XMonad.Util.SpawnOnce
main :: IO ()
main =
xmonad
. ewmhFullscreen
. ewmh
. withEasySB (statusBarProp "xmobar -x 0 ~/.config/xmobar/xmobarrc" (pure myXmobarPP)) defToggleStrutsKey
$ myConfig
myConfig =
def
{ modMask = mod4Mask, -- Rebind Mod to the Super key
layoutHook = myLayout, -- Use custom layouts
manageHook = myManageHook, -- Match on certain windows
startupHook = myStartupHook,
terminal = "ghostty"
}
`additionalKeysP` [ ("M-S-z", spawn "xscreensaver-command -lock"),
("M-C-s", unGrab *> spawn "scrot -s"),
("M-f", spawn "brave-browser")
]
myStartupHook = do
spawnOnce "sh ~/.screenlayout/default.sh"
spawnOnce "xsetroot -cursor_name left_ptr"
spawnOnce "xfce4-power-manager &"
spawnOnce "nm-applet --sm-disable &"
spawnOnce "trayer --edge top --align right --SetDockType true --SetPartialStrut true --expand true --width 10 --transparent true --tint 0x5f5f5f --height 18 &"
spawnOnce "feh --bg-fill /usr/share/backgrounds/Fuji_san_by_amaral.png"
spawnOnce "xscreensaver -no-splash &"
myManageHook :: ManageHook
myManageHook =
composeAll
[ className =? "Gimp" --> doFloat,
isDialog --> doFloat
]
myLayout = tiled ||| Mirror tiled ||| Full ||| threeCol
where
threeCol = magnifiercz' 1.3 $ ThreeColMid nmaster delta ratio
tiled = Tall nmaster delta ratio
nmaster = 1 -- Default number of windows in the master pane
ratio = 1 / 2 -- Default proportion of screen occupied by master pane
delta = 3 / 100 -- Percent of screen to increment by when resizing panes
myXmobarPP :: PP
myXmobarPP =
def
{ ppSep = magenta "",
ppTitleSanitize = xmobarStrip,
ppCurrent = wrap " " "" . xmobarBorder "Top" "#8be9fd" 2,
ppHidden = white . wrap " " "",
ppHiddenNoWindows = lowWhite . wrap " " "",
ppUrgent = red . wrap (yellow "!") (yellow "!"),
ppOrder = \[ws, l, _, wins] -> [ws, l, wins],
ppExtras = [logTitles formatFocused formatUnfocused]
}
where
formatFocused = wrap (white "[") (white "]") . magenta . ppWindow
formatUnfocused = wrap (lowWhite "[") (lowWhite "]") . blue . ppWindow
-- \| Windows should have *some* title, which should not not exceed a
-- sane length.
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" ""

9
.gitmodules vendored Normal file
View file

@ -0,0 +1,9 @@
[submodule ".config/polybar/polybar-pulseaudio-control"]
path = .config/polybar/polybar-pulseaudio-control
url = git@github.com:marioortizmanero/polybar-pulseaudio-control.git
[submodule ".config/xmonad/xmonad-contrib"]
path = .config/xmonad/xmonad-contrib
url = https://github.com/xmonad/xmonad-contrib
[submodule ".config/xmonad/xmonad"]
path = .config/xmonad/xmonad
url = https://github.com/xmonad/xmonad