Compare commits

...

4 Commits

Author SHA1 Message Date
davidovski 729fd14c6b blur background with picom 2024-04-04 19:00:33 +01:00
davidovski 22e5df29f2 fix davidovski patch 2024-04-04 18:58:49 +01:00
davidovski 37716d1db0 fix mkshrc and picom errors 2024-04-04 18:08:42 +01:00
davidovski 54c6b0a122 transparent st 2024-04-04 18:04:29 +01:00
16 changed files with 215 additions and 130 deletions

View File

@ -1,10 +1,10 @@
#define FG #fefefe
#define BG #191919
! #define font1 xft:minecraft enchantment:minispace=False:size=10:antialias=true
! #define spacing -2
! #define font1 minecraft enchantment:minispace=False:size=10:antialias=true
! #define spacing 2
#define font1 xft:mononoki:minispace=False:size=14:antialias=true
#define font1 mononoki:minispace=False:size=10:antialias=true
#define spacing 2
#define font2 xft:MesloLGM Nerd Font Mono:minispace=False:size=10
@ -17,8 +17,9 @@ dzen2.font: mononoki
*.foreground: FG
*.background: BG
*.alpha: 100
*.borderColor: BG
*.cursorColor: FG
*.cursorColor: FG
! black
*.color0: #282a2e
@ -55,7 +56,7 @@ dzen2.font: mononoki
! Set depth to make transparency work.
URxvt*depth: 32
*.font: mononoki:minispace=False:size=10:antialias=true
*.font: font1
URxvt.font: font1,font2,font3,font4
URxvt.boldFont: font1:style=bold,font2:style=bold,font3:style=bold,font4
URxvt.italicFont:font1:style=italic,font2:style=italic,font3:style=italic,font4

View File

@ -14,10 +14,8 @@ pgrep -x sxhkd > /dev/null || sxhkd &
pgrep -x picom > /dev/null || picom &
pgrep -x xss-lock > /dev/null || xss-lock slock &
pgrep -x bg.sh > /dev/null || $HOME/.scripts/bg.sh > /dev/null &
#pgrep -x xcompmgr > /dev/null || xcompmgr -c -C -t-5 -l-5 -r4.2 -o.55 &
[ -f "$HOME/.config/xrandr.sh" ] && . $HOME/.config/xrandr.sh
#xrandr > ~/XRANDR
primary=$(bspc query --monitors -m primary)
set -- a b c d e f g h i j k l m n o

View File

@ -17,7 +17,7 @@
# Manual sensitivity in %. Autosens must be turned off for this to take effect.
# 200 means double height. Accepts only non-negative values.
; sensitivity = 200
; sensitivity = 100
# The number of bars (0-200). 0 sets it to auto (fill up console).
# Bars' width and space between bars in number of characters.
@ -56,10 +56,10 @@
# For alsa 'source' will be the capture device.
# For fifo 'source' will be the path to fifo-file.
# For shmem 'source' will be /squeezelite-AA:BB:CC:DD:EE:FF where 'AA:BB:CC:DD:EE:FF' will be squeezelite's MAC address
source = auto
; source = auto
; method = alsa
; source = hw:Loopback,1
method = alsa
source = hw:Loopback,1
; method = fifo
; source = /tmp/mpd.fifo
@ -139,15 +139,15 @@ source = auto
# Percentage value for integral smoothing. Takes values from 0 - 100.
# Higher values means smoother, but less precise. 0 to disable.
integral = 0
; integral = 76
# Disables or enables the so-called "Monstercat smoothing" with or without "waves". Set to 0 to disable.
monstercat = 0
waves = 0
monstercat = 1
; waves = 0
# Set gravity percentage for "drop off". Higher values means bars will drop faster.
# Accepts only non-negative values. 50 means half gravity, 200 means double. Set to 0 to disable "drop off".
gravity = 400
; gravity = 100
# In bar height, bars that would have been lower that this will not be drawn.

View File

