added dwm gruvbox rice

This commit is contained in:
Murat 2025-02-14 22:48:17 +03:00
parent 758f158b1c
commit 7a177cb8aa
27 changed files with 3416 additions and 0 deletions

27
dwm-gruvbox/README.md Normal file
View File

@ -0,0 +1,27 @@
# Hyprland With DWM
## Used Apps
- [Zen Browser](https://zen-browser.app/)
- [st](https://st.suckless.org/)
- Nvim
- [fastfetch](https://github.com/fastfetch-cli/fastfetch)
- [catnap](https://github.com/iinsertNameHere/catnap)
- [btop++](https://github.com/aristocratos/btop)
### Font
FiraMono Nerd Font
You can download from [NerdFonts](https://www.nerdfonts.com/font-downloads)
### Wallpaper
From [wallhaven](https://wallhaven.cc/w/3lyrvy)
### Zen Browser Theme
You can use this theme for any Firefox based browser:
[GruvboxDarkFirefoxTheme](https://codeberg.org/calvinchd/GruvboxDarkFirefoxTheme)
### Btop++ Theme
In the btop options menu, you can choose _gruvbox_material_dark_ theme.
## Screenshots
![Screenshot 1](https://git.muwat.fun/murat/myrices/raw/branch/main/dwm-gruvbox/screenshots/1.png)![screenshot 2](https://git.muwat.fun/murat/myrices/raw/branch/main/dwm-gruvbox/screenshots/2.png)![screenshot 3](https://git.muwat.fun/murat/myrices/raw/branch/main/dmw-gruvbox/screenshots/3.png)

View File

@ -0,0 +1,50 @@
# This is the configuration file for catnap.
# Here you can configure the stat colors,
# stat names, stat icons and more!
#
# https://github.com/iinsertNameHere/catnap
##############################################
## FetchInfo stats Config ##
##############################################
[stats]
username = {icon = " ", name = "user", color = "(RD)"}
hostname = {icon = " ", name = "hostname", color = "(YW)"}
uptime = {icon = " ", name = "uptime", color = "(BE)"}
distro = {icon = " ", name = "distro", color = "(GN)"}
kernel = {icon = " ", name = "kernel", color = "(MA)"}
desktop = {icon = " ", name = "desktop", color = "(CN)"}
terminal = {icon = " ", name = "term", color = "(RD)"}
shell = {icon = " ", name = "shell", color = "(MA)"}
# packages = {icon = " ", name = "packages", color = "(RD)"} # WARNING: Resource Intensive
# weather = {icon = " ", name = "weather", color = "(BE)"} # Requires curl and an emoji font. | WARNING: Resource Intensive
# gpu = {icon = "󱔐 ", name = "gpu", color = "(MA)"} # WARNING: Resource Intensive
# cpu = {icon = " ", name = "cpu", color = "(RD)"}
# battery = {icon = " ", name = "battery", color = "(GN)"}
# memory = {icon = " ", name = "memory", color = "(YW)"}
# The following stats do not work on MacOS and the BSDs.
# disk_0 = {icon = " ", name = "disk", color = "(GN)"}
sep_color = "SEPARATOR"
colors = {icon = " ", name = "colors", color = "!DT!", symbol = ""}
##############################################
## Misc Config ##
##############################################
[misc]
borderstyle = "line"
layout = "Inline" # [Inline, ArtOnTop, StatsOnTop]
stats_margin_top = 0
location = "" # Used for fetching weather; leave empty to use the location of your IP; check https://wttr.in/:help for supported location types
[misc.figletLogos] # Requires Figlet.
enable = false
color = "(YW)"
font = "slant"
margin = [0, 0, 0,]
[misc.imageMode] # Requires Viu.
enable = false
path = "/path/to/some/image.png" # Please only use absolute paths.
scale = 18
margin = [2, 2, 3,]

View File

@ -0,0 +1,866 @@
# This is the distro logos file for catnap.
# Here you can configure all distro logos
# or add a new one.
#
# https://github.com/iinsertNameHere/catnap
##############################################
## Distro ASCII-Art Config ##
##############################################
### A ###
[alpine]
margin = [3, 2, 2,]
art = [
"{BE} /\\ /\\ ",
"{BE} // \\ \\ ",
"{BE} // \\ \\ ",
"{BE} /// \\ \\ ",
"{BE}/// \\ \\",
]
[amogos]
margin = [1, 2, 3]
art = [
"{RD} -///:. ",
"{RD} smhhhhmh\\`",
"{RD} :NA{BE}mogO{RD}SNs ",
"{RD} hNNmmmmNNN ",
"{RD} NNNNNNNNNN ",
"{RD} :NNNNNNNNNN ",
"{RD} mNNssussNNN ",
"{RD} sNn: sNNo ",
"{RD}+ooo+ sNNo ",
"{RD} +oooo\\`",
]
[android]
margin = [2, 2, 2,]
art = [
"{GN} ;, ,; ",
"{GN} ';,.-----.,;' ",
"{GN} ,' ', ",
"{GN} / O O \\ ",
"{GN}| |",
"{GN}'-----------------'",
]
[arch]
margin = [2, 2, 3,]
art = [
"{BE} /\\ ",
"{BE} / \\ ",
"{BE} /\\ \\ ",
"{BE} / \\ ",
"{BE} / ,, \\ ",
"{BE} / | | -\\ ",
"{BE}/_-'' ''-_\\",
]
[arch_old]
margin = [1, 2, 3,]
art = [
"(BE) -+*##*+- ",
"(BE) -+#######*={BK}: ",
"(BE) -+*******+++={BK}+*+ ",
"(BE) -++++++++=====- {BK}**+-",
"(BE) =++==+ =====-{BK}-==",
"(BE)+++++ +++-{BK}---",
"(BE)++++ {BK}+++(BE)+++{BK}= ",
"(BE)**** {BK}******+ (BE)** ",
"(BE)*** * ",
]
[archbang]
margin = [3, 2, 3,]
art = [
"{CN} /\\ ",
"{CN} / _\\ ",
"{CN} / \\ / ",
"{CN} / // \\ ",
"{CN} / // \\ ",
"{CN} / ___()___ \\ ",
"{CN} /.\\` `/.\\ ",
]
[archcraft]
margin = [2, 2, 3,]
art = [
"{GN} . ",
"{GN} / \\ ",
"{GN} /\\ \\ ",
"{GN} / \\ ",
"{GN} / , ^ , \\ ",
"{GN} / < > -\\ ",
"{GN}/_-'' ''-_\\",
]
[arco]
alias = "arcolinux"
margin = [1, 2, 2,]
art = [
"{BE} A ",
"{BE} ooo ",
"{BE} ooooo ",
"{BE} ooooooo ",
"{BE} ooooooooo ",
"{BE} ooooo ooooo ",
"{BE} ooooo ooooo ",
"{BE} ooooo ooooo ",
"{BE} ooooo {GN}oooooooooo ",
"{BE} ooooo {GN}oooooooo ",
"{BE}ooooo {GN}oooooo",
]
[artix]
margin = [2,2,2,]
art = [
"{BE} /\\ ",
"{BE} / \\ ",
"{BE} /`'.,\\ ",
"{BE} / ', ",
"{BE} / ,`\\ ",
"{BE} / ,.'`. \\ ",
"{BE}/.,'` `'.\\",
]
### B ####
[bedrock]
margin = [4, 3, 3,]
art = [
"{WE}__ ",
"{WE}\\ \\___ ",
"{WE} \\ _ \\ ",
"{WE} \\___/ ",
]
[buildroot]
margin = [3, 3, 3,]
art = [
"{YW} ___ ",
"{YW} / \\` \\ ",
"{YW}| : :| ",
"{YW} -. _:__.- ",
"{YW} \\` ---- \\`"
]
### C ####
[cachy]
alias = "cachyos"
margin = [2, 2, 2,]
art = [
"{CN} /''''''''''''/ ",
"{CN} /''''''''''''/ ",
"{CN} /''''''/ ",
"{CN}/''''''/ ",
"{CN}\\......\\ ",
"{CN} \\......\\ ",
"{CN} \\.............../",
"{CN} \\............./ ",
]
[centos]
margin = [2, 3, 2]
art = [
"{GN} ____{YW}^{MA}____ ",
"{GN} |\\ {YW}|{MA} /| ",
"{GN} | \\ {YW}|{MA} / | ",
"{MA}<---- {BE}----> ",
"{BE} | / {GN}|{YW} \\ | ",
"{BE} |/__{GN}|{YW}__\\| ",
"{GN} v ",
]
[crux]
margin = [2, 2, 3,]
art = [
"{BE} ___ ",
"{BE} (.· | ",
"{BE} ({YW}<>{BE} | ",
"{BE} / {WE}__{BE} \\ ",
"{BE} ( {WE}/ \\{BE} /|",
"{YW}_/\\{WE}(__){YW}/_)",
"{YW}\\/{BE}-____{YW}\\/ ",
]
[crystal]
margin = [2, 2, 2,]
art = [
"(MA) -//. ",
"(MA) -//. ",
"(MA) -//. . ",
"(MA) -//. '//- ",
"(MA) /+: :+/",
"(MA) .//' .//. ",
"(MA) . .//. ",
"(MA) .//. ",
"(MA) .//. ",
]
### D ###
[dahlia]
alias = "dahliaos"
margin = [1, 4, 3,]
art = [
"{RD} _ ",
"{RD} ___/ \\___ ",
"{RD} | _-_ | ",
"{RD} | / \\ | ",
"{RD}/ | | \\ ",
"{RD}\\ | | / ",
"{RD} | \\ _ _ / | ",
"{RD} |___ - ___| ",
"{RD} \\_/ ",
]
[debian]
margin = [1, 2, 3,]
art = [
"(RD) , - = - , ",
"(RD) = ,, = ",
"(RD)= :° ; = ",
"(RD)= :. = ",
"(RD)^= ° == ° ",
"(RD)°=. ",
"(RD) ^==.. ",
"(RD) ^^°==.. ",
"(RD) ^^°= ",
]
[deepin]
margin = [2, 2, 2,]
art = [
"{BE} ____________ ",
"{BE} / / / ___\\ ",
"{BE} / | / __/ ___\\ ",
"{BE} / \\/ / / \\ ",
"{BE}| \\ \\ |",
"{BE} \\_______/ _/ / ",
"{BE} \\________/ / ",
"{BE} \\____________/ ",
]
[devuan]
margin = [2, 2, 2,]
art = [
"..:::. ",
" ..-==- ",
" .+#:",
" =@@",
" :+%@#:",
".:=+#@@%*: ",
"@@@@#=: ",
]
[dragonfly]
alias = "dragonflybsd"
margin = [2, 3, 2,]
art = [
" ,{RD}_{WE}, ",
"('-_{RD}|{WE}_-') ",
" >--{RD}|{WE}--< ",
"(_-'{RD}|{WE}'-_) ",
" {RD}| ",
" {RD}| ",
" {RD}| ",
]
### E ###
[elementary]
alias = "elementaryos"
margin = [2, 2, 3,]
art = [
"{WE} _______ ",
"{WE} / ____ \\ ",
"{WE}/ | / /\\",
"{WE}|__\\ / / |",
"{WE}\\ /__/ /",
"{WE} \\_______/ ",
]
[endeavour]
alias = "endeavouros"
margin = [2, 2, 3,]
art = [
"{MA} /\\ ",
"{RD} /{MA}/ \\{CN}\\ ",
"{RD} /{MA}/ \\{CN}\\ ",
"{RD} / {MA}/ _) {CN})",
"{RD} /_{MA}/___-- {CN}__- ",
"{CN}/____-- ",
]
[evolution]
alias = "evolutionos"
margin = [2, 3, 3,]
art = [
"{GN} $2,coddoc' ",
"{GN} 'cddddddddddc' ",
"{GN} 'ddd$1OWWXXXXXXK$2ddo. ",
"{GN}.dddd$1OMX$2ddddddddddd. ",
"{GN}odddd$1OMX$2k$100O$2k$1OO$2ddddo",
"{GN}.dddd$1OMX$2kOOOxOkdddd. ",
"{GN} .ddd$1OWW$2X$1XXXXXK$2ddd' ",
"{GN} 'dddddddddddd' ",
"{GN} 'cddddd, "
]
### F ###
[fedora]
margin = [1, 2, 3,]
art = [
"(WE) _____ ",
"(WE) / __)(BE)\\ ",
"(WE) | / (BE)\\ \\",
"(BE) __(WE)_| |_(BE)_/ /",
"(BE) / (WE)(_ _)(BE)_/ ",
"(BE)/ / (WE)| | ",
"(BE)\\ \\(WE)__/ | ",
"(BE) \\(WE)(_____/ ",
]
[freebsd]
margin = [2, 4, 2,]
art = [
"{RD}/\\,-'''''-,/\\ ",
"{RD}\\_) (_/ ",
"{RD}| | ",
"{RD}| | ",
" {RD}; ; ",
" {RD}'-_____-' ",
]
### G ###
[garuda]
margin = [3, 2, 3,]
art = [
"(MA) .----. ",
"(MA) .' , '. ",
"(MA) .' '-----|",
"(MA)'. -----, ",
"(MA) '.____.' ",
]
[gentoo]
margin = [2, 2, 3,]
art = [
"{MA} _-----_ ",
"{MA}( \\ ",
"{MA}\\ 0 \\ ",
"{WE} \\ )",
"{WE} / _/ ",
"{WE}( _- ",
"{WE}\\____- ",
]
[guix]
margin = [3, 2, 3,]
art = [
"{YW}|.__ __.| ",
"{YW}|__ \\ / __| ",
"{YW} \\ \\ / / ",
"{YW} \\ \\ / / ",
"{YW} \\ \\ / / ",
"{YW} \\ \\/ / ",
"{YW} \\__/ ",
]
### H ###
[hyperbola]
margin = [2, 2, 3]
art = [
" |`__.`/ ",
" \\____/ ",
" .--. ",
" / \\ ",
" / ___ \\ ",
" / .` `.\\ ",
"/.` `.\\ ",
]
### I ###
[iglunix]
margin = [0, 2, 2,]
art = [
" | ",
" | | ",
" | ",
" | ________ ",
" | /\\ | \\ ",
" / \\ | \\ | ",
" / \\ \\ | ",
" / \\________\\ ",
" \\ / / ",
" \\ / / ",
" \\ / / ",
" \\/________/ ",
]
[instant]
alias = "instantos"
margin = [3, 2, 2,]
art = [
"{WE} ,-''-, ",
"{WE}: .''. : ",
"{WE}: ',,' : ",
"{WE} '-____:__ ",
"{WE} : \\`.",
"{WE} \\`._.'",
]
### J ###
### K ###
[kali]
margin = [0, 1, 2]
art = [
"{BE} ⢀ ⡀ ",
"{BE} ⢀⡀⢀⡀⢣⡐⣄ ",
"{BE} ⢤⣬⣿⣿⣿⣿⣿⣶⣿⣮⣷⣄ ",
"{BE} ⢴⣿⣿⠛⠉ ⠈⠉⠻⣿⣿⣿⣷⣄ ",
"{BE}⢠⣿⣿⡇ ⢿⣿⣦⣿⣦ ",
"{BE} ⡸⣿⣷⡀ ⠙⠻⣿⣷⡀ ",
"{BE} ⠸⠻⣿⣦⡀ ⠈⢻⣿⠇",
"{BE} ⠉⠛⠷⣦⣄⡀ ⠈⠁ ",
"{BE} ⠉⠛⢷⣄ ",
"{BE} ⠈⢿ ",
]
[neon]
alias = "kdeneon"
margin = [3, 3, 3,]
art = [
"{GN} --- _ ",
"{GN} / --- \\ ",
"{GN}| | | | ",
"{GN} \\ --- _/ ",
"{GN} --- ",
]
### L ###
[lite]
alias = "linuxlite"
margin = [3, 3, 4,]
art = [
"{YW} /\\ ",
"{YW} / \\",
"{YW} / {WE}/ {YW}/",
"{YW}> {WE}/ {YW}/ ",
"{YW}\\ {WE}\\ {YW}\\ ",
" {YW}\\_{WE}\\{YW}_\\",
"{WE} \\ ",
]
### M ###
[macos]
margin = [2, 4, 2,]
art = [
"{GN} .:' ",
"{GN} _ :'_ ",
"{YW} .'\\`_\\`-'_\\`. ",
"{RD}:________.-' ",
"{RD}:________: ",
"{MA} :_______\\`-; ",
"{BE} \\`._.-._.' ",
]
[mageria]
margin = [2, 4, 3,]
art = [
"{BE} * ",
"{BE} * ",
"{BE} ** ",
"{BK} /\\__/\\ ",
"{BK}/ \\ ",
"{BK}\\ / ",
"{BK} \\____/ ",
]
[manjaro]
margin = [2, 2, 4,]
art = [
"<GN> !DT! <GN> ",
"<GN> !DT! <GN> ",
"<GN> !DT! <GN> ",
"<GN> !DT! <GN> !DT! <GN> ",
"<GN> !DT! <GN> !DT! <GN> ",
"<GN> !DT! <GN> !DT! <GN> ",
]
[mint]
alias = "linuxmint"
margin = [2, 2, 4,]
art = [
"{CN} ___________ ",
"{CN}|_ \\",
"{CN} | (WE)| _____ {CN}|",
"{CN} | (WE)| | | | {CN}|",
"{CN} | (WE)| | | | {CN}|",
"{CN} | (WE)\\_____/ {CN}|",
"{CN} \\_________/",
]
[mx]
margin = [2, 2, 2,]
art = [
"{WE} \\\\ / ",
"{WE} \\\\/ ",
"{WE} \\\\ ",
"{WE} /\\/ \\\\ ",
"{WE} / \\ /\\ ",
"{WE} / \\/ \\ ",
"{WE}/__________\\ ",
]
### N ###
[netbsd]
margin = [2, 2, 2,]
art = [
"{WE}\\\\{YW}\\`-______,----__ ",
"{WE} \\\\ {YW}__,---\\`_",
"{WE} \\\\ {YW}\\`.____ ",
"{WE} \\\\{YW}-______,----\\`-",
"{WE} \\\\ ",
"{WE} \\\\ ",
"{WE} \\\\ ",
]
[nobara]
margin = [2, 2, 2,]
art = [
"{WE} _._. _..,._ ",
"{WE}|##############. ",
"{WE}|################. ",
"{WE}|#####/ . \\#####. ",
"{WE}|####| ### > ### ",
"{WE}|##### \\`\\`\\`|##### ",
"{WE}|######==_ |##### ",
"{WE}|######\"##| |##### ",
"{WE} \\`\"\"\\`\\` ' \\`\\##/ ",
]
[none]
margin = [0, 0, 0,]
art = [""]
[nixos]
margin = [1, 2, 3,]
art = [
"{BE} ⣀⡀ {CN}⣀⣀⡀ ⢀⣀ ",
"{BE} ⠈⢿⣷⡀ {CN}⠈⢿⣷⣄⣾⡿⠃ ",
"{BE} ⢀⣶⣶⣾⣿⣿⣶⣶⣮{CN}⣻⣿⣿⠁ {BE}⢠⡀ ",
"{CN} ⣩⣭⡍ ⢻⣿⣆{BE}⢠⣿⡗ ",
"{CN}⢠⣤⣤⣤⣴⣿⠟ ⠹{BE}⣳⣿⣿⣤⣤⡄",
"{CN}⠘⠛⠛⣿⣿⢯{BE}⣦ ⣰⣿⠟⠛⠛⠛⠃",
"{CN} ⢼⣿⠋{BE}⠹⣿⣧{CN}⢀⣀⣀⣀⣜⣛⣋⣀⣀⡀ ",
"{CN} ⠈⠃ {BE}⢀⣾⣿⣷{CN}⡻⠿⠿⢿⣿⡿⠿⠿⠁ ",
"{BE} ⢠⣾⡿⠙⢿⣷⡀ {CN}⠈⢿⣷⡄ ",
"{BE} ⠉⠁ ⠈⠉⠉ {CN}⠈⠉ ",
]
### O ###
[openbsd]
margin = [2, 2, 3,]
art = [
"{YW} _____ ",
"{YW} \\- -/ ",
"{YW} \\_/ \\ ",
"{YW} | {WE}O O{YW} |",
"{YW} |_ < ) 3 )",
"{YW} / \\ / ",
" {YW} /-_____-\\ ",
]
[opensuse]
margin = [0, 0, 2,]
art = [
"!DT! .;ldkO0000Okdl;. ",
"!DT! .;d00xl:^''''''^:ok00d;. ",
"!DT! .d00l' 'o00d. ",
"!DT! .d0Kd' (GN)Okxol:;,. !DT!:O0d. ",
"!DT! .OK(GN)KKK0kOKKKKKKKKKKOxo:, !DT!lK0. ",
"!DT! ,0K(GN)KKKKKKKKKKKKKKKOP^!DT!,,,(GN)^dx: !DT!;OO, ",
"!DT!.OK(GN)KKKKKKKKKKKKKKKk'!DT!.oOPPb.(GN)'Ok. !DT!cKO.",
"!DT!:KK(GN)KKKKKKKKKKKKKKK: !DT!kKx..dd (GN)lKd !DT!'OK:",
"!DT!dKK(GN)KKKKKKKKKOxOKKKd !DT!^OKKKO' (GN)kKKc !DT!dKd",
"!DT!dKK(GN)KKKKKKKKKK;.;oOKx,..!DT!^(GN)..;kKKKO. !DT!dKd",
"!DT!:KK(GN)KKKKKKKKKK0o;...^cdxxOK0O/^^' !DT!.OK:",
"!DT! kKK(GN)KKKKKKKKKKKKKOx;,,......,;od !DT!lKk ",
"!DT! '0K(GN)KKKKKKKKKKKKKKKKKKKK00KKOo^ !DT!c00' ",
"!DT! 'kK(GN)KKOxddxkOO00000Okxoc;'' !DT!.dKk' ",
"!DT! l0Ko. .c00l' ",
"!DT! 'l0Kk:. .;xK0l' ",
"!DT! 'lkK0xl:;,,,,;:ldO0kl' ",
"!DT! '^:ldxkkkkxdl:^' "
]
### P ###
[parabola]
margin = [2, 2, 2,]
art = [
" __ __ __ _ ",
"`_//_//_/ / `. ",
" / .`",
" / .` ",
" /.` ",
" /` ",
]
[pop]
alias = "popos, pop_os"
margin = [1, 1, 2,]
art = [
"{CN} ______ ",
"{CN} \\ _ \\ __ ",
"{CN} \\ \\ \\ \\ / / ",
"{CN} \\ \\_\\ \\ / / ",
"{CN} \\ ___\\ /_/ ",
"{CN} \\ \\ _ ",
"{CN} __\\_\\__(_)_ ",
"{CN} (___________) ",
]
[postmarketos]
margin = [2, 2, 2,]
art = [
"{GN} /\\ ",
"{GN} / \\ ",
"{GN} / \\ ",
"{GN} \\__ \\ ",
"{GN} /\\__ \\ _\\ ",
"{GN} / / \\/ __ ",
"{GN} / / ____/ \\ ",
"{GN} / \\ \\ \\ ",
"{GN}/_____/ /________\\",
]
[pureos]
margin = [3, 2, 2,]
art = [
" _____________ ",
"| _________ |",
"| | | |",
"| | | |",
"| |_________| |",
"|_____________|",
]
### Q ###
### R ###
[raspbian]
alias = "raspberrypios"
margin = [2, 2, 3,]
art = [
"{GN} __ __ ",
"{GN} (_\\)(/_) ",
"{RD} (_(__)_) ",
"{RD}(_(_)(_)_) ",
"{RD} (_(__)_) ",
"{RD} (__) ",
]
[reborn]
alias = "rebornos"
margin = [2, 3, 3,]
art = [
"{BE} _______ ",
"{BE} /\\_____/\\ ",
"{BE} / /\\___/\\ \\ ",
"{BE}/_/_/ \\_\\_\\",
"{BE}\\ \\ \\___/ / /",
"{BE} \\ \\/___\\/ / ",
"{BE} \\/_____\\/ ",
]
[rocky]
margin = [1, 2, 3]
art = [
"{GN} `-/+++++++++/-.` ",
"{GN} `-+++++++++++++++++-` ",
"{GN}.+++++++++++++++++++++. ",
"{GN}-+++++++++++++++++++++++.",
"{GN}+++++++++++++++/-/+++++++",
"{GN}+++++++++++++/. ./+++++",
"{GN}+++++++++++:. ./+++",
"{GN}+++++++++:` `:/:` .:/",
"{GN}-++++++:` .:+++++:` ",
"{GN} .+++-` ./+++++++++:` ",
"{GN} `-` ./+++++++++++- ",
"{GN} -+++++++++:-.` ",
]
### S ###
[slackware]
margin = [2, 2, 3,]
art = [
"{BE} ________ ",
"{BE} / ______| ",
"{BE} | |______ ",
"{BE} \\______ \\ ",
"{BE} ______| | ",
"{BE}| |________/ ",
"{BE}|____________",
]
[solus]
margin = [3, 2, 2,]
art = [
"{BE} /| ",
"{BE} / |\\ ",
"{BE} / | \\ _ ",
"{BE} /___|__\\_\\ ",
"{BE} \\ / ",
"{BE} \\-------´ ",
]
[sourcemage]
margin = [0, 2, 3]
art = [
" :ymNMNho. ",
".+sdmNMMMMMMMMMMy` ",
".-::/yMMMMMMMMMMMm- ",
" sMMMMMMMMMMMm/ ",
" /NMMMMMMMMMMMMMm: ",
" .MMMMMMMMMMMMMMMMM: ",
" `MMMMMMMMMMMMMMMMMN. ",
" NMMMMMMMMMMMMMMMMMd ",
" mMMMMMMMMMMMMMMMMMMo ",
" hhMMMMMMMMMMMMMMMMMM. ",
" .`/MMMMMMMMMMMMMMMMMs ",
" :mMMMMMMMMMMMMMMMN` ",
" `sMMMMMMMMMMMMMMM+ ",
" /NMMMMMMMMMMMMMN` ",
" oMMMMMMMMMMMMM+ ",
" ./sd.-hMMMMMMMMmmN` ",
" ./+oyyyh- `MMMMMMMMMmNh ",
" sMMMMMMMMMmmo",
" `NMMMMMMMMMd:",
" -dMMMMMMMMMo",
" -shmNMMms.",
]
### T ###
[tux]
alias = "default"
margin = [2, 2, 3,]
art = [
"(BK) .--. ",
"(BK) |!DT!o(BK)_!DT!o (BK)| ",
"(BK) |(YW):_/ (BK)| ",
"(BK) /!DT!/ \\ (BK)\\ ",
"(BK) (!DT!| | (BK)) ",
"(YW) /'!DT!|_ _/(YW)'\\ ",
"(YW) \\___)(BK)=(YW)(___/ ",
]
### U ###
[ubuntu]
margin = [0, 2, 4,]
art = [
"{RD} .-. ",
"{RD} .-'````( ) ",
"{RD} ,`\\ \\ `-`. ",
"{RD} / \\ '````-. ` ",
"{RD} .-. , `___:",
"{RD} ( ) : ___ ",
"{RD} `-` ` , :",
"{RD} \\ / ,....-` , ",
"{RD} `./ / .-.` ",
"{RD} `-....-( ) ",
"{RD} `-` ",
]
### V ###
[vanilla]
alias = "vanillaos"
margin = [2, 2, 2,]
art = [
"{YW} .#. ",
"{YW} :#=#: ",
"{YW}.#=\":.:##=##:.:\"=#. ",
"{YW}\\`:#=#####=####=##:\\` ",
"{YW} \\`:####=\\` \\`=####:\\`",
"{YW} .:##,. .,##:. ",
"{YW} :##=##:-:##=##: ",
"{YW} .#=##:\\` \\`:##=#. ",
"{YW} \\`\\` \\`\\` ",
]
[venom]
margin = [1, 2, 3,]
art = [
"{WE} ++** ",
"{WE} *===**====+* ",
"{WE} *====* +===+ ",
"{WE} *==*+===* *===* ",
"{WE}*===* *===+ *===*",
"{WE}*===* +===+ *===*",
"{WE}*===* +===* *===*",
"{WE} *===* *===+*==* ",
"{WE} +===+ *===+=* ",
"{WE} *+====**===* ",
"{WE} **++ ",
]
[void]
margin = [2, 2, 4,]
art = [
"(GN) _______ ",
"(GN) _ \\______ - ",
"(GN)| \\ ___ \\ |",
"(GN)| | / \\ | |",
"(GN)| | \\___/ | |",
"(GN)| \\______ \\_|",
"(GN) -_______\\ ",
]
[voyager]
margin = [2, 2, 2,]
art = [
"{RD} _____ ____ ",
"{RD}| | | |",
"{RD}| | | |",
"{RD}| | | |",
"{RD}| | |____|",
"{RD}| | _____ ",
"{RD}| || |",
"{RD}|_____||_____|",
]
### W ###
### X ###
[xero]
alias = "xerolinux"
margin = [3, 2, 2,]
art = [
"{WE} /\\ ",
"{WE}______ / \\______",
"{WE} /\\ /\\ ",
"{WE} / || \\ ",
"{WE}____/__/__\\__\\___",
"{WE} / __| |__-\\ ",
"{WE} /_-'' ''-_\\ ",
]
### Y ###
### Z ###
[zorin]
margin = [1, 1, 2]
art = [
"(BE) ⣰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣆ ",
"(BE) ⠐⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠂ ",
"(BE) ",
"(BE) ⣴⣿⣿⣿⣿⣿⣿⣿⡿⠟⠋⠁ ⣀⣤⣶⣦ ",
"(BE)⢼⣿⣿⣿⣿⣿⠿⠋⠁ ⢀⣠⣶⣿⣿⣿⣿⣿⡇",
"(BE) ⠹⣿⠛⠉ ⣀⣴⣾⣿⣿⣿⣿⣿⣿⣿⠟ ",
"(BE) ",
"(BE) ⠠⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⠄ ",
"(BE) ⠹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏ ",
]

View File

@ -0,0 +1,146 @@
/* See LICENSE file for copyright and license details. */
/* appearance */
static const unsigned int borderpx = 3; /* border pixel of windows */
static const unsigned int gappx = 7; /* gaps between windows */
static const unsigned int snap = 15; /* snap pixel */
static const unsigned int systraypinning = 1; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
static const unsigned int systrayonleft = 1; /* 0: systray in the right corner, >0: systray on left of status text */
static const unsigned int systrayspacing = 2; /* systray spacing */
static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/
static const int showsystray = 1; /* 0 means no systray */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
static const char *fonts[] = { "FiraMono Nerd Font:size=10" };
static const char dmenufont[] = "FiraMono Nerd Font:size=10";
static const char col_gray1[] = "#282828";
static const char col_gray2[] = "#444444";
static const char col_gray3[] = "#ebdbb2";
static const char col_gray4[] = "#1d2021";
static const char col_cyan[] = "#d65d0e";
static const char *colors[][3] = {
/* fg bg border */
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
};
/* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
static const Rule rules[] = {
/* xprop(1):
* WM_CLASS(STRING) = instance, class
* WM_NAME(STRING) = title
*/
/* class instance title tags mask isfloating monitor */
{ "Gimp", NULL, NULL, 0, 1, -1 },
{ "Firefox", NULL, NULL, 1 << 8, 0, -1 },
};
/* layout(s) */
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
static const int nmaster = 1; /* number of clients in master area */
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
static const Layout layouts[] = {
/* symbol arrange function */
{ "[]=", tile }, /* first entry is default */
{ "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle },
};
/* key definitions */
#define MODKEY Mod4Mask
#define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
/* commands */
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
static const char *termcmd[] = { "st", NULL };
static const char *flameshot[] = { "flameshot", "gui", NULL };
/* multimedia */
static const char *volup[] = { "/home/murat/scripts/sesac.sh", NULL };
static const char *voldown[] = { "/home/murat/scripts/seskis.sh", NULL };
static const char *volmute[] = { "/home/murat/scripts/sessustur.sh", NULL };
static const char *next[] = { "/home/murat/scripts/sonraki.sh", NULL };
static const char *play[] = { "/home/murat/scripts/durdurbaslat.sh", NULL };
static const char *prev[] = { "/home/murat/scripts/onceki.sh", NULL };
/* Custom Commands */
static const char *rofi[] = { "/home/murat/.config/rofi/launchers/type-1/launcher.sh", NULL };
static const char *zenbrowser[] = { "zen-browser", NULL };
static const char *powermenu[] = { "/home/murat/.config/rofi/powermenu/type-1/powermenu.sh", NULL };
static const Key keys[] = {
/* modifier key function argument */
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
{ MODKEY, XK_Return, spawn, {.v = termcmd } },
{ MODKEY|ShiftMask, XK_s, spawn, {.v = flameshot } },
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
{ MODKEY|ShiftMask, XK_Return, zoom, {0} },
{ MODKEY, XK_Tab, view, {0} },
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_x, setlayout, {0} },
{ MODKEY, XK_space, spawn, {.v = rofi} },
{ MODKEY, XK_z, spawn, {.v = zenbrowser} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
{ MODKEY, XK_period, focusmon, {.i = +1 } },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
{ MODKEY, XK_minus, setgaps, {.i = -1 } },
{ MODKEY, XK_equal, setgaps, {.i = +1 } },
{ MODKEY|ShiftMask, XK_equal, setgaps, {.i = 0 } },
{ 0, XF86XK_AudioRaiseVolume, spawn, {.v = volup } },
{ 0, XF86XK_AudioLowerVolume, spawn, {.v = voldown } },
{ 0, XF86XK_AudioMute, spawn, {.v = volmute } },
{ 0, XF86XK_AudioNext, spawn, {.v = next } },
{ 0, XF86XK_AudioPlay, spawn, {.v = play } },
{ 0, XF86XK_AudioPrev, spawn, {.v = prev } },
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)
TAGKEYS( XK_4, 3)
TAGKEYS( XK_5, 4)
TAGKEYS( XK_6, 5)
TAGKEYS( XK_7, 6)
TAGKEYS( XK_8, 7)
TAGKEYS( XK_9, 8)
{ MODKEY|ShiftMask, XK_q, spawn, {.v = powermenu} },
};
/* button definitions */
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
static const Button buttons[] = {
/* click event mask button function argument */
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
{ ClkWinTitle, 0, Button2, zoom, {0} },
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
{ ClkTagBar, 0, Button1, view, {0} },
{ ClkTagBar, 0, Button3, toggleview, {0} },
{ ClkTagBar, MODKEY, Button1, tag, {0} },
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
};

View File

@ -0,0 +1,12 @@
diff -up dwm/dwm.c dwmmod/dwm.c
--- dwm/dwm.c 2020-06-25 00:21:30.383692180 -0300
+++ dwmmod/dwm.c 2020-06-25 00:20:35.643692330 -0300
@@ -1057,6 +1057,8 @@ manage(Window w, XWindowAttributes *wa)
updatewindowtype(c);
updatesizehints(c);
updatewmhints(c);
+ c->x = c->mon->mx + (c->mon->mw - WIDTH(c)) / 2;
+ c->y = c->mon->my + (c->mon->mh - HEIGHT(c)) / 2;
XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
grabbuttons(c, 0);
if (!c->isfloating)

View File

@ -0,0 +1,54 @@
diff -up dwm-6.3/dwm.c dwm-6.3-attachbottom/dwm.c
--- dwm-6.3/dwm.c 2022-01-07 12:42:18.000000000 +0100
+++ dwm-6.3-attachbottom/dwm.c 2022-08-17 22:14:41.813809073 +0200
@@ -147,6 +147,7 @@ static int applysizehints(Client *c, int
static void arrange(Monitor *m);
static void arrangemon(Monitor *m);
static void attach(Client *c);
+static void attachbottom(Client *c);
static void attachstack(Client *c);
static void buttonpress(XEvent *e);
static void checkotherwm(void);
@@ -408,6 +409,15 @@ attach(Client *c)
}
void
+attachbottom(Client *c)
+{
+ Client **tc;
+ c->next = NULL;
+ for (tc = &c->mon->clients; *tc; tc = &(*tc)->next);
+ *tc = c;
+}
+
+void
attachstack(Client *c)
{
c->snext = c->mon->stack;
@@ -1066,7 +1076,7 @@ manage(Window w, XWindowAttributes *wa)
c->isfloating = c->oldstate = trans != None || c->isfixed;
if (c->isfloating)
XRaiseWindow(dpy, c->win);
- attach(c);
+ attachbottom(c);
attachstack(c);
XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
(unsigned char *) &(c->win), 1);
@@ -1421,7 +1431,7 @@ sendmon(Client *c, Monitor *m)
detachstack(c);
c->mon = m;
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
- attach(c);
+ attachbottom(c);
attachstack(c);
focus(NULL);
arrange(NULL);
@@ -1903,7 +1913,7 @@ updategeom(void)
m->clients = c->next;
detachstack(c);
c->mon = mons;
- attach(c);
+ attachbottom(c);
attachstack(c);
}
if (m == selmon)

View File

@ -0,0 +1,138 @@
From 7b7773458c072e4b24d6ea32d0364a8e402e4a43 Mon Sep 17 00:00:00 2001
From: swy7ch <swy7ch@protonmail.com>
Date: Fri, 8 May 2020 19:07:24 +0200
Subject: [PATCH] [PATCH] update dwm-fullgaps patch to be used with tile layout
update
the recent tile layout changes in commit HEAD~1 (f09418b) broke the
patch
this patch adapt the new `if` statements to take gaps into account
this patch also provides manpage entries for the keybindings
---
config.def.h | 4 ++++
dwm.1 | 10 ++++++++++
dwm.c | 33 +++++++++++++++++++++++----------
3 files changed, 37 insertions(+), 10 deletions(-)
diff --git a/config.def.h b/config.def.h
index 1c0b587..38d2f6c 100644
--- a/config.def.h
+++ b/config.def.h
@@ -2,6 +2,7 @@
/* appearance */
static const unsigned int borderpx = 1; /* border pixel of windows */
+static const unsigned int gappx = 5; /* gaps between windows */
static const unsigned int snap = 32; /* snap pixel */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
@@ -84,6 +85,9 @@ static Key keys[] = {
{ MODKEY, XK_period, focusmon, {.i = +1 } },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
+ { MODKEY, XK_minus, setgaps, {.i = -1 } },
+ { MODKEY, XK_equal, setgaps, {.i = +1 } },
+ { MODKEY|ShiftMask, XK_equal, setgaps, {.i = 0 } },
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)
diff --git a/dwm.1 b/dwm.1
index 13b3729..0202d96 100644
--- a/dwm.1
+++ b/dwm.1
@@ -140,6 +140,16 @@ View all windows with any tag.
.B Mod1\-Control\-[1..n]
Add/remove all windows with nth tag to/from the view.
.TP
+.B Mod1\--
+Decrease the gaps around windows.
+.TP
+.B Mod1\-=
+Increase the gaps around windows.
+.TP
+.B Mod1\-Shift-=
+Reset the gaps around windows to
+.BR 0 .
+.TP
.B Mod1\-Shift\-q
Quit dwm.
.SS Mouse commands
diff --git a/dwm.c b/dwm.c
index 9fd0286..45a58f3 100644
--- a/dwm.c
+++ b/dwm.c
@@ -119,6 +119,7 @@ struct Monitor {
int by; /* bar geometry */
int mx, my, mw, mh; /* screen size */
int wx, wy, ww, wh; /* window area */
+ int gappx; /* gaps between windows */
unsigned int seltags;
unsigned int sellt;
unsigned int tagset[2];
@@ -200,6 +201,7 @@ static void sendmon(Client *c, Monitor *m);
static void setclientstate(Client *c, long state);
static void setfocus(Client *c);
static void setfullscreen(Client *c, int fullscreen);
+static void setgaps(const Arg *arg);
static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg);
static void setup(void);
@@ -639,6 +641,7 @@ createmon(void)
m->nmaster = nmaster;
m->showbar = showbar;
m->topbar = topbar;
+ m->gappx = gappx;
m->lt[0] = &layouts[0];
m->lt[1] = &layouts[1 % LENGTH(layouts)];
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
@@ -1498,6 +1501,16 @@ setfullscreen(Client *c, int fullscreen)
}
}
+void
+setgaps(const Arg *arg)
+{
+ if ((arg->i == 0) || (selmon->gappx + arg->i < 0))
+ selmon->gappx = 0;
+ else
+ selmon->gappx += arg->i;
+ arrange(selmon);
+}
+
void
setlayout(const Arg *arg)
{
@@ -1684,18 +1697,18 @@ tile(Monitor *m)
if (n > m->nmaster)
mw = m->nmaster ? m->ww * m->mfact : 0;
else
- mw = m->ww;
- for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
+ mw = m->ww - m->gappx;
+ for (i = 0, my = ty = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
if (i < m->nmaster) {
- h = (m->wh - my) / (MIN(n, m->nmaster) - i);
- resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0);
- if (my + HEIGHT(c) < m->wh)
- my += HEIGHT(c);
+ h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gappx;
+ resize(c, m->wx + m->gappx, m->wy + my, mw - (2*c->bw) - m->gappx, h - (2*c->bw), 0);
+ if (my + HEIGHT(c) + m->gappx < m->wh)
+ my += HEIGHT(c) + m->gappx;
} else {
- h = (m->wh - ty) / (n - i);
- resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
- if (ty + HEIGHT(c) < m->wh)
- ty += HEIGHT(c);
+ h = (m->wh - ty) / (n - i) - m->gappx;
+ resize(c, m->wx + mw + m->gappx, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappx, h - (2*c->bw), 0);
+ if (ty + HEIGHT(c) + m->gappx < m->wh)
+ ty += HEIGHT(c) + m->gappx;
}
}
--
2.26.2

View File

@ -0,0 +1,735 @@
diff --git a/config.def.h b/config.def.h
index 9efa774..fed4fb9 100644
--- a/config.def.h
+++ b/config.def.h
@@ -3,6 +3,11 @@
/* appearance */
static const unsigned int borderpx = 1; /* border pixel of windows */
static const unsigned int snap = 32; /* snap pixel */
+static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
+static const unsigned int systrayonleft = 0; /* 0: systray in the right corner, >0: systray on left of status text */
+static const unsigned int systrayspacing = 2; /* systray spacing */
+static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/
+static const int showsystray = 1; /* 0 means no systray */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
static const char *fonts[] = { "monospace:size=10" };
diff --git a/dwm.c b/dwm.c
index f1d86b2..f9e7e4a 100644
--- a/dwm.c
+++ b/dwm.c
@@ -57,12 +57,27 @@
#define TAGMASK ((1 << LENGTH(tags)) - 1)
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
+#define SYSTEM_TRAY_REQUEST_DOCK 0
+/* XEMBED messages */
+#define XEMBED_EMBEDDED_NOTIFY 0
+#define XEMBED_WINDOW_ACTIVATE 1
+#define XEMBED_FOCUS_IN 4
+#define XEMBED_MODALITY_ON 10
+#define XEMBED_MAPPED (1 << 0)
+#define XEMBED_WINDOW_ACTIVATE 1
+#define XEMBED_WINDOW_DEACTIVATE 2
+#define VERSION_MAJOR 0
+#define VERSION_MINOR 0
+#define XEMBED_EMBEDDED_VERSION (VERSION_MAJOR << 16) | VERSION_MINOR
+
/* enums */
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
enum { SchemeNorm, SchemeSel }; /* color schemes */
enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
+ NetSystemTray, NetSystemTrayOP, NetSystemTrayOrientation, NetSystemTrayOrientationHorz,
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
+enum { Manager, Xembed, XembedInfo, XLast }; /* Xembed atoms */
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
@@ -141,6 +156,12 @@ typedef struct {
int monitor;
} Rule;
+typedef struct Systray Systray;
+struct Systray {
+ Window win;
+ Client *icons;
+};
+
/* function declarations */
static void applyrules(Client *c);
static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact);
@@ -172,6 +193,7 @@ static void focusstack(const Arg *arg);
static Atom getatomprop(Client *c, Atom prop);
static int getrootptr(int *x, int *y);
static long getstate(Window w);
+static unsigned int getsystraywidth();
static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
static void grabbuttons(Client *c, int focused);
static void grabkeys(void);
@@ -189,13 +211,16 @@ static void pop(Client *c);
static void propertynotify(XEvent *e);
static void quit(const Arg *arg);
static Monitor *recttomon(int x, int y, int w, int h);
+static void removesystrayicon(Client *i);
static void resize(Client *c, int x, int y, int w, int h, int interact);
+static void resizebarwin(Monitor *m);
static void resizeclient(Client *c, int x, int y, int w, int h);
static void resizemouse(const Arg *arg);
+static void resizerequest(XEvent *e);
static void restack(Monitor *m);
static void run(void);
static void scan(void);
-static int sendevent(Client *c, Atom proto);
+static int sendevent(Window w, Atom proto, int m, long d0, long d1, long d2, long d3, long d4);
static void sendmon(Client *c, Monitor *m);
static void setclientstate(Client *c, long state);
static void setfocus(Client *c);
@@ -206,6 +231,7 @@ static void setup(void);
static void seturgent(Client *c, int urg);
static void showhide(Client *c);
static void spawn(const Arg *arg);
+static Monitor *systraytomon(Monitor *m);
static void tag(const Arg *arg);
static void tagmon(const Arg *arg);
static void tile(Monitor *m);
@@ -223,18 +249,23 @@ static int updategeom(void);
static void updatenumlockmask(void);
static void updatesizehints(Client *c);
static void updatestatus(void);
+static void updatesystray(void);
+static void updatesystrayicongeom(Client *i, int w, int h);
+static void updatesystrayiconstate(Client *i, XPropertyEvent *ev);
static void updatetitle(Client *c);
static void updatewindowtype(Client *c);
static void updatewmhints(Client *c);
static void view(const Arg *arg);
static Client *wintoclient(Window w);
static Monitor *wintomon(Window w);
+static Client *wintosystrayicon(Window w);
static int xerror(Display *dpy, XErrorEvent *ee);
static int xerrordummy(Display *dpy, XErrorEvent *ee);
static int xerrorstart(Display *dpy, XErrorEvent *ee);
static void zoom(const Arg *arg);
/* variables */
+static Systray *systray = NULL;
static const char broken[] = "broken";
static char stext[256];
static int screen;
@@ -257,9 +288,10 @@ static void (*handler[LASTEvent]) (XEvent *) = {
[MapRequest] = maprequest,
[MotionNotify] = motionnotify,
[PropertyNotify] = propertynotify,
+ [ResizeRequest] = resizerequest,
[UnmapNotify] = unmapnotify
};
-static Atom wmatom[WMLast], netatom[NetLast];
+static Atom wmatom[WMLast], netatom[NetLast], xatom[XLast];
static int running = 1;
static Cur *cursor[CurLast];
static Clr **scheme;
@@ -441,7 +473,7 @@ buttonpress(XEvent *e)
arg.ui = 1 << i;
} else if (ev->x < x + TEXTW(selmon->ltsymbol))
click = ClkLtSymbol;
- else if (ev->x > selmon->ww - (int)TEXTW(stext))
+ else if (ev->x > selmon->ww - (int)TEXTW(stext) - getsystraywidth())
click = ClkStatusText;
else
click = ClkWinTitle;
@@ -484,6 +516,13 @@ cleanup(void)
XUngrabKey(dpy, AnyKey, AnyModifier, root);
while (mons)
cleanupmon(mons);
+
+ if (showsystray) {
+ XUnmapWindow(dpy, systray->win);
+ XDestroyWindow(dpy, systray->win);
+ free(systray);
+ }
+
for (i = 0; i < CurLast; i++)
drw_cur_free(drw, cursor[i]);
for (i = 0; i < LENGTH(colors); i++)
@@ -515,9 +554,58 @@ cleanupmon(Monitor *mon)
void
clientmessage(XEvent *e)
{
+ XWindowAttributes wa;
+ XSetWindowAttributes swa;
XClientMessageEvent *cme = &e->xclient;
Client *c = wintoclient(cme->window);
+ if (showsystray && cme->window == systray->win && cme->message_type == netatom[NetSystemTrayOP]) {
+ /* add systray icons */
+ if (cme->data.l[1] == SYSTEM_TRAY_REQUEST_DOCK) {
+ if (!(c = (Client *)calloc(1, sizeof(Client))))
+ die("fatal: could not malloc() %u bytes\n", sizeof(Client));
+ if (!(c->win = cme->data.l[2])) {
+ free(c);
+ return;
+ }
+ c->mon = selmon;
+ c->next = systray->icons;
+ systray->icons = c;
+ if (!XGetWindowAttributes(dpy, c->win, &wa)) {
+ /* use sane defaults */
+ wa.width = bh;
+ wa.height = bh;
+ wa.border_width = 0;
+ }
+ c->x = c->oldx = c->y = c->oldy = 0;
+ c->w = c->oldw = wa.width;
+ c->h = c->oldh = wa.height;
+ c->oldbw = wa.border_width;
+ c->bw = 0;
+ c->isfloating = True;
+ /* reuse tags field as mapped status */
+ c->tags = 1;
+ updatesizehints(c);
+ updatesystrayicongeom(c, wa.width, wa.height);
+ XAddToSaveSet(dpy, c->win);
+ XSelectInput(dpy, c->win, StructureNotifyMask | PropertyChangeMask | ResizeRedirectMask);
+ XReparentWindow(dpy, c->win, systray->win, 0, 0);
+ /* use parents background color */
+ swa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
+ XChangeWindowAttributes(dpy, c->win, CWBackPixel, &swa);
+ sendevent(c->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_EMBEDDED_NOTIFY, 0 , systray->win, XEMBED_EMBEDDED_VERSION);
+ /* FIXME not sure if I have to send these events, too */
+ sendevent(c->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_FOCUS_IN, 0 , systray->win, XEMBED_EMBEDDED_VERSION);
+ sendevent(c->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_WINDOW_ACTIVATE, 0 , systray->win, XEMBED_EMBEDDED_VERSION);
+ sendevent(c->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_MODALITY_ON, 0 , systray->win, XEMBED_EMBEDDED_VERSION);
+ XSync(dpy, False);
+ resizebarwin(selmon);
+ updatesystray();
+ setclientstate(c, NormalState);
+ }
+ return;
+ }
+
if (!c)
return;
if (cme->message_type == netatom[NetWMState]) {
@@ -570,7 +658,7 @@ configurenotify(XEvent *e)
for (c = m->clients; c; c = c->next)
if (c->isfullscreen)
resizeclient(c, m->mx, m->my, m->mw, m->mh);
- XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh);
+ resizebarwin(m);
}
focus(NULL);
arrange(NULL);
@@ -655,6 +743,11 @@ destroynotify(XEvent *e)
if ((c = wintoclient(ev->window)))
unmanage(c, 1);
+ else if ((c = wintosystrayicon(ev->window))) {
+ removesystrayicon(c);
+ resizebarwin(selmon);
+ updatesystray();
+ }
}
void
@@ -698,7 +791,7 @@ dirtomon(int dir)
void
drawbar(Monitor *m)
{
- int x, w, tw = 0;
+ int x, w, tw = 0, stw = 0;
int boxs = drw->fonts->h / 9;
int boxw = drw->fonts->h / 6 + 2;
unsigned int i, occ = 0, urg = 0;
@@ -707,13 +800,17 @@ drawbar(Monitor *m)
if (!m->showbar)
return;
+ if(showsystray && m == systraytomon(m) && !systrayonleft)
+ stw = getsystraywidth();
+
/* draw status first so it can be overdrawn by tags later */
if (m == selmon) { /* status is only drawn on selected monitor */
drw_setscheme(drw, scheme[SchemeNorm]);
- tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
- drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0);
+ tw = TEXTW(stext) - lrpad / 2 + 2; /* 2px extra right padding */
+ drw_text(drw, m->ww - tw - stw, 0, tw, bh, lrpad / 2 - 2, stext, 0);
}
+ resizebarwin(m);
for (c = m->clients; c; c = c->next) {
occ |= c->tags;
if (c->isurgent)
@@ -734,7 +831,7 @@ drawbar(Monitor *m)
drw_setscheme(drw, scheme[SchemeNorm]);
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
- if ((w = m->ww - tw - x) > bh) {
+ if ((w = m->ww - tw - stw - x) > bh) {
if (m->sel) {
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
@@ -745,7 +842,7 @@ drawbar(Monitor *m)
drw_rect(drw, x, 0, w, bh, 1, 1);
}
}
- drw_map(drw, m->barwin, 0, 0, m->ww, bh);
+ drw_map(drw, m->barwin, 0, 0, m->ww - stw, bh);
}
void
@@ -782,8 +879,11 @@ expose(XEvent *e)
Monitor *m;
XExposeEvent *ev = &e->xexpose;
- if (ev->count == 0 && (m = wintomon(ev->window)))
+ if (ev->count == 0 && (m = wintomon(ev->window))) {
drawbar(m);
+ if (m == selmon)
+ updatesystray();
+ }
}
void
@@ -869,14 +969,32 @@ getatomprop(Client *c, Atom prop)
unsigned char *p = NULL;
Atom da, atom = None;
- if (XGetWindowProperty(dpy, c->win, prop, 0L, sizeof atom, False, XA_ATOM,
+ /* FIXME getatomprop should return the number of items and a pointer to
+ * the stored data instead of this workaround */
+ Atom req = XA_ATOM;
+ if (prop == xatom[XembedInfo])
+ req = xatom[XembedInfo];
+
+ if (XGetWindowProperty(dpy, c->win, prop, 0L, sizeof atom, False, req,
&da, &di, &dl, &dl, &p) == Success && p) {
atom = *(Atom *)p;
+ if (da == xatom[XembedInfo] && dl == 2)
+ atom = ((Atom *)p)[1];
XFree(p);
}
return atom;
}
+unsigned int
+getsystraywidth()
+{
+ unsigned int w = 0;
+ Client *i;
+ if(showsystray)
+ for(i = systray->icons; i; w += i->w + systrayspacing, i = i->next) ;
+ return w ? w + systrayspacing : 1;
+}
+
int
getrootptr(int *x, int *y)
{
@@ -1017,7 +1135,8 @@ killclient(const Arg *arg)
{
if (!selmon->sel)
return;
- if (!sendevent(selmon->sel, wmatom[WMDelete])) {
+
+ if (!sendevent(selmon->sel->win, wmatom[WMDelete], NoEventMask, wmatom[WMDelete], CurrentTime, 0 , 0, 0)) {
XGrabServer(dpy);
XSetErrorHandler(xerrordummy);
XSetCloseDownMode(dpy, DestroyAll);
@@ -1104,6 +1223,13 @@ maprequest(XEvent *e)
static XWindowAttributes wa;
XMapRequestEvent *ev = &e->xmaprequest;
+ Client *i;
+ if ((i = wintosystrayicon(ev->window))) {
+ sendevent(i->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_WINDOW_ACTIVATE, 0, systray->win, XEMBED_EMBEDDED_VERSION);
+ resizebarwin(selmon);
+ updatesystray();
+ }
+
if (!XGetWindowAttributes(dpy, ev->window, &wa) || wa.override_redirect)
return;
if (!wintoclient(ev->window))
@@ -1225,6 +1351,17 @@ propertynotify(XEvent *e)
Window trans;
XPropertyEvent *ev = &e->xproperty;
+ if ((c = wintosystrayicon(ev->window))) {
+ if (ev->atom == XA_WM_NORMAL_HINTS) {
+ updatesizehints(c);
+ updatesystrayicongeom(c, c->w, c->h);
+ }
+ else
+ updatesystrayiconstate(c, ev);
+ resizebarwin(selmon);
+ updatesystray();
+ }
+
if ((ev->window == root) && (ev->atom == XA_WM_NAME))
updatestatus();
else if (ev->state == PropertyDelete)
@@ -1275,6 +1412,19 @@ recttomon(int x, int y, int w, int h)
return r;
}
+void
+removesystrayicon(Client *i)
+{
+ Client **ii;
+
+ if (!showsystray || !i)
+ return;
+ for (ii = &systray->icons; *ii && *ii != i; ii = &(*ii)->next);
+ if (ii)
+ *ii = i->next;
+ free(i);
+}
+
void
resize(Client *c, int x, int y, int w, int h, int interact)
{
@@ -1282,6 +1432,14 @@ resize(Client *c, int x, int y, int w, int h, int interact)
resizeclient(c, x, y, w, h);
}
+void
+resizebarwin(Monitor *m) {
+ unsigned int w = m->ww;
+ if (showsystray && m == systraytomon(m) && !systrayonleft)
+ w -= getsystraywidth();
+ XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, w, bh);
+}
+
void
resizeclient(Client *c, int x, int y, int w, int h)
{
@@ -1297,6 +1455,19 @@ resizeclient(Client *c, int x, int y, int w, int h)
XSync(dpy, False);
}
+void
+resizerequest(XEvent *e)
+{
+ XResizeRequestEvent *ev = &e->xresizerequest;
+ Client *i;
+
+ if ((i = wintosystrayicon(ev->window))) {
+ updatesystrayicongeom(i, ev->width, ev->height);
+ resizebarwin(selmon);
+ updatesystray();
+ }
+}
+
void
resizemouse(const Arg *arg)
{
@@ -1443,26 +1614,37 @@ setclientstate(Client *c, long state)
}
int
-sendevent(Client *c, Atom proto)
+sendevent(Window w, Atom proto, int mask, long d0, long d1, long d2, long d3, long d4)
{
int n;
- Atom *protocols;
+ Atom *protocols, mt;
int exists = 0;
XEvent ev;
- if (XGetWMProtocols(dpy, c->win, &protocols, &n)) {
- while (!exists && n--)
- exists = protocols[n] == proto;
- XFree(protocols);
+ if (proto == wmatom[WMTakeFocus] || proto == wmatom[WMDelete]) {
+ mt = wmatom[WMProtocols];
+ if (XGetWMProtocols(dpy, w, &protocols, &n)) {
+ while (!exists && n--)
+ exists = protocols[n] == proto;
+ XFree(protocols);
+ }
+ }
+ else {
+ exists = True;
+ mt = proto;
}
+
if (exists) {
ev.type = ClientMessage;
- ev.xclient.window = c->win;
- ev.xclient.message_type = wmatom[WMProtocols];
+ ev.xclient.window = w;
+ ev.xclient.message_type = mt;
ev.xclient.format = 32;
- ev.xclient.data.l[0] = proto;
- ev.xclient.data.l[1] = CurrentTime;
- XSendEvent(dpy, c->win, False, NoEventMask, &ev);
+ ev.xclient.data.l[0] = d0;
+ ev.xclient.data.l[1] = d1;
+ ev.xclient.data.l[2] = d2;
+ ev.xclient.data.l[3] = d3;
+ ev.xclient.data.l[4] = d4;
+ XSendEvent(dpy, w, False, mask, &ev);
}
return exists;
}
@@ -1476,7 +1658,7 @@ setfocus(Client *c)
XA_WINDOW, 32, PropModeReplace,
(unsigned char *) &(c->win), 1);
}
- sendevent(c, wmatom[WMTakeFocus]);
+ sendevent(c->win, wmatom[WMTakeFocus], NoEventMask, wmatom[WMTakeFocus], CurrentTime, 0, 0, 0);
}
void
@@ -1572,6 +1754,10 @@ setup(void)
wmatom[WMTakeFocus] = XInternAtom(dpy, "WM_TAKE_FOCUS", False);
netatom[NetActiveWindow] = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False);
netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
+ netatom[NetSystemTray] = XInternAtom(dpy, "_NET_SYSTEM_TRAY_S0", False);
+ netatom[NetSystemTrayOP] = XInternAtom(dpy, "_NET_SYSTEM_TRAY_OPCODE", False);
+ netatom[NetSystemTrayOrientation] = XInternAtom(dpy, "_NET_SYSTEM_TRAY_ORIENTATION", False);
+ netatom[NetSystemTrayOrientationHorz] = XInternAtom(dpy, "_NET_SYSTEM_TRAY_ORIENTATION_HORZ", False);
netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False);
netatom[NetWMCheck] = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", False);
@@ -1579,6 +1765,9 @@ setup(void)
netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False);
netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False);
+ xatom[Manager] = XInternAtom(dpy, "MANAGER", False);
+ xatom[Xembed] = XInternAtom(dpy, "_XEMBED", False);
+ xatom[XembedInfo] = XInternAtom(dpy, "_XEMBED_INFO", False);
/* init cursors */
cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr);
cursor[CurResize] = drw_cur_create(drw, XC_sizing);
@@ -1587,6 +1776,8 @@ setup(void)
scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
for (i = 0; i < LENGTH(colors); i++)
scheme[i] = drw_scm_create(drw, colors[i], 3);
+ /* init system tray */
+ updatesystray();
/* init bars */
updatebars();
updatestatus();
@@ -1717,7 +1908,18 @@ togglebar(const Arg *arg)
{
selmon->showbar = !selmon->showbar;
updatebarpos(selmon);
- XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
+ resizebarwin(selmon);
+ if (showsystray) {
+ XWindowChanges wc;
+ if (!selmon->showbar)
+ wc.y = -bh;
+ else if (selmon->showbar) {
+ wc.y = 0;
+ if (!selmon->topbar)
+ wc.y = selmon->mh - bh;
+ }
+ XConfigureWindow(dpy, systray->win, CWY, &wc);
+ }
arrange(selmon);
}
@@ -1813,11 +2015,18 @@ unmapnotify(XEvent *e)
else
unmanage(c, 0);
}
+ else if ((c = wintosystrayicon(ev->window))) {
+ /* KLUDGE! sometimes icons occasionally unmap their windows, but do
+ * _not_ destroy them. We map those windows back */
+ XMapRaised(dpy, c->win);
+ updatesystray();
+ }
}
void
updatebars(void)
{
+ unsigned int w;
Monitor *m;
XSetWindowAttributes wa = {
.override_redirect = True,
@@ -1828,10 +2037,15 @@ updatebars(void)
for (m = mons; m; m = m->next) {
if (m->barwin)
continue;
- m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen),
+ w = m->ww;
+ if (showsystray && m == systraytomon(m))
+ w -= getsystraywidth();
+ m->barwin = XCreateWindow(dpy, root, m->wx, m->by, w, bh, 0, DefaultDepth(dpy, screen),
CopyFromParent, DefaultVisual(dpy, screen),
CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
+ if (showsystray && m == systraytomon(m))
+ XMapRaised(dpy, systray->win);
XMapRaised(dpy, m->barwin);
XSetClassHint(dpy, m->barwin, &ch);
}
@@ -2008,6 +2222,125 @@ updatestatus(void)
if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
strcpy(stext, "dwm-"VERSION);
drawbar(selmon);
+ updatesystray();
+}
+
+
+void
+updatesystrayicongeom(Client *i, int w, int h)
+{
+ if (i) {
+ i->h = bh;
+ if (w == h)
+ i->w = bh;
+ else if (h == bh)
+ i->w = w;
+ else
+ i->w = (int) ((float)bh * ((float)w / (float)h));
+ applysizehints(i, &(i->x), &(i->y), &(i->w), &(i->h), False);
+ /* force icons into the systray dimensions if they don't want to */
+ if (i->h > bh) {
+ if (i->w == i->h)
+ i->w = bh;
+ else
+ i->w = (int) ((float)bh * ((float)i->w / (float)i->h));
+ i->h = bh;
+ }
+ }
+}
+
+void
+updatesystrayiconstate(Client *i, XPropertyEvent *ev)
+{
+ long flags;
+ int code = 0;
+
+ if (!showsystray || !i || ev->atom != xatom[XembedInfo] ||
+ !(flags = getatomprop(i, xatom[XembedInfo])))
+ return;
+
+ if (flags & XEMBED_MAPPED && !i->tags) {
+ i->tags = 1;
+ code = XEMBED_WINDOW_ACTIVATE;
+ XMapRaised(dpy, i->win);
+ setclientstate(i, NormalState);
+ }
+ else if (!(flags & XEMBED_MAPPED) && i->tags) {
+ i->tags = 0;
+ code = XEMBED_WINDOW_DEACTIVATE;
+ XUnmapWindow(dpy, i->win);
+ setclientstate(i, WithdrawnState);
+ }
+ else
+ return;
+ sendevent(i->win, xatom[Xembed], StructureNotifyMask, CurrentTime, code, 0,
+ systray->win, XEMBED_EMBEDDED_VERSION);
+}
+
+void
+updatesystray(void)
+{
+ XSetWindowAttributes wa;
+ XWindowChanges wc;
+ Client *i;
+ Monitor *m = systraytomon(NULL);
+ unsigned int x = m->mx + m->mw;
+ unsigned int sw = TEXTW(stext) - lrpad + systrayspacing;
+ unsigned int w = 1;
+
+ if (!showsystray)
+ return;
+ if (systrayonleft)
+ x -= sw + lrpad / 2;
+ if (!systray) {
+ /* init systray */
+ if (!(systray = (Systray *)calloc(1, sizeof(Systray))))
+ die("fatal: could not malloc() %u bytes\n", sizeof(Systray));
+ systray->win = XCreateSimpleWindow(dpy, root, x, m->by, w, bh, 0, 0, scheme[SchemeSel][ColBg].pixel);
+ wa.event_mask = ButtonPressMask | ExposureMask;
+ wa.override_redirect = True;
+ wa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
+ XSelectInput(dpy, systray->win, SubstructureNotifyMask);
+ XChangeProperty(dpy, systray->win, netatom[NetSystemTrayOrientation], XA_CARDINAL, 32,
+ PropModeReplace, (unsigned char *)&netatom[NetSystemTrayOrientationHorz], 1);
+ XChangeWindowAttributes(dpy, systray->win, CWEventMask|CWOverrideRedirect|CWBackPixel, &wa);
+ XMapRaised(dpy, systray->win);
+ XSetSelectionOwner(dpy, netatom[NetSystemTray], systray->win, CurrentTime);
+ if (XGetSelectionOwner(dpy, netatom[NetSystemTray]) == systray->win) {
+ sendevent(root, xatom[Manager], StructureNotifyMask, CurrentTime, netatom[NetSystemTray], systray->win, 0, 0);
+ XSync(dpy, False);
+ }
+ else {
+ fprintf(stderr, "dwm: unable to obtain system tray.\n");
+ free(systray);
+ systray = NULL;
+ return;
+ }
+ }
+ for (w = 0, i = systray->icons; i; i = i->next) {
+ /* make sure the background color stays the same */
+ wa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
+ XChangeWindowAttributes(dpy, i->win, CWBackPixel, &wa);
+ XMapRaised(dpy, i->win);
+ w += systrayspacing;
+ i->x = w;
+ XMoveResizeWindow(dpy, i->win, i->x, 0, i->w, i->h);
+ w += i->w;
+ if (i->mon != m)
+ i->mon = m;
+ }
+ w = w ? w + systrayspacing : 1;
+ x -= w;
+ XMoveResizeWindow(dpy, systray->win, x, m->by, w, bh);
+ wc.x = x; wc.y = m->by; wc.width = w; wc.height = bh;
+ wc.stack_mode = Above; wc.sibling = m->barwin;
+ XConfigureWindow(dpy, systray->win, CWX|CWY|CWWidth|CWHeight|CWSibling|CWStackMode, &wc);
+ XMapWindow(dpy, systray->win);
+ XMapSubwindows(dpy, systray->win);
+ /* redraw background */
+ XSetForeground(dpy, drw->gc, scheme[SchemeNorm][ColBg].pixel);
+ XFillRectangle(dpy, systray->win, drw->gc, 0, 0, w, bh);
+ XSync(dpy, False);
}
void
@@ -2075,6 +2408,16 @@ wintoclient(Window w)
return NULL;
}
+Client *
+wintosystrayicon(Window w) {
+ Client *i = NULL;
+
+ if (!showsystray || !w)
+ return i;
+ for (i = systray->icons; i && i->win != w; i = i->next) ;
+ return i;
+}
+
Monitor *
wintomon(Window w)
{
@@ -2128,6 +2471,22 @@ xerrorstart(Display *dpy, XErrorEvent *ee)
return -1;
}
+Monitor *
+systraytomon(Monitor *m) {
+ Monitor *t;
+ int i, n;
+ if(!systraypinning) {
+ if(!m)
+ return selmon;
+ return m == selmon ? m : NULL;
+ }
+ for(n = 1, t = mons; t && t->next; n++, t = t->next) ;
+ for(i = 1, t = mons; t && t->next && i < systraypinning; i++, t = t->next) ;
+ if(systraypinningfailfirst && n < systraypinning)
+ return mons;
+ return t;
+}
+
void
zoom(const Arg *arg)
{

View File

@ -0,0 +1,144 @@
{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
"logo": {
"padding": {
"top": 3
}
},
"display": {
"separator": " 󰑃 "
},
"modules": [
{
"type": "custom",
"format": "\u001b[90m┌────────────────────────────────────────────────────────────┐"
},
{
"type": "title",
"keyWidth": 10,
"format": " {6}{7}{8}"
},
{
"type": "custom",
"format": "\u001b[90m└────────────────────────────────────────────────────────────┘"
},
{
"type": "custom",
"format": "\u001b[90m \u001b[31m \u001b[32m \u001b[33m \u001b[34m \u001b[35m \u001b[36m \u001b[37m \u001b[38m \u001b[39m  \u001b[38m \u001b[37m \u001b[36m \u001b[35m \u001b[34m \u001b[33m \u001b[32m \u001b[31m \u001b[90m "
},
{
"type": "custom",
"format": "\u001b[90m┌────────────────────────────────────────────────────────────┐"
},
{
"type": "os",
"key": " DISTRO",
"keyColor": "yellow"
},
{
"type": "kernel",
"key": "│ ├",
"keyColor": "yellow"
},
{
"type": "packages",
"key": "│ ├󰏖",
"keyColor": "yellow"
},
{
"type": "shell",
"key": "│ └",
"keyColor": "yellow"
},
{
"type": "wm",
"key": " DE/WM",
"keyColor": "blue"
},
{
"type": "wmtheme",
"key": "│ ├󰉼",
"keyColor": "blue"
},
{
"type": "icons",
"key": "│ ├󰀻",
"keyColor": "blue"
},
{
"type": "terminal",
"key": "│ ├",
"keyColor": "blue"
},
{
"type": "wallpaper",
"key": "│ └󰸉",
"keyColor": "blue"
},
{
"type": "host",
"key": "󰌢 SYSTEM",
"keyColor": "green"
},
{
"type": "cpu",
"key": "│ ├󰻠",
"keyColor": "green"
},
{
"type": "gpu",
"key": "│ ├󰻑",
"keyColor": "green"
},
{
"type": "display",
"key": "│ ├󰍹",
"keyColor": "green",
"compactType": "original-with-refresh-rate"
},
{
"type": "memory",
"key": "│ ├󰾆",
"keyColor": "green"
},
{
"type": "swap",
"key": "│ ├󰓡",
"keyColor": "green"
},
{
"type": "uptime",
"key": "│ ├󰅐",
"keyColor": "green"
},
{
"type": "display",
"key": "│ └󰍹",
"keyColor": "green"
},
{
"type": "sound",
"key": " AUDIO",
"keyColor": "cyan"
},
{
"type": "player",
"key": "│ ├󰥠",
"keyColor": "cyan"
},
{
"type": "media",
"key": "│ └󰝚",
"keyColor": "cyan"
},
{
"type": "custom",
"format": "\u001b[90m└────────────────────────────────────────────────────────────┘"
},
{
"type": "custom",
"format": "\u001b[90m \u001b[31m \u001b[32m \u001b[33m \u001b[34m \u001b[35m \u001b[36m \u001b[37m \u001b[38m \u001b[39m  \u001b[38m \u001b[37m \u001b[36m \u001b[35m \u001b[34m \u001b[33m \u001b[32m \u001b[31m \u001b[90m "
},
"break",
]
}

View File

@ -0,0 +1,17 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
local opts = {}
require("vim-options")
require("lazy").setup("plugins")

View File

@ -0,0 +1,13 @@
{
"fd": { "branch": "master", "commit": "86d6e2d45fd4ffd175f41ac805ca3dc4ee924f0b" },
"gruvbox.nvim": { "branch": "main", "commit": "68c3460a5d1d1a362318960035c9f3466d5011f5" },
"lazy.nvim": { "branch": "main", "commit": "d8f26efd456190241afd1b0f5235fe6fdba13d4a" },
"lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" },
"neo-tree.nvim": { "branch": "v3.x", "commit": "5d172e8315444dbc32867d1c7b04d8e7e68ec4e1" },
"nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" },
"nvim-treesitter": { "branch": "master", "commit": "61a385d74f822dcd1d223f42f1267d1317aaa2d0" },
"nvim-web-devicons": { "branch": "master", "commit": "1c9136332840edee0c593f2f4f89598c8ed97f5f" },
"plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" },
"ripgrep": { "branch": "master", "commit": "e2362d4d5185d02fa857bf381e7bd52e66fafc73" },
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }
}

