diff --git a/.local/share/kaomoji b/.local/share/kaomoji index b03258a..023dcc3 100644 --- a/.local/share/kaomoji +++ b/.local/share/kaomoji @@ -378,7 +378,7 @@ o(^_-)O Boxer {{|└(>o< )┘|}} Up In Arms (^^)// Applause (2) ( `_)?(_' ) Dueling -(´~`) Weary +(´~`) WearY v(^_^)v Victory (3) (ノ_ _)ノ Surrender <( ・ェ-)<} Bow and Arrow @@ -452,3 +452,4 @@ o(>< )o⌒* Mad (3) \(~O~)/ Good Morning \_(´▽`)♪_/ Bathtub ( • )( • )ԅ(≖‿≖ԅ) BOOB +◣_◢ angry diff --git a/Xdefaults b/Xdefaults index ae6f395..f08b7e2 100644 --- a/Xdefaults +++ b/Xdefaults @@ -4,8 +4,8 @@ ! #define font1 xft:minecraft enchantment:minispace=False:size=10:antialias=true ! #define spacing -2 -#define font1 xft:mononoki:minispace=False:size=10:antialias=true -#define spacing 1 +#define font1 xft:mononoki:minispace=False:size=14:antialias=true +#define spacing 2 #define font2 xft:MesloLGM Nerd Font Mono:minispace=False:size=10 #define font3 xft:Noto Sans Mono CJK TC:minispace=False:size=10 @@ -55,12 +55,13 @@ dzen2.font: mononoki ! Set depth to make transparency work. URxvt*depth: 32 -*.font: font1 +*.font: mononoki:minispace=False:size=10:antialias=true 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 URxvt.boldItalicfont: font1:style=bolditalic,font2:style=bolditalic,font3:style=bolditalic,font4 +*.borderpx: 20 URxvt.internalBorder: 20 *.cursorBlink: true URxvt.cursorUnderline: true @@ -72,12 +73,10 @@ URxvt.geometry: 92x24 URxvt.urgentOnBell: true URxvt.iso14755: false -urxvt*dynamicColors: on +URxvt*dynamicColors: on XTerm*faceName: font1,font2,font3,font4 - - !-- Xft settings -- ! Xft.dpi: 112 Xft.antialias: true @@ -85,7 +84,7 @@ Xft.rgba: rgb Xft.hinting: true Xft.hintstyle: hintfull -URxvt.perl-ext-common: resize-font,config-reload +URxvt.perl-ext-common: resize-font URxvt.url-launcher: /usr/bin/xdg-open URxvt.matcher.button: 1 @@ -101,3 +100,10 @@ URxvt*scrollTtyKeypress: true URxvt.keysym.Shift-Control-V: eval:paste_clipboard URxvt.keysym.Shift-Control-C: eval:selection_to_clipboard + + +*label.renderTable: variable +*.renderTable.variable.fontName: Sans +*.renderTable.variable.fontSize: 10 +*.renderTable.variable.fontType: FONT_IS_XFT + diff --git a/bspwm/change_update_order.patch b/bspwm/change_update_order.patch new file mode 100644 index 0000000..f27dce9 --- /dev/null +++ b/bspwm/change_update_order.patch @@ -0,0 +1,55 @@ + +diff --git a/src/ewmh.c b/src/ewmh.c +index 52f7e53..bdda6a7 100644 +--- a/src/ewmh.c ++++ b/src/ewmh.c +@@ -93,7 +93,12 @@ void ewmh_update_current_desktop(void) + if (mon == NULL) { + return; + } +- uint32_t i = ewmh_get_desktop_index(mon->desk); ++ ewmh_set_current_desktop(mon->desk); ++} ++ ++void ewmh_set_current_desktop(desktop_t *d) ++{ ++ uint32_t i = ewmh_get_desktop_index(d); + xcb_ewmh_set_current_desktop(ewmh, default_screen, i); + } + +diff --git a/src/ewmh.h b/src/ewmh.h +index 3b50e35..0781eb6 100644 +--- a/src/ewmh.h ++++ b/src/ewmh.h +@@ -35,6 +35,7 @@ void ewmh_update_number_of_desktops(void); + uint32_t ewmh_get_desktop_index(desktop_t *d); + bool ewmh_locate_desktop(uint32_t i, coordinates_t *loc); + void ewmh_update_current_desktop(void); ++void ewmh_set_current_desktop(desktop_t *d); + void ewmh_set_wm_desktop(node_t *n, desktop_t *d); + void ewmh_update_wm_desktops(void); + void ewmh_update_desktop_names(void); +diff --git a/src/tree.c b/src/tree.c +index 52055c5..3762335 100644 +--- a/src/tree.c ++++ b/src/tree.c +@@ -643,14 +643,18 @@ bool focus_node(monitor_t *m, desktop_t *d, node_t *n) + } + + if (m->desk != d) { ++ ewmh_set_current_desktop(d); ++ put_status(SBSC_MASK_DESKTOP_FOCUS, "desktop_focus 0x%08X 0x%08X\n", m->id, d->id); ++ + show_desktop(d); + set_input_focus(n); + has_input_focus = true; + hide_desktop(m->desk); + m->desk = d; ++ + } + +- if (desk_changed) { ++ if (m != mon) { + ewmh_update_current_desktop(); + put_status(SBSC_MASK_DESKTOP_FOCUS, "desktop_focus 0x%08X 0x%08X\n", m->id, d->id); + } diff --git a/bspwm/deploy.sh b/bspwm/deploy.sh new file mode 100755 index 0000000..65b9fd1 --- /dev/null +++ b/bspwm/deploy.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +wd="$HOME/.local/src/bspwm" + +[ ! -d "$HOME/.local/src" ] && mkdir -p "$wd" + +rm -rf "$wd" +git clone https://github.com/baskerville/bspwm "$wd" + +patch -d "$wd" -p1 -i $(realpath change_update_order.patch) + +make -C "$wd" +doas make -C "$wd" install PREFIX=/usr diff --git a/compfy/deploy.sh b/compfy/deploy.sh new file mode 100755 index 0000000..3a598cb --- /dev/null +++ b/compfy/deploy.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +wd="$HOME/.local/src/compfy" + +[ ! -d "$HOME/.local/src" ] && mkdir -p "$wd" + +rm -rf "$wd" +git clone https://github.com/allusive-dev/compfy "$wd" + +patch -d "$wd" -p1 -i $(realpath uncomment_sliding_animation.patch) + +cd "$wd" +meson build && meson compile -C build && doas meson install -C build +cd - diff --git a/compfy/uncomment_sliding_animation.patch b/compfy/uncomment_sliding_animation.patch new file mode 100644 index 0000000..77f613d --- /dev/null +++ b/compfy/uncomment_sliding_animation.patch @@ -0,0 +1,259 @@ +diff --git a/src/common.h b/src/common.h +index 978acf7..bcffb81 100644 +--- a/src/common.h ++++ b/src/common.h +@@ -186,9 +186,9 @@ typedef struct session { + /// Width of root window. + int root_width; + /// Current desktop number of root window +- // int root_desktop_num; ++ int root_desktop_num; + /// Desktop switch direction +- // int root_desktop_switch_direction; ++ int root_desktop_switch_direction; + /// X Composite overlay window. + xcb_window_t overlay; + /// The target window for debug mode +diff --git a/src/compfy.c b/src/compfy.c +index 975bfaf..d5dcc54 100644 +--- a/src/compfy.c ++++ b/src/compfy.c +@@ -597,13 +597,13 @@ static void configure_root(session_t *ps) { + ps->root_width = r->width; + ps->root_height = r->height; + +- // auto prop = x_get_prop(ps->c, ps->root, ps->atoms->a_NET_CURRENT_DESKTOP, +- // 1L, XCB_ATOM_CARDINAL, 32); ++ auto prop = x_get_prop(ps->c, ps->root, ps->atoms->a_NET_CURRENT_DESKTOP, ++ 1L, XCB_ATOM_CARDINAL, 32); + +- // ps->root_desktop_switch_direction = 0; +- // if (prop.nitems) { +- // ps->root_desktop_num = (int)*prop.c32; +- // } ++ ps->root_desktop_switch_direction = 0; ++ if (prop.nitems) { ++ ps->root_desktop_num = (int)*prop.c32; ++ } + + rebuild_screen_reg(ps); + rebuild_shadow_exclude_reg(ps); +@@ -1752,7 +1752,7 @@ static void draw_callback_impl(EV_P_ session_t *ps, int revents attr_unused) { + } + if (!animation_running) { + ps->animation_time = 0L; +- // ps->root_desktop_switch_direction = 0; ++ ps->root_desktop_switch_direction = 0; + } + + // TODO(yshui) Investigate how big the X critical section needs to be. There are +diff --git a/src/config.c b/src/config.c +index deca6ad..45da9a0 100644 +--- a/src/config.c ++++ b/src/config.c +@@ -759,6 +759,8 @@ enum wm_support parse_wm_support(const char *src) { + return WM_SUPPORT_HERB; + } else if (strcmp(src, "dwm") == 0) { + return WM_SUPPORT_DWM; ++ } else if (strcmp(src, "bspwm") == 0) { ++ return WM_SUPPORT_BSPWM; + } else if (strcmp(src, "legacy") == 0) { + return WM_SUPPORT_LEGACY; + } +diff --git a/src/config.h b/src/config.h +index 4276203..fe03eca 100644 +--- a/src/config.h ++++ b/src/config.h +@@ -49,8 +49,8 @@ enum open_window_animation { + OPEN_WINDOW_ANIMATION_SLIDE_DOWN, + OPEN_WINDOW_ANIMATION_SLIDE_LEFT, + OPEN_WINDOW_ANIMATION_SLIDE_RIGHT, +- // OPEN_WINDOW_ANIMATION_SLIDE_IN, +- // OPEN_WINDOW_ANIMATION_SLIDE_OUT, ++ OPEN_WINDOW_ANIMATION_SLIDE_IN, ++ OPEN_WINDOW_ANIMATION_SLIDE_OUT, + OPEN_WINDOW_ANIMATION_INVALID, + }; + +@@ -59,6 +59,7 @@ enum wm_support { + WM_SUPPORT_AWESOME, + WM_SUPPORT_HERB, + WM_SUPPORT_DWM, ++ WM_SUPPORT_BSPWM, + WM_SUPPORT_LEGACY, + WM_SUPPORT_INVALID, + }; +diff --git a/src/event.c b/src/event.c +index acbc82d..bf5bd1d 100644 +--- a/src/event.c ++++ b/src/event.c +@@ -450,15 +450,15 @@ static inline void ev_property_notify(session_t *ps, xcb_property_notify_event_t + + if (ps->root == ev->window) { + // If desktop number property changes +- // if (ev->atom == ps->atoms->a_NET_CURRENT_DESKTOP) { +- // auto prop = x_get_prop(ps->c, ps->root, ps->atoms->a_NET_CURRENT_DESKTOP, +- // 1L, XCB_ATOM_CARDINAL, 32); +- +- // if (prop.nitems) { +- // ps->root_desktop_switch_direction = ((int)*prop.c32) - ps->root_desktop_num; +- // ps->root_desktop_num = (int)*prop.c32; +- // } +- // } ++ if (ev->atom == ps->atoms->a_NET_CURRENT_DESKTOP) { ++ auto prop = x_get_prop(ps->c, ps->root, ps->atoms->a_NET_CURRENT_DESKTOP, ++ 1L, XCB_ATOM_CARDINAL, 32); ++ ++ if (prop.nitems) { ++ ps->root_desktop_switch_direction = ((int)*prop.c32) - ps->root_desktop_num; ++ ps->root_desktop_num = (int)*prop.c32; ++ } ++ } + + if (ps->o.use_ewmh_active_win && ps->atoms->a_NET_ACTIVE_WINDOW == ev->atom) { + // to update focus +diff --git a/src/win.c b/src/win.c +index 4d96bb7..df3af08 100644 +--- a/src/win.c ++++ b/src/win.c +@@ -484,13 +484,9 @@ static void init_animation(session_t *ps, struct managed_win *w) { + if (ps->o.wintype_option[w->window_type].animation < OPEN_WINDOW_ANIMATION_INVALID) + animation = ps->o.wintype_option[w->window_type].animation; + +- // if (ps->root_desktop_switch_direction != 0) { +- // if (ps->o.animation_for_workspace_switch_in == OPEN_WINDOW_ANIMATION_AUTO) { +- // animation = OPEN_WINDOW_ANIMATION_SLIDE_IN; +- // } else { +- // animation = ps->o.animation_for_workspace_switch_in; +- // } +- // } ++ if (ps->root_desktop_switch_direction != 0) { ++ animation = OPEN_WINDOW_ANIMATION_SLIDE_IN; ++ } + + if (c2_match(ps, w, ps->o.animation_open_blacklist, NULL)) { + animation = OPEN_WINDOW_ANIMATION_NONE; +@@ -553,28 +549,16 @@ static void init_animation(session_t *ps, struct managed_win *w) { + w->animation_h = w->pending_g.height; + break; + } +- // case OPEN_WINDOW_ANIMATION_SLIDE_IN: { +- // w->animation_center_x = w->pending_g.x + w->pending_g.width * 0.5; +- // w->animation_center_y = w->pending_g.y + w->pending_g.height * 0.5 - +- // ps->root_height * +- // ((ps->root_desktop_switch_direction < 0 && +- // ps->root_desktop_switch_direction >= -1) || +- // ps->root_desktop_switch_direction > 1?1:-1); +- // w->animation_w = w->pending_g.width; +- // w->animation_h = w->pending_g.height; +- // break; +- // } +- // case OPEN_WINDOW_ANIMATION_SLIDE_OUT: { +- // w->animation_dest_center_x = w->pending_g.x + w->pending_g.width * 0.5; +- // w->animation_dest_center_y = w->pending_g.y + w->pending_g.height * 0.5 - +- // ps->root_height * +- // ((ps->root_desktop_switch_direction < 0 && +- // ps->root_desktop_switch_direction >= -1) || +- // ps->root_desktop_switch_direction > 1?-1:1); +- // w->animation_dest_w = w->pending_g.width; +- // w->animation_dest_h = w->pending_g.height; +- // break; +- // } ++ case OPEN_WINDOW_ANIMATION_SLIDE_IN: { ++ w->animation_center_x = w->pending_g.x + w->pending_g.width * 0.5 + ++ ps->root_width * ++ (ps->root_desktop_switch_direction < 0?-1:1); ++ ++ w->animation_center_y = w->pending_g.y + w->pending_g.height * 0.5; ++ w->animation_w = w->pending_g.width; ++ w->animation_h = w->pending_g.height; ++ break; ++ } + case OPEN_WINDOW_ANIMATION_INVALID: assert(false); break; + } + } +@@ -599,10 +583,10 @@ static void init_animation_unmap(session_t *ps, struct managed_win *w) { + animation = OPEN_WINDOW_ANIMATION_SLIDE_RIGHT; + else if (animation == OPEN_WINDOW_ANIMATION_SLIDE_RIGHT) + animation = OPEN_WINDOW_ANIMATION_SLIDE_LEFT; +- // else if (animation == OPEN_WINDOW_ANIMATION_SLIDE_IN) +- // animation = OPEN_WINDOW_ANIMATION_SLIDE_OUT; +- // else if (animation == OPEN_WINDOW_ANIMATION_SLIDE_OUT) +- // animation = OPEN_WINDOW_ANIMATION_SLIDE_IN; ++ else if (animation == OPEN_WINDOW_ANIMATION_SLIDE_IN) ++ animation = OPEN_WINDOW_ANIMATION_SLIDE_OUT; ++ else if (animation == OPEN_WINDOW_ANIMATION_SLIDE_OUT) ++ animation = OPEN_WINDOW_ANIMATION_SLIDE_IN; + + } else { + animation = ps->o.animation_for_unmap_window; +@@ -611,12 +595,9 @@ static void init_animation_unmap(session_t *ps, struct managed_win *w) { + animation = ps->o.wintype_option[w->window_type].animation_unmap; + } + +- // if (ps->root_desktop_switch_direction != 0) { +- // if (ps->o.animation_for_workspace_switch_out == OPEN_WINDOW_ANIMATION_AUTO) +- // animation = OPEN_WINDOW_ANIMATION_SLIDE_OUT; +- // else +- // animation = ps->o.animation_for_workspace_switch_out; +- // } ++ if (ps->root_desktop_switch_direction != 0) { ++ animation = OPEN_WINDOW_ANIMATION_SLIDE_OUT; ++ } + + if (c2_match(ps, w, ps->o.animation_unmap_blacklist, NULL)) { + animation = OPEN_WINDOW_ANIMATION_NONE; +@@ -679,28 +660,15 @@ static void init_animation_unmap(session_t *ps, struct managed_win *w) { + w->animation_dest_h = w->pending_g.height; + break; + } +- // case OPEN_WINDOW_ANIMATION_SLIDE_IN: { +- // w->animation_center_x = w->pending_g.x + w->pending_g.width * 0.5; +- // w->animation_center_y = w->pending_g.y + w->pending_g.height * 0.5 - +- // ps->root_height * +- // ((ps->root_desktop_switch_direction < 0 && +- // ps->root_desktop_switch_direction >= -1) || +- // ps->root_desktop_switch_direction > 1?1:-1); +- // w->animation_w = w->pending_g.width; +- // w->animation_h = w->pending_g.height; +- // break; +- // } +- // case OPEN_WINDOW_ANIMATION_SLIDE_OUT: { +- // w->animation_dest_center_x = w->pending_g.x + w->pending_g.width * 0.5; +- // w->animation_dest_center_y = w->pending_g.y + w->pending_g.height * 0.5 - +- // ps->root_height * +- // ((ps->root_desktop_switch_direction < 0 && +- // ps->root_desktop_switch_direction >= -1) || +- // ps->root_desktop_switch_direction > 1?-1:1); +- // w->animation_dest_w = w->pending_g.width; +- // w->animation_dest_h = w->pending_g.height; +- // break; +- // } ++ case OPEN_WINDOW_ANIMATION_SLIDE_OUT: { ++ w->animation_dest_center_x = w->pending_g.x + w->pending_g.width * 0.5 - ++ ps->root_width * ++ (ps->root_desktop_switch_direction < 0?-1:1); ++ w->animation_dest_center_y = w->pending_g.y + w->pending_g.height * 0.5; ++ w->animation_dest_w = w->pending_g.width; ++ w->animation_dest_h = w->pending_g.height; ++ break; ++ } + case OPEN_WINDOW_ANIMATION_INVALID: assert(false); break; + } + } +@@ -1133,11 +1101,11 @@ double win_calc_opacity_target(session_t *ps, const struct managed_win *w) { + return 0; + } + if (w->state == WSTATE_UNMAPPING || w->state == WSTATE_DESTROYING) { +- // if (ps->root_desktop_switch_direction) +- // return w->opacity; ++// if (ps->root_desktop_switch_direction) ++// return w->opacity; + +- return 0; +- } ++ return 0; ++ } + // Try obeying opacity property and window type opacity firstly + if (w->has_opacity_prop) { + opacity = ((double)w->opacity_prop) / OPAQUE; diff --git a/config/bg.png b/config/bg.png new file mode 100644 index 0000000..4f08434 Binary files /dev/null and b/config/bg.png differ diff --git a/config/bspwm/bspwmrc b/config/bspwm/bspwmrc index b78963a..fec65c2 100755 --- a/config/bspwm/bspwmrc +++ b/config/bspwm/bspwmrc @@ -4,18 +4,20 @@ setup=0 COLOR_BACKGROUND="#282a2e" COLOR_PRIMARY="#fefefe" COLOR_SECONDARY="#707880" -BORDER=2 +BORDER=0 hsetroot -solid $COLOR_BACKGROUND & xsetroot -cursor_name left_ptr & -xrdb ~/.Xdefaults +xrdb ~/.config/Xdefaults 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 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 @@ -29,7 +31,6 @@ for m in $(bspc query -M --names); do bspc monitor $m -d ${m}1 ${m}2 ${m}3 ${m}4 ${m}5 ${m}6 ${m}7 ${m}8 ${m}9 done - $HOME/.config/polybar/launch.sh & bspc config border_width $BORDER @@ -41,10 +42,18 @@ bspc rule -a Zathura state=tiled bspc rule -a feh state=fullscreen bspc config focus_follows_pointer false - + bspc config normal_border_color "$COLOR_SECONDARY" bspc config active_border_color "$COLOR_SECONDARY" bspc config focused_border_color "$COLOR_PRIMARY" -wmname bspwm + +# fix java programs that get confused on a missing name property +wmname LG3D + +sleep 1 + +#pgrep -x pipewire > /dev/null || pipewire & +#pgrep -x pipewire-pulse > /dev/null || pipewire-pulse & +#pgrep -x wireplumber > /dev/null || wireplumber & $HOME/.scripts/start-mpd diff --git a/config/cava/config b/config/cava/config index 2ddd926..a8379c8 100644 --- a/config/cava/config +++ b/config/cava/config @@ -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 = 100 +; sensitivity = 200 # 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 @@ method = alsa # Percentage value for integral smoothing. Takes values from 0 - 100. # Higher values means smoother, but less precise. 0 to disable. -; integral = 76 +integral = 0 # Disables or enables the so-called "Monstercat smoothing" with or without "waves". Set to 0 to disable. -monstercat = 1 -; waves = 0 +monstercat = 0 +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 = 100 +gravity = 400 # In bar height, bars that would have been lower that this will not be drawn. diff --git a/config/compfy/compfy.conf b/config/compfy/compfy.conf new file mode 100644 index 0000000..00c38a6 --- /dev/null +++ b/config/compfy/compfy.conf @@ -0,0 +1,499 @@ + +# Enables patches for specific window managers. +# Currently patched: "awesome", "dwm", "herb" +wm-support = "none"; + +################################# +# ANIMATIONS # +################################# + +# Toggles whether animations should be used for windows +animations = true; + +# Changes animation stiffness. +# What stiffness basically is inferring is how much the window geometry will be stretched, +# when opening/closing windows +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; + +# Change dampening applied during the animation +# This setting basically does what it says. It dampens the animation of windows. +animation-dampening = 20; + +# Toggles clamping +# if you are using a animation setting that would make the window extend larger than it would be after, +# the animation has played then it will cut the animation off once the window reaches its physical geometry. +animation-clamping = false; + +# Set the open window animation. +# Options: ("none","zoom","fly-in","slide-up","slide-down","slide-left","slide-right") +animation-for-open-window = "zoom"; + +# Set the closing window animation. +# Options: ("none","zoom","fly-in","slide-up","slide-down","slide-left","slide-right") +animation-for-unmap-window = "zoom"; + +# Exclude certain windows from having a open animation. + +# animation-open-exclude = [ +# "class_g = 'Dunst'" +# ]; + +# Exclude certain windows from having a closing animation. + +# animation-unmap-exclude = [ +# "class_g = 'Dunst'" +# ]; + +################################# +# Corners # +################################# +# requires: https://github.com/sdhand/compton +corner-radius = 6; +round-borders = 0; + +# Specify a list of border width rules, in the format `PIXELS:PATTERN`, +# Note we don't make any guarantee about possible conflicts with the +# border_width set by the window manager. +# +# example: +# round-borders-rule = [ "2:class_g = 'URxvt'" ]; +# +round-borders-rule = [ +]; + +################################# +# Shadows # +################################# + + +# Enabled client-side shadows on windows. Note desktop windows +# (windows with '_NET_WM_WINDOW_TYPE_DESKTOP') never get shadow, +# unless explicitly requested using the wintypes option. +# +#shadow = false +shadow = true; + +# The blur radius for shadows, in pixels. (defaults to 12) +# shadow-radius = 12 +shadow-radius = 50; + +# The opacity of shadows. (1.0 - 1.0, defaults to 0.75) +shadow-opacity = 1.0; + +# The left offset for shadows, in pixels. (defaults to -15) +# shadow-offset-x = -15 +shadow-offset-x = -50; + +# The top offset for shadows, in pixels. (defaults to -15) +# shadow-offset-y = -15 +shadow-offset-y = -50; + +# 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 + +# Red color value of shadow (0.0 - 1.0, defaults to 0). +#shadow-red = 0.86328125 + +# Green color value of shadow (0.0 - 1.0, defaults to 0). +#shadow-green = 0.2109375 + +# Blue color value of shadow (0.0 - 1.0, defaults to 0). +#shadow-blue = 0.015625 + +# Do not paint shadows on shaped windows. Note shaped windows +# here means windows setting its shape through X Shape extension. +# Those using ARGB background is beyond our control. +# Deprecated, use +# shadow-exclude = 'bounding_shaped' +# or +# shadow-exclude = 'bounding_shaped && !rounded_corners' +# instead. +# +# shadow-ignore-shaped = '' + +# Specify a list of conditions of windows that should have no shadow. +# +# examples: +# shadow-exclude = "n:e:Notification"; +# +# shadow-exclude = [] +shadow-exclude = [ + "_GTK_FRAME_EXTENTS@:c", + #"_NET_WM_STATE@:32a" +]; + +# Specify a X geometry that describes the region in which shadow should not +# be painted in, such as a dock window region. Use +# shadow-exclude-reg = "x10+0+0" +# for example, if the 10 pixels on the bottom of the screen should not have shadows painted on. +# +# shadow-exclude-reg = "" + +# Crop shadow of a window fully on a particular Xinerama screen to the screen. +# xinerama-shadow-crop = false + + +################################# +# Fading # +################################# + + +# Fade windows in/out when opening/closing and when opacity changes, +# unless no-fading-openclose is used. +# fading = false +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; + +# 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; + +# The time between steps in fade step, in milliseconds. (> 0, defaults to 10) +fade-delta = 4 + +# Specify a list of conditions of windows that should not be faded. +# don't need this, we disable fading for all normal windows with wintypes: {} +fade-exclude = [ + "class_g = 'slop'" # maim +] + +# Do not fade on window open/close. +# no-fading-openclose = false + +# Do not fade destroyed ARGB windows with WM frame. Workaround of bugs in Openbox, Fluxbox, etc. +# no-fading-destroyed-argb = false + + +################################# +# Transparency / Opacity # +################################# + + +# Opacity of inactive windows. (0.1 - 1.0, defaults to 1.0) +# inactive-opacity = 1 + +# Opacity of window titlebars and borders. (0.1 - 1.0, disabled by default) +# frame-opacity = 1.0 + +# Default opacity for dropdown menus and popup menus. (0.0 - 1.0, defaults to 1.0) +# menu-opacity = 1.0 + +# Let inactive opacity set by -i override the '_NET_WM_OPACITY' values of windows. +# inactive-opacity-override = true +inactive-opacity-override = false; + +# 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 + +# Specify a list of conditions of windows that should always be considered focused. +# focus-exclude = [] +focus-exclude = [ + "class_g = 'slop'" # maim +]; + +# Use fixed inactive dim value, instead of adjusting according to window opacity. +# inactive-dim-fixed = 1.0 + +# Specify a list of opacity rules, in the format `PERCENT:PATTERN`, +# like `50:name *= "Firefox"`. picom-trans is recommended over this. +# Note we don't make any guarantee about possible conflicts with other +# programs that set '_NET_WM_WINDOW_OPACITY' on frame or client windows. +# example: +# opacity-rule = [ "80:class_g = 'URxvt'" ]; +# +# opacity-rule = [] +opacity-rule = [ + "100:class_g = 'slop'", # maim +]; + + +################################# +# Background-Blurring # +################################# + + +# Parameters for background blurring, see the *BLUR* section for more information. +# blur-method = gaussian +# blur-size = 12 +# +# blur-deviation = false + +# Blur background of semi-transparent / ARGB windows. +# Bad in performance, with driver-dependent behavior. +# The name of the switch may change without prior notifications. +# +blur-background = true; + +# Blur background of windows when the window frame is not opaque. +# Implies: +# blur-background +# Bad in performance, with driver-dependent behavior. The name may change. +# +# blur-background-frame = false; + + +# Use fixed blur strength rather than adjusting according to window opacity. +# blur-background-fixed = false; + + +# Specify the blur convolution kernel, with the following format: +# example: +# blur-kern = "5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"; +# +# blur-kern = '' +# blur-kern = "3x3box"; + +blur: { + # requires: https://github.com/ibhagwan/picom + method = "none"; + #method = "kernel"; + strength = 0; + # deviation = 1.0; + # kernel = "11x11gaussian"; + background = false; + background-frame = false; + background-fixed = false; + kern = "3x3box"; +} + +# Exclude conditions for background blur. +blur-background-exclude = [ + "class_g = 'slop'", + "_GTK_FRAME_EXTENTS@:c" +]; + + +################################# +# General Settings # +################################# + +# Daemonize process. Fork to background after initialization. Causes issues with certain (badly-written) drivers. +daemon = true + +# Specify the backend to use: `xrender`, `glx`, or `xr_glx_hybrid`. +# `xrender` is the default one. +# +experimental-backends = true; +backend = "xrender"; + +vsync = true + +# Enable remote control via D-Bus. See the *D-BUS API* section below for more details. +# dbus = false + +# Try to detect WM windows (a non-override-redirect window with no +# child that has 'WM_STATE') and mark them as active. +# +# mark-wmwin-focused = false +mark-wmwin-focused = true; + +# Mark override-redirect windows that doesn't have a child window with 'WM_STATE' focused. +# mark-ovredir-focused = false +mark-ovredir-focused = true; + +# Try to detect windows with rounded corners and don't consider them +# shaped windows. The accuracy is not very high, unfortunately. +# +detect-rounded-corners = true; + +# Detect '_NET_WM_OPACITY' on client windows, useful for window managers +# not passing '_NET_WM_OPACITY' of client windows to frame windows. +# +#detect-client-opacity = false +detect-client-opacity = true; + +# Specify refresh rate of the screen. If not specified or 0, picom will +# try detecting this with X RandR extension. +# +# refresh-rate = 60 +refresh-rate = 0 + +# Limit picom to repaint at most once every 1 / 'refresh_rate' second to +# boost performance. This should not be used with +# vsync drm/opengl/opengl-oml +# as they essentially does sw-opti's job already, +# unless you wish to specify a lower refresh rate than the actual value. +# +# sw-opti = + +# Use EWMH '_NET_ACTIVE_WINDOW' to determine currently focused window, +# rather than listening to 'FocusIn'/'FocusOut' event. Might have more accuracy, +# provided that the WM supports it. +# +# use-ewmh-active-win = false + +# Unredirect all windows if a full-screen opaque window is detected, +# to maximize performance for full-screen windows. Known to cause flickering +# when redirecting/unredirecting windows. paint-on-overlay may make the flickering less obvious. +# +# unredir-if-possible = true + +# Delay before unredirecting the window, in milliseconds. Defaults to 0. +# unredir-if-possible-delay = 0 + +# Conditions of windows that shouldn't be considered full-screen for unredirecting screen. +# unredir-if-possible-exclude = [] + +# Use 'WM_TRANSIENT_FOR' to group windows, and consider windows +# in the same group focused at the same time. +# +# detect-transient = false +detect-transient = true + +# Use 'WM_CLIENT_LEADER' to group windows, and consider windows in the same +# group focused at the same time. 'WM_TRANSIENT_FOR' has higher priority if +# detect-transient is enabled, too. +# +# detect-client-leader = false +detect-client-leader = true + +# Resize damaged region by a specific number of pixels. +# A positive value enlarges it while a negative one shrinks it. +# If the value is positive, those additional pixels will not be actually painted +# to screen, only used in blur calculation, and such. (Due to technical limitations, +# with use-damage, those pixels will still be incorrectly painted to screen.) +# Primarily used to fix the line corruption issues of blur, +# in which case you should use the blur radius value here +# (e.g. with a 3x3 kernel, you should use `--resize-damage 1`, +# with a 5x5 one you use `--resize-damage 2`, and so on). +# May or may not work with *--glx-no-stencil*. Shrinking doesn't function correctly. +# +# resize-damage = 1 + +# Specify a list of conditions of windows that should be painted with inverted color. +# Resource-hogging, and is not well tested. +# +# invert-color-include = [] + +# GLX backend: Avoid using stencil buffer, useful if you don't have a stencil buffer. +# Might cause incorrect opacity when rendering transparent content (but never +# practically happened) and may not work with blur-background. +# My tests show a 15% performance boost. Recommended. +# +# glx-no-stencil = false + +# GLX backend: Avoid rebinding pixmap on window damage. +# Probably could improve performance on rapid window content changes, +# but is known to break things on some drivers (LLVMpipe, xf86-video-intel, etc.). +# Recommended if it works. +# +# glx-no-rebind-pixmap = false + +# Disable the use of damage information. +# This cause the whole screen to be redrawn everytime, instead of the part of the screen +# has actually changed. Potentially degrades the performance, but might fix some artifacts. +# The opposing option is use-damage +# +# no-use-damage = false +use-damage = true + +# Use X Sync fence to sync clients' draw calls, to make sure all draw +# calls are finished before picom starts drawing. Needed on nvidia-drivers +# with GLX backend for some users. +# +xrender-sync-fence = true + +# GLX backend: Use specified GLSL fragment shader for rendering window contents. +# See `compton-default-fshader-win.glsl` and `compton-fake-transparency-fshader-win.glsl` +# in the source tree for examples. +# +# glx-fshader-win = '' + +# Force all windows to be painted with blending. Useful if you +# have a glx-fshader-win that could turn opaque pixels transparent. +# +# force-win-blend = false + +# Do not use EWMH to detect fullscreen windows. +# Reverts to checking if a window is fullscreen based only on its size and coordinates. +# +# no-ewmh-fullscreen = false + +# Dimming bright windows so their brightness doesn't exceed this set value. +# Brightness of a window is estimated by averaging all pixels in the window, +# so this could comes with a performance hit. +# Setting this to 1.0 disables this behaviour. Requires --use-damage to be disabled. (default: 1.0) +# +# max-brightness = 1.0 + +# Make transparent windows clip other windows like non-transparent windows do, +# instead of blending on top of them. +# +# transparent-clipping = false + +# Set the log level. Possible values are: +# "trace", "debug", "info", "warn", "error" +# in increasing level of importance. Case doesn't matter. +# If using the "TRACE" log level, it's better to log into a file +# using *--log-file*, since it can generate a huge stream of logs. +# +# log-level = "debug" +log-level = "info"; + +# Set the log file. +# If *--log-file* is never specified, logs will be written to stderr. +# Otherwise, logs will to written to the given file, though some of the early +# logs might still be written to the stderr. +# When setting this option from the config file, it is recommended to use an absolute path. +# +# log-file = '/path/to/your/log/file' + +# Show all X errors (for debugging) +# show-all-xerrors = false + +# Write process ID to a file. +# write-pid-path = '/path/to/your/log/file' + +# Window type settings +# +# 'WINDOW_TYPE' is one of the 15 window types defined in EWMH standard: +# "unknown", "desktop", "dock", "toolbar", "menu", "utility", +# "splash", "dialog", "normal", "dropdown_menu", "popup_menu", +# "tooltip", "notification", "combo", and "dnd". +# +# Following per window-type options are available: :: +# +# fade, shadow::: +# Controls window-type-specific shadow and fade settings. +# +# opacity::: +# Controls default opacity of the window type. +# +# focus::: +# Controls whether the window of this type is to be always considered focused. +# (By default, all window types except "normal" and "dialog" has this on.) +# +# full-shadow::: +# Controls whether shadow is drawn under the parts of the window that you +# normally won't be able to see. Useful when the window has parts of it +# transparent, and you want shadows in those areas. +# +# redir-ignore::: +# Controls whether this type of windows should cause screen to become +# redirected again after been unredirected. If you have unredir-if-possible +# set, and doesn't want certain window to cause unnecessary screen redirection, +# you can set this to `true`. +# +wintypes: +{ + normal = { fade = true; shadow = true;} + tooltip = { fade = true; shadow = true; opacity = 0.75; focus = true; full-shadow = false; }; + dock = { full-shadow = true; } + dnd = { shadow = true; } + popup_menu = { shadow = true; } + dropdown_menu = { shadow = true; } +}; +unredir-if-possible = false diff --git a/config/gtk-3.0/bookmarks b/config/gtk-3.0/bookmarks index 3bdccb3..d6229a6 100644 --- a/config/gtk-3.0/bookmarks +++ b/config/gtk-3.0/bookmarks @@ -1,5 +1,4 @@ -file:///home/x/pics/screenshot -file:///home/david/hd1/important +file:///home/david/docs/lmms file:///home/david/docs docs file:///home/david/pics pics file:///home/david/dl dl @@ -7,9 +6,6 @@ file:///home/david/video video file:///home/david/music music file:///home/david/pics/screenshot screenshot file:///home/david/docs/proj proj -file:///home/david/hd1/library library file:///tmp tmp -file:///home/david/docs/school file:///home/david/video/anime -file:///home/david/lmms file:///home/david/docs/proj/ardour diff --git a/config/mimeapps.list b/config/mimeapps.list new file mode 100644 index 0000000..fe28a07 --- /dev/null +++ b/config/mimeapps.list @@ -0,0 +1,30 @@ +[Default Applications] +image/jpeg=feh.desktop +image/png=feh.desktop +image/webp=feh.desktop +image/gif=feh.desktop +x-scheme-handler/http=userapp-Firefox-AK3I01.desktop +x-scheme-handler/https=userapp-Firefox-AK3I01.desktop +x-scheme-handler/chrome=userapp-Firefox-AK3I01.desktop +text/html=userapp-Firefox-AK3I01.desktop +application/x-extension-htm=userapp-Firefox-AK3I01.desktop +application/x-extension-html=userapp-Firefox-AK3I01.desktop +application/x-extension-shtml=userapp-Firefox-AK3I01.desktop +application/xhtml+xml=userapp-Firefox-AK3I01.desktop +application/x-extension-xhtml=userapp-Firefox-AK3I01.desktop +application/x-extension-xht=userapp-Firefox-AK3I01.desktop + +[Added Associations] +x-scheme-handler/http=userapp-Firefox-AK3I01.desktop; +x-scheme-handler/https=userapp-Firefox-AK3I01.desktop; +x-scheme-handler/chrome=userapp-Firefox-AK3I01.desktop; +text/html=userapp-Firefox-AK3I01.desktop; +application/x-extension-htm=userapp-Firefox-AK3I01.desktop; +application/x-extension-html=userapp-Firefox-AK3I01.desktop; +application/x-extension-shtml=userapp-Firefox-AK3I01.desktop; +application/xhtml+xml=userapp-Firefox-AK3I01.desktop; +application/x-extension-xhtml=userapp-Firefox-AK3I01.desktop; +application/x-extension-xht=userapp-Firefox-AK3I01.desktop; +image/gif=nsxiv.desktop; +image/png=gimp.desktop; +image/jpeg=gimp.desktop; diff --git a/config/mpd/mpd.conf b/config/mpd/mpd.conf index b086d5e..5dd1296 100644 --- a/config/mpd/mpd.conf +++ b/config/mpd/mpd.conf @@ -15,14 +15,24 @@ audio_output { audio_output { type "pulse" - name "mpd" + name "mpd pulse" } +#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 "44100:16:2" + format "22050:16:2" } db_file "~/.config/mpd/database" diff --git a/config/mpv/mpv.conf b/config/mpv/mpv.conf index de4d6d7..e69de29 100644 --- a/config/mpv/mpv.conf +++ b/config/mpv/mpv.conf @@ -1,5 +0,0 @@ -#vo=gpu -hwdec=auto -screenshot-directory=~/pics/screenshot -glsl-shaders="~~/shaders/Anime4K_Clamp_Highlights.glsl:~~/shaders/Anime4K_Upscale_Denoise_CNN.glsl:~~/shaders/Anime4K_Restore_CNN_Moderate_M.glsl:~~/shaders/Anime4K_Upscale_CNN_x2_S.glsl" - diff --git a/config/polybar/config b/config/polybar/config index 8b16e9b..e1fcd5b 100644 --- a/config/polybar/config +++ b/config/polybar/config @@ -40,14 +40,14 @@ modules-right = time [bar/ws] inherit = bar/base -width = 1870 +width = 2510 offset-x = 25 offset-y = 10 modules-left = workspaces xwindow modules-right = mpd temperature memory network battery pulseaudio microphone time tray-position = right background = ${color.bga} -border-size = 2 +border-size = 0 border-color = ${color.fg3} fg = ${color.fg1} @@ -138,9 +138,9 @@ label-muted = "%{T3} %{T-}--%" [module/microphone] type = custom/script -exec = pactl list sources | grep -qi 'Mute: yes' && echo "" || echo "" +exec = amixer get Capture | tail -2 | grep -q off && echo "" || echo "" interval = 1 -click-left = pactl list sources | grep -qi 'Mute: yes' && pactl set-source-mute 2 false || pactl set-source-mute 2 true +click-left = $HOME/.scripts/toggle-mute.sh [module/vpn] type = custom/script diff --git a/config/rofi/colors-rofi-dark.rasi b/config/rofi/colors-rofi-dark.rasi index 180889d..e861cd4 100644 --- a/config/rofi/colors-rofi-dark.rasi +++ b/config/rofi/colors-rofi-dark.rasi @@ -35,7 +35,7 @@ #window { background-color: @background; - border: 2px; + border: 0px; border-color: @foreground; padding: 2.5ch; } @@ -46,7 +46,7 @@ } #message { - border: 2px 0px 0px; + border: 0px 0px 0px; border-color: @border-color; padding: 1px; } @@ -68,7 +68,7 @@ #listview { fixed-height: 0; - border: 2px 0px 0px; + border: 0px 0px 0px; border-color: @border-color; spacing: 2px; scrollbar: true; diff --git a/config/sx/sxrc b/config/sx/sxrc new file mode 100755 index 0000000..ee19f27 --- /dev/null +++ b/config/sx/sxrc @@ -0,0 +1,4 @@ +setxkbmap -option caps:backspace +xmodmap -e "clear Lock" +exec bspwm + diff --git a/config/sxhkd/sxhkdrc b/config/sxhkd/sxhkdrc index 4869fc5..40ddc7e 100644 --- a/config/sxhkd/sxhkdrc +++ b/config/sxhkd/sxhkdrc @@ -4,7 +4,7 @@ # mic super + BackSpace - pactl list sources | grep -qi 'Mute: yes' && pactl set-source-mute 2 false || pactl set-source-mute 2 true + $HOME/.scripts/toggle-mute.sh super + ctrl + alt + f pactl list sources | grep -qi 'Active Port: analog-input-rear-mic' && pactl set-source-port 2 analog-input-front-mic || pactl set-source-port 2 analog-input-rear-mic @@ -21,12 +21,11 @@ super + ctrl + alt + f light -U {10,1} {_, super} + XF86MonBrightnessUp light -A {10,1} - super + r - rofi -show drun -show-icons + rofi -show drun -show-icons super + shift + r rofi -show ssh -show-icons @@ -35,13 +34,13 @@ super + ctrl + Tab rofi -show window super + g - $HOME/.scripts/toggle-gap.sh + $HOME/.scripts/toggle-gap.sh super + shift + g $HOME/.scripts/toggle-size-hints.sh # open terminal -super + Return +super + Return $TERMINAL # open pdf viewer @@ -67,6 +66,11 @@ super + m super + n $FILE_MANAGER +# open dmenu iwd +super + i + $HOME/.scripts/dmenu-iwd + + # open audio mixer super + semicolon bspc rule -a \* -o state=floating && $TERMINAL -e pulsemixer @@ -144,24 +148,24 @@ super + alt + t # record screen super + alt + s - .scripts/screenrecord + $HOME/.scripts/screenrecord #bring up calculator super + period - .scripts/calculator + $HOME/.scripts/calculator # file search and open super + slash websearch shift + super + slash - bspc rule -a \* -o state=floating && $TERMINAL -e ~/.scripts/fzf_menu.sh + bspc rule -a \* -o state=floating && $TERMINAL -e $HOME/.scripts/fzf_menu.sh # Calendar super + c - bspc rule -a \* -o state=floating && $TERMINAL -e calcurse + $HOME/.scripts/calendar super + comma - .scripts/notepad + $HOME/.scripts/notepad ################### # mpd server # @@ -188,7 +192,7 @@ super + alt + ctrl + backslash # chooser super + alt + ctrl + slash - .scripts/mpc_picker + $HOME/.scripts/mpc_picker # volume super + alt + ctrl + Next mpc volume -10 @@ -225,6 +229,12 @@ super + f bspc node focused -t floating || \ bspc node focused -t tiled; +# make the node sticky +super + d + [ -z "$(bspc query -N -n focused.sticky)" ] && \ + bspc node focused -g sticky=on || \ + bspc node focused -g stick=off; + super + ctrl + f bspc node -t \~fullscreen diff --git a/config/vim/vimrc b/config/vim/vimrc index 5bb2e7d..6a568a8 100644 --- a/config/vim/vimrc +++ b/config/vim/vimrc @@ -14,7 +14,7 @@ set spelllang=en_gb set number relativenumber -syntax on +syntax on nnoremap :nohl @@ -50,6 +50,7 @@ Plug 'preservim/vim-markdown' Plug 'neoclide/coc.nvim' +hi CocInlayHint ctermbg=Black ctermfg=Gray set updatetime=300 set signcolumn=yes @@ -111,10 +112,14 @@ Plug 'junegunn/fzf.vim' nnoremap :Files nnoremap :Rg + Plug 'heavenshell/vim-pydocstring', { 'do': 'make install', 'for': 'python' } +Plug 'tpope/vim-fugitive' + call plug#end() highlight Pmenu ctermbg=black guibg=black ctermfg=white - +hi TrailingWhitespace ctermbg=red guibg=red +call matchadd("TrailingWhitespace", '\v\s+$') diff --git a/config/zathura/zathurarc b/config/zathura/zathurarc index 5a0717d..8fc40d8 100644 --- a/config/zathura/zathurarc +++ b/config/zathura/zathurarc @@ -30,3 +30,5 @@ set selection-clipboard clipboard set guioptions none set recolor true + +set first-page-column 1:1 diff --git a/deploy.sh b/deploy.sh index 3cbaea2..cb42927 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,6 +1,6 @@ #!/bin/sh -configurations="iocane bg bg.gif bspwm cava neofetch mpd mpv ncmpcpp vim sxhkd polybar picom rofi user-dirs.dirs gtk-3.0 zathura" +configurations="iocane bg bg.gif bspwm cava neofetch mpd mpv ncmpcpp vim sxhkd polybar compfy rofi user-dirs.dirs gtk-3.0 zathura sx mimeapps.list" save () { @@ -15,8 +15,7 @@ save () { cp $HOME/.profile profile cp $HOME/.mkshrc mkshrc cp $HOME/.sh_aliases sh_aliases - cp $HOME/.Xdefaults Xdefaults - cp $HOME/.xinitrc xinitrc + cp $HOME/.config/Xdefaults Xdefaults mkdir -p fonts/TTF cp -r $HOME/.fonts/ttf-mononoki fonts/ @@ -59,8 +58,7 @@ load () { cp mkshrc $HOME/.mkshrc cp sh_aliases $HOME/.sh_aliases - cp Xdefaults $HOME/.Xdefaults - cp xinitrc $HOME/.xinitrc + cp Xdefaults $HOME/.config/Xdefaults cp profile $HOME/.profile mkdir -p $HOME/.fonts @@ -81,14 +79,19 @@ load () { cp -r icons/* $HOME/.local/share/icons/ cp .local/share/kaomoji ~/.local/share/ - git clone https://github.com/simmel/urxvt-resize-font /tmp/urxvt-resize-font mkdir -p ~/.urxvt/ext/ + + git clone https://github.com/simmel/urxvt-resize-font /tmp/urxvt-resize-font cp /tmp/urxvt-resize-font/resize-font ~/.urxvt/ext/ cd slock ./deploy.sh cd - + cd st + ./deploy.sh + cd - + echo "Copied configurations!" else diff --git a/icons/cursor.theme b/icons/cursor.theme deleted file mode 100644 index b8f2118..0000000 --- a/icons/cursor.theme +++ /dev/null @@ -1,2 +0,0 @@ -[Icon Theme] -Inherits=pixelfun3 diff --git a/icons/cursors/00008160000006810000408080010102 b/icons/cursors/00008160000006810000408080010102 deleted file mode 120000 index 127e1c0..0000000 --- a/icons/cursors/00008160000006810000408080010102 +++ /dev/null @@ -1 +0,0 @@ -v_double_arrow \ No newline at end of file diff --git a/icons/cursors/028006030e0e7ebffc7f7070c0600140 b/icons/cursors/028006030e0e7ebffc7f7070c0600140 deleted file mode 120000 index 1ffc159..0000000 --- a/icons/cursors/028006030e0e7ebffc7f7070c0600140 +++ /dev/null @@ -1 +0,0 @@ -h_double_arrow \ No newline at end of file diff --git a/icons/cursors/03b6e0fcb3499374a867c041f52298f0 b/icons/cursors/03b6e0fcb3499374a867c041f52298f0 deleted file mode 120000 index 01c907d..0000000 --- a/icons/cursors/03b6e0fcb3499374a867c041f52298f0 +++ /dev/null @@ -1 +0,0 @@ -crossed_circle \ No newline at end of file diff --git a/icons/cursors/08e8e1c95fe2fc01f976f1e063a24ccd b/icons/cursors/08e8e1c95fe2fc01f976f1e063a24ccd deleted file mode 120000 index b0e6589..0000000 --- a/icons/cursors/08e8e1c95fe2fc01f976f1e063a24ccd +++ /dev/null @@ -1 +0,0 @@ -left_ptr_watch \ No newline at end of file diff --git a/icons/cursors/1081e37283d90000800003c07f3ef6bf b/icons/cursors/1081e37283d90000800003c07f3ef6bf deleted file mode 120000 index 88740b2..0000000 --- a/icons/cursors/1081e37283d90000800003c07f3ef6bf +++ /dev/null @@ -1 +0,0 @@ -copy \ No newline at end of file diff --git a/icons/cursors/14fef782d02440884392942c11205230 b/icons/cursors/14fef782d02440884392942c11205230 deleted file mode 120000 index baba492..0000000 --- a/icons/cursors/14fef782d02440884392942c11205230 +++ /dev/null @@ -1 +0,0 @@ -sb_h_double_arrow \ No newline at end of file diff --git a/icons/cursors/2870a09082c103050810ffdffffe0204 b/icons/cursors/2870a09082c103050810ffdffffe0204 deleted file mode 120000 index a3693c3..0000000 --- a/icons/cursors/2870a09082c103050810ffdffffe0204 +++ /dev/null @@ -1 +0,0 @@ -sb_v_double_arrow \ No newline at end of file diff --git a/icons/cursors/3085a0e285430894940527032f8b26df b/icons/cursors/3085a0e285430894940527032f8b26df deleted file mode 120000 index c150ede..0000000 --- a/icons/cursors/3085a0e285430894940527032f8b26df +++ /dev/null @@ -1 +0,0 @@ -link \ No newline at end of file diff --git a/icons/cursors/3ecb610c1bf2410f44200f48c40d3599 b/icons/cursors/3ecb610c1bf2410f44200f48c40d3599 deleted file mode 120000 index b0e6589..0000000 --- a/icons/cursors/3ecb610c1bf2410f44200f48c40d3599 +++ /dev/null @@ -1 +0,0 @@ -left_ptr_watch \ No newline at end of file diff --git a/icons/cursors/4498f0e0c1937ffe01fd06f973665830 b/icons/cursors/4498f0e0c1937ffe01fd06f973665830 deleted file mode 120000 index d6a0af6..0000000 --- a/icons/cursors/4498f0e0c1937ffe01fd06f973665830 +++ /dev/null @@ -1 +0,0 @@ -move \ No newline at end of file diff --git a/icons/cursors/5c6cd98b3f3ebcb1f9c7f1c204630408 b/icons/cursors/5c6cd98b3f3ebcb1f9c7f1c204630408 deleted file mode 120000 index cc9a7ed..0000000 --- a/icons/cursors/5c6cd98b3f3ebcb1f9c7f1c204630408 +++ /dev/null @@ -1 +0,0 @@ -question_arrow \ No newline at end of file diff --git a/icons/cursors/6407b0e94181790501fd1e167b474872 b/icons/cursors/6407b0e94181790501fd1e167b474872 deleted file mode 120000 index 88740b2..0000000 --- a/icons/cursors/6407b0e94181790501fd1e167b474872 +++ /dev/null @@ -1 +0,0 @@ -copy \ No newline at end of file diff --git a/icons/cursors/640fb0e74195791501fd1ed57b41487f b/icons/cursors/640fb0e74195791501fd1ed57b41487f deleted file mode 120000 index c150ede..0000000 --- a/icons/cursors/640fb0e74195791501fd1ed57b41487f +++ /dev/null @@ -1 +0,0 @@ -link \ No newline at end of file diff --git a/icons/cursors/9081237383d90e509aa00f00170e968f b/icons/cursors/9081237383d90e509aa00f00170e968f deleted file mode 120000 index d6a0af6..0000000 --- a/icons/cursors/9081237383d90e509aa00f00170e968f +++ /dev/null @@ -1 +0,0 @@ -move \ No newline at end of file diff --git a/icons/cursors/9d800788f1b08800ae810202380a0822 b/icons/cursors/9d800788f1b08800ae810202380a0822 deleted file mode 120000 index 0b08654..0000000 --- a/icons/cursors/9d800788f1b08800ae810202380a0822 +++ /dev/null @@ -1 +0,0 @@ -hand2 \ No newline at end of file diff --git a/icons/cursors/X_cursor b/icons/cursors/X_cursor deleted file mode 120000 index 01c907d..0000000 --- a/icons/cursors/X_cursor +++ /dev/null @@ -1 +0,0 @@ -crossed_circle \ No newline at end of file diff --git a/icons/cursors/arrow b/icons/cursors/arrow deleted file mode 120000 index 0de4e80..0000000 --- a/icons/cursors/arrow +++ /dev/null @@ -1 +0,0 @@ -left_ptr \ No newline at end of file diff --git a/icons/cursors/bd_double_arrow b/icons/cursors/bd_double_arrow deleted file mode 120000 index be1ee95..0000000 --- a/icons/cursors/bd_double_arrow +++ /dev/null @@ -1 +0,0 @@ -top_left_corner \ No newline at end of file diff --git a/icons/cursors/bottom_left_corner b/icons/cursors/bottom_left_corner deleted file mode 120000 index 19274a2..0000000 --- a/icons/cursors/bottom_left_corner +++ /dev/null @@ -1 +0,0 @@ -top_right_corner \ No newline at end of file diff --git a/icons/cursors/bottom_right_corner b/icons/cursors/bottom_right_corner deleted file mode 120000 index be1ee95..0000000 --- a/icons/cursors/bottom_right_corner +++ /dev/null @@ -1 +0,0 @@ -top_left_corner \ No newline at end of file diff --git a/icons/cursors/bottom_side b/icons/cursors/bottom_side deleted file mode 120000 index 83cc946..0000000 --- a/icons/cursors/bottom_side +++ /dev/null @@ -1 +0,0 @@ -top_side \ No newline at end of file diff --git a/icons/cursors/bottom_tee b/icons/cursors/bottom_tee deleted file mode 100644 index 370fe4b..0000000 Binary files a/icons/cursors/bottom_tee and /dev/null differ diff --git a/icons/cursors/c7088f0f3e6c8088236ef8e1e3e70000 b/icons/cursors/c7088f0f3e6c8088236ef8e1e3e70000 deleted file mode 120000 index a8afe37..0000000 --- a/icons/cursors/c7088f0f3e6c8088236ef8e1e3e70000 +++ /dev/null @@ -1 +0,0 @@ -bd_double_arrow \ No newline at end of file diff --git a/icons/cursors/circle b/icons/cursors/circle deleted file mode 100644 index 3fde812..0000000 Binary files a/icons/cursors/circle and /dev/null differ diff --git a/icons/cursors/color-picker b/icons/cursors/color-picker deleted file mode 100644 index ba2c456..0000000 Binary files a/icons/cursors/color-picker and /dev/null differ diff --git a/icons/cursors/copy b/icons/cursors/copy deleted file mode 100644 index d7d129c..0000000 Binary files a/icons/cursors/copy and /dev/null differ diff --git a/icons/cursors/cross b/icons/cursors/cross deleted file mode 100644 index 2f3deff..0000000 Binary files a/icons/cursors/cross and /dev/null differ diff --git a/icons/cursors/cross_reverse b/icons/cursors/cross_reverse deleted file mode 120000 index 982ae30..0000000 --- a/icons/cursors/cross_reverse +++ /dev/null @@ -1 +0,0 @@ -cross \ No newline at end of file diff --git a/icons/cursors/crossed_circle b/icons/cursors/crossed_circle deleted file mode 100644 index 4c57b48..0000000 Binary files a/icons/cursors/crossed_circle and /dev/null differ diff --git a/icons/cursors/crosshair b/icons/cursors/crosshair deleted file mode 120000 index 982ae30..0000000 --- a/icons/cursors/crosshair +++ /dev/null @@ -1 +0,0 @@ -cross \ No newline at end of file diff --git a/icons/cursors/d9ce0ab605698f320427677b458ad60b b/icons/cursors/d9ce0ab605698f320427677b458ad60b deleted file mode 120000 index cc9a7ed..0000000 --- a/icons/cursors/d9ce0ab605698f320427677b458ad60b +++ /dev/null @@ -1 +0,0 @@ -question_arrow \ No newline at end of file diff --git a/icons/cursors/diamond_cross b/icons/cursors/diamond_cross deleted file mode 120000 index 982ae30..0000000 --- a/icons/cursors/diamond_cross +++ /dev/null @@ -1 +0,0 @@ -cross \ No newline at end of file diff --git a/icons/cursors/dnd-ask b/icons/cursors/dnd-ask deleted file mode 100644 index f897fa4..0000000 Binary files a/icons/cursors/dnd-ask and /dev/null differ diff --git a/icons/cursors/dnd-copy b/icons/cursors/dnd-copy deleted file mode 100644 index 8c128de..0000000 Binary files a/icons/cursors/dnd-copy and /dev/null differ diff --git a/icons/cursors/dnd-link b/icons/cursors/dnd-link deleted file mode 100644 index a1942ed..0000000 Binary files a/icons/cursors/dnd-link and /dev/null differ diff --git a/icons/cursors/dnd-move b/icons/cursors/dnd-move deleted file mode 100644 index f932d07..0000000 Binary files a/icons/cursors/dnd-move and /dev/null differ diff --git a/icons/cursors/dnd-none b/icons/cursors/dnd-none deleted file mode 100644 index dcde4fa..0000000 Binary files a/icons/cursors/dnd-none and /dev/null differ diff --git a/icons/cursors/dot_box_mask b/icons/cursors/dot_box_mask deleted file mode 120000 index def8590..0000000 --- a/icons/cursors/dot_box_mask +++ /dev/null @@ -1 +0,0 @@ -dotbox \ No newline at end of file diff --git a/icons/cursors/dotbox b/icons/cursors/dotbox deleted file mode 100644 index 1de5515..0000000 Binary files a/icons/cursors/dotbox and /dev/null differ diff --git a/icons/cursors/double_arrow b/icons/cursors/double_arrow deleted file mode 120000 index a3693c3..0000000 --- a/icons/cursors/double_arrow +++ /dev/null @@ -1 +0,0 @@ -sb_v_double_arrow \ No newline at end of file diff --git a/icons/cursors/draft_large b/icons/cursors/draft_large deleted file mode 120000 index cb9c1b4..0000000 --- a/icons/cursors/draft_large +++ /dev/null @@ -1 +0,0 @@ -right_ptr \ No newline at end of file diff --git a/icons/cursors/draft_small b/icons/cursors/draft_small deleted file mode 120000 index cb9c1b4..0000000 --- a/icons/cursors/draft_small +++ /dev/null @@ -1 +0,0 @@ -right_ptr \ No newline at end of file diff --git a/icons/cursors/draped_box b/icons/cursors/draped_box deleted file mode 120000 index def8590..0000000 --- a/icons/cursors/draped_box +++ /dev/null @@ -1 +0,0 @@ -dotbox \ No newline at end of file diff --git a/icons/cursors/e29285e634086352946a0e7090d73106 b/icons/cursors/e29285e634086352946a0e7090d73106 deleted file mode 120000 index 0b08654..0000000 --- a/icons/cursors/e29285e634086352946a0e7090d73106 +++ /dev/null @@ -1 +0,0 @@ -hand2 \ No newline at end of file diff --git a/icons/cursors/fcf1c3c7cd4491d801f1e1c78f100000 b/icons/cursors/fcf1c3c7cd4491d801f1e1c78f100000 deleted file mode 120000 index 3d249d7..0000000 --- a/icons/cursors/fcf1c3c7cd4491d801f1e1c78f100000 +++ /dev/null @@ -1 +0,0 @@ -fd_double_arrow \ No newline at end of file diff --git a/icons/cursors/fd_double_arrow b/icons/cursors/fd_double_arrow deleted file mode 120000 index 19274a2..0000000 --- a/icons/cursors/fd_double_arrow +++ /dev/null @@ -1 +0,0 @@ -top_right_corner \ No newline at end of file diff --git a/icons/cursors/fleur b/icons/cursors/fleur deleted file mode 120000 index bc5dcc0..0000000 --- a/icons/cursors/fleur +++ /dev/null @@ -1 +0,0 @@ -grabbing \ No newline at end of file diff --git a/icons/cursors/grabbing b/icons/cursors/grabbing deleted file mode 100644 index 2133d77..0000000 Binary files a/icons/cursors/grabbing and /dev/null differ diff --git a/icons/cursors/h_double_arrow b/icons/cursors/h_double_arrow deleted file mode 120000 index baba492..0000000 --- a/icons/cursors/h_double_arrow +++ /dev/null @@ -1 +0,0 @@ -sb_h_double_arrow \ No newline at end of file diff --git a/icons/cursors/hand b/icons/cursors/hand deleted file mode 120000 index 0b08654..0000000 --- a/icons/cursors/hand +++ /dev/null @@ -1 +0,0 @@ -hand2 \ No newline at end of file diff --git a/icons/cursors/hand1 b/icons/cursors/hand1 deleted file mode 120000 index 0b08654..0000000 --- a/icons/cursors/hand1 +++ /dev/null @@ -1 +0,0 @@ -hand2 \ No newline at end of file diff --git a/icons/cursors/hand2 b/icons/cursors/hand2 deleted file mode 100644 index 34fd40c..0000000 Binary files a/icons/cursors/hand2 and /dev/null differ diff --git a/icons/cursors/help b/icons/cursors/help deleted file mode 120000 index cc9a7ed..0000000 --- a/icons/cursors/help +++ /dev/null @@ -1 +0,0 @@ -question_arrow \ No newline at end of file diff --git a/icons/cursors/icon b/icons/cursors/icon deleted file mode 120000 index def8590..0000000 --- a/icons/cursors/icon +++ /dev/null @@ -1 +0,0 @@ -dotbox \ No newline at end of file diff --git a/icons/cursors/left_ptr b/icons/cursors/left_ptr deleted file mode 100644 index bdcdf9b..0000000 Binary files a/icons/cursors/left_ptr and /dev/null differ diff --git a/icons/cursors/left_ptr_help b/icons/cursors/left_ptr_help deleted file mode 100644 index bb7407c..0000000 Binary files a/icons/cursors/left_ptr_help and /dev/null differ diff --git a/icons/cursors/left_ptr_watch b/icons/cursors/left_ptr_watch deleted file mode 100644 index cc93372..0000000 Binary files a/icons/cursors/left_ptr_watch and /dev/null differ diff --git a/icons/cursors/left_side b/icons/cursors/left_side deleted file mode 100644 index 341c3e6..0000000 Binary files a/icons/cursors/left_side and /dev/null differ diff --git a/icons/cursors/left_tee b/icons/cursors/left_tee deleted file mode 100644 index 673a0e1..0000000 Binary files a/icons/cursors/left_tee and /dev/null differ diff --git a/icons/cursors/link b/icons/cursors/link deleted file mode 100644 index ee33bea..0000000 Binary files a/icons/cursors/link and /dev/null differ diff --git a/icons/cursors/ll_angle b/icons/cursors/ll_angle deleted file mode 100644 index 68a8e73..0000000 Binary files a/icons/cursors/ll_angle and /dev/null differ diff --git a/icons/cursors/lr_angle b/icons/cursors/lr_angle deleted file mode 100644 index e13a7c3..0000000 Binary files a/icons/cursors/lr_angle and /dev/null differ diff --git a/icons/cursors/move b/icons/cursors/move deleted file mode 100644 index 4a01647..0000000 Binary files a/icons/cursors/move and /dev/null differ diff --git a/icons/cursors/pencil b/icons/cursors/pencil deleted file mode 100644 index 188d73f..0000000 Binary files a/icons/cursors/pencil and /dev/null differ diff --git a/icons/cursors/pirate b/icons/cursors/pirate deleted file mode 120000 index 7b84daf..0000000 --- a/icons/cursors/pirate +++ /dev/null @@ -1 +0,0 @@ -X_cursor \ No newline at end of file diff --git a/icons/cursors/plus b/icons/cursors/plus deleted file mode 100644 index 894ace4..0000000 Binary files a/icons/cursors/plus and /dev/null differ diff --git a/icons/cursors/question_arrow b/icons/cursors/question_arrow deleted file mode 100644 index f7479fb..0000000 Binary files a/icons/cursors/question_arrow and /dev/null differ diff --git a/icons/cursors/right_ptr b/icons/cursors/right_ptr deleted file mode 100644 index f4a0b4c..0000000 Binary files a/icons/cursors/right_ptr and /dev/null differ diff --git a/icons/cursors/right_side b/icons/cursors/right_side deleted file mode 120000 index 1d46245..0000000 --- a/icons/cursors/right_side +++ /dev/null @@ -1 +0,0 @@ -left_side \ No newline at end of file diff --git a/icons/cursors/right_tee b/icons/cursors/right_tee deleted file mode 100644 index bc528c5..0000000 Binary files a/icons/cursors/right_tee and /dev/null differ diff --git a/icons/cursors/sb_down_arrow b/icons/cursors/sb_down_arrow deleted file mode 100644 index 59ca02e..0000000 Binary files a/icons/cursors/sb_down_arrow and /dev/null differ diff --git a/icons/cursors/sb_h_double_arrow b/icons/cursors/sb_h_double_arrow deleted file mode 120000 index 1d46245..0000000 --- a/icons/cursors/sb_h_double_arrow +++ /dev/null @@ -1 +0,0 @@ -left_side \ No newline at end of file diff --git a/icons/cursors/sb_left_arrow b/icons/cursors/sb_left_arrow deleted file mode 100644 index fc6c526..0000000 Binary files a/icons/cursors/sb_left_arrow and /dev/null differ diff --git a/icons/cursors/sb_right_arrow b/icons/cursors/sb_right_arrow deleted file mode 100644 index 1b79604..0000000 Binary files a/icons/cursors/sb_right_arrow and /dev/null differ diff --git a/icons/cursors/sb_up_arrow b/icons/cursors/sb_up_arrow deleted file mode 100644 index 6358205..0000000 Binary files a/icons/cursors/sb_up_arrow and /dev/null differ diff --git a/icons/cursors/sb_v_double_arrow b/icons/cursors/sb_v_double_arrow deleted file mode 120000 index 83cc946..0000000 --- a/icons/cursors/sb_v_double_arrow +++ /dev/null @@ -1 +0,0 @@ -top_side \ No newline at end of file diff --git a/icons/cursors/target b/icons/cursors/target deleted file mode 120000 index def8590..0000000 --- a/icons/cursors/target +++ /dev/null @@ -1 +0,0 @@ -dotbox \ No newline at end of file diff --git a/icons/cursors/tcross b/icons/cursors/tcross deleted file mode 120000 index 982ae30..0000000 --- a/icons/cursors/tcross +++ /dev/null @@ -1 +0,0 @@ -cross \ No newline at end of file diff --git a/icons/cursors/top_left_arrow b/icons/cursors/top_left_arrow deleted file mode 120000 index 0de4e80..0000000 --- a/icons/cursors/top_left_arrow +++ /dev/null @@ -1 +0,0 @@ -left_ptr \ No newline at end of file diff --git a/icons/cursors/top_left_corner b/icons/cursors/top_left_corner deleted file mode 100644 index 3f32ac1..0000000 Binary files a/icons/cursors/top_left_corner and /dev/null differ diff --git a/icons/cursors/top_right_corner b/icons/cursors/top_right_corner deleted file mode 100644 index ed5617e..0000000 Binary files a/icons/cursors/top_right_corner and /dev/null differ diff --git a/icons/cursors/top_side b/icons/cursors/top_side deleted file mode 100644 index 64f988f..0000000 Binary files a/icons/cursors/top_side and /dev/null differ diff --git a/icons/cursors/top_tee b/icons/cursors/top_tee deleted file mode 100644 index 05cf3b6..0000000 Binary files a/icons/cursors/top_tee and /dev/null differ diff --git a/icons/cursors/ul_angle b/icons/cursors/ul_angle deleted file mode 100644 index e2e2015..0000000 Binary files a/icons/cursors/ul_angle and /dev/null differ diff --git a/icons/cursors/ur_angle b/icons/cursors/ur_angle deleted file mode 100644 index 17bb213..0000000 Binary files a/icons/cursors/ur_angle and /dev/null differ diff --git a/icons/cursors/v_double_arrow b/icons/cursors/v_double_arrow deleted file mode 120000 index a3693c3..0000000 --- a/icons/cursors/v_double_arrow +++ /dev/null @@ -1 +0,0 @@ -sb_v_double_arrow \ No newline at end of file diff --git a/icons/cursors/watch b/icons/cursors/watch deleted file mode 100644 index 7c8c16d..0000000 Binary files a/icons/cursors/watch and /dev/null differ diff --git a/icons/cursors/xterm b/icons/cursors/xterm deleted file mode 100644 index 4d89809..0000000 Binary files a/icons/cursors/xterm and /dev/null differ diff --git a/icons/index.theme b/icons/index.theme deleted file mode 100644 index c6a4957..0000000 --- a/icons/index.theme +++ /dev/null @@ -1,3 +0,0 @@ -[Icon Theme] -Name=pixelfun3 -Comment=Good white modern-looking theme with a piece of nostalgia diff --git a/mkshrc b/mkshrc index 641c376..c0351ee 100644 --- a/mkshrc +++ b/mkshrc @@ -7,6 +7,9 @@ esac export VIMINIT="source ~/.config/vim/vimrc" export NVIMINIT="source ~/.config/vim/vimrc" +HISTFILE="$HOME/.mksh_history" +HISTSIZE=5000 + if [ -x /usr/bin/dircolors ]; then test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" alias ls='ls --color=auto' @@ -21,7 +24,7 @@ fi [ -f ~/.sh_aliases ] && . ~/.sh_aliases # parse the current branch and status of git to be added to the prompt -function parse_git_branch() { +parse_git_branch() { BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'` if [ ! "${BRANCH}" == "" ] then @@ -32,7 +35,7 @@ function parse_git_branch() { fi } -function parse_git_dirty { +parse_git_dirty () { status=`git status 2>&1 | tee` dirty=`echo -n "${status}" 2> /dev/null | grep "modified:" &> /dev/null; echo "$?"` untracked=`echo -n "${status}" 2> /dev/null | grep "Untracked files" &> /dev/null; echo "$?"` @@ -52,4 +55,4 @@ function parse_git_dirty { bind '^L=clear-screen' -export PS1=$(echo -e "\e[0;97m\${PWD/#\$HOME/\~}\e[0;37m\`parse_git_branch\` > \e[0;0m") +export PS1="\${PWD/#\$HOME/\~}\`parse_git_branch\` > ") diff --git a/profile b/profile index ea368ac..93a54ad 100644 --- a/profile +++ b/profile @@ -8,11 +8,13 @@ export XDG_RUNTIME_DIR=/tmp/$USER-$(uuidgen) alias editor=vim -export TERMINAL="urxvt" +export TERMINAL="st" export BROWSER="/usr/bin/firefox" export FILE_MANAGER="/usr/bin/thunar" -export EMAIL_CLIENT="/usr/bin/thunderbird" +export EMAIL_CLIENT="/usr/bin/claws-mail" export EDITOR="/usr/bin/vim" -[ "$(fgconsole 2>/dev/null)" = "1" ] && exec startx -- vt1 &> /dev/null +export JAVA_HOME=/usr/lib/jvm/java-19-openjdk/ +export XINITRC="$HOME/.config/sx/sxrc" +[ "$(fgconsole 2>/dev/null)" = "1" ] && exec sx diff --git a/scripts/bg.sh b/scripts/bg.sh index 34a1196..06793e9 100755 --- a/scripts/bg.sh +++ b/scripts/bg.sh @@ -1,4 +1,8 @@ #!/bin/sh + +feh --bg-fill ~/.config/bg.png +exit + setbg="feh --force-aliasing --bg-tile " image=~/.config/bg.gif diff --git a/scripts/calculator b/scripts/calculator index f092fd8..31998cc 100755 --- a/scripts/calculator +++ b/scripts/calculator @@ -1,2 +1,2 @@ #!/bin/sh -bspc rule -a \* -o state=floating && $TERMINAL -e bc -liq +bspc rule -a \* -o state=floating && $TERMINAL -e bc -l diff --git a/scripts/calendar b/scripts/calendar new file mode 100755 index 0000000..2836170 --- /dev/null +++ b/scripts/calendar @@ -0,0 +1,2 @@ +#!/bin/sh +bspc rule -a \* -o state=floating && $TERMINAL -e sh -c "cal $(date +%Y); read" diff --git a/scripts/cinema.sh b/scripts/cinema.sh index 5352a6e..c0e2938 100755 --- a/scripts/cinema.sh +++ b/scripts/cinema.sh @@ -1,3 +1,3 @@ #!/bin/sh -MAIN_DP=DP-1; +MAIN_DP=$($HOME/.scripts/primary-display.sh); v=$(xrandr --current --verbose | grep "Brightness" | cut -f2 -d " " | tr '\n' '*' | rev | cut -c 2- | rev | sed -e "s/$/==1/" | bc -l | grep -q 0 && echo 1 || echo 0); xrandr | grep " connected" | cut -f1 -d " " | while read -r line; do echo $line | grep -q $MAIN_DP && : || xrandr --output $line --brightness $v; done diff --git a/scripts/ddc-switch-inputs b/scripts/ddc-switch-inputs index 9bd3682..b6f8d0a 100755 --- a/scripts/ddc-switch-inputs +++ b/scripts/ddc-switch-inputs @@ -15,5 +15,5 @@ case $1 in ;; esac -ddcutil --bus=12 setvcp 60 ${OUT[0]} & +ddcutil --bus=10 setvcp 60 ${OUT[0]} & wait diff --git a/scripts/dmenu-iwd b/scripts/dmenu-iwd new file mode 100755 index 0000000..a3cc411 --- /dev/null +++ b/scripts/dmenu-iwd @@ -0,0 +1,96 @@ +#!/bin/bash + +STATION="wlan0" +FONT="Monospace" +NORMAL_BACKGROUND="#000000" +NORMAL_FOREGROUND="#8f8f8f" +SELECTED_BACKGROUND="#000000" +SELECTED_FOREGROUND="#00ff00" +FLAGS=( + "-i" + "-nb" "$NORMAL_BACKGROUND" + "-nf" "$NORMAL_FOREGROUND" + "-sb" "$SELECTED_BACKGROUND" + "-sf" "$SELECTED_FOREGROUND" + "-fn" "$FONT" +) + +remove_colors() { + sed -E 's/\x1B\[[0-9;]*[JKmsu]//g' +} + +connect() { + SSID="$1" + notify-send --urgency=low "Attempting to connect to network: $SSID" + if iwctl station "$STATION" connect "$SSID" --dont-ask; then + notify-send "Connected to network: $SSID" + exit 0 + fi + if ERROR=$( + iwctl station "$STATION" connect "$SSID" \ + --passphrase "$(dmenu "${FLAGS[@]}" -p Password: &1 + ); then + notify-send "Connected to network: $SSID" + else + notify-send --urgency=critical \ + "Failed to connect to network: $SSID" "$(remove_colors <<<$ERROR)" + fi +} + +networks() { + iwctl station "$STATION" get-networks | awk ' +BEGIN { + i = -1 +} +{ + i++ + if (i < 4) next # skip header + + network = "" + strength = 0 + for (ix = 1; ix <= NF; ix++) { + if (ix == NF - 1) continue # skip protocol + + # calculate strength by reading *s until + # a color code is encountered + char = sprintf("%c", $ix) + if (char == "*") { + split($ix, chars, "") + for (c = 1; c <= length($ix); c++) { + char = sprintf("%c", chars[c]) + if (char == "\033") break + strength++ + } + continue + } + + if (char == "\033") continue # color codes + if ($ix == "") continue # whitespace + if ($ix == ">") continue # current network + + # ssids may contain spaces + if (network == "") { + network = $ix + continue + } + network = network " " $ix + } + if (network == "") next + networks[network] = strength +} +END { + for (s = 4; s >= 0; s--) { + for (network in networks) { + if (networks[network] == s) { + print network + delete networks[network] + } + } + } +} +' +} + +SELECTION=$(networks | dmenu "${FLAGS[@]}") || exit 1 +connect "$SELECTION" diff --git a/scripts/gamma.sh b/scripts/gamma.sh index 796b561..8de1b80 100755 --- a/scripts/gamma.sh +++ b/scripts/gamma.sh @@ -1,10 +1,10 @@ #!/bin/bash -MAIN_DP=eDP1; +MAIN_DP=$($HOME/.scripts/primary-display.sh); v=$1 if [ $# -ne 0 ]; then xrandr --output $MAIN_DP --gamma $(paste -d" " <(xrandr | grep " connected" | cut -f1 -d " ") <(xrandr --current --verbose | grep "Gamma" | cut -f7 -d" " | cut -f1 -d":" | xargs -I % echo "1/%") | grep $MAIN_DP | cut -d" " -f2 | xargs -I % echo "%*$v" | bc -l) else - xrandr --output $MAIN_DP --gamma 1 + xrandr --output $MAIN_DP --gamma 1.1 fi diff --git a/scripts/iommu.sh b/scripts/iommu.sh new file mode 100755 index 0000000..d971665 --- /dev/null +++ b/scripts/iommu.sh @@ -0,0 +1,8 @@ +#!/bin/bash +shopt -s nullglob +for g in $(find /sys/kernel/iommu_groups/* -maxdepth 0 -type d | sort -V); do + echo "IOMMU Group ${g##*/}:" + for d in $g/devices/*; do + echo -e "\t$(lspci $@ -nns ${d##*/})" + done; +done; diff --git a/scripts/kaomoji b/scripts/kaomoji new file mode 100644 index 0000000..6c8d1d3 --- /dev/null +++ b/scripts/kaomoji @@ -0,0 +1,453 @@ +ʕ•ₒ•ʔ Bear Shocked +ʕ•ᴥ•ʔ Bear +ʕ ·ᴥ·ʔ RBear +ʕ·ᴥ· ʔ LBear +ʕ ꈍᴥꈍʔ Bear Sob +ʕ – ᴥ – ʔ Bear Sleep + ʕノ•ᴥ•ʔノ ︵ ┻━┻ Bear Flip +ʕ╮•ᴥ•ʔ╮┳━━┳ Bear Unflip +ʕ; •`ᴥ•´ʔ Bear Angry +ʕ♡˙ᴥ˙♡ʔ Bear Love +ʕ•ᴥ•ʔ?? Bear Confused +(◕‿◕) Happy (1) +(^▽^) Joy (2) +(¬‿¬) Smug Happy +(´・ᴗ・`) Joy (4) +(⌒‿⌒) Joy (5) +(^‿^) Joy (6) +(☆▽☆) Joy (7) +(❛ᴗ❛) Joy (8) +(´♡‿♡`) Love (1) +(◕‿◕)♡ Love (2) +(─‿‿─)♡ Love (3) +(⌒_⌒;) Ashamed +(--_--) Unimpressed +((╬◣﹏◢)) Angry (1) +(#`Д´) Angry (2) +(◕︵◕) Sad (1) +(-_-) Sad (2) +(╥_╥) Cry (1) +(╥﹏╥) Cry (2) +(×﹏×) Dead +(;;;o_o) Fear +┐( ̄ヘ ̄)┌ Shrug (1) +╮(︶︿︶)╭ Shrug (2) +┐(︶▽︶)┌ Shrug +┐( ˘_˘ )┌ Shrug Small +ᕕ( ᐛ )ᕗ Joyful March +(•ิ_•ิ)? Confused +(¬_¬) Doubt +(⊙_⊙) Shock Raw +(°▽°)/ Greet (1) +(^-^*)/ Greet (2) +( ̄▽ ̄)/ Greet (3) +ヾ(・ω・*) Greet (4) +ʕ•ᴥ•ʔ/ Bear Greet +(^_<) Wink (1) +(-_・) Wink (2) +( ̄ハ ̄*) Nosebleed +┬┴┬┴┤( ͡° ͜ʖ├┬┴┬┴ Hiding +ε===(っ≧ω≦)っ Fart +(-_-)zzZ Sleep +╰( ͡° ͜ʖ ͡°)つ──☆*:・゚ Magic +(˘ɜ˘)♬♪♫ Whistle +(〜 ̄▽ ̄)〜 Dance R +〜( ̄▽ ̄〜) Dance L +( ͡° ͜ʖ ͡°) LNeutral +( ͡°ʖ̯ ͡°) LSad +( ͠° ͟ʖ ͡°) LConcern +( ͡ᵔ ͜ʖ ͡ᵔ) LJoy +(⌐■_■) Cool +( ^▽^)っ✂╰⋃╯ NoMoreWilly +(╯°益°)╯彡┻━┻ TableRage +( ╯°□°)╯ ┻━━┻ Flip +(╮°-°)╮┳━━┳ Unflip +(◕ω◕) owo (1) +𝕠𝕨𝕠 owo (2) +ʕ•w•ʔ Bear owo +(ノ≧ ヮ ≦)ノ︵ ┻┻ CuteFlip +ಠ_ಠ Disaproval +(◕ᴗ◕✿) Flower Happy (1) +(◕ ω ◕✿) Flower owo +(◕∇◕✿) Flower Happy (2) +(◕ᱛ ◕✿) Flower Shocked +(◕︿◕✿) Flower Sad +(◕ﬦ ◕✿) Flower Disapointed +(◕‸ ◕✿) *pout* Flower Pout +(≖ ︿ ≖ ✿)ꐦꐦ Flower Angry +(╯✿◕益◕)╯︵ ┻━┻ Flower Flip +🗡⊂(ʘ‿ʘ✿) Flower Yandere +(´∀`) Laughing + ( ՞ ڡ ՞ ) Yum +(▀̿Ĺ̯▀̿ ̿) Boss +(/-(エ)-\) Scared Cowering 1 +(ΟΔΟ;;) Fear Shock Scared +(⊃д⊂) Scared 2 +(/_\) Scared Cowering +^•-•^ cat derp +(>‿<) squint happy closed eyes +♡ heart +♫ music +.‿. smol happy +^_^ Overjoyed (2) +(╯°□°)╯︵ ┻━┻ Flipping Table (3) +ლ(ಠ益ಠლ) But At What Cost +(//_^) Emo (5) +ʕ •ᴥ•ʔ Koala (3) +(っ^‿^)っ Kirby (5) +[¬º-°]¬ Zombie (2) +(●∈∋●) Bird (5) +ಠ_ಠ Disapproval +T.T Sad (2) +◤◡ᴥ◡◥  Dog (4) +(∩`-´)⊃━☆゚.*・。゚ Wizard +^-^ Happy (7) +ᕦ(ò_óˇ)ᕤ Flexing (3) +♪┏(・o・)┛♪ Dancing (8) +( ͡° ͜ʖ ͡°) Smiling (2) +/人◕ ‿‿ ◕人\ Kyubey +༼ ༎ຶ ෴ ༎ຶ༽ Distraught +ᒄ₍⁽ˆ⁰ˆ⁾₎ᒃ♪♬ Frosty the Snowman (2) +(╯°□°)╯︵ ┻━┻ Flipping table (2) +<(^oo^)> Pig (3) +¯\_(ツ)_/¯ Shrugging (2) +U=・ x ・=U Rabbit (2) +⊂((・▽・))⊃ Hug me (2) +V●ᴥ●V Doggy (2) +(=^_^=) Bunny (3) +<コ:彡 Squid (2) +-_-; Anime Sweat Drop (2) +(°̥̥̥̥̥̥̥̥ᴗ°̥̥̥̥̥̥̥̥) Happy crying +(=^・ェ・^=) Kitty (2) +(((༼•̫͡•༽))) Ghost (2) +(-‸ლ) Whoops +(=^ェ^=) Cat (4) +( ´-ω・)︻┻┳══━一 Sniper +⊆☉ᴥ☉⊇ Bear (7) +༼ つ ◕_◕ ༽つ Take my energy +(  ̄┏_┓ ̄) Mustache (2) +(;´Д`) Giving Up +( ͡° ʖ̯ ͡°) Disgruntled +✌(◕‿-)✌ Peace (3) +ಠ_ರೃ Monocle (2) +T^T Crying (5) +ᘛ⁐̤ᕐᐷ Chameleon +༼ つ ◕_◕ ༽つ Gimme +ლ(ಠ益ಠ)ლ Anger +(ง •̀_•́)ง Feisty +(っ⌒‿⌒)っ Hug (3) +ϵ( 'Θ' )϶ Fish (3) +(^▽^) Laughing (5) +¯\(°_o)/¯ Confused (4) +̿’̿’\̵͇̿̿\З=( ͠° ͟ʖ ͡°)=Ε/̵͇̿̿/’̿̿ ̿ ̿ ̿ ̿ ̿ Outlaw +o(^▽^)o Pumped (2) +.∵・(゚Д゚) Scared (2) +(*☉౪ ⊙。)ノ Imbecile (2) +d-(^.^)z Thumbs Up (2) +(>_<) Painful +(¬_¬") Annoyed (4) +(´╹〽╹`) Worried (4) +(o^-^o) Pikachu (2) +(▀̿Ĺ̯▀̿ ̿) Deal with it +(∩`-´)⊃━☆゚.*・。゚ Magic Attack +꒡ᘦ̲꒡ Sleeping (5) +(‾ʖ̫‾) Lethargic +^_^; Guilty +ヽ(`⌒´メ)ノ Angry (8) +^^ Blissful +^_^/ High Five (2) +ʕ•͡ᴥ•ʔ Polar bear +❆❅❉ Snowing +ヽ(★ω★)ノ Excited +U^ェ^U Puppy +⊂(^(工)^)⊃ Teddy bear +(≧∇≦)/ Joyful (2) +◦°˚\☺/˚°◦ Playing in the snow +(╯°□°)╯︵  ʞooqǝɔɐɟ Flipping Facebook +(;-_-)ノ Giving up +⊙▂⊙ Shocked +|∴め ϖ め∴| SpongeBob SquarePants +◔̯◔ Rolling Eyes +⊂(◜ᴥ◝)つ Teddy Bear +ε=(☉_☉) Accidental farting +(ಥ﹏ಥ) Devastated (2) +(•͡.•͡) Skeptical +ε=┏( >_<)┛ Running (5) +┬─┬︵/(.□.)╯ Table Flips You +〠_〠 Tired (3) +∊ಠ_ಠ∍ Distressed +V=(° °)=V Crab (2) +ᶘ ᵒᴥᵒᶅ Seal (2) +Ƹ̵̡Ӝ̵̨̄Ʒ Butterfly +(- o - ) zzZ ☽ Sleepy +◯0o。(ー。ー)y Smoking (4) +(。々°) Herp Derp +-_-* Frustrated (3) +(+[__]∙:∙) PlayStation Portable +(V) (°,,,,°) (V) Zoidberg +/|\( ;,; )/|\ Bat +◖㈠ ω ㈠◗ Panda +\m/d(^_^)b\m/ Rocking Out +ヽ(゚Д゚)ノ Freak Out (2) +(ノ゚0゚)ノ~ Yoo-Hoo +¤\( `⌂´ )/¤ Lifting weights +(ò_ó) Furious +( ˘ ³˘)♥ Kiss me +(^▽^) Cheerful (3) +(⌒ ͜ʖ⌒)b Attentive +ᕦ❍ᴗ❍ᕤ Muscular Person +(´>_●)メ(●_<`) Sword Fighting +:-Þ Teasing +=( ^o^)ノ___o Bowling +(#×_×) Dead (2) +(。・_・)ノ”【】 Painting +(/。\) Shy (5) +⎰≀.☮-☮≀⎰ John Lennon +─=≡Σ(([ ⊐•̀⌂•́]⊐ Superhero +(¬з¬)σ Pointing (2) +(・д・)} On The Phone (3) +㐈⦁ཽし⦁ཽ㐈  Larry David +⨌⨀_⨀⨌ Benjamin Franklin +(☄ฺ◣д◢)☄ฺ Scaring +ƪ(˘▽˘ƪ) Worshiping +[•.•ิ] Huh +(◐‿◑) Crazy +\(-_- ) Thank You +(_ε_) Kiss my butt +(⊃‿⊂) Anticipation +(* ̄m ̄) Dissatisfied +Q('.'Q) Put Em Up +\(^o)(^0^)(o^)/ Caroling +( ̄~ ̄) Unimpressed +༼ঢ_༽ঢ༽ Perplexed +(。♥‿♥。) Smitten +( ̄□ ̄;) Surprised +(^o^) Singing (3) +(:3 っ)っ Walrus +( `_)乂(_' ) Arm wrestle +(ง •̀ゝ•́)ง Fighting (2) +uwu Happy Anime Face +└(^o^ )X( ^o^)┘ Best buddies +d^_^b DJ +( --)/ ==卍 Ninja Star +C:。ミ Octopus +(´・ω・`) Snubbing (2) +♪(●′▽`)ノ Good Night +(#^.^#) Embarrassed (3) +ಥ_ಥ Bawling (3) +†_(゚ー゚*)β Exorcism +੯ू•́ू ໒꒱⁼³₌₃ Sonic the Hedgehog +(^‿◕) Winking (3) +(″・ิ_・ิ)っ Wait (3) +。◕‿◕。 Gleeful +ヽ( ★ω★)ノ Pumped up +_〆(。。) Writing (2) +(∿°○°)∿ ︵ ǝʌol Heartbroken +^;;^ Spider +(⓪益⓪) Staring (2) +( ̄┏∞┓ ̄) Fu Manchu Man +( • ∀•)っθΘʘ Hiding Easter eggs +_φ( °-°)/ Doing Homework +◖ර◞ʖ◟ර◗ Grandma +¬.¬ Whatever (3) +⫷ °⧭° ⫸ Clown +(♥_♥) In Love +>.< Upset (2) +( ◢д◣) Depressed (4) +ᕕ( ᐛ )ᕗ Celebrating +(¬‿¬) Cunning +└(^o^)┐ Grooving (3) +~゜・_・゜~ Raving +ᕦ◉▿◉ᕤ Owl (2) +\(^O^)/ Celebrate +(*’(OO)’*) Piggy (2) +˃ʍ˂ Enraged (2) +(ू˃̣̣̣̣̣̣︿˂̣̣̣̣̣̣ ू) Sobbing (3) +( ^^)人(^^ ) Best Buds +└@(・ェ・)@┐ Beefcake +(☉__☉”) Yikes +(╯˘ -˘ )╯ Praying (2) +ε=┌( ≧▽)┘ Elated +( •_•)O °Q(•_• ) Playing Ping Pong +∋(°O°)∈ Blowfish +(;一_一) Ashamed (4) +{♥‿♥} Lovestruck +๏-) Cyclops +(o ̄∇ ̄)=◯)`ν゜)・ Punching (6) +┬─┬ノ( º _ ºノ) Putting Table Back (2) +(~_(]=--Z(◡˘) Pie Fight +((((((^_^;) Evading +(/o^)/°⊥\(^o\) Volleyball +-{'''|'''|'''|''']=[] Syringe +[^._.^]ノ彡 Nyan Cat +---(o_ _)o Tripping (2) +┬┴┬┴┤(・_├┬┴┬┴ Snooper +(ㆆ_ㆆ) Unamused +(✿◠‿◠)  Hippie +ヾ(* ̄O ̄)ツ Yelling +(ɔ◔‿◔)ɔ ♥ Loving +(ノ-o-)ノ 中 Olympic Hammer Throw +(/ω・\) Peering +(´・ω・)っ由 Gift +[-_-]~ Ninja +(シ_ _)シ Apology (2) +∋∞(●゚v゚)∞∈ Pigtails +‎(>o<)ρミ┳┷┳゜ Table Tennis +(^̮^) Pleased (2) +♪~( ̄ε ̄;) Whistling +( ̄▼ ̄) Big Grin +⋟^≏^⋞ Kitty Cat +( ̄へ ̄) Discontent +(*・_・)ノ⌒* Throwing Away +(*@_*#) Beaten Up +(p_-) Thinking +(。_°)☆ Punched +♥‿♥ Enamored +ε-(´・`) フ Phew +༼ঢ_㇁ঢ༽ Bad hair day +(づ ̄ ³ ̄)づ Smooch (3) +O(<>'<>)O Aang +(_ _)..ooOO Dreaming +┳┻┳° Ping Pong table +^o^ Mog +(゚皿゚)r┏┳-* Shooting (2) +m( ゚皿゚)m★━━ Laser +٩◔̯◔۶ Eye Roll With Hands Up +ヽ(´Д`ヽミノ´Д`)ノ Frantic (2) +(-ε- ) Pucker up (3) +ヽ(⌐■_■)ノ♪♬ Boogie down +「(°ヘ°) Puzzled +d(^_^)b Listening to Music +( -_-)旦~ Drinking +<_< Looking (4) +(( _ _)☆ ≡〇 Header +^)_(^ Chubby +(๑´•.̫ • `๑) Blushing +(。▼皿▼) Darth Vader +(╬☉Д⊙ฺ) Cyborg +(ʘ‿ʘ) Smile +ε=ε=ε=┌(๑ʘ∀ʘ)┘ Sprinting +ƪ(˘⌣˘)ʃ Raise the roof +( ˘︹˘ ) Smug +(▰˘◡˘▰) Satisfied +(¬、¬) Shifty +¯(°_o)/¯ Confused shrug +✖‿✖ Dead person +(。_°☆\(- – ) Punch +(ɔˆ ³(ˆ⌣ˆc) Loving couple +(*▿▿* ƪ) Vampire +o(^^o)(o^^)o Hopeful +___ψ(‥ ) Studying +_φ(°-°=) Doing homework +@( o・ω・)@ Monkey +(╭ರ_•́) Inquisitive +੯ू‵ू ໒꒱ Poodle +(*^^)^*) Kiss (5) +(^~^) Meh +(/。\) Frightened +:þ Playful +(>^_^)><(^o^<) Hugging +(-_ゞ Groggy +(*^o^)人(^o^*) Buddies +(●´ノω`)コ Whispering (2) +o(´^`)o Reluctant +( つ Д `) Wiping Tears +(o´・Υ・)ノ・ Help (2) +(。・ˇдˇ・。) Pompous +(´∪`*) Friendly +ヘ(。□°)ヘ Psycho +(人’∀’) Precious +(っ˘ڡ˘ς) Yummy +┗(・ω・;)┛ How Should I Know +(о^ω^о) Giggling +(´ー`)┌フッ Golf Clap +\\(<.<|>.>)// Panicking +^(#`∀´)_Ψ Demon +(╯‵Д′)╯ Scary +:-{  -__-: Stinky +ಠᴗಠ Scheming +<(; ̄ ・ ̄) Scratching +\(^ ^)/ Glad +(╯_╰) Bummed out +┗( ●-﹏ `。)づ Hurt (2) +(-_-)# Girl +8(>_<)8 Jealous +(*°∀°)=3 Infatuated (3) +( ^_^)/ Waving +o(^_-)O Boxer +{{|└(>o< )┘|}} Up In Arms +(^^)// Applause (2) +( `_)?(_' ) Dueling +(´~`) Weary +v(^_^)v Victory (3) +(ノ_ _)ノ Surrender +<( ・ェ-)<} Bow and Arrow +( `o´)_θ☆ Kicking +(-□-)︵* Blowing a Kiss +|д・) Hiding (4) +(´Д゜)/゜⌒。 Discarding +ʕʔ Bread +(ɔ˘з˘)ɔ Romantic +ʕ •́؈•̀) Winnie the Pooh +(ó ì_í)=óò=(ì_í ò) Bro Pound +ヾ(`ε´)ノ Booing +|̲̅̅●̲̅̅|̲̅̅=̲̅̅|̲̅̅●̲̅̅| Stereo +ʘ‿ʘ Eager +:(¦) Frog +( ^)/占~~~ Banksy +(;´༎ຶД༎ຶ`) Weeping (2) +⊂ •͡˘∠•͡˘ ⊃ Suspicious +( ° ᴗ°)~ð  Proposal +(๑╹ڡ╹๑) Tasty +(¬_¬ ) Neglected +ʕु•̫͡•ʔु Bear cub (2) +┌|°з°|┘ Cutting a rug +(⊙_◎) Crazed +(✖╭╮✖) Deceased +←~(o `▽´ )oΨ Satan +˙ ͜ʟ˙ Content +( ˇ෴ˇ ) Hipster +♫.(◠౪◠).♫ Jamming to music +∊♡_ᴥ_♡∍ Puppy Love +L(´□`L) Oh No! (2) +(;´ρ`) Yawning +(╯ნ_㇁ნ)╯ Defeated +(.〜◍`皿′◍〜.) Livid (2) +ᡊ|◔じ◔|ᡊ  Woody Allen +✌(გ_㇁გ)✌ Ringo Starr +╹﹏╹ Cold +☉ϖ☉ Lobster +(๑≖ิิ益≖ิ๑) Evil Laugh +(((☎))) Phone +(○`д´)ノシ Σ(っ゚Д゚)っ Chasing +o(>< )o⌒* Mad (3) +ლ(´ڡ`ლ) Licking +⪿ ↂ ˒̫̮ ↂ ⫀ Elton John +(•ᴥ• )́`́'́`́'́⻍ Porcupine +且_(゚◇゚;)ノ゙ Waiter +◖⎚∠⎚◗ Geek Nerd +-ˆ ω ˆ- Kitten +•:_:• Nagato +ε=┌(^-^)┘ Skipping +(+.+)(-.-)(_ _) Falling Asleep +[ ± _ ± ] Sick +〜〜(/ ̄▽)/ 〜ф Chasing A Butterfly +\(`0´)/ Fed Up +¥[*.*]¥ Robot +(*・)σσ(*゜O゜) Poking +( ̄ー ̄(_ _( Nodding +▼o・_・o▼ Hello +(`_^) Wink +/( _0_) ̄θ☆≡≡○ Scissor Kick +ヽ(´ー`)┌ Mellow +(^ _ ^)/~~ Goodbye +(*・)「」「」 Magic Casting +( `皿´)。ミ/ Hitting +[]゛7(∀゜*) Dialing +(((((^_^) Teleporting +( ̄ー ̄)//”” Clapping +(。。;)\(-_-) Comforting +(*  ̄)( ̄ *)  Kissing +(;^_^)ッ☆( ゜o゜) Slapping +\(~O~)/ Good Morning +\_(´▽`)♪_/ Bathtub diff --git a/scripts/mpc_add_query.sh b/scripts/mpc_add_query.sh new file mode 100755 index 0000000..adc820a --- /dev/null +++ b/scripts/mpc_add_query.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +query=${1} +cd ~/music +find . -iname "*$query*" -type f | while read -r line; do mpc insert "${line#./}"; done diff --git a/scripts/mpc_add_recent.sh b/scripts/mpc_add_recent.sh new file mode 100755 index 0000000..7465e0e --- /dev/null +++ b/scripts/mpc_add_recent.sh @@ -0,0 +1,7 @@ +#!/bin/sh +# add recently added files to the playlist + +count=${1:-10} + +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 diff --git a/scripts/mpc_picker b/scripts/mpc_picker index 0e6fddc..3758b0a 100755 --- a/scripts/mpc_picker +++ b/scripts/mpc_picker @@ -1,4 +1,6 @@ #!/bin/sh -chosen=$(mpc listall | dmenu -i -p mpd) -[ "$chosen" != "" ] || exit -mpc insert "$chosen" +selected=$(mpc -f "%title%[\t\t%artist%][\t\t%album%]\t\t%file%" listall | dmenu -i -p mpd) +[ "$selected" == "" ] && exit +file=$(printf "%s\n" "$selected" | rev | cut -f1 -d' ' | rev) +echo "$file" +mpc insert "$file" diff --git a/scripts/primary-display.sh b/scripts/primary-display.sh new file mode 100755 index 0000000..310cfb6 --- /dev/null +++ b/scripts/primary-display.sh @@ -0,0 +1,3 @@ +#!/bin/sh +xrandr | awk '/ primary / {print $1}' + diff --git a/scripts/start-mpd b/scripts/start-mpd index 33f6ad5..7b4f9a2 100755 --- a/scripts/start-mpd +++ b/scripts/start-mpd @@ -1,4 +1,4 @@ #!/bin/sh -[ ! -s ~/.config/mpd/pid ] && mpd .config/mpd/mpd.conf +pidof mpd || mpd .config/mpd/mpd.conf pidof mpdscribble || mpdscribble --conf .config/mpdscribble/mpdscribble.conf pidof mpd-rpc || mpd-rpc --no-idle --fork diff --git a/scripts/tablet b/scripts/tablet index 009395a..31c4871 100755 --- a/scripts/tablet +++ b/scripts/tablet @@ -2,51 +2,78 @@ import sys import numpy as np import os +from Xlib import X, display +from Xlib.ext import randr -if len(sys.argv) < 3: - print("Usage: tablet [dev number] [property number] [scale factor] [aspect ratio]") +import subprocess +import re + +# this is horriffic, gets the list of all screens +screens = [ (lambda s: [int(x) for x in (s.split("+")[1], s.split("+")[2], s.split("x")[0].split("/")[0], s.split("x")[1].split("/")[0])])(l.split(" ")[3]) for l in str(subprocess.check_output(["xrandr", "--listmonitors"])).split("\\n") if len(l.split(" ")) > 2] + +#if len(sys.argv) < 3: +# print("Usage: tablet [dev number] [property number] [scale factor] [aspect ratio]") #Arguments -dev = sys.argv[1] -prop = sys.argv[2] -scale = float(sys.argv[3]) -tablet_ratio = (lambda s: float(s[0]) / float(s[1]))(sys.argv[4].split(":")) if len(sys.argv) > 4 else 16/9 +scale = float(sys.argv[1]) if len(sys.argv) > 1 else 1 +#tablet_ratio = (lambda s: float(s[0]) / float(s[1]))(sys.argv[4].split(":")) if len(sys.argv) > 4 else 16/9 +tablet_ratio = 16/9 -#Layout of screens: (x, y, w, h) -#screens = [ -# (0, 0, 1280, 1024), -# (1280, 0, 2560, 1440), -# (3840, 0, 1080, 1920), -# (4920, 0, 1080, 1920), -#] -screens = [ - (0, 0, 1920, 1080), -] +input_items = list(filter(lambda i: i[0], zip(subprocess.check_output(["xinput", "list", "--id-only"]).decode("ascii").split("\n"), subprocess.check_output(["xinput", "list", "--name-only"]).decode("ascii").split("\n")))) + +input_items = sorted(input_items, key=(lambda i: int(i[0]))) + +print("Input devices found:") + +for item in input_items: + print(f"{item[0]}: {item[1]}") + +print() +dev = input("Select input device (id) to use: ") + + +prop = [ re.search(r"\((.+)\)", line).group(1) for line in subprocess.check_output(["xinput", "list-props", dev]).decode("ascii").split("\n") if re.search("Coordinate Transformation Matrix", line) ][0] + +if len(screens) == 1: + target = screens[1] +else: + print("Multiple screens detected:\n") + for i, screen in enumerate(screens): + print(f"{i}: {screen}") + + print() + targetno = input("Enter screen to map to (0): ") + + if targetno: + target = screens[int(targetno)] + else: + target = screens[0] -#TODO find this with xrandr -target = screens[0] #Physical offset of the selected screen offsetx = target[0] offsety = target[1] #Size of the full screen areas -sh = 1080 -sw = 1920 -#TODO calculate using list of screens +sh, sw = 0, 0 + +for screen in screens: + if screen[0]+screen[2] > sw: + sw = screen[0] + screen[2] + if screen[1]+screen[3] > sh: + sh = screen[1] + screen[3] #Aspect ratio of the tablet, to avoid weird scaling problems #Size of the tablet -#Prioritize the with when scaling between aspect ratios -tw = target[2] +#Prioritize the width when scaling between aspect ratios +tw = target[2] th = tw / tablet_ratio -print(tw, "x", th) if "-r" in sys.argv or "-l" in sys.argv: - th = target[2] + th = target[2] tw = th / tablet_ratio #make a variable that will try to make the scale the same over diferent resoultions @@ -83,5 +110,7 @@ if "-l" in sys.argv: arr = np.squeeze(np.asarray(transform)) -os.system(" ".join(["xinput set-prop", dev, prop, " ".join([str(x) for x in [arr[0, 0], arr[0, 1], arr[0, 2], arr[1, 0], arr[1, 1], arr[1, 2], arr[2, 0], arr[2, 1], arr[2, 2]]])])) +cmd = " ".join(["xinput set-prop", dev, prop, " ".join([str(x) for x in [arr[0, 0], arr[0, 1], arr[0, 2], arr[1, 0], arr[1, 1], arr[1, 2], arr[2, 0], arr[2, 1], arr[2, 2]]])]) +print(cmd) +os.system(cmd) #alias tablet2="xinput set-prop 18 156 2.45 0 -0.725 0 2.45 -0.725 0 0 1" diff --git a/scripts/toggle-mute.sh b/scripts/toggle-mute.sh new file mode 100755 index 0000000..95c2555 --- /dev/null +++ b/scripts/toggle-mute.sh @@ -0,0 +1,2 @@ +#!/bin/sh +amixer set Capture toggle diff --git a/scripts/vfetch b/scripts/vfetch new file mode 100755 index 0000000..e0018e3 --- /dev/null +++ b/scripts/vfetch @@ -0,0 +1,288 @@ +#!/usr/bin/env python3 + +from xdg.BaseDirectory import xdg_config_home +from enum import Enum +import subprocess +import platform +import distro +import json +import re +import os +import wmctrl + +colors = [ + # Regular colors. + "\u001b[30m", + "\u001b[31m", + "\u001b[32m", + "\u001b[33m", + "\u001b[34m", + "\u001b[35m", + "\u001b[36m", + "\u001b[37m", + + # Bright colors. + "\u001b[30;1m", + "\u001b[31;1m", + "\u001b[32;1m", + "\u001b[33;1m", + "\u001b[34;1m", + "\u001b[35;1m", + "\u001b[36;1m", + "\u001b[37;1m", + + # Reset. + "\u001b[0m" +] + +decorations = [ + "\u001b[1m", # Bold. + "\u001b[4m", # Underline. + "\u001b[7m" # Reversed. +] + +# Creates a copy of the specified string with color and decorations added. +def colored(string, colorIndex, decorationIndices=[]): + newString = colors[colorIndex] + for decorationIndex in decorationIndices: + newString += decorations[decorationIndex] + newString += string + colors[len(colors)-1] + return newString + +# Enum for the different data types. +class Type(str, Enum): + os = 'os' + kernel = 'kernel' + wm = 'wm' + packages = 'packages' + uptime = 'uptime' + +# Enum for the different align modes. +class AlignMode(str, Enum): + spaces = 'spaces' + center = 'center' + +# Loads the settings from the configuration file. +# First checks for a configuration file in ~/.config/vfetch/vfetch.conf, +# else it defaults to the configuration file in the same folder as the script. +def loadSettings(): + try: + file = open(xdg_config_home + '/vfetch/vfetch.conf', 'r') + except FileNotFoundError: + file = open(os.path.dirname(os.path.realpath(__file__)) + '/vfetch.conf', 'r') + content = file.read() + settings = json.loads(content) + file.close() + return settings + +# Prints string without ending with a new line. +def printn(string): + print(string, end="") + +# Prints string at a specified position. +def printAt(string, *position): + if len(position) == 1: + x = position[0][0] + y = position[0][1] + else: + x = position[0] + y = position[1] + printn("\x1b7\x1b[%d;%df%s\x1b8" % (y+1, x+1, string)) + +# Prints the data lines. +def printLines(lines, colorIndex, offsetX, offsetY, alignMode, alignSpace): + longestName = 0 + dataPosition = 0 + + if alignMode is AlignMode.spaces: + for line in lines: + position = len(line[0]) + alignSpace + if position > dataPosition: + dataPosition = position + else: + # Finds the length of the longest name. + longestName = len(max(lines, key = lambda data: len(data[0]))[0]) + + y = 0 + x = offsetX + # Prints the lines and formats them accordingly. + for line in lines: + if alignMode is AlignMode.spaces: + printAt(line[1], x + dataPosition, y+offsetY) + elif alignMode is AlignMode.center: + line[0] = ' ' * (longestName - len(line[0])) + line[0] + + printAt(colored(line[0], colorIndex, [0]), x, y+offsetY) + if alignMode is AlignMode.center: + printAt(' ~ ' + line[1], x+len(line[0]), y+offsetY) + y += 1 + +# Sets the cursor position. +def setCursorPosition(*position, newLine=False): + if len(position) == 1: + x = position[0][0] + y = position[0][1] + else: + x = position[0] + y = position[1] + string = '\033[%d;%dH' % (y, x) + if newLine: + print(string) + else: + printn(string) + +# Runs the specified terminal command. +def termRun(command, arguments): + output = subprocess.run([command, arguments], text=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + return output.stdout + +# Prints ascii image. +def printAscii(position, asciiImage): + setCursorPosition(position) + lines = asciiImage.split('\n') + for line in lines: + print(line) + +# Gets the operating system. +def getOS(architecture=False, removeLinux=False): + os = distro.linux_distribution()[0] + if removeLinux: + os = re.sub('linux', '', os, flags=re.IGNORECASE) + os = os.rstrip() + if architecture: + os += ' ' + platform.machine() + return os + +# Gets the kernel. +def getKernel(fullName=True): + kernel = platform.release() + if not fullName: + kernel = kernel.split('-')[0] + return kernel + +# Gets the window manager. +def getWM(): + try: + return wmctrl.os.environ.get('DESKTOP_SESSION') + except: + pass + try: + return wmctrl.os.environ.get('XDG_SESSION_DESKTOP') + except: + return None + +# Gets the number of packages. +def getPackages(displayPackageManager=False): + try: + packages = termRun('pacman', '-Qq') + string = str(len(packages.split('\n'))) + if displayPackageManager: + string += ' (pacman)' + return string + except: + return None + +# Gets the machine uptime. +def getUptime(): + with open('/proc/uptime', 'r') as f: + uptime_seconds = float(f.readline().split()[0]) + hours = uptime_seconds / 3600 + minutes = (hours - int(hours)) * 60 + hours = int(hours) + minutes = int(minutes) + string = '' + if hours != 0: + string += str(hours) + 'h ' + if minutes != 0 or hours == 0: + string += str(minutes) + 'm' + return string + +# Gets the data for the specified data type. +def getData(type, settings): + data = { + Type.os: getOS(settings['displayArchitecture'], settings['removeLinux']), + Type.kernel: getKernel(settings['kernelFullName']), + Type.wm: getWM(), + Type.packages: getPackages(settings['displayPackageManager']), + Type.uptime: getUptime() + }.get(type, None) + + if data is None: + return None + + name = { + Type.os: [ 'OS', '' ], + Type.kernel: [ 'Kernel', '' ], + Type.wm: [ 'WM', '缾' ], + Type.packages: [ 'Packages', '' ], + Type.uptime: [ 'Uptime', '' ] + }.get(type, None)[int(settings['iconMode'])] + + if settings['lowercase']: + name = name.lower() + data = data.lower() + + return [name, data] + +# Gets the size of the specified ascii image. +def asciiSize(asciiImage): + x = 0 + split = asciiImage.split('\n') + for line in split: + if len(line) > x: + x = len(line) + return [x, len(split)] + +# Trims the specified ascii image of empty lines and trailing whitespaces. +def trimAscii(asciiImage): + lines = asciiImage.split('\n') + string = '' + for line in lines: + trimmedString = line.rstrip() + if len(trimmedString) != 0: + string += trimmedString + '\n' + string = string[:-1] # Removes last newline. + return string + +# Loads the ascii image at the specified path. +def loadAsciiImage(path): + file = open(path, 'r') + asciiImage = trimAscii(file.read()) + file.close() + return asciiImage + +settings = loadSettings() + +displayAscii = settings['displayAscii'] +offset = settings['offset'] + +# Loads the data lines. If the data is invalid (None) it does not get added. +lines = [] +for dataType in settings['data']: + data = getData(dataType, settings) + if data is not None: + lines.append(data) + +# Loads the ascii image if the option is set for it. +if displayAscii: + asciiImage = loadAsciiImage(settings['asciiImage']) + size = asciiSize(asciiImage) + offset[0] += size[0] + finalPosition = [0, size[1]] +else: + finalPosition = [0, len(lines)+offset[1]] + +# Makes the prompt after the script finishes have a blank line before it. +finalPosition[1] += 1 + +os.system('clear') + +if displayAscii: + printAscii([0,0], asciiImage) + +alignMode = AlignMode(settings['alignMode']) + +printLines(lines, settings['colorIndex'], offset[0], offset[1], alignMode, settings['alignSpace']) + +# Sets the final cursor position for the prompt to end up at. +setCursorPosition(finalPosition, newLine=True) diff --git a/scripts/websearch b/scripts/websearch index 5ffb91b..7af5b57 100755 --- a/scripts/websearch +++ b/scripts/websearch @@ -7,6 +7,8 @@ SEARCH_HISTORY=$HOME/.local/share/search_history SEARCH=$(cat $SEARCH_HISTORY | dmenu -p "search") +[ -z "$SEARCH" ] && exit 1 + echo "$SEARCH" >> $SEARCH_HISTORY query=$(echo $SEARCH | sed 's/ /+/g') diff --git a/sh_aliases b/sh_aliases index 8f60308..7d2d6ce 100644 --- a/sh_aliases +++ b/sh_aliases @@ -18,8 +18,6 @@ alias gosumemory-default="sudo /home/david/.local/share/gosumemory/gosumemory -p alias yta="yt-dlp --no-mtime --add-metadata --no-check-certificate --embed-thumbnail -x -f bestaudio/best" -alias suspend="i3lock-fancy -p -t ''; systemctl suspend" - alias vim="nvim" #alias tablet2='tablet 18 156 2.4' @@ -36,7 +34,7 @@ mp4-gif () { alias zth="zathura" alias nb="nb --blog-dir $BLOG_DIR" alias looking-glass-client="looking-glass-client -G input:rawMouse=yes input:escapekey=119 input:autocapture=yes -k -j" -alias show-keymap="vim qmk_firmware/keyboards/ergo42/keymaps/iksvo/keymap.c" +alias show-keymap="vim ~/docs/proj/qmk_firmware/keyboards/biacco42/ergo42/keymaps/iksvo/keymap.c" configure () { diff --git a/st/davidovski.patch b/st/davidovski.patch new file mode 100644 index 0000000..ee263b2 --- /dev/null +++ b/st/davidovski.patch @@ -0,0 +1,2002 @@ +From d71723fb393211ce03bae41e26d962b25e3dae98 Mon Sep 17 00:00:00 2001 +From: davidovski +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 ++++ b/Makefile +@@ -4,7 +4,7 @@ + + include config.mk + +-SRC = st.c x.c ++SRC = st.c x.c boxdraw.c + OBJ = $(SRC:.c=.o) + + all: st +@@ -17,6 +17,7 @@ config.h: + + st.o: config.h st.h win.h + x.o: arg.h config.h st.h win.h ++boxdraw.o: config.h st.h boxdraw_data.h + + $(OBJ): config.h config.mk + +@@ -43,9 +44,12 @@ install: st + chmod 644 $(DESTDIR)$(MANPREFIX)/man1/st.1 + tic -sx st.info + @echo Please see the README file regarding the terminfo entry of st. ++ mkdir -p $(DESTDIR)$(PREFIX)/share/applications ++ cp -f st.desktop $(DESTDIR)$(PREFIX)/share/applications + + uninstall: + rm -f $(DESTDIR)$(PREFIX)/bin/st + rm -f $(DESTDIR)$(MANPREFIX)/man1/st.1 ++ rm -f $(DESTDIR)$(PREFIX)/share/applications/st.desktop + + .PHONY: all clean dist install uninstall +diff --git a/boxdraw.c b/boxdraw.c +new file mode 100644 +index 0000000..28a92d0 +--- /dev/null ++++ b/boxdraw.c +@@ -0,0 +1,194 @@ ++/* ++ * Copyright 2018 Avi Halachmi (:avih) avihpit@yahoo.com https://github.com/avih ++ * MIT/X Consortium License ++ */ ++ ++#include ++#include "st.h" ++#include "boxdraw_data.h" ++ ++/* Rounded non-negative integers division of n / d */ ++#define DIV(n, d) (((n) + (d) / 2) / (d)) ++ ++static Display *xdpy; ++static Colormap xcmap; ++static XftDraw *xd; ++static Visual *xvis; ++ ++static void drawbox(int, int, int, int, XftColor *, XftColor *, ushort); ++static void drawboxlines(int, int, int, int, XftColor *, ushort); ++ ++/* public API */ ++ ++void ++boxdraw_xinit(Display *dpy, Colormap cmap, XftDraw *draw, Visual *vis) ++{ ++ xdpy = dpy; xcmap = cmap; xd = draw, xvis = vis; ++} ++ ++int ++isboxdraw(Rune u) ++{ ++ Rune block = u & ~0xff; ++ return (boxdraw && block == 0x2500 && boxdata[(uint8_t)u]) || ++ (boxdraw_braille && block == 0x2800); ++} ++ ++/* the "index" is actually the entire shape data encoded as ushort */ ++ushort ++boxdrawindex(const Glyph *g) ++{ ++ if (boxdraw_braille && (g->u & ~0xff) == 0x2800) ++ return BRL | (uint8_t)g->u; ++ if (boxdraw_bold && (g->mode & ATTR_BOLD)) ++ return BDB | boxdata[(uint8_t)g->u]; ++ return boxdata[(uint8_t)g->u]; ++} ++ ++void ++drawboxes(int x, int y, int cw, int ch, XftColor *fg, XftColor *bg, ++ const XftGlyphFontSpec *specs, int len) ++{ ++ for ( ; len-- > 0; x += cw, specs++) ++ drawbox(x, y, cw, ch, fg, bg, (ushort)specs->glyph); ++} ++ ++/* implementation */ ++ ++void ++drawbox(int x, int y, int w, int h, XftColor *fg, XftColor *bg, ushort bd) ++{ ++ ushort cat = bd & ~(BDB | 0xff); /* mask out bold and data */ ++ if (bd & (BDL | BDA)) { ++ /* lines (light/double/heavy/arcs) */ ++ drawboxlines(x, y, w, h, fg, bd); ++ ++ } else if (cat == BBD) { ++ /* lower (8-X)/8 block */ ++ int d = DIV((uint8_t)bd * h, 8); ++ XftDrawRect(xd, fg, x, y + d, w, h - d); ++ ++ } else if (cat == BBU) { ++ /* upper X/8 block */ ++ XftDrawRect(xd, fg, x, y, w, DIV((uint8_t)bd * h, 8)); ++ ++ } else if (cat == BBL) { ++ /* left X/8 block */ ++ XftDrawRect(xd, fg, x, y, DIV((uint8_t)bd * w, 8), h); ++ ++ } else if (cat == BBR) { ++ /* right (8-X)/8 block */ ++ int d = DIV((uint8_t)bd * w, 8); ++ XftDrawRect(xd, fg, x + d, y, w - d, h); ++ ++ } else if (cat == BBQ) { ++ /* Quadrants */ ++ int w2 = DIV(w, 2), h2 = DIV(h, 2); ++ if (bd & TL) ++ XftDrawRect(xd, fg, x, y, w2, h2); ++ if (bd & TR) ++ XftDrawRect(xd, fg, x + w2, y, w - w2, h2); ++ if (bd & BL) ++ XftDrawRect(xd, fg, x, y + h2, w2, h - h2); ++ if (bd & BR) ++ XftDrawRect(xd, fg, x + w2, y + h2, w - w2, h - h2); ++ ++ } else if (bd & BBS) { ++ /* Shades - data is 1/2/3 for 25%/50%/75% alpha, respectively */ ++ int d = (uint8_t)bd; ++ XftColor xfc; ++ XRenderColor xrc = { .alpha = 0xffff }; ++ ++ xrc.red = DIV(fg->color.red * d + bg->color.red * (4 - d), 4); ++ xrc.green = DIV(fg->color.green * d + bg->color.green * (4 - d), 4); ++ xrc.blue = DIV(fg->color.blue * d + bg->color.blue * (4 - d), 4); ++ ++ XftColorAllocValue(xdpy, xvis, xcmap, &xrc, &xfc); ++ XftDrawRect(xd, &xfc, x, y, w, h); ++ XftColorFree(xdpy, xvis, xcmap, &xfc); ++ ++ } else if (cat == BRL) { ++ /* braille, each data bit corresponds to one dot at 2x4 grid */ ++ int w1 = DIV(w, 2); ++ int h1 = DIV(h, 4), h2 = DIV(h, 2), h3 = DIV(3 * h, 4); ++ ++ if (bd & 1) XftDrawRect(xd, fg, x, y, w1, h1); ++ if (bd & 2) XftDrawRect(xd, fg, x, y + h1, w1, h2 - h1); ++ if (bd & 4) XftDrawRect(xd, fg, x, y + h2, w1, h3 - h2); ++ if (bd & 8) XftDrawRect(xd, fg, x + w1, y, w - w1, h1); ++ if (bd & 16) XftDrawRect(xd, fg, x + w1, y + h1, w - w1, h2 - h1); ++ if (bd & 32) XftDrawRect(xd, fg, x + w1, y + h2, w - w1, h3 - h2); ++ if (bd & 64) XftDrawRect(xd, fg, x, y + h3, w1, h - h3); ++ if (bd & 128) XftDrawRect(xd, fg, x + w1, y + h3, w - w1, h - h3); ++ ++ } ++} ++ ++void ++drawboxlines(int x, int y, int w, int h, XftColor *fg, ushort bd) ++{ ++ /* s: stem thickness. width/8 roughly matches underscore thickness. */ ++ /* We draw bold as 1.5 * normal-stem and at least 1px thicker. */ ++ /* doubles draw at least 3px, even when w or h < 3. bold needs 6px. */ ++ int mwh = MIN(w, h); ++ int base_s = MAX(1, DIV(mwh, 8)); ++ int bold = (bd & BDB) && mwh >= 6; /* possibly ignore boldness */ ++ int s = bold ? MAX(base_s + 1, DIV(3 * base_s, 2)) : base_s; ++ int w2 = DIV(w - s, 2), h2 = DIV(h - s, 2); ++ /* the s-by-s square (x + w2, y + h2, s, s) is the center texel. */ ++ /* The base length (per direction till edge) includes this square. */ ++ ++ int light = bd & (LL | LU | LR | LD); ++ int double_ = bd & (DL | DU | DR | DD); ++ ++ if (light) { ++ /* d: additional (negative) length to not-draw the center */ ++ /* texel - at arcs and avoid drawing inside (some) doubles */ ++ int arc = bd & BDA; ++ int multi_light = light & (light - 1); ++ int multi_double = double_ & (double_ - 1); ++ /* light crosses double only at DH+LV, DV+LH (ref. shapes) */ ++ int d = arc || (multi_double && !multi_light) ? -s : 0; ++ ++ if (bd & LL) ++ XftDrawRect(xd, fg, x, y + h2, w2 + s + d, s); ++ if (bd & LU) ++ XftDrawRect(xd, fg, x + w2, y, s, h2 + s + d); ++ if (bd & LR) ++ XftDrawRect(xd, fg, x + w2 - d, y + h2, w - w2 + d, s); ++ if (bd & LD) ++ XftDrawRect(xd, fg, x + w2, y + h2 - d, s, h - h2 + d); ++ } ++ ++ /* double lines - also align with light to form heavy when combined */ ++ if (double_) { ++ /* ++ * going clockwise, for each double-ray: p is additional length ++ * to the single-ray nearer to the previous direction, and n to ++ * the next. p and n adjust from the base length to lengths ++ * which consider other doubles - shorter to avoid intersections ++ * (p, n), or longer to draw the far-corner texel (n). ++ */ ++ int dl = bd & DL, du = bd & DU, dr = bd & DR, dd = bd & DD; ++ if (dl) { ++ int p = dd ? -s : 0, n = du ? -s : dd ? s : 0; ++ XftDrawRect(xd, fg, x, y + h2 + s, w2 + s + p, s); ++ XftDrawRect(xd, fg, x, y + h2 - s, w2 + s + n, s); ++ } ++ if (du) { ++ int p = dl ? -s : 0, n = dr ? -s : dl ? s : 0; ++ XftDrawRect(xd, fg, x + w2 - s, y, s, h2 + s + p); ++ XftDrawRect(xd, fg, x + w2 + s, y, s, h2 + s + n); ++ } ++ if (dr) { ++ int p = du ? -s : 0, n = dd ? -s : du ? s : 0; ++ XftDrawRect(xd, fg, x + w2 - p, y + h2 - s, w - w2 + p, s); ++ XftDrawRect(xd, fg, x + w2 - n, y + h2 + s, w - w2 + n, s); ++ } ++ if (dd) { ++ int p = dr ? -s : 0, n = dl ? -s : dr ? s : 0; ++ XftDrawRect(xd, fg, x + w2 + s, y + h2 - p, s, h - h2 + p); ++ XftDrawRect(xd, fg, x + w2 - s, y + h2 - n, s, h - h2 + n); ++ } ++ } ++} +diff --git a/boxdraw_data.h b/boxdraw_data.h +new file mode 100644 +index 0000000..7890500 +--- /dev/null ++++ b/boxdraw_data.h +@@ -0,0 +1,214 @@ ++/* ++ * Copyright 2018 Avi Halachmi (:avih) avihpit@yahoo.com https://github.com/avih ++ * MIT/X Consortium License ++ */ ++ ++/* ++ * U+25XX codepoints data ++ * ++ * References: ++ * http://www.unicode.org/charts/PDF/U2500.pdf ++ * http://www.unicode.org/charts/PDF/U2580.pdf ++ * ++ * Test page: ++ * https://github.com/GNOME/vte/blob/master/doc/boxes.txt ++ */ ++ ++/* Each shape is encoded as 16-bits. Higher bits are category, lower are data */ ++/* Categories (mutually exclusive except BDB): */ ++/* For convenience, BDL/BDA/BBS/BDB are 1 bit each, the rest are enums */ ++#define BDL (1<<8) /* Box Draw Lines (light/double/heavy) */ ++#define BDA (1<<9) /* Box Draw Arc (light) */ ++ ++#define BBD (1<<10) /* Box Block Down (lower) X/8 */ ++#define BBL (2<<10) /* Box Block Left X/8 */ ++#define BBU (3<<10) /* Box Block Upper X/8 */ ++#define BBR (4<<10) /* Box Block Right X/8 */ ++#define BBQ (5<<10) /* Box Block Quadrants */ ++#define BRL (6<<10) /* Box Braille (data is lower byte of U28XX) */ ++ ++#define BBS (1<<14) /* Box Block Shades */ ++#define BDB (1<<15) /* Box Draw is Bold */ ++ ++/* (BDL/BDA) Light/Double/Heavy x Left/Up/Right/Down/Horizontal/Vertical */ ++/* Heavy is light+double (literally drawing light+double align to form heavy) */ ++#define LL (1<<0) ++#define LU (1<<1) ++#define LR (1<<2) ++#define LD (1<<3) ++#define LH (LL+LR) ++#define LV (LU+LD) ++ ++#define DL (1<<4) ++#define DU (1<<5) ++#define DR (1<<6) ++#define DD (1<<7) ++#define DH (DL+DR) ++#define DV (DU+DD) ++ ++#define HL (LL+DL) ++#define HU (LU+DU) ++#define HR (LR+DR) ++#define HD (LD+DD) ++#define HH (HL+HR) ++#define HV (HU+HD) ++ ++/* (BBQ) Quadrants Top/Bottom x Left/Right */ ++#define TL (1<<0) ++#define TR (1<<1) ++#define BL (1<<2) ++#define BR (1<<3) ++ ++/* Data for U+2500 - U+259F except dashes/diagonals */ ++static const unsigned short boxdata[256] = { ++ /* light lines */ ++ [0x00] = BDL + LH, /* light horizontal */ ++ [0x02] = BDL + LV, /* light vertical */ ++ [0x0c] = BDL + LD + LR, /* light down and right */ ++ [0x10] = BDL + LD + LL, /* light down and left */ ++ [0x14] = BDL + LU + LR, /* light up and right */ ++ [0x18] = BDL + LU + LL, /* light up and left */ ++ [0x1c] = BDL + LV + LR, /* light vertical and right */ ++ [0x24] = BDL + LV + LL, /* light vertical and left */ ++ [0x2c] = BDL + LH + LD, /* light horizontal and down */ ++ [0x34] = BDL + LH + LU, /* light horizontal and up */ ++ [0x3c] = BDL + LV + LH, /* light vertical and horizontal */ ++ [0x74] = BDL + LL, /* light left */ ++ [0x75] = BDL + LU, /* light up */ ++ [0x76] = BDL + LR, /* light right */ ++ [0x77] = BDL + LD, /* light down */ ++ ++ /* heavy [+light] lines */ ++ [0x01] = BDL + HH, ++ [0x03] = BDL + HV, ++ [0x0d] = BDL + HR + LD, ++ [0x0e] = BDL + HD + LR, ++ [0x0f] = BDL + HD + HR, ++ [0x11] = BDL + HL + LD, ++ [0x12] = BDL + HD + LL, ++ [0x13] = BDL + HD + HL, ++ [0x15] = BDL + HR + LU, ++ [0x16] = BDL + HU + LR, ++ [0x17] = BDL + HU + HR, ++ [0x19] = BDL + HL + LU, ++ [0x1a] = BDL + HU + LL, ++ [0x1b] = BDL + HU + HL, ++ [0x1d] = BDL + HR + LV, ++ [0x1e] = BDL + HU + LD + LR, ++ [0x1f] = BDL + HD + LR + LU, ++ [0x20] = BDL + HV + LR, ++ [0x21] = BDL + HU + HR + LD, ++ [0x22] = BDL + HD + HR + LU, ++ [0x23] = BDL + HV + HR, ++ [0x25] = BDL + HL + LV, ++ [0x26] = BDL + HU + LD + LL, ++ [0x27] = BDL + HD + LU + LL, ++ [0x28] = BDL + HV + LL, ++ [0x29] = BDL + HU + HL + LD, ++ [0x2a] = BDL + HD + HL + LU, ++ [0x2b] = BDL + HV + HL, ++ [0x2d] = BDL + HL + LD + LR, ++ [0x2e] = BDL + HR + LL + LD, ++ [0x2f] = BDL + HH + LD, ++ [0x30] = BDL + HD + LH, ++ [0x31] = BDL + HD + HL + LR, ++ [0x32] = BDL + HR + HD + LL, ++ [0x33] = BDL + HH + HD, ++ [0x35] = BDL + HL + LU + LR, ++ [0x36] = BDL + HR + LU + LL, ++ [0x37] = BDL + HH + LU, ++ [0x38] = BDL + HU + LH, ++ [0x39] = BDL + HU + HL + LR, ++ [0x3a] = BDL + HU + HR + LL, ++ [0x3b] = BDL + HH + HU, ++ [0x3d] = BDL + HL + LV + LR, ++ [0x3e] = BDL + HR + LV + LL, ++ [0x3f] = BDL + HH + LV, ++ [0x40] = BDL + HU + LH + LD, ++ [0x41] = BDL + HD + LH + LU, ++ [0x42] = BDL + HV + LH, ++ [0x43] = BDL + HU + HL + LD + LR, ++ [0x44] = BDL + HU + HR + LD + LL, ++ [0x45] = BDL + HD + HL + LU + LR, ++ [0x46] = BDL + HD + HR + LU + LL, ++ [0x47] = BDL + HH + HU + LD, ++ [0x48] = BDL + HH + HD + LU, ++ [0x49] = BDL + HV + HL + LR, ++ [0x4a] = BDL + HV + HR + LL, ++ [0x4b] = BDL + HV + HH, ++ [0x78] = BDL + HL, ++ [0x79] = BDL + HU, ++ [0x7a] = BDL + HR, ++ [0x7b] = BDL + HD, ++ [0x7c] = BDL + HR + LL, ++ [0x7d] = BDL + HD + LU, ++ [0x7e] = BDL + HL + LR, ++ [0x7f] = BDL + HU + LD, ++ ++ /* double [+light] lines */ ++ [0x50] = BDL + DH, ++ [0x51] = BDL + DV, ++ [0x52] = BDL + DR + LD, ++ [0x53] = BDL + DD + LR, ++ [0x54] = BDL + DR + DD, ++ [0x55] = BDL + DL + LD, ++ [0x56] = BDL + DD + LL, ++ [0x57] = BDL + DL + DD, ++ [0x58] = BDL + DR + LU, ++ [0x59] = BDL + DU + LR, ++ [0x5a] = BDL + DU + DR, ++ [0x5b] = BDL + DL + LU, ++ [0x5c] = BDL + DU + LL, ++ [0x5d] = BDL + DL + DU, ++ [0x5e] = BDL + DR + LV, ++ [0x5f] = BDL + DV + LR, ++ [0x60] = BDL + DV + DR, ++ [0x61] = BDL + DL + LV, ++ [0x62] = BDL + DV + LL, ++ [0x63] = BDL + DV + DL, ++ [0x64] = BDL + DH + LD, ++ [0x65] = BDL + DD + LH, ++ [0x66] = BDL + DD + DH, ++ [0x67] = BDL + DH + LU, ++ [0x68] = BDL + DU + LH, ++ [0x69] = BDL + DH + DU, ++ [0x6a] = BDL + DH + LV, ++ [0x6b] = BDL + DV + LH, ++ [0x6c] = BDL + DH + DV, ++ ++ /* (light) arcs */ ++ [0x6d] = BDA + LD + LR, ++ [0x6e] = BDA + LD + LL, ++ [0x6f] = BDA + LU + LL, ++ [0x70] = BDA + LU + LR, ++ ++ /* Lower (Down) X/8 block (data is 8 - X) */ ++ [0x81] = BBD + 7, [0x82] = BBD + 6, [0x83] = BBD + 5, [0x84] = BBD + 4, ++ [0x85] = BBD + 3, [0x86] = BBD + 2, [0x87] = BBD + 1, [0x88] = BBD + 0, ++ ++ /* Left X/8 block (data is X) */ ++ [0x89] = BBL + 7, [0x8a] = BBL + 6, [0x8b] = BBL + 5, [0x8c] = BBL + 4, ++ [0x8d] = BBL + 3, [0x8e] = BBL + 2, [0x8f] = BBL + 1, ++ ++ /* upper 1/2 (4/8), 1/8 block (X), right 1/2, 1/8 block (8-X) */ ++ [0x80] = BBU + 4, [0x94] = BBU + 1, ++ [0x90] = BBR + 4, [0x95] = BBR + 7, ++ ++ /* Quadrants */ ++ [0x96] = BBQ + BL, ++ [0x97] = BBQ + BR, ++ [0x98] = BBQ + TL, ++ [0x99] = BBQ + TL + BL + BR, ++ [0x9a] = BBQ + TL + BR, ++ [0x9b] = BBQ + TL + TR + BL, ++ [0x9c] = BBQ + TL + TR + BR, ++ [0x9d] = BBQ + TR, ++ [0x9e] = BBQ + BL + TR, ++ [0x9f] = BBQ + BL + TR + BR, ++ ++ /* Shades, data is an alpha value in 25% units (1/4, 1/2, 3/4) */ ++ [0x91] = BBS + 1, [0x92] = BBS + 2, [0x93] = BBS + 3, ++ ++ /* U+2504 - U+250B, U+254C - U+254F: unsupported (dashes) */ ++ /* U+2571 - U+2573: unsupported (diagonals) */ ++}; +diff --git a/config.def.h b/config.def.h +index 91ab8ca..b55e689 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -5,7 +5,13 @@ + * + * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html + */ +-static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true"; ++static char *font = "Liberation Mono:pixelsize=10:antialias=true:autohint=true"; ++/* Spare fonts */ ++static char *font2[] = { ++/* "Inconsolata for Powerline:pixelsize=12:antialias=true:autohint=true", */ ++/* "Hack Nerd Font Mono:pixelsize=11:antialias=true:autohint=true", */ ++}; ++ + static int borderpx = 2; + + /* +@@ -67,6 +73,18 @@ static unsigned int blinktimeout = 800; + */ + static unsigned int cursorthickness = 2; + ++/* ++ * 1: render most of the lines/blocks characters without using the font for ++ * perfect alignment between cells (U2500 - U259F except dashes/diagonals). ++ * Bold affects lines thickness if boxdraw_bold is not 0. Italic is ignored. ++ * 0: disable (render all U25XX glyphs normally from the font). ++ */ ++const int boxdraw = 0; ++const int boxdraw_bold = 0; ++ ++/* braille (U28XX): 1: render as adjacent "pixels", 0: use font */ ++const int boxdraw_braille = 0; ++ + /* + * 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; + */ + static uint forcemousemod = ShiftMask; + ++/* ++ * Xresources preferences to load at startup ++ */ ++ResourcePref resources[] = { ++ { "font", STRING, &font }, ++ { "color0", STRING, &colorname[0] }, ++ { "color1", STRING, &colorname[1] }, ++ { "color2", STRING, &colorname[2] }, ++ { "color3", STRING, &colorname[3] }, ++ { "color4", STRING, &colorname[4] }, ++ { "color5", STRING, &colorname[5] }, ++ { "color6", STRING, &colorname[6] }, ++ { "color7", STRING, &colorname[7] }, ++ { "color8", STRING, &colorname[8] }, ++ { "color9", STRING, &colorname[9] }, ++ { "color10", STRING, &colorname[10] }, ++ { "color11", STRING, &colorname[11] }, ++ { "color12", STRING, &colorname[12] }, ++ { "color13", STRING, &colorname[13] }, ++ { "color14", STRING, &colorname[14] }, ++ { "color15", STRING, &colorname[15] }, ++ { "background", STRING, &colorname[259] }, ++ { "foreground", STRING, &colorname[258] }, ++ { "cursorColor", STRING, &colorname[256] }, ++ { "termname", STRING, &termname }, ++ { "shell", STRING, &shell }, ++ { "minlatency", INTEGER, &minlatency }, ++ { "maxlatency", INTEGER, &maxlatency }, ++ { "blinktimeout", INTEGER, &blinktimeout }, ++ { "bellvolume", INTEGER, &bellvolume }, ++ { "tabspaces", INTEGER, &tabspaces }, ++ { "borderpx", INTEGER, &borderpx }, ++ { "cwscale", FLOAT, &cwscale }, ++ { "chscale", FLOAT, &chscale }, ++}; ++ + /* + * Internal mouse shortcuts. + * Beware that overloading Button1 will disable the selection. + */ + static MouseShortcut mshortcuts[] = { + /* mask button function argument release */ ++ { XK_ANY_MOD, Button4, kscrollup, {.i = 5} }, ++ { XK_ANY_MOD, Button5, kscrolldown, {.i = 5} }, + { 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[] = { + { 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/config.h b/config.h +new file mode 100644 +index 0000000..b55e689 +--- /dev/null ++++ b/config.h +@@ -0,0 +1,532 @@ ++/* See LICENSE file for copyright and license details. */ ++ ++/* ++ * appearance ++ * ++ * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html ++ */ ++static char *font = "Liberation Mono:pixelsize=10:antialias=true:autohint=true"; ++/* Spare fonts */ ++static char *font2[] = { ++/* "Inconsolata for Powerline:pixelsize=12:antialias=true:autohint=true", */ ++/* "Hack Nerd Font Mono:pixelsize=11: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 = 8; ++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; ++ ++/* ++ * 1: render most of the lines/blocks characters without using the font for ++ * perfect alignment between cells (U2500 - U259F except dashes/diagonals). ++ * Bold affects lines thickness if boxdraw_bold is not 0. Italic is ignored. ++ * 0: disable (render all U25XX glyphs normally from the font). ++ */ ++const int boxdraw = 0; ++const int boxdraw_bold = 0; ++ ++/* braille (U28XX): 1: render as adjacent "pixels", 0: use font */ ++const int boxdraw_braille = 0; ++ ++/* ++ * 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 = "st-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 */ ++ "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", ++ "gray90", /* default foreground colour */ ++ "black", /* default background colour */ ++}; ++ ++ ++/* ++ * Default colors (colorname index) ++ * foreground, background, cursor, reverse cursor ++ */ ++unsigned int defaultfg = 258; ++unsigned int defaultbg = 259; ++unsigned int defaultcs = 256; ++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; ++ ++/* ++ * Xresources preferences to load at startup ++ */ ++ResourcePref resources[] = { ++ { "font", STRING, &font }, ++ { "color0", STRING, &colorname[0] }, ++ { "color1", STRING, &colorname[1] }, ++ { "color2", STRING, &colorname[2] }, ++ { "color3", STRING, &colorname[3] }, ++ { "color4", STRING, &colorname[4] }, ++ { "color5", STRING, &colorname[5] }, ++ { "color6", STRING, &colorname[6] }, ++ { "color7", STRING, &colorname[7] }, ++ { "color8", STRING, &colorname[8] }, ++ { "color9", STRING, &colorname[9] }, ++ { "color10", STRING, &colorname[10] }, ++ { "color11", STRING, &colorname[11] }, ++ { "color12", STRING, &colorname[12] }, ++ { "color13", STRING, &colorname[13] }, ++ { "color14", STRING, &colorname[14] }, ++ { "color15", STRING, &colorname[15] }, ++ { "background", STRING, &colorname[259] }, ++ { "foreground", STRING, &colorname[258] }, ++ { "cursorColor", STRING, &colorname[256] }, ++ { "termname", STRING, &termname }, ++ { "shell", STRING, &shell }, ++ { "minlatency", INTEGER, &minlatency }, ++ { "maxlatency", INTEGER, &maxlatency }, ++ { "blinktimeout", INTEGER, &blinktimeout }, ++ { "bellvolume", INTEGER, &bellvolume }, ++ { "tabspaces", INTEGER, &tabspaces }, ++ { "borderpx", INTEGER, &borderpx }, ++ { "cwscale", FLOAT, &cwscale }, ++ { "chscale", FLOAT, &chscale }, ++}; ++ ++/* ++ * Internal mouse shortcuts. ++ * Beware that overloading Button1 will disable the selection. ++ */ ++static MouseShortcut mshortcuts[] = { ++ /* mask button function argument release */ ++ { XK_ANY_MOD, Button4, kscrollup, {.i = 5} }, ++ { XK_ANY_MOD, Button5, kscrolldown, {.i = 5} }, ++ { 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{|}~"; +diff --git a/st.c b/st.c +index d6478f5..1fd732e 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++; + } +@@ -1215,6 +1277,9 @@ tsetchar(Rune u, const Glyph *attr, int x, int y) + term.dirty[y] = 1; + term.line[y][x] = *attr; + term.line[y][x].u = u; ++ ++ if (isboxdraw(u)) ++ term.line[y][x].mode |= ATTR_BOXDRAW; + } + + void +@@ -1285,14 +1350,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 +@@ -1729,11 +1794,11 @@ csihandle(void) + break; + case 'S': /* SU -- Scroll line up */ + DEFAULT(csiescseq.arg[0], 1); +- tscrollup(term.top, csiescseq.arg[0]); ++ tscrollup(term.top, csiescseq.arg[0], 0); + break; + case 'T': /* SD -- Scroll 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 blank lines */ + DEFAULT(csiescseq.arg[0], 1); +@@ -1809,6 +1874,33 @@ csihandle(void) + goto unknown; + } + break; ++ case 't': /* title stack operations */ ++ switch (csiescseq.arg[0]) { ++ case 22: /* pust current title on stack */ ++ switch (csiescseq.arg[1]) { ++ case 0: ++ case 1: ++ case 2: ++ xpushtitle(); ++ break; ++ default: ++ goto unknown; ++ } ++ break; ++ case 23: /* pop last title from stack */ ++ switch (csiescseq.arg[1]) { ++ case 0: ++ case 1: ++ case 2: ++ xsettitle(NULL, 1); ++ break; ++ default: ++ goto unknown; ++ } ++ break; ++ default: ++ goto unknown; ++ } + } + } + +@@ -1887,7 +1979,7 @@ strhandle(void) + switch (par) { + case 0: + if (narg > 1) { +- xsettitle(strescseq.args[1]); ++ xsettitle(strescseq.args[1], 0); + xseticontitle(strescseq.args[1]); + } + return; +@@ -1897,7 +1989,7 @@ strhandle(void) + return; + case 2: + if (narg > 1) +- xsettitle(strescseq.args[1]); ++ xsettitle(strescseq.args[1], 0); + return; + case 52: + if (narg > 2 && allowwindowops) { +@@ -1956,7 +2048,7 @@ strhandle(void) + } + break; + case 'k': /* old title set compatibility */ +- xsettitle(strescseq.args[0]); ++ xsettitle(strescseq.args[0], 0); + return; + case 'P': /* DCS -- Device Control String */ + case '_': /* APC -- Application Program Command */ +@@ -2305,7 +2397,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); + } +@@ -2318,7 +2410,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); + } +@@ -2328,6 +2420,7 @@ eschandle(uchar ascii) + break; + case 'c': /* RIS -- Reset to initial state */ + treset(); ++ xfreetitlestack(); + resettitle(); + xloadcols(); + xsetmode(0, MODE_HIDE); +@@ -2541,7 +2634,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; +@@ -2578,6 +2671,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)); +@@ -2623,7 +2724,7 @@ tresize(int col, int row) + void + resettitle(void) + { +- xsettitle(NULL); ++ xsettitle(NULL, 0); + } + + void +@@ -2636,7 +2737,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); + } + } + +@@ -2657,8 +2758,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.desktop b/st.desktop +new file mode 100644 +index 0000000..49029d8 +--- /dev/null ++++ b/st.desktop +@@ -0,0 +1,8 @@ ++[Desktop Entry] ++Name=st ++Comment=st is a simple terminal implementation for X ++Exec=st ++Icon=utilities-terminal ++Terminal=false ++Type=Application ++Categories=System;TerminalEmulator; +diff --git a/st.h b/st.h +index fd3b0d8..f6bd3b4 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_BOXDRAW = 1 << 11, + ATTR_BOLD_FAINT = ATTR_BOLD | ATTR_FAINT, + }; + +@@ -81,6 +82,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 *); +@@ -111,6 +114,14 @@ void *xmalloc(size_t); + void *xrealloc(void *, size_t); + char *xstrdup(const char *); + ++int isboxdraw(Rune); ++ushort boxdrawindex(const Glyph *); ++#ifdef XFT_VERSION ++/* only exposed to x.c, otherwise we'll need Xft.h for the types */ ++void boxdraw_xinit(Display *, Colormap, XftDraw *, Visual *); ++void drawboxes(int, int, int, int, XftColor *, XftColor *, const XftGlyphFontSpec *, int); ++#endif ++ + /* config.h globals */ + extern char *utmp; + extern char *scroll; +@@ -124,3 +135,4 @@ extern unsigned int tabspaces; + extern unsigned int defaultfg; + extern unsigned int defaultbg; + extern unsigned int defaultcs; ++extern const int boxdraw, boxdraw_bold, boxdraw_braille; +diff --git a/st.info b/st.info +index efab2cf..24dfc7d 100644 +--- a/st.info ++++ b/st.info +@@ -161,7 +161,7 @@ st-mono| simpleterm monocolor, + rin=\E[%p1%dT, + ritm=\E[23m, + rmacs=\E(B, +- rmcup=\E[?1049l, ++ rmcup=\E[?1049l\E[23;0;0t, + rmir=\E[4l, + rmkx=\E[?1l\E>, + rmso=\E[27m, +@@ -172,7 +172,7 @@ st-mono| simpleterm monocolor, + sitm=\E[3m, + sgr0=\E[0m, + smacs=\E(0, +- smcup=\E[?1049h, ++ smcup=\E[?1049h\E[22;0;0t, + smir=\E[4h, + smkx=\E[?1h\E=, + smso=\E[7m, +diff --git a/win.h b/win.h +index 6de960d..2a40aa0 100644 +--- a/win.h ++++ b/win.h +@@ -32,7 +32,9 @@ void xloadcols(void); + int xsetcolorname(int, const char *); + int xgetcolor(int, unsigned char *, unsigned char *, unsigned char *); + void xseticontitle(char *); +-void xsettitle(char *); ++void xfreetitlestack(void); ++void xsettitle(char *, int); ++void xpushtitle(void); + int xsetcursor(int); + void xsetmode(int, unsigned int); + void xsetpointermotion(int); +diff --git a/x.c b/x.c +index b36fb8c..ccfb7e7 100644 +--- a/x.c ++++ b/x.c +@@ -14,6 +14,7 @@ + #include + #include + #include ++#include + + char *argv0; + #include "arg.h" +@@ -45,6 +46,19 @@ typedef struct { + signed char appcursor; /* application cursor */ + } Key; + ++/* Xresources preferences */ ++enum resource_type { ++ STRING = 0, ++ INTEGER = 1, ++ FLOAT = 2 ++}; ++ ++typedef struct { ++ char *name; ++ enum resource_type type; ++ void *dst; ++} ResourcePref; ++ + /* X modifiers */ + #define XK_ANY_MOD UINT_MAX + #define XK_NO_MOD 0 +@@ -63,6 +77,9 @@ static void ttysend(const Arg *); + /* config.h for applying patches and the configuration. */ + #include "config.h" + ++/* size of title stack */ ++#define TITLESTACKSIZE 8 ++ + /* XEMBED messages */ + #define XEMBED_FOCUS_IN 4 + #define XEMBED_FOCUS_OUT 5 +@@ -157,6 +174,8 @@ static void xhints(void); + static int xloadcolor(int, const char *, Color *); + static int xloadfont(Font *, FcPattern *); + static void xloadfonts(const char *, double); ++static int xloadsparefont(FcPattern *, int); ++static void xloadsparefonts(void); + static void xunloadfont(Font *); + static void xunloadfonts(void); + static void xsetenv(void); +@@ -220,6 +239,8 @@ static DC dc; + static XWindow xw; + static XSelection xsel; + static TermWindow win; ++static int tstki; /* title stack index */ ++static char *titlestack[TITLESTACKSIZE]; /* title stack */ + + /* Font Ring Cache */ + enum { +@@ -306,6 +327,7 @@ zoomabs(const Arg *arg) + { + xunloadfonts(); + xloadfonts(usedfont, arg->f); ++ xloadsparefonts(); + cresize(0, 0); + redraw(); + xhints(); +@@ -686,6 +708,8 @@ setsel(char *str, Time t) + XSetSelectionOwner(xw.dpy, XA_PRIMARY, xw.win, t); + if (XGetSelectionOwner(xw.dpy, XA_PRIMARY) != xw.win) + selclear(); ++ ++ xclipcopy(); + } + + void +@@ -859,8 +883,8 @@ xclear(int x1, int y1, int x2, int y2) + void + xhints(void) + { +- XClassHint class = {opt_name ? opt_name : termname, +- opt_class ? opt_class : termname}; ++ XClassHint class = {opt_name ? opt_name : "st", ++ opt_class ? opt_class : "St"}; + XWMHints wm = {.flags = InputHint, .input = 1}; + XSizeHints *sizeh; + +@@ -1050,6 +1074,101 @@ xloadfonts(const char *fontstr, double fontsize) + FcPatternDestroy(pattern); + } + ++int ++xloadsparefont(FcPattern *pattern, int flags) ++{ ++ FcPattern *match; ++ FcResult result; ++ ++ match = FcFontMatch(NULL, pattern, &result); ++ if (!match) { ++ return 1; ++ } ++ ++ if (!(frc[frclen].font = XftFontOpenPattern(xw.dpy, match))) { ++ FcPatternDestroy(match); ++ return 1; ++ } ++ ++ frc[frclen].flags = flags; ++ /* Believe U+0000 glyph will present in each default font */ ++ frc[frclen].unicodep = 0; ++ frclen++; ++ ++ return 0; ++} ++ ++void ++xloadsparefonts(void) ++{ ++ FcPattern *pattern; ++ double sizeshift, fontval; ++ int fc; ++ char **fp; ++ ++ if (frclen != 0) ++ die("can't embed spare fonts. cache isn't empty"); ++ ++ /* Calculate count of spare fonts */ ++ fc = sizeof(font2) / sizeof(*font2); ++ if (fc == 0) ++ return; ++ ++ /* Allocate memory for cache entries. */ ++ if (frccap < 4 * fc) { ++ frccap += 4 * fc - frccap; ++ frc = xrealloc(frc, frccap * sizeof(Fontcache)); ++ } ++ ++ for (fp = font2; fp - font2 < fc; ++fp) { ++ ++ if (**fp == '-') ++ pattern = XftXlfdParse(*fp, False, False); ++ else ++ pattern = FcNameParse((FcChar8 *)*fp); ++ ++ if (!pattern) ++ die("can't open spare font %s\n", *fp); ++ ++ if (defaultfontsize > 0) { ++ sizeshift = usedfontsize - defaultfontsize; ++ if (sizeshift != 0 && ++ FcPatternGetDouble(pattern, FC_PIXEL_SIZE, 0, &fontval) == ++ FcResultMatch) { ++ fontval += sizeshift; ++ FcPatternDel(pattern, FC_PIXEL_SIZE); ++ FcPatternDel(pattern, FC_SIZE); ++ FcPatternAddDouble(pattern, FC_PIXEL_SIZE, fontval); ++ } ++ } ++ ++ FcPatternAddBool(pattern, FC_SCALABLE, 1); ++ ++ FcConfigSubstitute(NULL, pattern, FcMatchPattern); ++ XftDefaultSubstitute(xw.dpy, xw.scr, pattern); ++ ++ if (xloadsparefont(pattern, FRC_NORMAL)) ++ die("can't open spare font %s\n", *fp); ++ ++ FcPatternDel(pattern, FC_SLANT); ++ FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC); ++ if (xloadsparefont(pattern, FRC_ITALIC)) ++ die("can't open spare font %s\n", *fp); ++ ++ FcPatternDel(pattern, FC_WEIGHT); ++ FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD); ++ if (xloadsparefont(pattern, FRC_ITALICBOLD)) ++ die("can't open spare font %s\n", *fp); ++ ++ FcPatternDel(pattern, FC_SLANT); ++ FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN); ++ if (xloadsparefont(pattern, FRC_BOLD)) ++ die("can't open spare font %s\n", *fp); ++ ++ FcPatternDestroy(pattern); ++ } ++} ++ + void + xunloadfont(Font *f) + { +@@ -1135,8 +1254,6 @@ xinit(int cols, int rows) + pid_t thispid = getpid(); + XColor xmousefg, xmousebg; + +- if (!(xw.dpy = XOpenDisplay(NULL))) +- die("can't open display\n"); + xw.scr = XDefaultScreen(xw.dpy); + xw.vis = XDefaultVisual(xw.dpy, xw.scr); + +@@ -1147,6 +1264,9 @@ xinit(int cols, int rows) + usedfont = (opt_font == NULL)? font : opt_font; + xloadfonts(usedfont, 0); + ++ /* spare fonts */ ++ xloadsparefonts(); ++ + /* colors */ + xw.cmap = XDefaultColormap(xw.dpy, xw.scr); + xloadcols(); +@@ -1237,6 +1357,8 @@ xinit(int cols, int rows) + xsel.xtarget = XInternAtom(xw.dpy, "UTF8_STRING", 0); + if (xsel.xtarget == None) + xsel.xtarget = XA_STRING; ++ ++ boxdraw_xinit(xw.dpy, xw.cmap, xw.draw, xw.vis); + } + + int +@@ -1283,8 +1405,13 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x + yp = winy + font->ascent; + } + +- /* Lookup character index with default font. */ +- glyphidx = XftCharIndex(xw.dpy, font->match, rune); ++ if (mode & ATTR_BOXDRAW) { ++ /* minor shoehorning: boxdraw uses only this ushort */ ++ glyphidx = boxdrawindex(&glyphs[i]); ++ } else { ++ /* Lookup character index with default font. */ ++ glyphidx = XftCharIndex(xw.dpy, font->match, rune); ++ } + 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 + r.width = width; + XftDrawSetClipRectangles(xw.draw, winx, winy, &r, 1); + +- /* Render the glyphs. */ +- XftDrawGlyphFontSpec(xw.draw, fg, specs, len); ++ if (base.mode & ATTR_BOXDRAW) { ++ drawboxes(winx, winy, width / len, win.ch, fg, bg, specs, len); ++ } else { ++ /* Render the glyphs. */ ++ XftDrawGlyphFontSpec(xw.draw, fg, specs, len); ++ } + + /* 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) + /* + * Select the right color for the right mode. + */ +- g.mode &= ATTR_BOLD|ATTR_ITALIC|ATTR_UNDERLINE|ATTR_STRUCK|ATTR_WIDE; ++ g.mode &= ATTR_BOLD|ATTR_ITALIC|ATTR_UNDERLINE|ATTR_STRUCK|ATTR_WIDE|ATTR_BOXDRAW; + + if (IS_SET(MODE_REVERSE)) { + g.mode |= ATTR_REVERSE; +@@ -1626,10 +1757,30 @@ xseticontitle(char *p) + } + + void +-xsettitle(char *p) ++xfreetitlestack(void) + { +- XTextProperty prop; +- DEFAULT(p, opt_title); ++ for (int i = 0; i < LEN(titlestack); i++) { ++ free(titlestack[i]); ++ titlestack[i] = NULL; ++ } ++} ++ ++void ++xsettitle(char *p, int pop) ++{ ++ XTextProperty prop; ++ ++ free(titlestack[tstki]); ++ if (pop) { ++ titlestack[tstki] = NULL; ++ tstki = (tstki - 1 + TITLESTACKSIZE) % TITLESTACKSIZE; ++ p = titlestack[tstki] ? titlestack[tstki] : opt_title; ++ } else if (p) { ++ titlestack[tstki] = xstrdup(p); ++ } else { ++ titlestack[tstki] = NULL; ++ p = opt_title; ++ } + + if (Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle, + &prop) != Success) +@@ -1639,6 +1790,16 @@ xsettitle(char *p) + XFree(prop.value); + } + ++void ++xpushtitle(void) ++{ ++ int tstkin = (tstki + 1) % TITLESTACKSIZE; ++ ++ free(titlestack[tstkin]); ++ titlestack[tstkin] = titlestack[tstki] ? xstrdup(titlestack[tstki]) : NULL; ++ tstki = tstkin; ++} ++ + int + xstartdraw(void) + { +@@ -2014,6 +2175,59 @@ run(void) + } + } + ++int ++resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst) ++{ ++ char **sdst = dst; ++ int *idst = dst; ++ float *fdst = dst; ++ ++ char fullname[256]; ++ char fullclass[256]; ++ char *type; ++ XrmValue ret; ++ ++ snprintf(fullname, sizeof(fullname), "%s.%s", ++ opt_name ? opt_name : "st", name); ++ snprintf(fullclass, sizeof(fullclass), "%s.%s", ++ opt_class ? opt_class : "St", name); ++ fullname[sizeof(fullname) - 1] = fullclass[sizeof(fullclass) - 1] = '\0'; ++ ++ XrmGetResource(db, fullname, fullclass, &type, &ret); ++ if (ret.addr == NULL || strncmp("String", type, 64)) ++ return 1; ++ ++ switch (rtype) { ++ case STRING: ++ *sdst = ret.addr; ++ break; ++ case INTEGER: ++ *idst = strtoul(ret.addr, NULL, 10); ++ break; ++ case FLOAT: ++ *fdst = strtof(ret.addr, NULL); ++ break; ++ } ++ return 0; ++} ++ ++void ++config_init(void) ++{ ++ char *resm; ++ XrmDatabase db; ++ ResourcePref *p; ++ ++ XrmInitialize(); ++ resm = XResourceManagerString(xw.dpy); ++ if (!resm) ++ return; ++ ++ db = XrmGetStringDatabase(resm); ++ for (p = resources; p < resources + LEN(resources); p++) ++ resource_load(db, p->name, p->type, p->dst); ++} ++ + void + usage(void) + { +@@ -2087,6 +2301,11 @@ run: + + setlocale(LC_CTYPE, ""); + XSetLocaleModifiers(""); ++ ++ if(!(xw.dpy = XOpenDisplay(NULL))) ++ die("Can't open display\n"); ++ ++ config_init(); + cols = MAX(cols, 1); + rows = MAX(rows, 1); + tnew(cols, rows); +-- +2.43.0 + diff --git a/st/deploy.sh b/st/deploy.sh new file mode 100755 index 0000000..aeb65e6 --- /dev/null +++ b/st/deploy.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +wd="$HOME/.local/src/st" + +[ ! -d "$HOME/.local/src" ] && mkdir -p "$wd" + +rm -rf "$wd" +git clone https://git.suckless.org/st "$wd" + +patch -d "$wd" -p1 -i $(realpath davidovski.patch) + +make -C "$wd" +doas make -C "$wd" install PREFIX=/usr