@ -17,7 +17,7 @@ animation-stiffness = 240;
# Change the mass of windows
# Modifying the mass of windows makes them virtually heavier and therefore slower to animate.
animation-window-mass = 0.5;
animation-window-mass = 1;
# Change dampening applied during the animation
# This setting basically does what it says. It dampens the animation of windows.
@ -152,11 +152,11 @@ fading = true;
# Opacity change between steps while fading in. (0.01 - 1.0, defaults to 0.028)
# fade-in-step = 0.028
fade-in-step = 0.01;
fade-in-step = 0.03;
# Opacity change between steps while fading out. (0.01 - 1.0, defaults to 0.03)
# fade-out-step = 0.03
fade-out-step = 0.01;
fade-out-step = 0.03;
# The time between steps in fade step, in milliseconds. (> 0, defaults to 10)
fade-delta = 4

View File

@ -15,24 +15,14 @@ audio_output {
audio_output {
type "pulse"
name "mpd pulse"
name "mpd"
}
#audio_output {
# type "jack"
# name "MPD jack"
#}
#audio_output {
#type "pipewire"
#name "MPD pipewire"
#}
audio_output {
type "fifo"
name "Visualizer feed"
path "/tmp/mpd.fifo"
format "22050:16:2"
format "44100:16:2"
}
db_file "~/.config/mpd/database"

View File

@ -2,7 +2,7 @@
# Corners #
#################################
# requires: https://github.com/sdhand/compton
corner-radius = 6;
corner-radius = 4;
round-borders = 0;
# Specify a list of border width rules, in the format `PIXELS:PATTERN`,
@ -29,24 +29,24 @@ shadow = true;
# The blur radius for shadows, in pixels. (defaults to 12)
# shadow-radius = 12
shadow-radius = 50;
shadow-radius = 20;
# The opacity of shadows. (1.0 - 1.0, defaults to 0.75)
shadow-opacity = 1.0;
shadow-opacity = 0.7;
# The left offset for shadows, in pixels. (defaults to -15)
# shadow-offset-x = -15
shadow-offset-x = -50;
shadow-offset-x = -20;
# The top offset for shadows, in pixels. (defaults to -15)
# shadow-offset-y = -15
shadow-offset-y = -50;
shadow-offset-y = -20;
# Don't draw shadows on drag-and-drop windows. This option is deprecated,
# you should use the *wintypes* option in your config file instead.
#
#no-dnd-shadow = true
no-dock-shadow = false
#no-dock-shadow = false
# Red color value of shadow (0.0 - 1.0, defaults to 0).
#shadow-red = 0.86328125
@ -140,13 +140,13 @@ fade-exclude = [
# Let inactive opacity set by -i override the '_NET_WM_OPACITY' values of windows.
# inactive-opacity-override = true
inactive-opacity-override = false;
inactive-opacity-override = true;
# Default opacity for active windows. (0.0 - 1.0, defaults to 1.0)
active-opacity = 1.0;
# Dim inactive windows. (0.0 - 1.0, defaults to 0.0)
# inactive-dim = 0.0
inactive-dim = 0.0
# Specify a list of conditions of windows that should always be considered focused.
# focus-exclude = []
@ -208,12 +208,11 @@ blur-background = true;
blur: {
# requires: https://github.com/ibhagwan/picom
method = "none";
#method = "kernel";
strength = 0;
# deviation = 1.0;
# kernel = "11x11gaussian";
background = false;
#method = "none";
method = "kawase";
strength = 3;
deviation = 1.0;
background = true;
background-frame = false;
background-fixed = false;
kern = "3x3box";
@ -221,7 +220,7 @@ blur: {
# Exclude conditions for background blur.
blur-background-exclude = [
"class_g = 'slop'",
"class_g != 'St'",
"_GTK_FRAME_EXTENTS@:c"
];
@ -239,7 +238,7 @@ daemon = true
experimental-backends = true;
backend = "glx";
vsync = true
vsync = false
# Enable remote control via D-Bus. See the *D-BUS API* section below for more details.
# dbus = false

View File

@ -4,8 +4,8 @@ offsety = 24
[color]
bg = #191919
bga = #191919
fg4= #f58d44
bga = #CC191919
fg4 = #f58d44
fg2 = #5f819d
fg3 = #707880
fg1 = #fefefe
@ -40,7 +40,7 @@ modules-right = time
[bar/ws]
inherit = bar/base
width = 2510
width = 1870
offset-x = 25
offset-y = 10
modules-left = workspaces xwindow

View File

@ -46,7 +46,7 @@
}
#message {
border: 0px 0px 0px;
border: 2px 0px 0px;
border-color: @border-color;
padding: 1px;
}
@ -68,7 +68,7 @@
#listview {
fixed-height: 0;
border: 0px 0px 0px;
border: 2px 0px 0px;
border-color: @border-color;
spacing: 2px;
scrollbar: true;

View File

@ -73,7 +73,7 @@ super + i
# open audio mixer
super + semicolon
bspc rule -a \* -o state=floating && $TERMINAL -e pulsemixer
bspc rule -a \* -o state=floating && $TERMINAL -e pulsemixer
# xkill
ctrl + alt + Escape
@ -233,7 +233,7 @@ super + f
super + d
[ -z "$(bspc query -N -n focused.sticky)" ] && \
bspc node focused -g sticky=on || \
bspc node focused -g stick=off;
bspc node focused -g sticky=off;
super + ctrl + f
bspc node -t \~fullscreen

View File

@ -71,13 +71,13 @@ nmap <silent> <leader>re <Plug>(coc-codeaction-refactor)
xmap <silent> <leader>r <Plug>(coc-codeaction-refactor-selected)
" nmap <silent> <leader>r <Plug>(coc-codeaction-refactor-selected)
inoremap <silent><expr> <TAB>
\ coc#pum#visible() ? coc#pum#next(1) :
\ CheckBackspace() ? "\<Tab>" :
\ coc#refresh()
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
"inoremap <silent><expr> <TAB>
" \ coc#pum#visible() ? coc#pum#next(1) :
" \ CheckBackspace() ? "\<Tab>" :
" \ coc#refresh()
"inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
"inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
function! CheckBackspace() abort

2
mkshrc
View File

@ -55,4 +55,4 @@ parse_git_dirty () {
bind '^L=clear-screen'
export PS1="\${PWD/#\$HOME/\~}\`parse_git_branch\` > ")
export PS1="\${PWD/#\$HOME/\~}\`parse_git_branch\` > "

View File

@ -14,7 +14,7 @@ export FILE_MANAGER="/usr/bin/thunar"
export EMAIL_CLIENT="/usr/bin/claws-mail"
export EDITOR="/usr/bin/vim"
export JAVA_HOME=/usr/lib/jvm/java-19-openjdk/
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk/
export XINITRC="$HOME/.config/sx/sxrc"
[ "$(fgconsole 2>/dev/null)" = "1" ] && exec sx

View File

@ -2,4 +2,4 @@
query=${1}
cd ~/music
find . -iname "*$query*" -type f | while read -r line; do mpc insert "${line#./}"; done
find . -iname "*$query*" -type f | while read -r line; do echo "$line"; mpc insert "${line#./}"; done

View File

@ -1,7 +1,7 @@
#!/bin/sh
# add recently added files to the playlist
count=${1:-10}
count=${1:-25}
cd ~/music
find . -type f -print0 | xargs -0 stat -c"%Y %n" | sort -n | tail -${count} |cut -d' ' -f2- | while read -r line; do mpc insert "${line#./}"; done

View File

@ -1,4 +1,7 @@
#!/bin/sh
#
#
# TODO make this list results in rofi/dmenu that would be coo
default_browser="links-launcher"
BROWSER=${BROWSER:-$default_browser}

View File

@ -1,26 +1,3 @@
From d71723fb393211ce03bae41e26d962b25e3dae98 Mon Sep 17 00:00:00 2001
From: davidovski <david@davidovski.xyz>
Date: Mon, 4 Dec 2023 23:42:07 +0000
Subject: [PATCH] davidovski
---
Makefile | 6 +-
boxdraw.c | 194 ++++++++++++++++++
boxdraw_data.h | 214 ++++++++++++++++++++
config.def.h | 60 +++++-
config.h | 532 +++++++++++++++++++++++++++++++++++++++++++++++++
st.c | 164 ++++++++++++---
st.desktop | 8 +
st.h | 12 ++
st.info | 4 +-
win.h | 4 +-
x.c | 243 ++++++++++++++++++++--
11 files changed, 1393 insertions(+), 48 deletions(-)
create mode 100644 boxdraw.c
create mode 100644 boxdraw_data.h
create mode 100644 config.h
create mode 100644 st.desktop
diff --git a/Makefile b/Makefile
index 15db421..bc75c1d 100644
--- a/Makefile
@ -476,7 +453,7 @@ index 0000000..7890500
+ /* U+2571 - U+2573: unsupported (diagonals) */
+};
diff --git a/config.def.h b/config.def.h
index 91ab8ca..b55e689 100644
index 91ab8ca..805e09d 100644
--- a/config.def.h
+++ b/config.def.h
@@ -5,7 +5,13 @@
@ -513,7 +490,17 @@ index 91ab8ca..b55e689 100644
/*
* bell volume. It must be a value between -100 and 100. Use 0 for disabling
* it
@@ -170,12 +188,50 @@ static unsigned int defaultattr = 11;
@@ -93,6 +111,9 @@ char *termname = "st-256color";
*/
unsigned int tabspaces = 8;
+/* bg opacity */
+float alpha = 0.8;
+
/* Terminal colors (16 first used in escape sequence) */
static const char *colorname[] = {
/* 8 normal colors */
@@ -170,12 +191,50 @@ static unsigned int defaultattr = 11;
*/
static uint forcemousemod = ShiftMask;
@ -564,7 +551,7 @@ index 91ab8ca..b55e689 100644
{ XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
{ ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} },
{ XK_ANY_MOD, Button4, ttysend, {.s = "\031"} },
@@ -201,6 +257,8 @@ static Shortcut shortcuts[] = {
@@ -201,6 +260,8 @@ static Shortcut shortcuts[] = {
{ TERMMOD, XK_Y, selpaste, {.i = 0} },
{ ShiftMask, XK_Insert, selpaste, {.i = 0} },
{ TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
@ -575,10 +562,10 @@ index 91ab8ca..b55e689 100644
/*
diff --git a/config.h b/config.h
new file mode 100644
index 0000000..b55e689
index 0000000..206c72d
--- /dev/null
+++ b/config.h
@@ -0,0 +1,532 @@
@@ -0,0 +1,536 @@
+/* See LICENSE file for copyright and license details. */
+
+/*
@ -733,6 +720,10 @@ index 0000000..b55e689
+unsigned int defaultcs = 256;
+static unsigned int defaultrcs = 257;
+
+/*
+ * Default alpha
+ */
+float alpha = 0.75;
+/*
+ * Default shape of cursor
+ * 2: Block ("█")
@ -1111,8 +1102,21 @@ index 0000000..b55e689
+ " !\"#$%&'()*+,-./0123456789:;<=>?"
+ "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
+ "`abcdefghijklmnopqrstuvwxyz{|}~";
diff --git a/config.mk b/config.mk
index 1e306f8..47c615e 100644
--- a/config.mk
+++ b/config.mk
@@ -16,7 +16,7 @@ PKG_CONFIG = pkg-config
INCS = -I$(X11INC) \
`$(PKG_CONFIG) --cflags fontconfig` \
`$(PKG_CONFIG) --cflags freetype2`
-LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft \
+LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft -lXrender\
`$(PKG_CONFIG) --libs fontconfig` \
`$(PKG_CONFIG) --libs freetype2`
diff --git a/st.c b/st.c
index d6478f5..1fd732e 100644
index 77c3e8a..df6d4c9 100644
--- a/st.c
+++ b/st.c
@@ -35,6 +35,7 @@
@ -1369,9 +1373,9 @@ index d6478f5..1fd732e 100644
}
int32_t
@@ -1729,11 +1794,11 @@ csihandle(void)
break;
@@ -1730,11 +1795,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);
@ -1383,7 +1387,7 @@ index d6478f5..1fd732e 100644
break;
case 'L': /* IL -- Insert <n> blank lines */
DEFAULT(csiescseq.arg[0], 1);
@@ -1809,6 +1874,33 @@ csihandle(void)
@@ -1810,6 +1875,33 @@ csihandle(void)
goto unknown;
}
break;
@ -1417,7 +1421,7 @@ index d6478f5..1fd732e 100644
}
}
@@ -1887,7 +1979,7 @@ strhandle(void)
@@ -1888,7 +1980,7 @@ strhandle(void)
switch (par) {
case 0:
if (narg > 1) {
@ -1426,7 +1430,7 @@ index d6478f5..1fd732e 100644
xseticontitle(strescseq.args[1]);
}
return;
@@ -1897,7 +1989,7 @@ strhandle(void)
@@ -1898,7 +1990,7 @@ strhandle(void)
return;
case 2:
if (narg > 1)
@ -1435,7 +1439,7 @@ index d6478f5..1fd732e 100644
return;
case 52:
if (narg > 2 && allowwindowops) {
@@ -1956,7 +2048,7 @@ strhandle(void)
@@ -1957,7 +2049,7 @@ strhandle(void)
}
break;
case 'k': /* old title set compatibility */
@ -1444,7 +1448,7 @@ index d6478f5..1fd732e 100644
return;
case 'P': /* DCS -- Device Control String */
case '_': /* APC -- Application Program Command */
@@ -2305,7 +2397,7 @@ eschandle(uchar ascii)
@@ -2310,7 +2402,7 @@ eschandle(uchar ascii)
return 0;
case 'D': /* IND -- Linefeed */
if (term.c.y == term.bot) {
@ -1453,7 +1457,7 @@ index d6478f5..1fd732e 100644
} else {
tmoveto(term.c.x, term.c.y+1);
}
@@ -2318,7 +2410,7 @@ eschandle(uchar ascii)
@@ -2323,7 +2415,7 @@ eschandle(uchar ascii)
break;
case 'M': /* RI -- Reverse index */
if (term.c.y == term.top) {
@ -1462,7 +1466,7 @@ index d6478f5..1fd732e 100644
} else {
tmoveto(term.c.x, term.c.y-1);
}
@@ -2328,6 +2420,7 @@ eschandle(uchar ascii)
@@ -2333,6 +2425,7 @@ eschandle(uchar ascii)
break;
case 'c': /* RIS -- Reset to initial state */
treset();
@ -1470,7 +1474,7 @@ index d6478f5..1fd732e 100644
resettitle();
xloadcols();
xsetmode(0, MODE_HIDE);
@@ -2541,7 +2634,7 @@ twrite(const char *buf, int buflen, int show_ctrl)
@@ -2546,7 +2639,7 @@ twrite(const char *buf, int buflen, int show_ctrl)
void
tresize(int col, int row)
{
@ -1479,7 +1483,7 @@ index d6478f5..1fd732e 100644
int minrow = MIN(row, term.row);
int mincol = MIN(col, term.col);
int *bp;
@@ -2578,6 +2671,14 @@ tresize(int col, int row)
@@ -2583,6 +2676,14 @@ tresize(int col, int row)
term.dirty = xrealloc(term.dirty, row * sizeof(*term.dirty));
term.tabs = xrealloc(term.tabs, col * sizeof(*term.tabs));
@ -1494,7 +1498,7 @@ index d6478f5..1fd732e 100644
/* 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));
@@ -2623,7 +2724,7 @@ tresize(int col, int row)
@@ -2628,7 +2729,7 @@ tresize(int col, int row)
void
resettitle(void)
{
@ -1503,7 +1507,7 @@ index d6478f5..1fd732e 100644
}
void
@@ -2636,7 +2737,7 @@ drawregion(int x1, int y1, int x2, int y2)
@@ -2641,7 +2742,7 @@ drawregion(int x1, int y1, int x2, int y2)
continue;
term.dirty[y] = 0;
@ -1512,7 +1516,7 @@ index d6478f5..1fd732e 100644
}
}
@@ -2657,8 +2758,9 @@ draw(void)
@@ -2662,8 +2763,9 @@ draw(void)
cx--;
drawregion(0, 0, term.col, term.row);
@ -1539,7 +1543,7 @@ index 0000000..49029d8
+Type=Application
+Categories=System;TerminalEmulator;
diff --git a/st.h b/st.h
index fd3b0d8..f6bd3b4 100644
index fd3b0d8..c248ec6 100644
--- a/st.h
+++ b/st.h
@@ -33,6 +33,7 @@ enum glyph_attribute {
@ -1574,10 +1578,11 @@ index fd3b0d8..f6bd3b4 100644
/* config.h globals */
extern char *utmp;
extern char *scroll;
@@ -124,3 +135,4 @@ extern unsigned int tabspaces;
@@ -124,3 +135,5 @@ extern unsigned int tabspaces;
extern unsigned int defaultfg;
extern unsigned int defaultbg;
extern unsigned int defaultcs;
+extern float alpha;
+extern const int boxdraw, boxdraw_bold, boxdraw_braille;
diff --git a/st.info b/st.info
index efab2cf..24dfc7d 100644
@ -1617,7 +1622,7 @@ index 6de960d..2a40aa0 100644
void xsetmode(int, unsigned int);
void xsetpointermotion(int);
diff --git a/x.c b/x.c
index b36fb8c..ccfb7e7 100644
index b36fb8c..458e4af 100644
--- a/x.c
+++ b/x.c
@@ -14,6 +14,7 @@
@ -1658,7 +1663,15 @@ index b36fb8c..ccfb7e7 100644
/* XEMBED messages */
#define XEMBED_FOCUS_IN 4
#define XEMBED_FOCUS_OUT 5
@@ -157,6 +174,8 @@ static void xhints(void);
@@ -105,6 +122,7 @@ typedef struct {
XSetWindowAttributes attrs;
int scr;
int isfixed; /* is fixed geometry? */
+ int depth; /* bit depth */
int l, t; /* left and top offset */
int gm; /* geometry mask */
} XWindow;
@@ -157,6 +175,8 @@ static void xhints(void);
static int xloadcolor(int, const char *, Color *);
static int xloadfont(Font *, FcPattern *);
static void xloadfonts(const char *, double);
@ -1667,7 +1680,7 @@ index b36fb8c..ccfb7e7 100644
static void xunloadfont(Font *);
static void xunloadfonts(void);
static void xsetenv(void);
@@ -220,6 +239,8 @@ static DC dc;
@@ -220,6 +240,8 @@ static DC dc;
static XWindow xw;
static XSelection xsel;
static TermWindow win;
@ -1676,7 +1689,15 @@ index b36fb8c..ccfb7e7 100644
/* Font Ring Cache */
enum {
@@ -306,6 +327,7 @@ zoomabs(const Arg *arg)
@@ -243,6 +265,7 @@ static char *usedfont = NULL;
static double usedfontsize = 0;
static double defaultfontsize = 0;
+static char *opt_alpha = NULL;
static char *opt_class = NULL;
static char **opt_cmd = NULL;
static char *opt_embed = NULL;
@@ -306,6 +329,7 @@ zoomabs(const Arg *arg)
{
xunloadfonts();
xloadfonts(usedfont, arg->f);
@ -1684,7 +1705,7 @@ index b36fb8c..ccfb7e7 100644
cresize(0, 0);
redraw();
xhints();
@@ -686,6 +708,8 @@ setsel(char *str, Time t)
@@ -686,6 +710,8 @@ setsel(char *str, Time t)
XSetSelectionOwner(xw.dpy, XA_PRIMARY, xw.win, t);
if (XGetSelectionOwner(xw.dpy, XA_PRIMARY) != xw.win)
selclear();
@ -1693,7 +1714,30 @@ index b36fb8c..ccfb7e7 100644
}
void
@@ -859,8 +883,8 @@ xclear(int x1, int y1, int x2, int y2)
@@ -752,7 +778,7 @@ xresize(int col, int row)
XFreePixmap(xw.dpy, xw.buf);
xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
- DefaultDepth(xw.dpy, xw.scr));
+ xw.depth);
XftDrawChange(xw.draw, xw.buf);
xclear(0, 0, win.w, win.h);
@@ -812,6 +838,13 @@ xloadcols(void)
else
die("could not allocate color %d\n", i);
}
+
+ /* set alpha value of bg color */
+ if (opt_alpha)
+ alpha = strtof(opt_alpha, NULL);
+ dc.col[defaultbg].color.alpha = (unsigned short)(0xffff * alpha);
+ dc.col[defaultbg].pixel &= 0x00FFFFFF;
+ dc.col[defaultbg].pixel |= (unsigned char)(0xff * alpha) << 24;
loaded = 1;
}
@@ -859,8 +892,8 @@ xclear(int x1, int y1, int x2, int y2)
void
xhints(void)
{
@ -1704,7 +1748,7 @@ index b36fb8c..ccfb7e7 100644
XWMHints wm = {.flags = InputHint, .input = 1};
XSizeHints *sizeh;
@@ -1050,6 +1074,101 @@ xloadfonts(const char *fontstr, double fontsize)
@@ -1050,6 +1083,101 @@ xloadfonts(const char *fontstr, double fontsize)
FcPatternDestroy(pattern);
}
@ -1806,16 +1850,33 @@ index b36fb8c..ccfb7e7 100644
void
xunloadfont(Font *f)
{
@@ -1135,8 +1254,6 @@ xinit(int cols, int rows)
@@ -1134,11 +1262,22 @@ xinit(int cols, int rows)
Window parent;
pid_t thispid = getpid();
XColor xmousefg, xmousebg;
+ XWindowAttributes attr;
+ XVisualInfo vis;
+
- if (!(xw.dpy = XOpenDisplay(NULL)))
- die("can't open display\n");
xw.scr = XDefaultScreen(xw.dpy);
xw.vis = XDefaultVisual(xw.dpy, xw.scr);
- xw.vis = XDefaultVisual(xw.dpy, xw.scr);
+
+ if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) {
+ parent = XRootWindow(xw.dpy, xw.scr);
+ xw.depth = 32;
+ } else {
+ XGetWindowAttributes(xw.dpy, parent, &attr);
+ xw.depth = attr.depth;
+ }
+
+ XMatchVisualInfo(xw.dpy, xw.scr, xw.depth, TrueColor, &vis);
+ xw.vis = vis.visual;
@@ -1147,6 +1264,9 @@ xinit(int cols, int rows)
/* font */
if (!FcInit())
@@ -1147,8 +1286,11 @@ xinit(int cols, int rows)
usedfont = (opt_font == NULL)? font : opt_font;
xloadfonts(usedfont, 0);
@ -1823,9 +1884,35 @@ index b36fb8c..ccfb7e7 100644
+ xloadsparefonts();
+
/* colors */
xw.cmap = XDefaultColormap(xw.dpy, xw.scr);
- xw.cmap = XDefaultColormap(xw.dpy, xw.scr);
+ xw.cmap = XCreateColormap(xw.dpy, parent, xw.vis, None);
xloadcols();
@@ -1237,6 +1357,8 @@ xinit(int cols, int rows)
/* adjust fixed window geometry */
@@ -1168,19 +1310,15 @@ xinit(int cols, int rows)
| ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
xw.attrs.colormap = xw.cmap;
- if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0))))
- parent = XRootWindow(xw.dpy, xw.scr);
xw.win = XCreateWindow(xw.dpy, parent, xw.l, xw.t,
- win.w, win.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput,
+ win.w, win.h, 0, xw.depth, InputOutput,
xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity
| CWEventMask | CWColormap, &xw.attrs);
memset(&gcvalues, 0, sizeof(gcvalues));
gcvalues.graphics_exposures = False;
- dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures,
- &gcvalues);
- xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
- DefaultDepth(xw.dpy, xw.scr));
+ xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, xw.depth);
+ dc.gc = XCreateGC(xw.dpy, xw.buf, GCGraphicsExposures, &gcvalues);
XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel);
XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h);
@@ -1237,6 +1375,8 @@ xinit(int cols, int rows)
xsel.xtarget = XInternAtom(xw.dpy, "UTF8_STRING", 0);
if (xsel.xtarget == None)
xsel.xtarget = XA_STRING;
@ -1834,7 +1921,7 @@ index b36fb8c..ccfb7e7 100644
}
int
@@ -1283,8 +1405,13 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
@@ -1283,8 +1423,13 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
yp = winy + font->ascent;
}
@ -1850,7 +1937,7 @@ index b36fb8c..ccfb7e7 100644
if (glyphidx) {
specs[numspecs].font = font->match;
specs[numspecs].glyph = glyphidx;
@@ -1488,8 +1615,12 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
@@ -1488,8 +1633,12 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
r.width = width;
XftDrawSetClipRectangles(xw.draw, winx, winy, &r, 1);
@ -1865,7 +1952,7 @@ index b36fb8c..ccfb7e7 100644
/* Render underline and strikethrough. */
if (base.mode & ATTR_UNDERLINE) {
@@ -1532,7 +1663,7 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
@@ -1532,7 +1681,7 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
/*
* Select the right color for the right mode.
*/
@ -1874,7 +1961,7 @@ index b36fb8c..ccfb7e7 100644
if (IS_SET(MODE_REVERSE)) {
g.mode |= ATTR_REVERSE;
@@ -1626,10 +1757,30 @@ xseticontitle(char *p)
@@ -1626,10 +1775,30 @@ xseticontitle(char *p)
}
void
@ -1908,7 +1995,7 @@ index b36fb8c..ccfb7e7 100644
if (Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
&prop) != Success)
@@ -1639,6 +1790,16 @@ xsettitle(char *p)
@@ -1639,6 +1808,16 @@ xsettitle(char *p)
XFree(prop.value);
}
@ -1925,7 +2012,7 @@ index b36fb8c..ccfb7e7 100644
int
xstartdraw(void)
{
@@ -2014,6 +2175,59 @@ run(void)
@@ -2014,6 +2193,59 @@ run(void)
}
}
@ -1985,7 +2072,17 @@ index b36fb8c..ccfb7e7 100644
void
usage(void)
{
@@ -2087,6 +2301,11 @@ run:
@@ -2038,6 +2270,9 @@ main(int argc, char *argv[])
case 'a':
allowaltscreen = 0;
break;
+ case 'A':
+ opt_alpha = EARGF(usage());
+ break;
case 'c':
opt_class = EARGF(usage());
break;
@@ -2087,6 +2322,11 @@ run:
setlocale(LC_CTYPE, "");
XSetLocaleModifiers("");
@ -1997,6 +2094,3 @@ index b36fb8c..ccfb7e7 100644
cols = MAX(cols, 1);
rows = MAX(rows, 1);
tnew(cols, rows);
--
2.43.0