View File

@ -0,0 +1,2 @@
return {
}

View File

@ -0,0 +1,7 @@
return {
"ellisonleao/gruvbox.nvim",
priority = 1000,
config = function()
vim.cmd.colorscheme "gruvbox"
end,
opts = ...}

View File

@ -0,0 +1,10 @@
return {
"nvim-lualine/lualine.nvim",
config = function()
require('lualine').setup({
options = {
theme = 'gruvbox'
}
})
end
}

View File

@ -0,0 +1,12 @@
return {
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons",
"MunifTanjim/nui.nvim",
},
config = function()
vim.keymap.set('n', '<C-n>', ':Neotree filesystem toggle right<CR>')
end
}

View File

@ -0,0 +1,8 @@
return {
'nvim-telescope/telescope.nvim', tag = '0.1.8',
dependencies = { 'nvim-lua/plenary.nvim', 'BurntSushi/ripgrep', 'sharkdp/fd' },
config = function()
local builtin = require("telescope.builtin")
vim.keymap.set('n', '<C-p>', builtin.find_files, {})
end
}

View File

@ -0,0 +1,12 @@
return {
"nvim-treesitter/nvim-treesitter",
build= ":TSUpdate",
config = function()
local config = require("nvim-treesitter.configs")
config.setup({
ensure_installed = {"lua", "javascript", "python", "c", "rust", "html", "css"},
highlight = { enable= true },
indent = { enable = true }
})
end
}

View File

@ -0,0 +1,9 @@
vim.cmd("set expandtab")
vim.cmd("set tabstop=4")
vim.cmd("set softtabstop=4")
vim.cmd("set shiftwidth=4")
vim.cmd("set textwidth=79")
vim.cmd("set cursorline")
-- vim.cmd("highlight Cursorline cterm=bold ctermbg=black")
vim.cmd("set number")

View File

@ -0,0 +1,481 @@
/* See LICENSE file for copyright and license details. */
/*
* appearance
*
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
*/
static char *font = "FiraMono Nerd Font:size=9:antialias=true:autohint=true";
static int borderpx = 2;
/*
* What program is execed by st depends of these precedence rules:
* 1: program passed with -e
* 2: scroll and/or utmp
* 3: SHELL environment variable
* 4: value of shell in /etc/passwd
* 5: value of shell in config.h
*/
static char *shell = "/bin/sh";
char *utmp = NULL;
/* scroll program: to enable use a string like "scroll" */
char *scroll = NULL;
char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400";
/* identification sequence returned in DA and DECID */
char *vtiden = "\033[?6c";
/* Kerning / character bounding-box multipliers */
static float cwscale = 1.0;
static float chscale = 1.0;
/*
* word delimiter string
*
* More advanced example: L" `'\"()[]{}"
*/
wchar_t *worddelimiters = L" ";
/* selection timeouts (in milliseconds) */
static unsigned int doubleclicktimeout = 300;
static unsigned int tripleclicktimeout = 600;
/* alt screens */
int allowaltscreen = 1;
/* allow certain non-interactive (insecure) window operations such as:
setting the clipboard text */
int allowwindowops = 0;
/*
* draw latency range in ms - from new content/keypress/etc until drawing.
* within this range, st draws when content stops arriving (idle). mostly it's
* near minlatency, but it waits longer for slow updates to avoid partial draw.
* low minlatency will tear/flicker more, as it can "detect" idle too early.
*/
static double minlatency = 2;
static double maxlatency = 33;
/*
* blinking timeout (set to 0 to disable blinking) for the terminal blinking
* attribute.
*/
static unsigned int blinktimeout = 800;
/*
* thickness of underline and bar cursors
*/
static unsigned int cursorthickness = 2;
/*
* bell volume. It must be a value between -100 and 100. Use 0 for disabling
* it
*/
static int bellvolume = 0;
/* default TERM value */
char *termname = "xterm-256color";
/*
* spaces per tab
*
* When you are changing this value, don't forget to adapt the »it« value in
* the st.info and appropriately install the st.info in the environment where
* you use this st version.
*
* it#$tabspaces,
*
* Secondly make sure your kernel is not expanding tabs. When running `stty
* -a` »tab0« should appear. You can tell the terminal to not expand tabs by
* running following command:
*
* stty tabs
*/
unsigned int tabspaces = 8;
/* Terminal colors (16 first used in escape sequence) */
static const char *colorname[] = {
/* 8 normal colors */
[0] = "#282828", /* hard contrast: #1d2021 / soft contrast: #32302f */
[1] = "#cc241d", /* red */
[2] = "#98971a", /* green */
[3] = "#d79921", /* yellow */
[4] = "#458588", /* blue */
[5] = "#b16286", /* magenta */
[6] = "#689d6a", /* cyan */
[7] = "#a89984", /* white */
/* 8 bright colors */
[8] = "#928374", /* black */
[9] = "#fb4934", /* red */
[10] = "#b8bb26", /* green */
[11] = "#fabd2f", /* yellow */
[12] = "#83a598", /* blue */
[13] = "#d3869b", /* magenta */
[14] = "#8ec07c", /* cyan */
[15] = "#ebdbb2", /* white */
};
/*
* Default colors (colorname index)
* foreground, background, cursor
*/
unsigned int defaultfg = 15;
unsigned int defaultbg = 0;
unsigned int defaultcs = 15;
static unsigned int defaultrcs = 257;
/*
* Default shape of cursor
* 2: Block ("")
* 4: Underline ("_")
* 6: Bar ("|")
* 7: Snowman ("")
*/
static unsigned int cursorshape = 2;
/*
* Default columns and rows numbers
*/
static unsigned int cols = 80;
static unsigned int rows = 24;
/*
* Default colour and shape of the mouse cursor
*/
static unsigned int mouseshape = XC_xterm;
static unsigned int mousefg = 7;
static unsigned int mousebg = 0;
/*
* Color used to display font attributes when fontconfig selected a font which
* doesn't match the ones requested.
*/
static unsigned int defaultattr = 11;
/*
* Force mouse select/shortcuts while mask is active (when MODE_MOUSE is set).
* Note that if you want to use ShiftMask with selmasks, set this to an other
* modifier, set to 0 to not use it.
*/
static uint forcemousemod = ShiftMask;
/*
* Internal mouse shortcuts.
* Beware that overloading Button1 will disable the selection.
*/
static MouseShortcut mshortcuts[] = {
/* mask button function argument release */
{ 0, Button4, kscrollup, {.i = 1} },
{ 0, Button5, kscrolldown, {.i = 1} },
{ XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
{ ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} },
{ XK_ANY_MOD, Button4, ttysend, {.s = "\031"} },
{ ShiftMask, Button5, ttysend, {.s = "\033[6;2~"} },
{ XK_ANY_MOD, Button5, ttysend, {.s = "\005"} },
};
/* Internal keyboard shortcuts. */
#define MODKEY Mod1Mask
#define TERMMOD (ControlMask|ShiftMask)
static Shortcut shortcuts[] = {
/* mask keysym function argument */
{ XK_ANY_MOD, XK_Break, sendbreak, {.i = 0} },
{ ControlMask, XK_Print, toggleprinter, {.i = 0} },
{ ShiftMask, XK_Print, printscreen, {.i = 0} },
{ XK_ANY_MOD, XK_Print, printsel, {.i = 0} },
{ TERMMOD, XK_Prior, zoom, {.f = +1} },
{ TERMMOD, XK_Next, zoom, {.f = -1} },
{ TERMMOD, XK_Home, zoomreset, {.f = 0} },
{ TERMMOD, XK_C, clipcopy, {.i = 0} },
{ TERMMOD, XK_V, clippaste, {.i = 0} },
{ TERMMOD, XK_Y, selpaste, {.i = 0} },
{ ShiftMask, XK_Insert, selpaste, {.i = 0} },
{ TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
{ ShiftMask, XK_Page_Up, kscrollup, {.i = -1} },
{ ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} },
};
/*
* Special keys (change & recompile st.info accordingly)
*
* Mask value:
* * Use XK_ANY_MOD to match the key no matter modifiers state
* * Use XK_NO_MOD to match the key alone (no modifiers)
* appkey value:
* * 0: no value
* * > 0: keypad application mode enabled
* * = 2: term.numlock = 1
* * < 0: keypad application mode disabled
* appcursor value:
* * 0: no value
* * > 0: cursor application mode enabled
* * < 0: cursor application mode disabled
*
* Be careful with the order of the definitions because st searches in
* this table sequentially, so any XK_ANY_MOD must be in the last
* position for a key.
*/
/*
* If you want keys other than the X11 function keys (0xFD00 - 0xFFFF)
* to be mapped below, add them to this array.
*/
static KeySym mappedkeys[] = { -1 };
/*
* State bits to ignore when matching key or button events. By default,
* numlock (Mod2Mask) and keyboard layout (XK_SWITCH_MOD) are ignored.
*/
static uint ignoremod = Mod2Mask|XK_SWITCH_MOD;
/*
* This is the huge key array which defines all compatibility to the Linux
* world. Please decide about changes wisely.
*/
static Key key[] = {
/* keysym mask string appkey appcursor */
{ XK_KP_Home, ShiftMask, "\033[2J", 0, -1},
{ XK_KP_Home, ShiftMask, "\033[1;2H", 0, +1},
{ XK_KP_Home, XK_ANY_MOD, "\033[H", 0, -1},
{ XK_KP_Home, XK_ANY_MOD, "\033[1~", 0, +1},
{ XK_KP_Up, XK_ANY_MOD, "\033Ox", +1, 0},
{ XK_KP_Up, XK_ANY_MOD, "\033[A", 0, -1},
{ XK_KP_Up, XK_ANY_MOD, "\033OA", 0, +1},
{ XK_KP_Down, XK_ANY_MOD, "\033Or", +1, 0},
{ XK_KP_Down, XK_ANY_MOD, "\033[B", 0, -1},
{ XK_KP_Down, XK_ANY_MOD, "\033OB", 0, +1},
{ XK_KP_Left, XK_ANY_MOD, "\033Ot", +1, 0},
{ XK_KP_Left, XK_ANY_MOD, "\033[D", 0, -1},
{ XK_KP_Left, XK_ANY_MOD, "\033OD", 0, +1},
{ XK_KP_Right, XK_ANY_MOD, "\033Ov", +1, 0},
{ XK_KP_Right, XK_ANY_MOD, "\033[C", 0, -1},
{ XK_KP_Right, XK_ANY_MOD, "\033OC", 0, +1},
{ XK_KP_Prior, ShiftMask, "\033[5;2~", 0, 0},
{ XK_KP_Prior, XK_ANY_MOD, "\033[5~", 0, 0},
{ XK_KP_Begin, XK_ANY_MOD, "\033[E", 0, 0},
{ XK_KP_End, ControlMask, "\033[J", -1, 0},
{ XK_KP_End, ControlMask, "\033[1;5F", +1, 0},
{ XK_KP_End, ShiftMask, "\033[K", -1, 0},
{ XK_KP_End, ShiftMask, "\033[1;2F", +1, 0},
{ XK_KP_End, XK_ANY_MOD, "\033[4~", 0, 0},
{ XK_KP_Next, ShiftMask, "\033[6;2~", 0, 0},
{ XK_KP_Next, XK_ANY_MOD, "\033[6~", 0, 0},
{ XK_KP_Insert, ShiftMask, "\033[2;2~", +1, 0},
{ XK_KP_Insert, ShiftMask, "\033[4l", -1, 0},
{ XK_KP_Insert, ControlMask, "\033[L", -1, 0},
{ XK_KP_Insert, ControlMask, "\033[2;5~", +1, 0},
{ XK_KP_Insert, XK_ANY_MOD, "\033[4h", -1, 0},
{ XK_KP_Insert, XK_ANY_MOD, "\033[2~", +1, 0},
{ XK_KP_Delete, ControlMask, "\033[M", -1, 0},
{ XK_KP_Delete, ControlMask, "\033[3;5~", +1, 0},
{ XK_KP_Delete, ShiftMask, "\033[2K", -1, 0},
{ XK_KP_Delete, ShiftMask, "\033[3;2~", +1, 0},
{ XK_KP_Delete, XK_ANY_MOD, "\033[P", -1, 0},
{ XK_KP_Delete, XK_ANY_MOD, "\033[3~", +1, 0},
{ XK_KP_Multiply, XK_ANY_MOD, "\033Oj", +2, 0},
{ XK_KP_Add, XK_ANY_MOD, "\033Ok", +2, 0},
{ XK_KP_Enter, XK_ANY_MOD, "\033OM", +2, 0},
{ XK_KP_Enter, XK_ANY_MOD, "\r", -1, 0},
{ XK_KP_Subtract, XK_ANY_MOD, "\033Om", +2, 0},
{ XK_KP_Decimal, XK_ANY_MOD, "\033On", +2, 0},
{ XK_KP_Divide, XK_ANY_MOD, "\033Oo", +2, 0},
{ XK_KP_0, XK_ANY_MOD, "\033Op", +2, 0},
{ XK_KP_1, XK_ANY_MOD, "\033Oq", +2, 0},
{ XK_KP_2, XK_ANY_MOD, "\033Or", +2, 0},
{ XK_KP_3, XK_ANY_MOD, "\033Os", +2, 0},
{ XK_KP_4, XK_ANY_MOD, "\033Ot", +2, 0},
{ XK_KP_5, XK_ANY_MOD, "\033Ou", +2, 0},
{ XK_KP_6, XK_ANY_MOD, "\033Ov", +2, 0},
{ XK_KP_7, XK_ANY_MOD, "\033Ow", +2, 0},
{ XK_KP_8, XK_ANY_MOD, "\033Ox", +2, 0},
{ XK_KP_9, XK_ANY_MOD, "\033Oy", +2, 0},
{ XK_Up, ShiftMask, "\033[1;2A", 0, 0},
{ XK_Up, Mod1Mask, "\033[1;3A", 0, 0},
{ XK_Up, ShiftMask|Mod1Mask,"\033[1;4A", 0, 0},
{ XK_Up, ControlMask, "\033[1;5A", 0, 0},
{ XK_Up, ShiftMask|ControlMask,"\033[1;6A", 0, 0},
{ XK_Up, ControlMask|Mod1Mask,"\033[1;7A", 0, 0},
{ XK_Up,ShiftMask|ControlMask|Mod1Mask,"\033[1;8A", 0, 0},
{ XK_Up, XK_ANY_MOD, "\033[A", 0, -1},
{ XK_Up, XK_ANY_MOD, "\033OA", 0, +1},
{ XK_Down, ShiftMask, "\033[1;2B", 0, 0},
{ XK_Down, Mod1Mask, "\033[1;3B", 0, 0},
{ XK_Down, ShiftMask|Mod1Mask,"\033[1;4B", 0, 0},
{ XK_Down, ControlMask, "\033[1;5B", 0, 0},
{ XK_Down, ShiftMask|ControlMask,"\033[1;6B", 0, 0},
{ XK_Down, ControlMask|Mod1Mask,"\033[1;7B", 0, 0},
{ XK_Down,ShiftMask|ControlMask|Mod1Mask,"\033[1;8B",0, 0},
{ XK_Down, XK_ANY_MOD, "\033[B", 0, -1},
{ XK_Down, XK_ANY_MOD, "\033OB", 0, +1},
{ XK_Left, ShiftMask, "\033[1;2D", 0, 0},
{ XK_Left, Mod1Mask, "\033[1;3D", 0, 0},
{ XK_Left, ShiftMask|Mod1Mask,"\033[1;4D", 0, 0},
{ XK_Left, ControlMask, "\033[1;5D", 0, 0},
{ XK_Left, ShiftMask|ControlMask,"\033[1;6D", 0, 0},
{ XK_Left, ControlMask|Mod1Mask,"\033[1;7D", 0, 0},
{ XK_Left,ShiftMask|ControlMask|Mod1Mask,"\033[1;8D",0, 0},
{ XK_Left, XK_ANY_MOD, "\033[D", 0, -1},
{ XK_Left, XK_ANY_MOD, "\033OD", 0, +1},
{ XK_Right, ShiftMask, "\033[1;2C", 0, 0},
{ XK_Right, Mod1Mask, "\033[1;3C", 0, 0},
{ XK_Right, ShiftMask|Mod1Mask,"\033[1;4C", 0, 0},
{ XK_Right, ControlMask, "\033[1;5C", 0, 0},
{ XK_Right, ShiftMask|ControlMask,"\033[1;6C", 0, 0},
{ XK_Right, ControlMask|Mod1Mask,"\033[1;7C", 0, 0},
{ XK_Right,ShiftMask|ControlMask|Mod1Mask,"\033[1;8C",0, 0},
{ XK_Right, XK_ANY_MOD, "\033[C", 0, -1},
{ XK_Right, XK_ANY_MOD, "\033OC", 0, +1},
{ XK_ISO_Left_Tab, ShiftMask, "\033[Z", 0, 0},
{ XK_Return, Mod1Mask, "\033\r", 0, 0},
{ XK_Return, XK_ANY_MOD, "\r", 0, 0},
{ XK_Insert, ShiftMask, "\033[4l", -1, 0},
{ XK_Insert, ShiftMask, "\033[2;2~", +1, 0},
{ XK_Insert, ControlMask, "\033[L", -1, 0},
{ XK_Insert, ControlMask, "\033[2;5~", +1, 0},
{ XK_Insert, XK_ANY_MOD, "\033[4h", -1, 0},
{ XK_Insert, XK_ANY_MOD, "\033[2~", +1, 0},
{ XK_Delete, ControlMask, "\033[M", -1, 0},
{ XK_Delete, ControlMask, "\033[3;5~", +1, 0},
{ XK_Delete, ShiftMask, "\033[2K", -1, 0},
{ XK_Delete, ShiftMask, "\033[3;2~", +1, 0},
{ XK_Delete, XK_ANY_MOD, "\033[P", -1, 0},
{ XK_Delete, XK_ANY_MOD, "\033[3~", +1, 0},
{ XK_BackSpace, XK_NO_MOD, "\177", 0, 0},
{ XK_BackSpace, Mod1Mask, "\033\177", 0, 0},
{ XK_Home, ShiftMask, "\033[2J", 0, -1},
{ XK_Home, ShiftMask, "\033[1;2H", 0, +1},
{ XK_Home, XK_ANY_MOD, "\033[H", 0, -1},
{ XK_Home, XK_ANY_MOD, "\033[1~", 0, +1},
{ XK_End, ControlMask, "\033[J", -1, 0},
{ XK_End, ControlMask, "\033[1;5F", +1, 0},
{ XK_End, ShiftMask, "\033[K", -1, 0},
{ XK_End, ShiftMask, "\033[1;2F", +1, 0},
{ XK_End, XK_ANY_MOD, "\033[4~", 0, 0},
{ XK_Prior, ControlMask, "\033[5;5~", 0, 0},
{ XK_Prior, ShiftMask, "\033[5;2~", 0, 0},
{ XK_Prior, XK_ANY_MOD, "\033[5~", 0, 0},
{ XK_Next, ControlMask, "\033[6;5~", 0, 0},
{ XK_Next, ShiftMask, "\033[6;2~", 0, 0},
{ XK_Next, XK_ANY_MOD, "\033[6~", 0, 0},
{ XK_F1, XK_NO_MOD, "\033OP" , 0, 0},
{ XK_F1, /* F13 */ ShiftMask, "\033[1;2P", 0, 0},
{ XK_F1, /* F25 */ ControlMask, "\033[1;5P", 0, 0},
{ XK_F1, /* F37 */ Mod4Mask, "\033[1;6P", 0, 0},
{ XK_F1, /* F49 */ Mod1Mask, "\033[1;3P", 0, 0},
{ XK_F1, /* F61 */ Mod3Mask, "\033[1;4P", 0, 0},
{ XK_F2, XK_NO_MOD, "\033OQ" , 0, 0},
{ XK_F2, /* F14 */ ShiftMask, "\033[1;2Q", 0, 0},
{ XK_F2, /* F26 */ ControlMask, "\033[1;5Q", 0, 0},
{ XK_F2, /* F38 */ Mod4Mask, "\033[1;6Q", 0, 0},
{ XK_F2, /* F50 */ Mod1Mask, "\033[1;3Q", 0, 0},
{ XK_F2, /* F62 */ Mod3Mask, "\033[1;4Q", 0, 0},
{ XK_F3, XK_NO_MOD, "\033OR" , 0, 0},
{ XK_F3, /* F15 */ ShiftMask, "\033[1;2R", 0, 0},
{ XK_F3, /* F27 */ ControlMask, "\033[1;5R", 0, 0},
{ XK_F3, /* F39 */ Mod4Mask, "\033[1;6R", 0, 0},
{ XK_F3, /* F51 */ Mod1Mask, "\033[1;3R", 0, 0},
{ XK_F3, /* F63 */ Mod3Mask, "\033[1;4R", 0, 0},
{ XK_F4, XK_NO_MOD, "\033OS" , 0, 0},
{ XK_F4, /* F16 */ ShiftMask, "\033[1;2S", 0, 0},
{ XK_F4, /* F28 */ ControlMask, "\033[1;5S", 0, 0},
{ XK_F4, /* F40 */ Mod4Mask, "\033[1;6S", 0, 0},
{ XK_F4, /* F52 */ Mod1Mask, "\033[1;3S", 0, 0},
{ XK_F5, XK_NO_MOD, "\033[15~", 0, 0},
{ XK_F5, /* F17 */ ShiftMask, "\033[15;2~", 0, 0},
{ XK_F5, /* F29 */ ControlMask, "\033[15;5~", 0, 0},
{ XK_F5, /* F41 */ Mod4Mask, "\033[15;6~", 0, 0},
{ XK_F5, /* F53 */ Mod1Mask, "\033[15;3~", 0, 0},
{ XK_F6, XK_NO_MOD, "\033[17~", 0, 0},
{ XK_F6, /* F18 */ ShiftMask, "\033[17;2~", 0, 0},
{ XK_F6, /* F30 */ ControlMask, "\033[17;5~", 0, 0},
{ XK_F6, /* F42 */ Mod4Mask, "\033[17;6~", 0, 0},
{ XK_F6, /* F54 */ Mod1Mask, "\033[17;3~", 0, 0},
{ XK_F7, XK_NO_MOD, "\033[18~", 0, 0},
{ XK_F7, /* F19 */ ShiftMask, "\033[18;2~", 0, 0},
{ XK_F7, /* F31 */ ControlMask, "\033[18;5~", 0, 0},
{ XK_F7, /* F43 */ Mod4Mask, "\033[18;6~", 0, 0},
{ XK_F7, /* F55 */ Mod1Mask, "\033[18;3~", 0, 0},
{ XK_F8, XK_NO_MOD, "\033[19~", 0, 0},
{ XK_F8, /* F20 */ ShiftMask, "\033[19;2~", 0, 0},
{ XK_F8, /* F32 */ ControlMask, "\033[19;5~", 0, 0},
{ XK_F8, /* F44 */ Mod4Mask, "\033[19;6~", 0, 0},
{ XK_F8, /* F56 */ Mod1Mask, "\033[19;3~", 0, 0},
{ XK_F9, XK_NO_MOD, "\033[20~", 0, 0},
{ XK_F9, /* F21 */ ShiftMask, "\033[20;2~", 0, 0},
{ XK_F9, /* F33 */ ControlMask, "\033[20;5~", 0, 0},
{ XK_F9, /* F45 */ Mod4Mask, "\033[20;6~", 0, 0},
{ XK_F9, /* F57 */ Mod1Mask, "\033[20;3~", 0, 0},
{ XK_F10, XK_NO_MOD, "\033[21~", 0, 0},
{ XK_F10, /* F22 */ ShiftMask, "\033[21;2~", 0, 0},
{ XK_F10, /* F34 */ ControlMask, "\033[21;5~", 0, 0},
{ XK_F10, /* F46 */ Mod4Mask, "\033[21;6~", 0, 0},
{ XK_F10, /* F58 */ Mod1Mask, "\033[21;3~", 0, 0},
{ XK_F11, XK_NO_MOD, "\033[23~", 0, 0},
{ XK_F11, /* F23 */ ShiftMask, "\033[23;2~", 0, 0},
{ XK_F11, /* F35 */ ControlMask, "\033[23;5~", 0, 0},
{ XK_F11, /* F47 */ Mod4Mask, "\033[23;6~", 0, 0},
{ XK_F11, /* F59 */ Mod1Mask, "\033[23;3~", 0, 0},
{ XK_F12, XK_NO_MOD, "\033[24~", 0, 0},
{ XK_F12, /* F24 */ ShiftMask, "\033[24;2~", 0, 0},
{ XK_F12, /* F36 */ ControlMask, "\033[24;5~", 0, 0},
{ XK_F12, /* F48 */ Mod4Mask, "\033[24;6~", 0, 0},
{ XK_F12, /* F60 */ Mod1Mask, "\033[24;3~", 0, 0},
{ XK_F13, XK_NO_MOD, "\033[1;2P", 0, 0},
{ XK_F14, XK_NO_MOD, "\033[1;2Q", 0, 0},
{ XK_F15, XK_NO_MOD, "\033[1;2R", 0, 0},
{ XK_F16, XK_NO_MOD, "\033[1;2S", 0, 0},
{ XK_F17, XK_NO_MOD, "\033[15;2~", 0, 0},
{ XK_F18, XK_NO_MOD, "\033[17;2~", 0, 0},
{ XK_F19, XK_NO_MOD, "\033[18;2~", 0, 0},
{ XK_F20, XK_NO_MOD, "\033[19;2~", 0, 0},
{ XK_F21, XK_NO_MOD, "\033[20;2~", 0, 0},
{ XK_F22, XK_NO_MOD, "\033[21;2~", 0, 0},
{ XK_F23, XK_NO_MOD, "\033[23;2~", 0, 0},
{ XK_F24, XK_NO_MOD, "\033[24;2~", 0, 0},
{ XK_F25, XK_NO_MOD, "\033[1;5P", 0, 0},
{ XK_F26, XK_NO_MOD, "\033[1;5Q", 0, 0},
{ XK_F27, XK_NO_MOD, "\033[1;5R", 0, 0},
{ XK_F28, XK_NO_MOD, "\033[1;5S", 0, 0},
{ XK_F29, XK_NO_MOD, "\033[15;5~", 0, 0},
{ XK_F30, XK_NO_MOD, "\033[17;5~", 0, 0},
{ XK_F31, XK_NO_MOD, "\033[18;5~", 0, 0},
{ XK_F32, XK_NO_MOD, "\033[19;5~", 0, 0},
{ XK_F33, XK_NO_MOD, "\033[20;5~", 0, 0},
{ XK_F34, XK_NO_MOD, "\033[21;5~", 0, 0},
{ XK_F35, XK_NO_MOD, "\033[23;5~", 0, 0},
};
/*
* Selection types' masks.
* Use the same masks as usual.
* Button1Mask is always unset, to make masks match between ButtonPress.
* ButtonRelease and MotionNotify.
* If no match is found, regular selection is used.
*/
static uint selmasks[] = {
[SEL_RECTANGULAR] = Mod1Mask,
};
/*
* Printable characters in ASCII, used to estimate the advance width
* of single wide characters.
*/
static char ascii_printable[] =
" !\"#$%&'()*+,-./0123456789:;<=>?"
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
"`abcdefghijklmnopqrstuvwxyz{|}~";
/*
* Open urls starting with urlprefixes, contatining urlchars
* by passing as ARG1 to urlhandler.
*/
char* urlhandler = "xdg-open";
char urlchars[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789-._~:/?#@!$&'*+,;=%";
char* urlprefixes[] = {"http://", "https://", NULL};

View File

@ -0,0 +1,215 @@
From 8d13e4a296f0b2a625df10c8ee6d2fc96ec97580 Mon Sep 17 00:00:00 2001
From: Kyle Chui <kyle.chui+suckless@pm.me>
Date: Tue, 9 Apr 2024 16:31:25 -0700
Subject: [PATCH] Underline URLs and follow with click
---
config.def.h | 11 +++++++
st.c | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++
st.h | 9 ++++++
x.c | 12 ++++++-
4 files changed, 119 insertions(+), 1 deletion(-)
diff --git a/config.def.h b/config.def.h
index 91ab8ca..4961830 100644
--- a/config.def.h
+++ b/config.def.h
@@ -472,3 +472,14 @@ static char ascii_printable[] =
" !\"#$%&'()*+,-./0123456789:;<=>?"
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
"`abcdefghijklmnopqrstuvwxyz{|}~";
+
+/*
+ * Open urls starting with urlprefixes, contatining urlchars
+ * by passing as ARG1 to urlhandler.
+ */
+char* urlhandler = "xdg-open";
+char urlchars[] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "abcdefghijklmnopqrstuvwxyz"
+ "0123456789-._~:/?#@!$&'*+,;=%";
+char* urlprefixes[] = {"http://", "https://", NULL};
diff --git a/st.c b/st.c
index 51049ba..a7eb86e 100644
--- a/st.c
+++ b/st.c
@@ -643,6 +643,92 @@ getsel(void)
return str;
}
+char *
+strstrany(char* s, char** strs) {
+ char *match;
+ for (int i = 0; strs[i]; i++) {
+ if ((match = strstr(s, strs[i]))) {
+ return match;
+ }
+ }
+ return NULL;
+}
+
+void
+highlighturlsline(int row)
+{
+ char *linestr = calloc(sizeof(char), term.col+1); /* assume ascii */
+ char *match;
+ for (int j = 0; j < term.col; j++) {
+ if (term.line[row][j].u < 127) {
+ linestr[j] = term.line[row][j].u;
+ }
+ linestr[term.col] = '\0';
+ }
+ int url_start = -1;
+ while ((match = strstrany(linestr + url_start + 1, urlprefixes))) {
+ url_start = match - linestr;
+ for (int c = url_start; c < term.col && strchr(urlchars, linestr[c]); c++) {
+ term.line[row][c].mode |= ATTR_URL;
+ tsetdirt(row, c);
+ }
+ }
+ free(linestr);
+}
+
+void
+unhighlighturlsline(int row)
+{
+ for (int j = 0; j < term.col; j++) {
+ Glyph* g = &term.line[row][j];
+ if (g->mode & ATTR_URL) {
+ g->mode &= ~ATTR_URL;
+ tsetdirt(row, j);
+ }
+ }
+ return;
+}
+
+int
+followurl(int col, int row) {
+ char *linestr = calloc(sizeof(char), term.col+1); /* assume ascii */
+ char *match;
+ for (int i = 0; i < term.col; i++) {
+ if (term.line[row][i].u < 127) {
+ linestr[i] = term.line[row][i].u;
+ }
+ linestr[term.col] = '\0';
+ }
+ int url_start = -1, found_url = 0;
+ while ((match = strstrany(linestr + url_start + 1, urlprefixes))) {
+ url_start = match - linestr;
+ int url_end = url_start;
+ for (int c = url_start; c < term.col && strchr(urlchars, linestr[c]); c++) {
+ url_end++;
+ }
+ if (url_start <= col && col < url_end) {
+ found_url = 1;
+ linestr[url_end] = '\0';
+ break;
+ }
+ }
+ if (!found_url) {
+ free(linestr);
+ return 0;
+ }
+
+ pid_t chpid;
+ if ((chpid = fork()) == 0) {
+ if (fork() == 0)
+ execlp(urlhandler, urlhandler, linestr + url_start, NULL);
+ exit(1);
+ }
+ if (chpid > 0)
+ waitpid(chpid, NULL, 0);
+ free(linestr);
+ return 1;
+}
+
void
selclear(void)
{
@@ -2652,6 +2738,8 @@ drawregion(int x1, int y1, int x2, int y2)
continue;
term.dirty[y] = 0;
+ unhighlighturlsline(y);
+ highlighturlsline(y);
xdrawline(term.line[y], x1, y, x2);
}
}
diff --git a/st.h b/st.h
index 519b9bd..5efc27e 100644
--- a/st.h
+++ b/st.h
@@ -33,6 +33,7 @@ enum glyph_attribute {
ATTR_WRAP = 1 << 8,
ATTR_WIDE = 1 << 9,
ATTR_WDUMMY = 1 << 10,
+ ATTR_URL = 1 << 11,
ATTR_BOLD_FAINT = ATTR_BOLD | ATTR_FAINT,
};
@@ -105,6 +106,10 @@ void selextend(int, int, int, int);
int selected(int, int);
char *getsel(void);
+void highlighturlsline(int);
+void unhighlighturlsline(int);
+int followurl(int, int);
+
size_t utf8encode(Rune, char *);
void *xmalloc(size_t);
@@ -126,3 +131,7 @@ extern unsigned int tabspaces;
extern unsigned int defaultfg;
extern unsigned int defaultbg;
extern unsigned int defaultcs;
+extern char *urlhandler;
+extern char urlchars[];
+extern char *urlprefixes[];
+extern int nurlprefixes;
diff --git a/x.c b/x.c
index 8a16faa..c721f8b 100644
--- a/x.c
+++ b/x.c
@@ -191,6 +191,7 @@ static void usage(void);
static void (*handler[LASTEvent])(XEvent *) = {
[KeyPress] = kpress,
+ [KeyRelease] = kpress,
[ClientMessage] = cmessage,
[ConfigureNotify] = resize,
[VisibilityNotify] = visibility,
@@ -445,6 +446,10 @@ mouseaction(XEvent *e, uint release)
/* ignore Button<N>mask for Button<N> - it's set on release */
uint state = e->xbutton.state & ~buttonmask(e->xbutton.button);
+ if (release == 0 && e->xbutton.button == Button1) {
+ return followurl(evcol(e), evrow(e));
+ }
+
for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) {
if (ms->release == release &&
ms->button == e->xbutton.button &&
@@ -1476,7 +1481,7 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
XftDrawGlyphFontSpec(xw.draw, fg, specs, len);
/* Render underline and strikethrough. */
- if (base.mode & ATTR_UNDERLINE) {
+ if (base.mode & ATTR_UNDERLINE || base.mode & ATTR_URL) {
XftDrawRect(xw.draw, fg, winx, winy + dc.font.ascent + 1,
width, 1);
}
@@ -1831,6 +1836,11 @@ kpress(XEvent *ev)
len = XmbLookupString(xw.ime.xic, e, buf, sizeof buf, &ksym, &status);
else
len = XLookupString(e, buf, sizeof buf, &ksym, NULL);
+
+ /* KeyRelease not relevant to shortcuts */
+ if (ev->type == KeyRelease)
+ return;
+
/* 1. shortcuts */
for (bp = shortcuts; bp < shortcuts + LEN(shortcuts); bp++) {
if (ksym == bp->keysym && match(bp->mod, e->state)) {
--
2.42.0

View File

@ -0,0 +1,12 @@
diff --git a/x.c b/x.c
index e5f1737..5cabd60 100644
--- a/x.c
+++ b/x.c
@@ -673,6 +673,7 @@ setsel(char *str, Time t)
XSetSelectionOwner(xw.dpy, XA_PRIMARY, xw.win, t);
if (XGetSelectionOwner(xw.dpy, XA_PRIMARY) != xw.win)
selclear();
+ clipcopy(NULL);
}
void

View File

@ -0,0 +1,70 @@
diff --git a/config.def.h b/config.def.h
index 877afab..6a1699f 100644
--- a/config.def.h
+++ b/config.def.h
@@ -84,41 +84,35 @@ static unsigned int tabspaces = 8;
/* Terminal colors (16 first used in escape sequence) */
static const char *colorname[] = {
- /* 8 normal colors */
- "black",
- "red3",
- "green3",
- "yellow3",
- "blue2",
- "magenta3",
- "cyan3",
- "gray90",
-
- /* 8 bright colors */
- "gray50",
- "red",
- "green",
- "yellow",
- "#5c5cff",
- "magenta",
- "cyan",
- "white",
-
- [255] = 0,
-
- /* more colors can be added after 255 to use with DefaultXX */
- "#cccccc",
- "#555555",
-};
+ /* 8 normal colors */
+ [0] = "#282828", /* hard contrast: #1d2021 / soft contrast: #32302f */
+ [1] = "#cc241d", /* red */
+ [2] = "#98971a", /* green */
+ [3] = "#d79921", /* yellow */
+ [4] = "#458588", /* blue */
+ [5] = "#b16286", /* magenta */
+ [6] = "#689d6a", /* cyan */
+ [7] = "#a89984", /* white */
+
+ /* 8 bright colors */
+ [8] = "#928374", /* black */
+ [9] = "#fb4934", /* red */
+ [10] = "#b8bb26", /* green */
+ [11] = "#fabd2f", /* yellow */
+ [12] = "#83a598", /* blue */
+ [13] = "#d3869b", /* magenta */
+ [14] = "#8ec07c", /* cyan */
+ [15] = "#ebdbb2", /* white */
+};
/*
* Default colors (colorname index)
- * foreground, background, cursor, reverse cursor
+ * foreground, background, cursor
*/
-unsigned int defaultfg = 7;
-unsigned int defaultbg = 0;
-static unsigned int defaultcs = 256;
+unsigned int defaultfg = 15;
+unsigned int defaultbg = 0;
+static unsigned int defaultcs = 15;
static unsigned int defaultrcs = 257;
/*

View File

@ -0,0 +1,351 @@
diff --git a/config.def.h b/config.def.h
index 2cd740a..40b7d93 100644
--- a/config.def.h
+++ b/config.def.h
@@ -201,6 +201,8 @@ static Shortcut shortcuts[] = {
{ TERMMOD, XK_Y, selpaste, {.i = 0} },
{ ShiftMask, XK_Insert, selpaste, {.i = 0} },
{ TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
+ { ShiftMask, XK_Page_Up, kscrollup, {.i = -1} },
+ { ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} },
};
/*
diff --git a/st.c b/st.c
index b9f66e7..2478942 100644
--- a/st.c
+++ b/st.c
@@ -35,6 +35,7 @@
#define ESC_ARG_SIZ 16
#define STR_BUF_SIZ ESC_BUF_SIZ
#define STR_ARG_SIZ ESC_ARG_SIZ
+#define HISTSIZE 2000
/* macros */
#define IS_SET(flag) ((term.mode & (flag)) != 0)
@@ -42,6 +43,9 @@
#define ISCONTROLC1(c) (BETWEEN(c, 0x80, 0x9f))
#define ISCONTROL(c) (ISCONTROLC0(c) || ISCONTROLC1(c))
#define ISDELIM(u) (u && wcschr(worddelimiters, u))
+#define TLINE(y) ((y) < term.scr ? term.hist[((y) + term.histi - \
+ term.scr + HISTSIZE + 1) % HISTSIZE] : \
+ term.line[(y) - term.scr])
enum term_mode {
MODE_WRAP = 1 << 0,
@@ -115,6 +119,9 @@ typedef struct {
int col; /* nb col */
Line *line; /* screen */
Line *alt; /* alternate screen */
+ Line hist[HISTSIZE]; /* history buffer */
+ int histi; /* history index */
+ int scr; /* scroll back */
int *dirty; /* dirtyness of lines */
TCursor c; /* cursor */
int ocx; /* old cursor col */
@@ -185,8 +192,8 @@ static void tnewline(int);
static void tputtab(int);
static void tputc(Rune);
static void treset(void);
-static void tscrollup(int, int);
-static void tscrolldown(int, int);
+static void tscrollup(int, int, int);
+static void tscrolldown(int, int, int);
static void tsetattr(const int *, int);
static void tsetchar(Rune, const Glyph *, int, int);
static void tsetdirt(int, int);
@@ -409,10 +416,10 @@ tlinelen(int y)
{
int i = term.col;
- if (term.line[y][i - 1].mode & ATTR_WRAP)
+ if (TLINE(y)[i - 1].mode & ATTR_WRAP)
return i;
- while (i > 0 && term.line[y][i - 1].u == ' ')
+ while (i > 0 && TLINE(y)[i - 1].u == ' ')
--i;
return i;
@@ -521,7 +528,7 @@ selsnap(int *x, int *y, int direction)
* Snap around if the word wraps around at the end or
* beginning of a line.
*/
- prevgp = &term.line[*y][*x];
+ prevgp = &TLINE(*y)[*x];
prevdelim = ISDELIM(prevgp->u);
for (;;) {
newx = *x + direction;
@@ -536,14 +543,14 @@ selsnap(int *x, int *y, int direction)
yt = *y, xt = *x;
else
yt = newy, xt = newx;
- if (!(term.line[yt][xt].mode & ATTR_WRAP))
+ if (!(TLINE(yt)[xt].mode & ATTR_WRAP))
break;
}
if (newx >= tlinelen(newy))
break;
- gp = &term.line[newy][newx];
+ gp = &TLINE(newy)[newx];
delim = ISDELIM(gp->u);
if (!(gp->mode & ATTR_WDUMMY) && (delim != prevdelim
|| (delim && gp->u != prevgp->u)))
@@ -564,14 +571,14 @@ selsnap(int *x, int *y, int direction)
*x = (direction < 0) ? 0 : term.col - 1;
if (direction < 0) {
for (; *y > 0; *y += direction) {
- if (!(term.line[*y-1][term.col-1].mode
+ if (!(TLINE(*y-1)[term.col-1].mode
& ATTR_WRAP)) {
break;
}
}
} else if (direction > 0) {
for (; *y < term.row-1; *y += direction) {
- if (!(term.line[*y][term.col-1].mode
+ if (!(TLINE(*y)[term.col-1].mode
& ATTR_WRAP)) {
break;
}
@@ -602,13 +609,13 @@ getsel(void)
}
if (sel.type == SEL_RECTANGULAR) {
- gp = &term.line[y][sel.nb.x];
+ gp = &TLINE(y)[sel.nb.x];
lastx = sel.ne.x;
} else {
- gp = &term.line[y][sel.nb.y == y ? sel.nb.x : 0];
+ gp = &TLINE(y)[sel.nb.y == y ? sel.nb.x : 0];
lastx = (sel.ne.y == y) ? sel.ne.x : term.col-1;
}
- last = &term.line[y][MIN(lastx, linelen-1)];
+ last = &TLINE(y)[MIN(lastx, linelen-1)];
while (last >= gp && last->u == ' ')
--last;
@@ -844,6 +851,9 @@ void
ttywrite(const char *s, size_t n, int may_echo)
{
const char *next;
+ Arg arg = (Arg) { .i = term.scr };
+
+ kscrolldown(&arg);
if (may_echo && IS_SET(MODE_ECHO))
twrite(s, n, 1);
@@ -1055,13 +1065,53 @@ tswapscreen(void)
}
void
-tscrolldown(int orig, int n)
+kscrolldown(const Arg* a)
+{
+ int n = a->i;
+
+ if (n < 0)
+ n = term.row + n;
+
+ if (n > term.scr)
+ n = term.scr;
+
+ if (term.scr > 0) {
+ term.scr -= n;
+ selscroll(0, -n);
+ tfulldirt();
+ }
+}
+
+void
+kscrollup(const Arg* a)
+{
+ int n = a->i;
+
+ if (n < 0)
+ n = term.row + n;
+
+ if (term.scr <= HISTSIZE-n) {
+ term.scr += n;
+ selscroll(0, n);
+ tfulldirt();
+ }
+}
+
+void
+tscrolldown(int orig, int n, int copyhist)
{
int i;
Line temp;
LIMIT(n, 0, term.bot-orig+1);
+ if (copyhist) {
+ term.histi = (term.histi - 1 + HISTSIZE) % HISTSIZE;
+ temp = term.hist[term.histi];
+ term.hist[term.histi] = term.line[term.bot];
+ term.line[term.bot] = temp;
+ }
+
tsetdirt(orig, term.bot-n);
tclearregion(0, term.bot-n+1, term.col-1, term.bot);
@@ -1071,17 +1121,28 @@ tscrolldown(int orig, int n)
term.line[i-n] = temp;
}
- selscroll(orig, n);
+ if (term.scr == 0)
+ selscroll(orig, n);
}
void
-tscrollup(int orig, int n)
+tscrollup(int orig, int n, int copyhist)
{
int i;
Line temp;
LIMIT(n, 0, term.bot-orig+1);
+ if (copyhist) {
+ term.histi = (term.histi + 1) % HISTSIZE;
+ temp = term.hist[term.histi];
+ term.hist[term.histi] = term.line[orig];
+ term.line[orig] = temp;
+ }
+
+ if (term.scr > 0 && term.scr < HISTSIZE)
+ term.scr = MIN(term.scr + n, HISTSIZE-1);
+
tclearregion(0, orig, term.col-1, orig+n-1);
tsetdirt(orig+n, term.bot);
@@ -1091,7 +1152,8 @@ tscrollup(int orig, int n)
term.line[i+n] = temp;
}
- selscroll(orig, -n);
+ if (term.scr == 0)
+ selscroll(orig, -n);
}
void
@@ -1120,7 +1182,7 @@ tnewline(int first_col)
int y = term.c.y;
if (y == term.bot) {
- tscrollup(term.top, 1);
+ tscrollup(term.top, 1, 1);
} else {
y++;
}
@@ -1285,14 +1347,14 @@ void
tinsertblankline(int n)
{
if (BETWEEN(term.c.y, term.top, term.bot))
- tscrolldown(term.c.y, n);
+ tscrolldown(term.c.y, n, 0);
}
void
tdeleteline(int n)
{
if (BETWEEN(term.c.y, term.top, term.bot))
- tscrollup(term.c.y, n);
+ tscrollup(term.c.y, n, 0);
}
int32_t
@@ -1730,11 +1792,11 @@ csihandle(void)
case 'S': /* SU -- Scroll <n> line up */
if (csiescseq.priv) break;
DEFAULT(csiescseq.arg[0], 1);
- tscrollup(term.top, csiescseq.arg[0]);
+ tscrollup(term.top, csiescseq.arg[0], 0);
break;
case 'T': /* SD -- Scroll <n> line down */
DEFAULT(csiescseq.arg[0], 1);
- tscrolldown(term.top, csiescseq.arg[0]);
+ tscrolldown(term.top, csiescseq.arg[0], 0);
break;
case 'L': /* IL -- Insert <n> blank lines */
DEFAULT(csiescseq.arg[0], 1);
@@ -2306,7 +2368,7 @@ eschandle(uchar ascii)
return 0;
case 'D': /* IND -- Linefeed */
if (term.c.y == term.bot) {
- tscrollup(term.top, 1);
+ tscrollup(term.top, 1, 1);
} else {
tmoveto(term.c.x, term.c.y+1);
}
@@ -2319,7 +2381,7 @@ eschandle(uchar ascii)
break;
case 'M': /* RI -- Reverse index */
if (term.c.y == term.top) {
- tscrolldown(term.top, 1);
+ tscrolldown(term.top, 1, 1);
} else {
tmoveto(term.c.x, term.c.y-1);
}
@@ -2542,7 +2604,7 @@ twrite(const char *buf, int buflen, int show_ctrl)
void
tresize(int col, int row)
{
- int i;
+ int i, j;
int minrow = MIN(row, term.row);
int mincol = MIN(col, term.col);
int *bp;
@@ -2579,6 +2641,14 @@ tresize(int col, int row)
term.dirty = xrealloc(term.dirty, row * sizeof(*term.dirty));
term.tabs = xrealloc(term.tabs, col * sizeof(*term.tabs));
+ for (i = 0; i < HISTSIZE; i++) {
+ term.hist[i] = xrealloc(term.hist[i], col * sizeof(Glyph));
+ for (j = mincol; j < col; j++) {
+ term.hist[i][j] = term.c.attr;
+ term.hist[i][j].u = ' ';
+ }
+ }
+
/* resize each row to new width, zero-pad if needed */
for (i = 0; i < minrow; i++) {
term.line[i] = xrealloc(term.line[i], col * sizeof(Glyph));
@@ -2637,7 +2707,7 @@ drawregion(int x1, int y1, int x2, int y2)
continue;
term.dirty[y] = 0;
- xdrawline(term.line[y], x1, y, x2);
+ xdrawline(TLINE(y), x1, y, x2);
}
}
@@ -2658,8 +2728,9 @@ draw(void)
cx--;
drawregion(0, 0, term.col, term.row);
- xdrawcursor(cx, term.c.y, term.line[term.c.y][cx],
- term.ocx, term.ocy, term.line[term.ocy][term.ocx]);
+ if (term.scr == 0)
+ xdrawcursor(cx, term.c.y, term.line[term.c.y][cx],
+ term.ocx, term.ocy, term.line[term.ocy][term.ocx]);
term.ocx = cx;
term.ocy = term.c.y;
xfinishdraw();
diff --git a/st.h b/st.h
index fd3b0d8..818a6f8 100644
--- a/st.h
+++ b/st.h
@@ -81,6 +81,8 @@ void die(const char *, ...);
void redraw(void);
void draw(void);
+void kscrolldown(const Arg *);
+void kscrollup(const Arg *);
void printscreen(const Arg *);
void printsel(const Arg *);
void sendbreak(const Arg *);

View File

@ -0,0 +1,25 @@
From 6b7e7e6c5c44dd6347ad49691b80d808c1b0cb77 Mon Sep 17 00:00:00 2001
From: Jernej Jakob <jernej.jakob@gmail.com>
Date: Mon, 1 Jul 2024 14:00:02 +0200
Subject: [PATCH] [st][patch] Update st-scrollback-mouse for 0.9.2
---
config.def.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/config.def.h b/config.def.h
index 8b25d40..d259675 100644
--- a/config.def.h
+++ b/config.def.h
@@ -176,6 +176,8 @@ static uint forcemousemod = ShiftMask;
*/
static MouseShortcut mshortcuts[] = {
/* mask button function argument release */
+ { ShiftMask, Button4, kscrollup, {.i = 1} },
+ { ShiftMask, Button5, kscrolldown, {.i = 1} },
{ XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
{ ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} },
{ XK_ANY_MOD, Button4, ttysend, {.s = "\031"} },
--
2.44.2

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 319 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 473 KiB