mirror of
https://github.com/gaschz/dotfiles.git
synced 2025-12-04 22:34:27 +01:00
Compare commits
12 Commits
002e0354ab
...
819e502a8c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
819e502a8c | ||
|
|
c534002253 | ||
|
|
e7cebe4551 | ||
|
|
d6a423d41a | ||
|
|
efe660b3b1 | ||
|
|
45a0acb222 | ||
|
|
0bae3d94b2 | ||
|
|
11bc58a4dd | ||
|
|
6e0fe495cf | ||
|
|
ebe96406fb | ||
|
|
8a6cdd5096 | ||
|
|
a7d2876bb4 |
51
README.md
51
README.md
@ -1,7 +1,8 @@
|
||||
# dotfiles
|
||||
|
||||
<!--
|
||||
SPDX-FileCopyrightText: 2023 - 2024 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
SPDX-FileCopyrightText: 2023 - 2025 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
SPDX-FileCopyrightText: 2024 seven-beep <ebn@entreparentheses.xyz>
|
||||
|
||||
SPDX-License-Identifier: CC-BY-SA-4.0
|
||||
-->
|
||||
@ -13,6 +14,8 @@ Dotfiles.
|
||||
* [Description](#description)
|
||||
* [Installation](#installation)
|
||||
* [Salt](#salt)
|
||||
* [Pillar](#pillar)
|
||||
* [Pillar example](#pillar-example)
|
||||
* [Script](#script)
|
||||
* [Usage](#usage)
|
||||
* [License](#license)
|
||||
@ -59,6 +62,52 @@ Install specific files in Dom0:
|
||||
sudo qubesctl state.apply dotfiles.copy-dom0,dotfiles.copy-sh,dotfiles.copy-vim,dotfiles.copy-x11
|
||||
```
|
||||
|
||||
#### Pillar
|
||||
|
||||
By default, all states are executed when applied. Each component can be be
|
||||
deactivated by configuring the corresponding pillar data to a non true value.
|
||||
|
||||
You will need a top and a state file in your `pillar_roots`. If you followed
|
||||
[Qusal's installation instructions](https://github.com/ben-grande/qusal/blob/main/docs/INSTALL.md),
|
||||
it has already configured the setting for you using the value
|
||||
`/srv/pillar/qusal`. What you can do, is selectively enable or disable
|
||||
components.
|
||||
|
||||
For a complete example of a pillar state and a list of their corresponding
|
||||
formulas states, please refer to [pillar.sls.example](pillar.sls.example).
|
||||
|
||||
##### Pillar example
|
||||
|
||||
On the following example, we will selectively disable only the `dom0`
|
||||
component, therefore, the state `copy-dom0.sls` is not applied to `dom0`:
|
||||
|
||||
Create a pillar top to apply to all targets, write it to
|
||||
`/srv/pillar/qusal/dotfiles.top`:
|
||||
|
||||
```yaml
|
||||
base:
|
||||
'*':
|
||||
- qusal.dotfiles
|
||||
```
|
||||
|
||||
Then, create a pillar state do disable only `dom0` states, write it to
|
||||
`/srv/pillar/qusal/dotfiles.sls`:
|
||||
|
||||
```yaml
|
||||
qusal:
|
||||
dotfiles:
|
||||
dom0: false
|
||||
```
|
||||
|
||||
Add the pillar to the highstate:
|
||||
|
||||
```sh
|
||||
sudo qubesctl top.enable qusal.dotfiles pillar=true
|
||||
```
|
||||
|
||||
From now on, when calling the state `copy-dom0.sls`, it won't execute
|
||||
anything.
|
||||
|
||||
### Script
|
||||
|
||||
You can simply deploy all configurations with:
|
||||
|
||||
46
copy-all.sls
46
copy-all.sls
@ -1,21 +1,43 @@
|
||||
{#
|
||||
SPDX-FileCopyrightText: 2023 - 2024 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
SPDX-FileCopyrightText: 2023 - 2025 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
SPDX-FileCopyrightText: 2024 seven-beep <ebn@entreparentheses.xyz>
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
#}
|
||||
|
||||
{%- if salt["pillar.get"]("qusal:dotfiles:all", default=True) or
|
||||
salt["pillar.get"]("qusal:dotfiles:dom0") or
|
||||
salt["pillar.get"]("qusal:dotfiles:git") or
|
||||
salt["pillar.get"]("qusal:dotfiles:gtk") or
|
||||
salt["pillar.get"]("qusal:dotfiles:mutt") or
|
||||
salt["pillar.get"]("qusal:dotfiles:net") or
|
||||
salt["pillar.get"]("qusal:dotfiles:pgp") or
|
||||
salt["pillar.get"]("qusal:dotfiles:sh") or
|
||||
salt["pillar.get"]("qusal:dotfiles:ssh") or
|
||||
salt["pillar.get"]("qusal:dotfiles:tmux") or
|
||||
salt["pillar.get"]("qusal:dotfiles:vim") or
|
||||
salt["pillar.get"]("qusal:dotfiles:x11")
|
||||
-%}
|
||||
|
||||
include:
|
||||
- .copy-dom0
|
||||
- .copy-git
|
||||
- .copy-gtk
|
||||
- .copy-net
|
||||
- .copy-pgp
|
||||
- .copy-sh
|
||||
- .copy-ssh
|
||||
- .copy-tmux
|
||||
- .copy-vim
|
||||
- .copy-x11
|
||||
- .copy-xfce
|
||||
- {{ slsdotpath }}.copy-dom0
|
||||
- {{ slsdotpath }}.copy-git
|
||||
- {{ slsdotpath }}.copy-gtk
|
||||
- {{ slsdotpath }}.copy-mutt
|
||||
- {{ slsdotpath }}.copy-net
|
||||
- {{ slsdotpath }}.copy-pgp
|
||||
- {{ slsdotpath }}.copy-sh
|
||||
- {{ slsdotpath }}.copy-ssh
|
||||
- {{ slsdotpath }}.copy-tmux
|
||||
- {{ slsdotpath }}.copy-vim
|
||||
- {{ slsdotpath }}.copy-x11
|
||||
|
||||
{%- else -%}
|
||||
|
||||
"{{ sls }}-was-disabled-by-pillar":
|
||||
test.nop
|
||||
|
||||
{%- endif -%}
|
||||
|
||||
{#
|
||||
Unfortunately salt.states.file does not keep permissions when using salt-ssh.
|
||||
|
||||
@ -1,9 +1,13 @@
|
||||
{#
|
||||
SPDX-FileCopyrightText: 2023 - 2024 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
SPDX-FileCopyrightText: 2023 - 2025 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
SPDX-FileCopyrightText: 2024 seven-beep <ebn@entreparentheses.xyz>
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
#}
|
||||
|
||||
{%- set qusal_dot = salt["pillar.get"]("qusal:dotfiles:all", default=True) -%}
|
||||
{%- if salt["pillar.get"]("qusal:dotfiles:dom0", default=qusal_dot) -%}
|
||||
|
||||
{%- import "dom0/gui-user.jinja" as gui_user -%}
|
||||
|
||||
"{{ slsdotpath }}-copy-dom0-home":
|
||||
@ -25,3 +29,10 @@ SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
- user: root
|
||||
- group: root
|
||||
- makedirs: True
|
||||
|
||||
{%- else -%}
|
||||
|
||||
"{{ sls }}-was-disabled-by-pillar":
|
||||
test.nop
|
||||
|
||||
{%- endif %}
|
||||
|
||||
11
copy-git.sls
11
copy-git.sls
@ -1,9 +1,13 @@
|
||||
{#
|
||||
SPDX-FileCopyrightText: 2023 - 2025 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
SPDX-FileCopyrightText: 2024 seven-beep <ebn@entreparentheses.xyz>
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
#}
|
||||
|
||||
{%- set qusal_dot = salt["pillar.get"]("qusal:dotfiles:all", default=True) -%}
|
||||
{%- if salt["pillar.get"]("qusal:dotfiles:git", default=qusal_dot) -%}
|
||||
|
||||
{%- import "dom0/gui-user.jinja" as gui_user -%}
|
||||
|
||||
"{{ slsdotpath }}-copy-git-home":
|
||||
@ -65,3 +69,10 @@ SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
- mode: '0755'
|
||||
- recurse:
|
||||
- mode
|
||||
|
||||
{%- else -%}
|
||||
|
||||
"{{ sls }}-was-disabled-by-pillar":
|
||||
test.nop
|
||||
|
||||
{%- endif %}
|
||||
|
||||
13
copy-gtk.sls
13
copy-gtk.sls
@ -1,9 +1,13 @@
|
||||
{#
|
||||
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
SPDX-FileCopyrightText: 2023 - 2025 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
SPDX-FileCopyrightText: 2024 seven-beep <ebn@entreparentheses.xyz>
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
#}
|
||||
|
||||
{%- set qusal_dot = salt["pillar.get"]("qusal:dotfiles:all", default=True) -%}
|
||||
{%- if salt["pillar.get"]("qusal:dotfiles:gtk", default=qusal_dot) -%}
|
||||
|
||||
{%- import "dom0/gui-user.jinja" as gui_user -%}
|
||||
|
||||
"{{ slsdotpath }}-copy-gtk-home":
|
||||
@ -23,3 +27,10 @@ SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
- dir_mode: '0700'
|
||||
- user: root
|
||||
- group: root
|
||||
|
||||
{%- else -%}
|
||||
|
||||
"{{ sls }}-was-disabled-by-pillar":
|
||||
test.nop
|
||||
|
||||
{%- endif %}
|
||||
|
||||
@ -1,9 +1,13 @@
|
||||
{#
|
||||
SPDX-FileCopyrightText: 2023 - 2025 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
SPDX-FileCopyrightText: 2024 seven-beep <ebn@entreparentheses.xyz>
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
#}
|
||||
|
||||
{%- set qusal_dot = salt["pillar.get"]("qusal:dotfiles:all", default=True) -%}
|
||||
{%- if salt["pillar.get"]("qusal:dotfiles:mutt", default=qusal_dot) -%}
|
||||
|
||||
{%- import "dom0/gui-user.jinja" as gui_user -%}
|
||||
|
||||
"{{ slsdotpath }}-copy-mutt-home":
|
||||
@ -39,3 +43,10 @@ SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
- mode: '0755'
|
||||
- recurse:
|
||||
- mode
|
||||
|
||||
{%- else -%}
|
||||
|
||||
"{{ sls }}-was-disabled-by-pillar":
|
||||
test.nop
|
||||
|
||||
{%- endif %}
|
||||
|
||||
11
copy-net.sls
11
copy-net.sls
@ -1,9 +1,13 @@
|
||||
{#
|
||||
SPDX-FileCopyrightText: 2023 - 2025 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
SPDX-FileCopyrightText: 2024 seven-beep <ebn@entreparentheses.xyz>
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
#}
|
||||
|
||||
{%- set qusal_dot = salt["pillar.get"]("qusal:dotfiles:all", default=True) -%}
|
||||
{%- if salt["pillar.get"]("qusal:dotfiles:net", default=qusal_dot) -%}
|
||||
|
||||
{%- import "dom0/gui-user.jinja" as gui_user -%}
|
||||
|
||||
"{{ slsdotpath }}-copy-net-home":
|
||||
@ -41,3 +45,10 @@ SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
- mode: '0755'
|
||||
- recurse:
|
||||
- mode
|
||||
|
||||
{%- else -%}
|
||||
|
||||
"{{ sls }}-was-disabled-by-pillar":
|
||||
test.nop
|
||||
|
||||
{%- endif %}
|
||||
|
||||
13
copy-pgp.sls
13
copy-pgp.sls
@ -1,9 +1,13 @@
|
||||
{#
|
||||
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
SPDX-FileCopyrightText: 2023 - 2025 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
SPDX-FileCopyrightText: 2024 seven-beep <ebn@entreparentheses.xyz>
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
#}
|
||||
|
||||
{%- set qusal_dot = salt["pillar.get"]("qusal:dotfiles:all", default=True) -%}
|
||||
{%- if salt["pillar.get"]("qusal:dotfiles:pgp", default=qusal_dot) -%}
|
||||
|
||||
{%- import "dom0/gui-user.jinja" as gui_user -%}
|
||||
|
||||
"{{ slsdotpath }}-copy-pgp-home":
|
||||
@ -27,3 +31,10 @@ SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
- group: root
|
||||
|
||||
{% endif -%}
|
||||
|
||||
{%- else -%}
|
||||
|
||||
"{{ sls }}-was-disabled-by-pillar":
|
||||
test.nop
|
||||
|
||||
{%- endif %}
|
||||
|
||||
13
copy-sh.sls
13
copy-sh.sls
@ -1,9 +1,13 @@
|
||||
{#
|
||||
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
SPDX-FileCopyrightText: 2023 - 2025 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
SPDX-FileCopyrightText: 2024 seven-beep <ebn@entreparentheses.xyz>
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
#}
|
||||
|
||||
{%- set qusal_dot = salt["pillar.get"]("qusal:dotfiles:all", default=True) -%}
|
||||
{%- if salt["pillar.get"]("qusal:dotfiles:sh", default=qusal_dot) -%}
|
||||
|
||||
{%- import "dom0/gui-user.jinja" as gui_user -%}
|
||||
|
||||
"{{ slsdotpath }}-copy-sh-home":
|
||||
@ -43,3 +47,10 @@ SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
- dir_mode: '0755'
|
||||
- recurse:
|
||||
- mode
|
||||
|
||||
{%- else -%}
|
||||
|
||||
"{{ sls }}-was-disabled-by-pillar":
|
||||
test.nop
|
||||
|
||||
{%- endif %}
|
||||
|
||||
13
copy-ssh.sls
13
copy-ssh.sls
@ -1,9 +1,13 @@
|
||||
{#
|
||||
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
SPDX-FileCopyrightText: 2023 - 2025 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
SPDX-FileCopyrightText: 2024 seven-beep <ebn@entreparentheses.xyz>
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
#}
|
||||
|
||||
{%- set qusal_dot = salt["pillar.get"]("qusal:dotfiles:all", default=True) -%}
|
||||
{%- if salt["pillar.get"]("qusal:dotfiles:ssh", default=qusal_dot) -%}
|
||||
|
||||
{%- import "dom0/gui-user.jinja" as gui_user -%}
|
||||
|
||||
"{{ slsdotpath }}-copy-ssh-home":
|
||||
@ -24,3 +28,10 @@ SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
- dir_mode: '0700'
|
||||
- user: root
|
||||
- group: root
|
||||
|
||||
{%- else -%}
|
||||
|
||||
"{{ sls }}-was-disabled-by-pillar":
|
||||
test.nop
|
||||
|
||||
{%- endif %}
|
||||
|
||||
@ -1,9 +1,13 @@
|
||||
{#
|
||||
SPDX-FileCopyrightText: 2023 - 2025 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
SPDX-FileCopyrightText: 2024 seven-beep <ebn@entreparentheses.xyz>
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
#}
|
||||
|
||||
{%- set qusal_dot = salt["pillar.get"]("qusal:dotfiles:all", default=True) -%}
|
||||
{%- if salt["pillar.get"]("qusal:dotfiles:tmux", default=qusal_dot) -%}
|
||||
|
||||
{%- import "dom0/gui-user.jinja" as gui_user -%}
|
||||
|
||||
"{{ slsdotpath }}-copy-tmux-home":
|
||||
@ -37,3 +41,10 @@ SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
- mode: '0755'
|
||||
- recurse:
|
||||
- mode
|
||||
|
||||
{%- else -%}
|
||||
|
||||
"{{ sls }}-was-disabled-by-pillar":
|
||||
test.nop
|
||||
|
||||
{%- endif %}
|
||||
|
||||
13
copy-vim.sls
13
copy-vim.sls
@ -1,9 +1,13 @@
|
||||
{#
|
||||
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
SPDX-FileCopyrightText: 2023 - 2025 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
SPDX-FileCopyrightText: 2024 seven-beep <ebn@entreparentheses.xyz>
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
#}
|
||||
|
||||
{%- set qusal_dot = salt["pillar.get"]("qusal:dotfiles:all", default=True) -%}
|
||||
{%- if salt["pillar.get"]("qusal:dotfiles:vim", default=qusal_dot) -%}
|
||||
|
||||
{%- import "dom0/gui-user.jinja" as gui_user -%}
|
||||
|
||||
"{{ slsdotpath }}-copy-vim-home":
|
||||
@ -23,3 +27,10 @@ SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
- dir_mode: '0700'
|
||||
- user: root
|
||||
- group: root
|
||||
|
||||
{%- else -%}
|
||||
|
||||
"{{ sls }}-was-disabled-by-pillar":
|
||||
test.nop
|
||||
|
||||
{%- endif %}
|
||||
|
||||
13
copy-x11.sls
13
copy-x11.sls
@ -1,9 +1,13 @@
|
||||
{#
|
||||
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
SPDX-FileCopyrightText: 2023 - 2025 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
SPDX-FileCopyrightText: 2024 seven-beep <ebn@entreparentheses.xyz>
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
#}
|
||||
|
||||
{%- set qusal_dot = salt["pillar.get"]("qusal:dotfiles:all", default=True) -%}
|
||||
{%- if salt["pillar.get"]("qusal:dotfiles:x11", default=qusal_dot) -%}
|
||||
|
||||
{%- import "dom0/gui-user.jinja" as gui_user -%}
|
||||
|
||||
"{{ slsdotpath }}-copy-x11-home":
|
||||
@ -27,3 +31,10 @@ SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
- group: root
|
||||
- keep_symlinks: True
|
||||
- force_symlinks: True
|
||||
|
||||
{%- else -%}
|
||||
|
||||
"{{ sls }}-was-disabled-by-pillar":
|
||||
test.nop
|
||||
|
||||
{%- endif %}
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
{#
|
||||
SPDX-FileCopyrightText: 2024 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
#}
|
||||
|
||||
{%- import "dom0/gui-user.jinja" as gui_user -%}
|
||||
|
||||
"{{ slsdotpath }}-copy-xfce-home":
|
||||
file.recurse:
|
||||
- name: {{ gui_user.gui_user_home }}/
|
||||
- source: salt://{{ slsdotpath }}/files/xfce/
|
||||
- file_mode: '0644'
|
||||
- dir_mode: '0700'
|
||||
- user: {{ gui_user.gui_user }}
|
||||
- group: {{ gui_user.gui_user }}
|
||||
- keep_symlinks: True
|
||||
- force_symlinks: True
|
||||
|
||||
"{{ slsdotpath }}-copy-xfce-skel":
|
||||
file.recurse:
|
||||
- name: /etc/skel
|
||||
- source: salt://{{ slsdotpath }}/files/xfce/
|
||||
- file_mode: '0644'
|
||||
- dir_mode: '0700'
|
||||
- user: root
|
||||
- group: root
|
||||
- keep_symlinks: True
|
||||
- force_symlinks: True
|
||||
@ -1,9 +0,0 @@
|
||||
{#
|
||||
SPDX-FileCopyrightText: 2024 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
#}
|
||||
|
||||
base:
|
||||
'*':
|
||||
- dotfiles.copy-xfce
|
||||
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# SPDX-FileCopyrightText: 2018 Chris Laprise <https://github.com/tasket>
|
||||
# SPDX-FileCopyrightText: 2023 - 2024 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
# SPDX-FileCopyrightText: 2023 - 2025 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
@ -9,57 +9,80 @@
|
||||
## Credits: https://github.com/tasket/Qubes-scripts
|
||||
set -eu
|
||||
|
||||
if ! command -v sensors >/dev/null; then
|
||||
printf '%s\n' "Program not installed: sensors" >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! command -v xentop >/dev/null; then
|
||||
printf '%s\n' "Program not installed: xentop" >&2
|
||||
exit 1
|
||||
fi
|
||||
sensors="1"
|
||||
if ! command -v sensors >/dev/null; then
|
||||
sensors="0"
|
||||
fi
|
||||
|
||||
sensors_stats () {
|
||||
redraw(){
|
||||
# shellcheck disable=SC2312
|
||||
sensors | grep -E -e "^(${sensor_lines})"
|
||||
stty size </dev/null 2>&1 >&2 | read -r LINES COLUMNS
|
||||
tput ed home
|
||||
}
|
||||
|
||||
delay=5
|
||||
sortcol=3
|
||||
sensor_lines='Package id 0|fan1|CPU'
|
||||
do_tui(){
|
||||
stty -echo -icanon
|
||||
tput smcup civis home
|
||||
}
|
||||
|
||||
undo_tui(){
|
||||
stty echo icanon
|
||||
tput cnorm rmcup
|
||||
}
|
||||
|
||||
trap 'undo_tui' HUP INT QUIT ABRT TERM EXIT
|
||||
trap 'redraw' WINCH
|
||||
do_tui
|
||||
|
||||
get_header(){
|
||||
cpusum=0
|
||||
memsum=0
|
||||
table=""
|
||||
if test "${sensors}" != "0"; then
|
||||
sensors | grep -E -e "^(fan[1-9]+|[C|G]PU|temp[1-9]+):" |
|
||||
grep -v -e "0 RPM" -e "+0\.0.C" |
|
||||
tr -s "\t" " " | tr "\n" "\t" | sed "s/\s\+$/\n/" || true
|
||||
fi
|
||||
printf '%s%-40s %-6s %6s %8s%s\n' "${bold}" 'Qube' 'State' 'CPU(%)' \
|
||||
'MEM(MiB)' "${nobold}"
|
||||
}
|
||||
|
||||
|
||||
table=""
|
||||
delay=1
|
||||
sortcol=1
|
||||
newline='
|
||||
'
|
||||
sumline="--------------------------------------------------------"
|
||||
header="\033[2K\nVM NAME STATE CPU(%) MEM(MB)"
|
||||
bold="$(tput smso)"
|
||||
nobold="$(tput rmso)"
|
||||
index=0
|
||||
|
||||
trap "tput reset" HUP INT QUIT ABRT TERM EXIT
|
||||
|
||||
tput reset
|
||||
sensors_stats
|
||||
printf '%b\n' "${header}"
|
||||
cpusum=0; memsum=0; table="${sumline}"
|
||||
get_header
|
||||
# shellcheck disable=SC2016,SC2312
|
||||
stdbuf -oL xentop -b -f -d "${delay}" | \
|
||||
stdbuf -oL awk '{printf ("%-32s %5s %5d %7d\n", $1,$2,$4,$5/1000) }' | \
|
||||
xentop -b -f -d "${delay}" | \
|
||||
stdbuf -oL awk '{printf ("%-40s %-6s %6d %8d\n", $1,$2,$4,$5/1000) }' | \
|
||||
(
|
||||
read -r ln
|
||||
read -r _
|
||||
while true; do
|
||||
if read -r -t 0.1 ln; then
|
||||
table="${table}${newline}${ln}"
|
||||
read -r _ _ cpu mem <<<"${ln}"
|
||||
if read -r -t 0.1 line; then
|
||||
table="${table:+${table}${newline}}${line}"
|
||||
read -r _ _ cpu mem <<<"${line}"
|
||||
index=$((index+1))
|
||||
cpusum=$((cpusum+cpu))
|
||||
memsum=$((memsum+mem))
|
||||
cpuavg=$((cpusum/index))
|
||||
else
|
||||
# End of list, print totals, make new page.
|
||||
sort -k "${sortcol}" -n -r <<<"${table}"
|
||||
printf '%-32s %5s %5d %7d\033[J\033[H' " " " " "${cpusum}" \
|
||||
"${memsum}"
|
||||
read -r ln
|
||||
cpusum=0; memsum=0
|
||||
table="${sumline}"
|
||||
#clear
|
||||
#sensors |grep -E "^(${sensor_lines})"
|
||||
sensors_stats
|
||||
printf '%b\n' "\033[2K${header}\n"
|
||||
index=0
|
||||
sort -k "${sortcol}" -n <<<"${table}"
|
||||
printf '%s%-s %-34s %-6s %6d %8d%s' "${bold}" "Total" "" "" \
|
||||
"${cpuavg}" "${memsum}" "${nobold}"
|
||||
tput ed home
|
||||
read -r _
|
||||
get_header
|
||||
fi
|
||||
done
|
||||
)
|
||||
|
||||
@ -38,4 +38,4 @@ fi
|
||||
description="$(printf '%s\n' "$3" | cut -c 1-80)"
|
||||
test_description description "${description}"
|
||||
|
||||
printf '%s\n' "${description}" | tee "${description_file}"
|
||||
printf '%s\n' "${description}" | tee -- "${description_file}"
|
||||
|
||||
@ -1,30 +1,35 @@
|
||||
#!/bin/sh
|
||||
|
||||
## SPDX-FileCopyrightText: 2023 - 2024 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
## SPDX-FileCopyrightText: 2023 - 2025 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
##
|
||||
## SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
set -eu
|
||||
|
||||
if command -v delta >/dev/null; then
|
||||
exec delta "${@}"
|
||||
exec delta -- "${@}"
|
||||
else
|
||||
: "${DIFF_HIGHLIGHT_SOURCE:=/usr/share/doc/git/contrib/diff-highlight}"
|
||||
: "${DIFF_HIGHLIGHT_EXEC:=/usr/share/git-core/contrib/diff-highlight}"
|
||||
|
||||
git_less(){
|
||||
exec less -RS -- "${@}"
|
||||
}
|
||||
|
||||
## Debian.
|
||||
if command -v perl >/dev/null &&
|
||||
test -f "${DIFF_HIGHLIGHT_SOURCE}/DiffHighlight.pm" &&
|
||||
test -f "${DIFF_HIGHLIGHT_SOURCE}/diff-highlight.perl"
|
||||
then
|
||||
exec perl -I "${DIFF_HIGHLIGHT_SOURCE}" -MDiffHighlight -- \
|
||||
"${DIFF_HIGHLIGHT_SOURCE}/diff-highlight.perl" | less -RS
|
||||
|
||||
"${DIFF_HIGHLIGHT_SOURCE}/diff-highlight.perl" | git_less
|
||||
exit
|
||||
## Fedora.
|
||||
elif command -v perl >/dev/null && test -f "${DIFF_HIGHLIGHT_EXEC}"
|
||||
then
|
||||
exec "${DIFF_HIGHLIGHT_EXEC}" | less -RS
|
||||
exec "${DIFF_HIGHLIGHT_EXEC}" | git_less
|
||||
exit
|
||||
fi
|
||||
|
||||
exec less -RS "${@}"
|
||||
git_less "${@}"
|
||||
fi
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
##
|
||||
## SPDX-FileCopyrightText: 2023 - 2024 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
## SPDX-FileCopyrightText: 2023 - 2025 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
##
|
||||
## SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
##
|
||||
@ -28,14 +28,14 @@ test -f ./setup.sh ||
|
||||
|
||||
if test "${qube}" = "dom0"; then
|
||||
sh ./dotfiles/setup.sh
|
||||
user_name="$(getent group qubes | awk -F "[:,]" '{print $4}')"
|
||||
user_home="$(getent passwd "${user_name}" | awk -F ":" '{print $6}')"
|
||||
sudo -u "${user_name}" mkdir -pv -- "${user_home}/.cache"
|
||||
tmpdir="$(sudo -u "${user_name}" -- mktemp -d -- "${user_home}/.cache/XXXXXX")"
|
||||
user="$(getent group qubes | awk -F "[:,]" '{print $4}')"
|
||||
home="$(getent passwd "${user}" | awk -F ":" '{print $6}')"
|
||||
sudo -u "${user}" mkdir -pv -- "${home}/.cache"
|
||||
tmpdir="$(sudo -u "${user}" -- mktemp -d -- "${home}/.cache/XXXXXX")"
|
||||
trap 'rm -rf -- "${tmpdir}"' EXIT INT HUP QUIT ABRT
|
||||
cp -r -- ./dotfiles "${tmpdir}"
|
||||
chown -R -- "${user_name}:${user_name}" "${tmpdir}"
|
||||
sudo -u "${user_name}" -- "${tmpdir}/dotfiles/setup.sh"
|
||||
chown -R -- "${user}:${user}" "${tmpdir}"
|
||||
sudo -u "${user}" -- "${tmpdir}/dotfiles/setup.sh"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
## SPDX-FileCopyrightText: 2023 - 2025 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
##
|
||||
## SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
@ -43,7 +43,11 @@ _reset_line() {
|
||||
esac
|
||||
## Credit: Can't find the source, posted on StackExchange or alike.
|
||||
## Does not work well on Bash 5.0 and older.
|
||||
bash_version_clean="$(printf '%s\n' "${BASH_VERSION%.*}" | tr -d ".")"
|
||||
bash_version_clean="${BASH_VERSION%.*}"
|
||||
bash_version_clean="${bash_version_clean//\./}"
|
||||
if [[ ! ${bash_version_clean} =~ ^[0-9]+$ ]]; then
|
||||
return
|
||||
fi
|
||||
if test "${bash_version_clean}" -lt 51; then
|
||||
unset bash_version_clean
|
||||
return
|
||||
@ -56,15 +60,17 @@ _reset_line() {
|
||||
## On pending input, assume it's been echoed and we're not in first column.
|
||||
## Otherwise ask the terminal for current column and read it from input.
|
||||
if read -t 0 || {
|
||||
IFS='[;' read -s -r -d'R' -p$'\033[6n' _ _ cur_y && [[ ${cur_y} != 1 ]]
|
||||
# shellcheck disable=SC2154
|
||||
IFS='[;' read -s -r -d'R' -p "${_t_u7}" _ _ cur_y && [[ ${cur_y} != 1 ]]
|
||||
}
|
||||
then
|
||||
unset cur_y
|
||||
## Print line ending char with reversed video and end with newline.
|
||||
if test "${color_prompt-}" = "yes"; then
|
||||
printf '%b' "\033[41m\033[0m\033[7m%\033[m\n\r"
|
||||
# shellcheck disable=SC2154
|
||||
printf '%s\n\r' "${_t_sgr0}${_t_rev}%${_t_sgr0}"
|
||||
else
|
||||
printf '%b' "%\n\r"
|
||||
printf '%s\n\r' "%"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@ -72,10 +78,13 @@ _reset_line() {
|
||||
_print_ec(){
|
||||
test "${_ec_ps1}" = "0" && return
|
||||
if test "${color_prompt:-}" = "yes"; then
|
||||
printf '%b%s%b' "(\001\033[31m\002" "${_ec_ps1}" "\001\033[0m\002)"
|
||||
# shellcheck disable=SC2154
|
||||
printf '(\001%s\002%s\001%s\002)' "${_t_setaf_1}" "${_ec_ps1}" \
|
||||
"${_t_sgr0}"
|
||||
else
|
||||
printf '%s' "(${_ec_ps1})"
|
||||
printf '(%s)' "${_ec_ps1}"
|
||||
fi
|
||||
unset _ec_ps1
|
||||
}
|
||||
|
||||
_save_ec() { _ec_ps1=$?; }
|
||||
@ -85,10 +94,10 @@ newline=$'\n'
|
||||
# shellcheck disable=SC2154
|
||||
if test "${color_prompt:-}" = "yes"; then
|
||||
# shellcheck disable=SC2154
|
||||
PS1="\$(_reset_line)\$(resize-terminal)\[\033[35m\][\[${reset_color}\]"
|
||||
PS1="\$(_reset_line)\$(resize-terminal)\[${_t_setaf_5}\][\[${_t_sgr0}\]"
|
||||
PS1="${PS1}${debian_chroot:+(${debian_chroot})}\[${usercolor}\]\u@\h "
|
||||
PS1="${PS1}\[${dircolor}\]\w\[${reset_color}\]\$(_git_prompt_info)"
|
||||
PS1="${PS1}\[\033[35m\]]\[${reset_color}\]${newline-}\$(_print_ec)"
|
||||
PS1="${PS1}\[${dircolor}\]\w\[${_t_sgr0}\]\$(_git_prompt_info)"
|
||||
PS1="${PS1}\[${_t_setaf_5}\]]\[${_t_sgr0}\]${newline-}\$(_print_ec)"
|
||||
PS1="${PS1}${ps1_symbol} "
|
||||
else
|
||||
PS1="\$(_reset_line)\$(resize-terminal)"
|
||||
@ -100,7 +109,7 @@ fi
|
||||
case "${TERM-}" in
|
||||
screen*|xterm*|rxvt*)
|
||||
## Set window title
|
||||
PS1="\[\e]0;${debian_chroot:+(${debian_chroot})}\u@\h: \w\a\]${PS1}"
|
||||
PS1="\[\033]0;${debian_chroot:+(${debian_chroot})}\u@\h: \w\a\]${PS1}"
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
@ -112,14 +121,14 @@ case "${TERM-}" in
|
||||
*)
|
||||
## Reset cursor to steady block after command input and before execution.
|
||||
# shellcheck disable=SC2034
|
||||
PS0="\e[2 q\2"
|
||||
PS0="\033[2 q\2"
|
||||
;;
|
||||
esac
|
||||
if ! shopt -oq posix; then
|
||||
source_readable /usr/share/bash-completion/bash_completion
|
||||
fi
|
||||
|
||||
unset newline ps1_symbol
|
||||
unset newline ps1_symbol dircolor usercolor
|
||||
## }}}
|
||||
## {{{ Plugins
|
||||
if has zoxide; then
|
||||
|
||||
@ -20,13 +20,13 @@ set editing-mode emacs
|
||||
set show-mode-in-prompt on
|
||||
|
||||
$if term=linux
|
||||
set emacs-mode-string "\1\e[?0c\2"
|
||||
set vi-ins-mode-string "\1\e[?0c\2"
|
||||
set vi-cmd-mode-string "\1\e[?8c\2"
|
||||
set emacs-mode-string "\1\033[?0c\2"
|
||||
set vi-ins-mode-string "\1\033[?0c\2"
|
||||
set vi-cmd-mode-string "\1\033[?8c\2"
|
||||
$else
|
||||
set emacs-mode-string "\1\e[5 q\2"
|
||||
set vi-ins-mode-string "\1\e[5 q\2"
|
||||
set vi-cmd-mode-string "\1\e[2 q\2"
|
||||
set emacs-mode-string "\1\033[5 q\2"
|
||||
set vi-ins-mode-string "\1\033[5 q\2"
|
||||
set vi-cmd-mode-string "\1\033[2 q\2"
|
||||
$endif
|
||||
|
||||
$if term=''
|
||||
@ -59,8 +59,8 @@ $if mode=emacs
|
||||
|
||||
set keymap emacs-ctlx
|
||||
v: vi-editing-mode
|
||||
Control-v: "\C-xv\e"
|
||||
Esc: "\C-xv\e"
|
||||
Control-v: "\C-xv\033"
|
||||
Esc: "\C-xv\033"
|
||||
set keymap emacs
|
||||
|
||||
$else
|
||||
@ -117,46 +117,46 @@ $endif
|
||||
|
||||
|
||||
## Home
|
||||
"\e[1~": beginning-of-line
|
||||
"\e[H": beginning-of-line
|
||||
"\eOH": beginning-of-line
|
||||
"\033[1~": beginning-of-line
|
||||
"\033[H": beginning-of-line
|
||||
"\033OH": beginning-of-line
|
||||
|
||||
## End
|
||||
"\e[4~": end-of-line
|
||||
"\e[F": end-of-line
|
||||
"\eOF": end-of-line
|
||||
"\033[4~": end-of-line
|
||||
"\033[F": end-of-line
|
||||
"\033OF": end-of-line
|
||||
|
||||
## Delete
|
||||
"\e[3~": delete-char
|
||||
"\e[P": delete-char
|
||||
"\eOP": delete-char
|
||||
"\033[3~": delete-char
|
||||
"\033[P": delete-char
|
||||
"\033OP": delete-char
|
||||
|
||||
## Insert
|
||||
"\e[2~": quoted-insert
|
||||
"\e[L": quoted-insert
|
||||
"\033[2~": quoted-insert
|
||||
"\033[L": quoted-insert
|
||||
|
||||
## PgUp
|
||||
"\e[5~": beginning-of-history
|
||||
"\e[I": beginning-of-history
|
||||
"\033[5~": beginning-of-history
|
||||
"\033[I": beginning-of-history
|
||||
|
||||
## PgDown
|
||||
"\e[6~": end-of-history
|
||||
"\e[G": end-of-history
|
||||
"\033[6~": end-of-history
|
||||
"\033[G": end-of-history
|
||||
|
||||
## Ctrl+RighArrow
|
||||
"\e[1;5C": forward-word
|
||||
"\e[5C": forward-word
|
||||
"\e\e[C": forward-word
|
||||
"\033[1;5C": forward-word
|
||||
"\033[5C": forward-word
|
||||
"\033\033[C": forward-word
|
||||
|
||||
## Ctrl+LeftArrow
|
||||
"\e[1;5D": backward-word
|
||||
"\e[5D": backward-word
|
||||
"\e\e[D": backward-word
|
||||
"\033[1;5D": backward-word
|
||||
"\033[5D": backward-word
|
||||
"\033\033[D": backward-word
|
||||
|
||||
## Terminal
|
||||
$if term=rxvt
|
||||
"\e[7~": beginning-of-line
|
||||
"\e[8~": end-of-line
|
||||
"\eOc": forward-word
|
||||
"\eOd": backward-word
|
||||
"\033[7~": beginning-of-line
|
||||
"\033[8~": end-of-line
|
||||
"\033Oc": forward-word
|
||||
"\033Od": backward-word
|
||||
$endif
|
||||
|
||||
@ -18,4 +18,4 @@ i toggle-option i
|
||||
^F right
|
||||
^N down
|
||||
^P up
|
||||
\ef word-right
|
||||
\033f word-right
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
# shellcheck disable=SC2312
|
||||
: "${USER:=$(id -un || printf '%s' "${HOME##*/}")}"
|
||||
# shellcheck disable=SC2312
|
||||
: "${UID:=$(id -u || awk -F ":" -v user="${USER}" -- '/^user:/{print $3}' \
|
||||
: "${UID:=$(id -u || awk -F ":" -v user="${USER}" -- '$1 == user {print $3}' \
|
||||
/etc/passwd)}"
|
||||
# shellcheck disable=SC2312
|
||||
: "${HOSTNAME:=$(hostname)}"
|
||||
@ -28,6 +28,7 @@ mkdir -p -- "${XDG_CONFIG_HOME}" "${XDG_CACHE_HOME}" "${XDG_DATA_HOME}" \
|
||||
xdg_dirs="$(awk -- '/^[ ]*XDG_[A-Z]*_DIR=/{print "export " $1}' \
|
||||
"${XDG_CONFIG_HOME}/user-dirs.dirs")"
|
||||
eval "${xdg_dirs}"
|
||||
unset xdg_dirs
|
||||
|
||||
## Set directory to be used for coding.
|
||||
CODEDIR="${HOME}/src"
|
||||
@ -156,7 +157,7 @@ if test -z "${SSH_AUTH_SOCK-}" && has ssh-agent; then
|
||||
ssh_agent_env="$(ssh-agent -s -a "${ssh_agent_sock}")"
|
||||
eval "${ssh_agent_env}" >/dev/null
|
||||
unset ssh_agent_env
|
||||
printf '%s\n' "${SSH_AGENT_PID}" | tee "${ssh_agent_pid}" >/dev/null
|
||||
printf '%s\n' "${SSH_AGENT_PID}" | tee -- "${ssh_agent_pid}" >/dev/null
|
||||
fi
|
||||
fi
|
||||
unset ssh_agent_dir ssh_agent_sock ssh_agent_pid
|
||||
@ -170,6 +171,7 @@ for f in "${XDG_CONFIG_HOME}/sh/profile.d"/*.sh; do
|
||||
# shellcheck disable=SC1090,SC1091
|
||||
! test -r "${f}" || . "${f}"
|
||||
done
|
||||
unset f
|
||||
|
||||
## Source local profile.
|
||||
# shellcheck disable=SC1090,SC1091
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
## SPDX-FileCopyrightText: 2004 - 2022 Tim Pope <https://tpo.pe>
|
||||
## SPDX-FileCopyrightText: 2023 - 2024 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
## SPDX-FileCopyrightText: 2023 - 2025 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
##
|
||||
## SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
@ -35,8 +35,11 @@ alias mv="mv -i"
|
||||
alias ls="ls -hF --group-directories-first --color=auto"
|
||||
if has lsblk; then
|
||||
_lsblk_options="NAME,FSTYPE,LABEL,SIZE,FSAVAIL,FSUSE%,MOUNTPOINT"
|
||||
alias lsblk='lsblk -o ${_lsblk_options}'
|
||||
alias lsblku='lsblk -o ${_lsblk_options},UUID,PARTUUID'
|
||||
# shellcheck disable=SC2139
|
||||
alias lsblk="lsblk -o ${_lsblk_options}"
|
||||
# shellcheck disable=SC2139
|
||||
alias lsblku="lsblk -o ${_lsblk_options},UUID,PARTUUID"
|
||||
unset _lsblk_options
|
||||
fi
|
||||
if ! grep --color 2>&1 | grep -qE -e "(unrecognized|unknown) option" &&
|
||||
! grep --exclude 2>&1 | grep -qE -e "(unrecognized|unknown) option"
|
||||
@ -110,7 +113,8 @@ has qubesctl && {
|
||||
alias qctlu="qctl --skip-dom0 --targets"
|
||||
qctlus(){
|
||||
test -n "${2-}" || return 1
|
||||
qubesctl --skip-dom0 --targets "${1}" state.apply "${2}"
|
||||
# shellcheck disable=SC3058
|
||||
qubesctl --skip-dom0 --targets "${1}" state.apply "${@#"${1}"}"
|
||||
}
|
||||
}
|
||||
has gpg && alias gpgs="gpg --show-keys"
|
||||
@ -124,9 +128,10 @@ has tmux && {
|
||||
alias tcl="clear && t clear-history" # clear buffer cus memory
|
||||
tcla(){
|
||||
## Clear all the panes of the current session.
|
||||
for _t_pane in $(tmux list-panes -s -F '#{pane_id}'); do
|
||||
tmux clear-history -t "${_t_pane}"
|
||||
for t_pane in $(tmux list-panes -s -F '#{pane_id}'); do
|
||||
tmux clear-history -t "${t_pane}"
|
||||
done
|
||||
unset t_pane
|
||||
}
|
||||
}
|
||||
## }}}
|
||||
@ -149,34 +154,206 @@ then
|
||||
# shellcheck disable=SC2139,SC2140
|
||||
alias "g${key}"="git ${key}"
|
||||
done
|
||||
unset g_alias
|
||||
unset key g_alias
|
||||
fi
|
||||
## }}}
|
||||
## }}}
|
||||
## {{{ Prompt
|
||||
## Set ability to color terminal.
|
||||
# shellcheck disable=2034
|
||||
case "${TERM-}" in
|
||||
iterm|*-truecolor)
|
||||
export COLORTERM=truecolor; color_prompt=yes
|
||||
;;
|
||||
*-color|*-256color|linux*)
|
||||
color_prompt=yes
|
||||
;;
|
||||
""|dumb|vt100*|vt220*)
|
||||
color_prompt=no
|
||||
;;
|
||||
*)
|
||||
color_prompt=no
|
||||
;;
|
||||
# shellcheck disable=SC2034
|
||||
_get_term_cap(){
|
||||
## SGR
|
||||
_t_colors="$(tput colors)" 2>/dev/null || true
|
||||
_t_sgr0="$(tput sgr0)" 2>/dev/null || true
|
||||
_t_bold="$(tput bold)" 2>/dev/null || true
|
||||
_t_dim="$(tput dim)" 2>/dev/null || true
|
||||
_t_sitm="$(tput sitm)" 2>/dev/null || true
|
||||
_t_smul="$(tput smul)" 2>/dev/null || true
|
||||
_t_blink="$(tput blink)" 2>/dev/null || true
|
||||
_t_rev="$(tput rev)" 2>/dev/null || true
|
||||
_t_smso="$(tput rmso)" 2>/dev/null || true
|
||||
_t_invis="$(tput invis)" 2>/dev/null || true
|
||||
_t_ritm="$(tput ritm)" 2>/dev/null || true
|
||||
_t_rmul="$(tput rmul)" 2>/dev/null || true
|
||||
_t_rmso="$(tput rmso)" 2>/dev/null || true
|
||||
_t_setaf_0="$(tput setaf 0)" 2>/dev/null || true
|
||||
_t_setaf_1="$(tput setaf 1)" 2>/dev/null || true
|
||||
_t_setaf_2="$(tput setaf 2)" 2>/dev/null || true
|
||||
_t_setaf_3="$(tput setaf 3)" 2>/dev/null || true
|
||||
_t_setaf_4="$(tput setaf 4)" 2>/dev/null || true
|
||||
_t_setaf_5="$(tput setaf 5)" 2>/dev/null || true
|
||||
_t_setaf_6="$(tput setaf 6)" 2>/dev/null || true
|
||||
_t_setaf_7="$(tput setaf 7)" 2>/dev/null || true
|
||||
_t_setab_0="$(tput setab 0)" 2>/dev/null || true
|
||||
_t_setab_1="$(tput setab 1)" 2>/dev/null || true
|
||||
_t_setab_2="$(tput setab 2)" 2>/dev/null || true
|
||||
_t_setab_3="$(tput setab 3)" 2>/dev/null || true
|
||||
_t_setab_4="$(tput setab 4)" 2>/dev/null || true
|
||||
_t_setab_5="$(tput setab 5)" 2>/dev/null || true
|
||||
_t_setab_6="$(tput setab 6)" 2>/dev/null || true
|
||||
_t_setab_7="$(tput setab 7)" 2>/dev/null || true
|
||||
## Movement
|
||||
_t_ed="$(tput ed)" 2>/dev/null || true
|
||||
_t_el="$(tput el)" 2>/dev/null || true
|
||||
_t_home="$(tput home)" 2>/dev/null || true
|
||||
_t_cnorm="$(tput cnorm)" 2>/dev/null || true
|
||||
_t_civis="$(tput civis)" 2>/dev/null || true
|
||||
_t_smcup="$(tput smcup)" 2>/dev/null || true
|
||||
_t_rmcup="$(tput rmcup)" 2>/dev/null || true
|
||||
_t_sc="$(tput sc)" 2>/dev/null || true
|
||||
_t_clear="$(tput clear)" 2>/dev/null || true
|
||||
## Extra
|
||||
_t_cub1="$(tput cub1)" 2>/dev/null || true
|
||||
_t_cud1="$(tput cud1)" 2>/dev/null || true
|
||||
_t_ind="$(tput ind)" 2>/dev/null || true
|
||||
_t_cr="$(tput cr)" 2>/dev/null || true
|
||||
_t_u7="$(tput u7)" 2>/dev/null || true
|
||||
_t_u8="$(tput u8)" 2>/dev/null || true
|
||||
_t_u9="$(tput u9)" 2>/dev/null || true
|
||||
}
|
||||
|
||||
_get_color_support(){
|
||||
if test -n "${NO_COLOR-}"; then
|
||||
color_support=-1
|
||||
return 0
|
||||
fi
|
||||
case "${COLORTERM-}" in
|
||||
truecolor|24bit)
|
||||
color_support=$((1 << 24))
|
||||
return 0
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
if has tput; then
|
||||
if tput RGB >/dev/null 2>&1; then
|
||||
color_support=$((1 << 24))
|
||||
return 0
|
||||
fi
|
||||
color_support=${_t_colors}
|
||||
if test -n "${color_support}"; then
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
## Color query from terminfo is relatively new, only available in ncurses
|
||||
## since 2018. Below is a match based on terminfo revision 1.909 to query
|
||||
## number of supported colors in case the terminfo database can't be
|
||||
## queried.
|
||||
case "${TERM-}" in
|
||||
*?-truecolor*|*?-direct*)
|
||||
## TODO: Some terminals such as iTerm should be in this list.
|
||||
color_support=$((1 << 24))
|
||||
;;
|
||||
*?-256color*|absolute|alacritty|Apple_Terminal|domterm|iterm|iterm2|\
|
||||
iTerm2.app|iTerm.app|kitty|mintty|ms-terminal|nsterm|nsterm-build309|\
|
||||
nsterm-build326|nsterm-build343|nsterm-build361|nsterm-build400|\
|
||||
nsterm-build440|scrt|securecrt|terminator|terminology|terminology-0.6.1|\
|
||||
terminology-1.0.0|terminology-1.8.1|termite|vscode|xterm+256setaf|\
|
||||
xterm.js)
|
||||
color_support=256
|
||||
;;
|
||||
*?-88color*|rxvt-unicode)
|
||||
color_support=88
|
||||
;;
|
||||
hpterm-color|wy370|wy370-101k|wy370-105k|wy370-EPC|wy370-nk|wy370-rv|\
|
||||
wy370-vb|wy370-w|wy370-wvb|wyse370)
|
||||
color_support=64
|
||||
;;
|
||||
d430c-dg-ccc|d430c-unix-25-ccc|d430c-unix-ccc|d430c-unix-s-ccc|\
|
||||
d430c-unix-sr-ccc|d430c-unix-w-ccc|d430-dg-ccc|d430-unix-25-ccc|\
|
||||
d430-unix-ccc|d430-unix-s-ccc|d430-unix-sr-ccc|d430-unix-w-ccc|dg+ccc|\
|
||||
dgunix+ccc)
|
||||
color_support=52
|
||||
;;
|
||||
*?-16color*|amiga-vnc|atari-color|atari_st-color|at-color|d430c-dg|\
|
||||
d430c-unix|d430c-unix-25|d430c-unix-s|d430c-unix-sr|d430c-unix-w|d430-dg|\
|
||||
d430-unix|d430-unix-25|d430-unix-s|d430-unix-sr|d430-unix-w|d470|d470-7b|\
|
||||
d470c|d470c-7b|d470c-dg|d470-dg|dg+color|dg+fixed|dgmode+color|\
|
||||
dgunix+fixed|hp2397|hp2397a|hp+color|ncr260wy325pp|ncr260wy325wpp|\
|
||||
ncr260wy350pp|ncr260wy350wpp|nsterm-7-c|nsterm-7-c-s|nsterm-acs-c|\
|
||||
nsterm-acs-c-s|nsterm-bce|nsterm+c|nsterm-c|nsterm-c-7|nsterm-c-acs|\
|
||||
nsterm-c-s|nsterm-c-s-7|nsterm-c-s-acs|st52-color|tt52|tw52|\
|
||||
tw52-color)
|
||||
color_support=16
|
||||
;;
|
||||
*?-color*|color_xterm|386at|aixterm|alacritty+common|ansi|ansi80x25|\
|
||||
ansi80x25-raw|ansi80x30|ansi80x43|ansi80x50|ansi80x60|ansi-emx|ansil|\
|
||||
ansis|ansi.sys|ansi.sysk|ansisysk|ansi.sys-old|ansiw|arm100|arm100-am|\
|
||||
arm100-w|arm100-wam|at386|aterm|att6386|beterm|bsdos-pc|bsdos-pc-nobold|\
|
||||
bsdos-ppc|bterm|cons25|cons25-debian|cons25-iso8859|cons25-koi8-r|\
|
||||
cons25l1|cons25r|cons25w|cons30|cons43|cons50|cons50-iso8859|\
|
||||
cons50-koi8r|cons50l1|cons50r|cons60|cons60-iso|cons60-koi8r|cons60l1|\
|
||||
cons60r|crt|crt-vt220|ctrm|cx|cx100|cygwin|cygwinB19|cygwinDBG|d220|\
|
||||
d220-7b|d220-dg|d230|d230c|d230c-dg|d230-dg|darwin|darwin-100x37|\
|
||||
darwin-112x37|darwin-128x40|darwin-128x48|darwin-144x48|darwin-160x64|\
|
||||
darwin-200x64|darwin-200x75|darwin-256x96|darwin-80x25|darwin-80x30|\
|
||||
darwin-90x30|darwin-b|darwin-f|darwin-f2|decansi|djgpp|djgpp204|dtterm|\
|
||||
dumb-emacs-ansi|dvtm|emots|emx-base|Eterm|gnome|gnome-2007|gnome-2008|\
|
||||
gnome-2012|gnome-fc5|gnome-rh62|gnome-rh72|gnome-rh80|gnome-rh90|gs6300|\
|
||||
hft|hft-c|hft-c-old|hft-old|hterm|hurd|i3164|ibm3164|ibm5081|ibm5154|\
|
||||
ibm6154|ibm8503|ibm8507|ibm8512|ibm8513|ibm8514|ibm8604|ibmpc3|ibmpc3r|\
|
||||
interix|interix-nti|jaixterm|jfbterm|kon|kon2|konsole|konsole-base|\
|
||||
konsole-linux|konsole-solaris|konsole-vt100|konsole-vt420pc|konsole-xf3x|\
|
||||
konsole-xf4x|kterm|kterm-co|kvt|linux|linux2.2|linux2.6|linux2.6.26|\
|
||||
linux3.0|linux-basic|linux-c|linux-c-nc|linux-koi8|linux-koi8r|linux-lat|\
|
||||
linux-m1|linux-nic|linux-s|linux-vt|mgt|mgterm|minitel1|minitel1b|minix|\
|
||||
minix-3.0|mintty+common|mlterm|mlterm2|mlterm3|mosh|mrxvt|ms-vt100+|\
|
||||
ms-vt-utf8|mvterm|nansi.sys|nansisys|nansi.sysk|nansisysk|ncr260intan|\
|
||||
ncr260intpp|ncr260intwan|ncr260intwpp|ncsa|ncsa-ns|ncsa-vt220|netbsd6|\
|
||||
nsterm-7|nsterm-7-s|nsterm-acs|nsterm-acs-s|nsterm+c41|nsterm-old|\
|
||||
nsterm-s|nsterm-s-7|nsterm-s-acs|ntconsole|ntconsole-100|\
|
||||
ntconsole-100-nti|ntconsole-25|ntconsole-25-nti|ntconsole-25-w|\
|
||||
ntconsole-25-w-vt|ntconsole-35|ntconsole-35-nti|ntconsole-35-w|\
|
||||
ntconsole-50|ntconsole-50-nti|ntconsole-50-w|ntconsole-60|\
|
||||
ntconsole-60-nti|ntconsole-60-w|ntconsole-w|ntconsole-w-vt|nxterm|old-st|\
|
||||
opennt|opennt-100|opennt-100-nti|opennt-25|opennt-25-nti|opennt-25-w|\
|
||||
opennt-25-w-vt|opennt-35|opennt-35-nti|opennt-35-w|opennt-50|\
|
||||
opennt-50-nti|opennt-50-w|opennt-60|opennt-60-nti|opennt-60-w|opennt-nti|\
|
||||
opennt-w|opennt-w-vt|pc3|pc3-bold|pc3r|pcansi|pcansi-25|pcansi25|\
|
||||
pcansi-33|pcansi33|pcansi-43|pcansi43|pccon|pccon0|pc-minix|putty|\
|
||||
putty-m1|putty-noapp|putty-sco|putty-screen|putty-vt100|qansi|qansi-g|\
|
||||
qansi-m|qansi-t|qansi-w|qnx|qnx4|qnxm|qnxt|qnxt2|qnxt4|qnxw|rxvt|\
|
||||
rxvt-cygwin|rxvt-cygwin-native|rxvt-xpm|scoansi|scoansi-new|scoansi-old|\
|
||||
screen|screen4|screen5|screen-base|screen-bce|screen-bce.Eterm|\
|
||||
screen-bce.gnome|screen-bce.konsole|screen-bce.linux|screen-bce.mrxvt|\
|
||||
screen-bce.rxvt|screen-bce.xterm-new|screen.Eterm|screen.gnome|\
|
||||
screen.konsole|screen.linux|screen.linux-m1|screen.linux-s|\
|
||||
screen.minitel1|screen.minitel1b|screen.mlterm|screen.mrxvt|screen.putty|\
|
||||
screen.putty-m1|screen.rxvt|screen-s|screen.teraterm|screen.vte|screen-w|\
|
||||
screen.xterm-new|screen.xterm-xfree86|simpleterm|st|st-0.6|st-0.7|st-0.8|\
|
||||
stterm|tek4205|teken|teken-2018|teken-2022|teken-sc|teken-vt|teraterm|\
|
||||
teraterm2.3|teraterm4.59|teraterm4.97|ti928|ti928-8|ti_ansi|tmux|tw100|\
|
||||
uwin|vt100+|vte|vte-2007|vte-2008|vte-2012|vte-2014|vte-2017|vte-2018|\
|
||||
vtnt|vt-utf8|vv100|vwmterm|wsvt25|wsvt25m|wy350|wy350-vb|wy350-w|\
|
||||
wy350-wvb|wyse350|wyse350-vb|wyse350-w|wyse350-wvb|xfce|xiterm|xnuppc|\
|
||||
xnuppc-100x37|xnuppc-112x37|xnuppc-128x40|xnuppc-128x48|xnuppc-144x48|\
|
||||
xnuppc-160x64|xnuppc-200x64|xnuppc-200x75|xnuppc-256x96|xnuppc-80x25|\
|
||||
xnuppc-80x30|xnuppc-90x30|xnuppc-b|xnuppc+c|xnuppc-f|xnuppc-f2|xterm|\
|
||||
xterm1|xterm-1002|xterm-1003|xterm-1005|xterm-1006|xterm-8bit|\
|
||||
xterm-basic|xtermc|xterm-debian|xterm-hp|xterm-new|xterm-nic|xterm-noapp|\
|
||||
xterm+nofkeys|xterm-p370|xterm-p371|xterm-sco|xterms-sun|xterm-sun|\
|
||||
xterm-utf8|xterm-vt220|xterm-x10mouse|xterm-x11hilite|xterm-x11mouse|\
|
||||
xterm-xf86-v32|xterm-xf86-v33|xterm-xf86-v333|xterm-xf86-v40|\
|
||||
xterm-xf86-v43|xterm-xf86-v44|xterm-xfree86|xterm-xi|xwsh)
|
||||
color_support=8
|
||||
;;
|
||||
*)
|
||||
color_support=-1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
_get_term_cap
|
||||
_get_color_support
|
||||
case "${color_support}" in
|
||||
$((1 << 24))) export COLORTERM=truecolor; color_prompt=yes;;
|
||||
[1-9]*) color_prompt=yes;;
|
||||
*) color_prompt=no;;
|
||||
esac
|
||||
|
||||
## Colorise "ls" output.
|
||||
if test "${color_prompt-}" = "yes"; then
|
||||
if has dircolors; then
|
||||
## Use dircolors if available.
|
||||
if test -r "${XDG_CONFIG_HOME}/dircolors/dircolors"; then
|
||||
dircolors="$(dircolors -b "${XDG_CONFIG_HOME}/dircolors/dircolors")"
|
||||
dircolors="$(dircolors -b -- "${XDG_CONFIG_HOME}/dircolors/dircolors")"
|
||||
eval "${dircolors}"
|
||||
else
|
||||
dircolors="$(dircolors -b)"
|
||||
@ -186,7 +363,8 @@ if test "${color_prompt-}" = "yes"; then
|
||||
## Fix bold on some terminals.
|
||||
case "${TERM-}" in
|
||||
xterm*|screen*)
|
||||
LS_COLORS="$(printf '%s\n' "${LS_COLORS}" | sed -e 's/01;3/00;9/g')"
|
||||
LS_COLORS="$(printf '%s' "${LS_COLORS}" |
|
||||
sed -e 's/01;3\([0-9]\)/00;9\1/g')"
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
@ -197,22 +375,21 @@ if test "${color_prompt-}" = "yes"; then
|
||||
export CLICOLOR CLICOLOR_FORCE LSCOLORS
|
||||
fi
|
||||
|
||||
## Set gcc colors.
|
||||
GCC_COLORS="error=00;31:warning=01;35:note=01;36:caret=01;32:locus=01"
|
||||
GCC_COLORS="${GCC_COLORS}:quote=01"
|
||||
export GCC_COLORS
|
||||
|
||||
## Colors for programs that uses less such as 'man'.
|
||||
## Colors for programs that uses 'less' such as 'man'.
|
||||
GROFF_NO_SGR=1
|
||||
LESS_TERMCAP_mb="$(tput bold; tput setaf 2)" # begin blink
|
||||
LESS_TERMCAP_md="$(tput bold; tput setaf 6)" # begin bold
|
||||
LESS_TERMCAP_me="$(tput sgr0)" # reset bold/blink
|
||||
LESS_TERMCAP_so="$(tput bold; tput setaf 7; tput setab 4)" # begin rev video
|
||||
LESS_TERMCAP_se="$(tput rmso; tput sgr0)" # reset rev video
|
||||
LESS_TERMCAP_us="$(tput smul; tput bold; tput setaf 2)" # begin underline
|
||||
LESS_TERMCAP_ue="$(tput rmul; tput sgr0)" # reset underline
|
||||
LESS_TERMCAP_mr="$(tput rev)" # revert
|
||||
LESS_TERMCAP_mh="$(tput dim)" # dimerize
|
||||
LESS_TERMCAP_mb="${_t_bold}${_t_setaf_2}"
|
||||
LESS_TERMCAP_md="${_t_bold}${_t_setaf_6}"
|
||||
LESS_TERMCAP_me="${_t_sgr0}"
|
||||
LESS_TERMCAP_so="${_t_bold}${_t_setaf_7}${_t_setab_4}"
|
||||
LESS_TERMCAP_se="${_t_rmso}${_t_sgr0}"
|
||||
LESS_TERMCAP_us="${_t_smul}${_t_bold}${_t_setaf_2}"
|
||||
LESS_TERMCAP_ue="${_t_rmul}${_t_sgr0}"
|
||||
LESS_TERMCAP_mr="${_t_rev}"
|
||||
LESS_TERMCAP_mh="${_t_dim}"
|
||||
export GROFF_NO_SGR
|
||||
export LESS_TERMCAP_mb LESS_TERMCAP_md LESS_TERMCAP_me
|
||||
export LESS_TERMCAP_so LESS_TERMCAP_se LESS_TERMCAP_us
|
||||
@ -223,9 +400,10 @@ fi
|
||||
_get_prompt_time(){
|
||||
test -n "${SECONDS:-}" || return
|
||||
# shellcheck disable=SC2154
|
||||
_ptime="$((SECONDS-_saved_prompt_time))"
|
||||
ptime="$((SECONDS-_saved_prompt_time))"
|
||||
printf '%02d:%02d:%02d' \
|
||||
"$((_ptime/3600))" "$(((_ptime%3600)/60))" "$((_ptime%60))"
|
||||
"$((ptime/3600))" "$(((ptime%3600)/60))" "$((ptime%60))"
|
||||
unset ptime
|
||||
}
|
||||
|
||||
_git_prompt_info(){
|
||||
@ -239,46 +417,46 @@ _git_prompt_info(){
|
||||
ref="$(git describe --tags --exact-match HEAD 2>/dev/null)"
|
||||
test "${ref-}" || ref="$(git rev-parse HEAD 2>/dev/null | cut -c 1-7)"
|
||||
test "${ref-}" || return
|
||||
# shellcheck disable=2039,3003
|
||||
case "${TERM-}" in
|
||||
*-256color|xterm-kitty) branchcolor=$'\e[38;5;31m' ;;
|
||||
*-88color|rxvt-unicode) branchcolor=$'\e[38;5;22m' ;;
|
||||
*) branchcolor=$'\e[00;94m' ;;
|
||||
case "${color_support-}" in
|
||||
256|$((1 << 24))) branchcolor="$(printf '%b' "\033[38;5;31m")";;
|
||||
88) branchcolor="$(printf '%b' "\033[38;5;22m")";;
|
||||
[1-9]*) branchcolor="${_t_bold}${_t_setaf_4}";;
|
||||
*) branchcolor="";;
|
||||
esac
|
||||
if test -n "${ZSH_VERSION-}"; then
|
||||
# shellcheck disable=2016
|
||||
if test "${color_prompt}" = "yes"; then
|
||||
print -Pn '(%%{${branchcolor}%%}%20>...>${ref}%<<%%{\e[00m%%})'
|
||||
if test "${color_prompt-}" = "yes"; then
|
||||
print -Pn '(%%{${branchcolor}%%}%20>...>${ref}%<<%%{${_t_sgr0}%%})'
|
||||
else
|
||||
print -Pn '(%20>...>${ref}%<<)'
|
||||
fi
|
||||
else
|
||||
if test "${color_prompt}" = "yes"; then
|
||||
printf '%s' "(${branchcolor}${ref}${reset_color})"
|
||||
if test "${color_prompt-}" = "yes"; then
|
||||
printf '%s' "(${branchcolor}${ref}${_t_sgr0})"
|
||||
else
|
||||
printf '%s' "(${ref})"
|
||||
fi
|
||||
fi
|
||||
unset ref
|
||||
unset ref branchcolor
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
reset_color="$(printf '%b' '\e[00m')"
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
## Use echotc Co? Only available by default for zsh, not bash.
|
||||
case "${TERM-}" in
|
||||
*-256color|xterm-kitty)
|
||||
usercolor="$(printf '%b' "\e[38;5;184m")"
|
||||
dircolor="$(printf '%b' "\e[38;5;27m")"
|
||||
case "${color_support-}" in
|
||||
256|$((1 << 24)))
|
||||
usercolor="$(printf '%b' "\033[38;5;184m")"
|
||||
dircolor="$(printf '%b' "\033[38;5;27m")"
|
||||
;;
|
||||
*-88color|rxvt-unicode)
|
||||
usercolor="$(printf '%b' "\e[38;5;56m")"
|
||||
dircolor="$(printf '%b' "\e[38;5;23m")"
|
||||
88)
|
||||
usercolor="$(printf '%b' "\033[38;5;56m")"
|
||||
dircolor="$(printf '%b' "\033[38;5;23m")"
|
||||
;;
|
||||
[1-9]*)
|
||||
usercolor="${_t_bold}${_t_setaf_3}"
|
||||
dircolor="${_t_bold}${_t_setaf_4}"
|
||||
;;
|
||||
*)
|
||||
usercolor="$(printf '%b' "\e[00;93m")"
|
||||
dircolor="$(printf '%b' "\e[01;34m")"
|
||||
usercolor=""
|
||||
dircolor=""
|
||||
;;
|
||||
esac
|
||||
|
||||
@ -290,19 +468,19 @@ esac
|
||||
# shellcheck disable=SC2034
|
||||
uid="$(id -u)"
|
||||
if test "${uid}" = "0"; then
|
||||
usercolor="$(printf '%b' "\e[00;97m")"
|
||||
usercolor="${_t_bold}${_t_setaf_7}"
|
||||
ps1_symbol="#"
|
||||
fi
|
||||
unset uid
|
||||
|
||||
## Do not colorize this prompt, Sh fails to count the correct number of
|
||||
## characters on the prompt leading to problems.
|
||||
user="$(id -un)"
|
||||
if test "${color_prompt-}" = "yes"; then
|
||||
PS1="[${usercolor}${user} $(hostname -s)${reset_color}]${ps1_symbol} "
|
||||
PS1="[${usercolor}${user} $(hostname -s)${_t_sgr0}]${ps1_symbol} "
|
||||
else
|
||||
PS1="${user}@$(hostname -s)${ps1_symbol} "
|
||||
fi
|
||||
|
||||
unset user uid
|
||||
## }}}
|
||||
## {{{ External Functions
|
||||
|
||||
@ -313,6 +491,7 @@ source_readable(){
|
||||
# shellcheck disable=SC1090
|
||||
! test -r "${_file}" || . "${_file}"
|
||||
done
|
||||
unset _file
|
||||
}
|
||||
|
||||
_fzf_comprun() {
|
||||
@ -338,6 +517,7 @@ _fzf_comprun() {
|
||||
fzf --preview 'test -d {} || cat -- {}' "${@}"
|
||||
;;
|
||||
esac
|
||||
unset _fzf_command
|
||||
}
|
||||
|
||||
alias l='ls -al'
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
## SPDX-FileCopyrightText: 2004 - 2022 Tim Pope <https://tpo.pe>
|
||||
## SPDX-FileCopyrightText: 2023 - 2024 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
## SPDX-FileCopyrightText: 2023 - 2025 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
##
|
||||
## SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
@ -20,6 +20,7 @@ source "$HOME/.zprofile"
|
||||
source "$ENV"
|
||||
## }}}
|
||||
## {{{ Options
|
||||
PROMPT_EOL_MARK='%b%B%S%#%s%b'
|
||||
## - Quiet
|
||||
setopt no_beep
|
||||
## - Words
|
||||
@ -74,10 +75,10 @@ if test "${color_prompt-}" = "yes"; then
|
||||
[[ "${COLORTERM-}" == (24bit|truecolor) ||
|
||||
"${terminfo[colors]}" -eq '16777216' ]] || zmodload zsh/nearcolor
|
||||
|
||||
PS1="\$(resize-terminal)%F{magenta}[%{$usercolor%}%n@%m%F{reset_color%}"
|
||||
PS1="\$(resize-terminal)%F{magenta}[%{${usercolor}%}%n@%m%F{reset_color%}"
|
||||
PS1="${PS1} %{$dircolor%}%50<...<%~%<<%F{reset_color%}\$(_git_prompt_info)"
|
||||
PS1="${PS1}%F{magenta}]%F{reset_color}${newline-}${ps1_symbol} "
|
||||
RPS1="%(?..(%{"$'\e[31m'"%}%?%{$reset_color%}%)%<<)"
|
||||
RPS1="%(?..(%F{red%}%?%F{reset_color%}%)%<<)"
|
||||
else
|
||||
PS1="\$(resize-terminal)[%n@%M %~\$(_git_prompt_info)]${newline}"
|
||||
PS1="${PS1}${ps1_symbol} "
|
||||
@ -90,8 +91,8 @@ _set_title() {
|
||||
*install*)
|
||||
hash -r ;;
|
||||
esac
|
||||
print -Pn '\e]1;%l@%m${1+*}\a'
|
||||
print -Pn '\e]2;%n@%m:%~'
|
||||
print -Pn '\033]1;%l@%m${1+*}\a'
|
||||
print -Pn '\033]2;%n@%m:%~'
|
||||
if test -n "${1:-}"; then
|
||||
print -Pnr ' (%24>..>$1%>>)' | tr '\0-\037' '?'
|
||||
fi
|
||||
@ -99,29 +100,28 @@ _set_title() {
|
||||
}
|
||||
|
||||
case "${TERM-}" in
|
||||
screen*)
|
||||
screen*|tmux*)
|
||||
precmd() {
|
||||
_set_title "$@"
|
||||
if [ "${STY:-}" -o "${TMUX:-}" ]; then
|
||||
# print -Pn "\e]1;\a\e]1;@%m\a"
|
||||
print -Pn '\ek@\e\\'
|
||||
print -Pn '\033k@\033\\'
|
||||
else
|
||||
print -Pn '\ek@%m\e\\'
|
||||
print -Pn '\033k@%m\033\\'
|
||||
fi
|
||||
}
|
||||
preexec() {
|
||||
_set_title "$@"
|
||||
print -n "\ek"
|
||||
print -Pnr '%10>..>$1' | tr '\0-\037' '?'
|
||||
if [ "${STY:-}" -o "${TMUX:-}" ]; then
|
||||
print -Pn '@\e\\'
|
||||
else
|
||||
print -Pn '@%m\e\\'
|
||||
fi
|
||||
return 0
|
||||
#print -Pnr '%10>..>$1' | tr '\0-\037' '?'
|
||||
#if [ "${STY:-}" -o "${TMUX:-}" ]; then
|
||||
# print -Pn '\033k@\033\\'
|
||||
#else
|
||||
# print -Pn '\033k@%m\033\\'
|
||||
#fi
|
||||
}
|
||||
;;
|
||||
|
||||
xterm*|rxvt*|Eterm*|kterm*|putty*|dtterm*|ansi*|cygwin*)
|
||||
*?-direct*|xterm*|rxvt*|Eterm*|kterm*|putty*|dtterm*|ansi*|cygwin*)
|
||||
precmd () { _set_title "$@" }
|
||||
preexec() { _set_title "$@" }
|
||||
;;
|
||||
@ -134,8 +134,8 @@ case "${TERM-}" in
|
||||
;;
|
||||
esac
|
||||
|
||||
unset hostcolor hostletter hostcode dircolor usercolor usercode reset_color
|
||||
unset newline
|
||||
unset hostcolor hostletter hostcode dircolor usercolor usercode newline \
|
||||
ps1_symbol
|
||||
## }}}
|
||||
## {{{ Completions
|
||||
|
||||
@ -224,9 +224,10 @@ if test "${color_prompt-}" = "yes"; then
|
||||
## Enable auto-suggestions based on the history
|
||||
if test -f /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh; then
|
||||
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=30
|
||||
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=7,bg=8,underline"
|
||||
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="standout"
|
||||
typeset -a ZSH_AUTOSUGGEST_CLEAR_WIDGETS
|
||||
ZSH_AUTOSUGGEST_CLEAR_WIDGETS+=(bracketed-paste)
|
||||
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
|
||||
ZSH_AUTOSUGGEST_CLEAR_WIDGETS+=(bracketed-paste accept-line)
|
||||
source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||
fi
|
||||
## Highlight commands as you type
|
||||
@ -236,7 +237,6 @@ if test "${color_prompt-}" = "yes"; then
|
||||
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern regexp)
|
||||
typeset -A ZSH_HIGHLIGHT_STYLES
|
||||
ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=red'
|
||||
ZSH_HIGHLIGHT_STYLES[default]='fg=white'
|
||||
ZSH_HIGHLIGHT_STYLES[alias]='fg=cyan'
|
||||
ZSH_HIGHLIGHT_STYLES[function]='fg=cyan'
|
||||
ZSH_HIGHLIGHT_STYLES[builtin]='fg=green'
|
||||
@ -301,10 +301,10 @@ function clear-screen-and-scrollback() {
|
||||
esac
|
||||
test -n "${TTY-}" || return
|
||||
echoti civis >"${TTY-}"
|
||||
printf '%b' "\e[H\e[2J" >"${TTY-}"
|
||||
printf '%b' "\033[H\033[2J" >"${TTY-}"
|
||||
zle .reset-prompt
|
||||
zle -R
|
||||
printf '%b' "\e[3J" >"${TTY-}"
|
||||
printf '%b' "\033[3J" >"${TTY-}"
|
||||
echoti cnorm >"${TTY-}"
|
||||
}
|
||||
zle -N clear-screen-and-scrollback
|
||||
@ -340,9 +340,9 @@ case "${TERM-}" in
|
||||
""|dumb|linux*|vt100*|vt220*) ;;
|
||||
*)
|
||||
zle-keymap-select zle-line-init() {
|
||||
case $KEYMAP in
|
||||
vicmd) print -n -- "\e[2 q";;
|
||||
viins|main) print -n -- "\e[5 q";;
|
||||
case "${KEYMAP:-}" in
|
||||
vicmd) print -n -- "\033[2 q";;
|
||||
viins|main) print -n -- "\033[5 q";;
|
||||
esac
|
||||
|
||||
zle reset-prompt
|
||||
@ -350,7 +350,7 @@ case "${TERM-}" in
|
||||
}
|
||||
|
||||
zle-line-finish() {
|
||||
print -n -- "\e[2 q"
|
||||
print -n -- "\033[2 q"
|
||||
}
|
||||
|
||||
zle -N zle-line-init
|
||||
@ -420,56 +420,56 @@ bindkey -M menuselect "^M" accept-line
|
||||
## https://invisible-island.net/xterm/xterm-function-keys.html
|
||||
##
|
||||
## Shit+Tab
|
||||
bindkey-multi emacs viins menuselect -- "\E[Z" "${terminfo[kcbt]}" \
|
||||
bindkey-multi emacs viins menuselect -- "\033[Z" "${terminfo[kcbt]}" \
|
||||
-- reverse-menu-complete
|
||||
## Backspace
|
||||
bindkey-multi emacs viins vicmd menuselect -- "^H" "^?" "${terminfo[kbs]}" \
|
||||
-- backward-delete-char
|
||||
## Home
|
||||
bindkey-multi emacs viins vicmd -- "\E[1~" "\E[7~" "\E[H" "\EOH" \
|
||||
bindkey-multi emacs viins vicmd -- "\033[1~" "\033[7~" "\033[H" "\033OH" \
|
||||
"${terminfo[khome]}" \
|
||||
-- beginning-of-line
|
||||
## Insert
|
||||
bindkey-multi emacs viins vicmd -- "\E[2~" "\E[L" "${terminfo[kich1]}" \
|
||||
bindkey-multi emacs viins vicmd -- "\033[2~" "\033[L" "${terminfo[kich1]}" \
|
||||
-- overwrite-mode
|
||||
## Delete
|
||||
bindkey-multi emacs viins vicmd -- "\E[3~" "\E[P" "\EOP" \
|
||||
bindkey-multi emacs viins vicmd -- "\033[3~" "\033[P" "\033OP" \
|
||||
"${terminfo[kdch1]}" \
|
||||
-- vi-delete-char
|
||||
## End
|
||||
bindkey-multi emacs viins vicmd -- "\E[4~" "\E[8~" "\E[F" "\EOF" \
|
||||
bindkey-multi emacs viins vicmd -- "\033[4~" "\033[8~" "\033[F" "\033OF" \
|
||||
"${terminfo[kend]}" \
|
||||
-- end-of-line
|
||||
## PgUp
|
||||
bindkey-multi emacs viins -- "\E[5~" "\E[I" "${terminfo[kpp]}" \
|
||||
bindkey-multi emacs viins -- "\033[5~" "\033[I" "${terminfo[kpp]}" \
|
||||
-- beginning-of-buffer-or-history
|
||||
## PgDown
|
||||
bindkey-multi emacs viins -- "\E[6~" "\E[G" "${terminfo[knp]}" \
|
||||
bindkey-multi emacs viins -- "\033[6~" "\033[G" "${terminfo[knp]}" \
|
||||
-- end-of-buffer-or-history
|
||||
## Up arrow
|
||||
bindkey-multi emacs viins vicmd -- "\E[A" "\EOA" "${terminfo[kcuu1]}" \
|
||||
bindkey-multi emacs viins vicmd -- "\033[A" "\033OA" "${terminfo[kcuu1]}" \
|
||||
-- up-line-or-history
|
||||
## Down arrow
|
||||
bindkey-multi emacs viins vicmd -- "\E[B" "\EOB" "${terminfo[kcud1]}" \
|
||||
bindkey-multi emacs viins vicmd -- "\033[B" "\033OB" "${terminfo[kcud1]}" \
|
||||
-- down-line-or-history
|
||||
## Right arrow
|
||||
bindkey-multi emacs viins vicmd -- "\E[1C" "\E[C" "\EOC" \
|
||||
bindkey-multi emacs viins vicmd -- "\033[1C" "\033[C" "\033OC" \
|
||||
"${terminfo[kcuf1]}" \
|
||||
-- forward-char
|
||||
## Left arrow
|
||||
bindkey-multi emacs viins vicmd -- "\E[D" "\EOD" "${terminfo[kcub1]}" \
|
||||
bindkey-multi emacs viins vicmd -- "\033[D" "\033OD" "${terminfo[kcub1]}" \
|
||||
-- backward-char
|
||||
## Ctrl-Delete
|
||||
bindkey-multi emacs viins vicmd -- "\E[3;5~" "\E[3\^" "${terminfo[kDC5]}" \
|
||||
bindkey-multi emacs viins vicmd -- "\033[3;5~" "\033[3\^" "${terminfo[kDC5]}" \
|
||||
-- kill-word
|
||||
## Ctrl-RightArrow
|
||||
bindkey-multi emacs viins vicmd -- "\E[1;5C" "\E0c" "${terminfo[kRIT5]}" \
|
||||
bindkey-multi emacs viins vicmd -- "\033[1;5C" "\0330c" "${terminfo[kRIT5]}" \
|
||||
-- forward-word
|
||||
## Ctrl-LeftArrow
|
||||
bindkey-multi emacs viins vicmd -- "\E[1;5D" "\E0d" "${terminfo[kLFT5]}" \
|
||||
bindkey-multi emacs viins vicmd -- "\033[1;5D" "\0330d" "${terminfo[kLFT5]}" \
|
||||
-- backward-word
|
||||
## F11
|
||||
bindkey-multi emacs viins -- "\E[23~" "${terminfo[kf11]}" -- new-screen
|
||||
bindkey-multi emacs viins -- "\033[23~" "${terminfo[kf11]}" -- new-screen
|
||||
|
||||
autoload -Uz edit-command-line
|
||||
zle -N edit-command-line
|
||||
@ -477,7 +477,7 @@ bindkey -M emacs "^[e" edit-command-line
|
||||
bindkey -M emacs "^X^E" edit-command-line
|
||||
bindkey -M vicmd "^E" edit-command-line
|
||||
|
||||
bindkey -M emacs "\ea" change-first-word
|
||||
bindkey -M emacs "\033a" change-first-word
|
||||
bindkey -M emacs "^XD" describe-key-briefly
|
||||
|
||||
for binding in ${(f)$(bindkey -M emacs|grep -e '^"\^X')}; do
|
||||
|
||||
@ -29,7 +29,7 @@ for prog in "${@}"; do
|
||||
test -x "${cmd}" || continue
|
||||
|
||||
case "${action-}" in
|
||||
show) printf '%s\n' "${cmd}"; exit 0;;
|
||||
show) printf '%s\n' "${cmd}"; unset cmd; exit 0;;
|
||||
*) exit 0;;
|
||||
esac
|
||||
done
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
## SPDX-FileCopyrightText: 2024 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
## SPDX-FileCopyrightText: 2024 - 2025 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
##
|
||||
## SPDX-License-Identifier: GFDL-1.3-or-later
|
||||
##
|
||||
@ -14,8 +14,10 @@ if test -n "${TERM_RESIZE_DISABLE:-}"; then
|
||||
fi
|
||||
|
||||
test -t 0 || exit 0
|
||||
|
||||
msg_unsupported="error: cannot resize screen: unsupported terminal emulator"
|
||||
case "${TERM-}" in
|
||||
dumb) exit 0;;
|
||||
*);;
|
||||
esac
|
||||
|
||||
## If argument is provided, allow user to bypass tty check.
|
||||
if test "${#}" -eq 0; then
|
||||
@ -46,9 +48,17 @@ if test "${#}" -eq 0; then
|
||||
unset term_file_active
|
||||
fi
|
||||
|
||||
get_caps(){
|
||||
sc="$(tput sc || printf '%b' '\0337')"
|
||||
rc="$(tput rc || printf '%b' '\0338')"
|
||||
cup="$(tput cup 99999 99999 || printf '%b' '\033[99999;99999H')"
|
||||
csr="$(tput csr || printf '%b' '\033[r')"
|
||||
gc="$(tput u7 || printf '%b' '\033[6n')"
|
||||
}
|
||||
|
||||
## POSIX compliant.
|
||||
# shellcheck disable=SC3045
|
||||
if ! printf '%s\n' "R" | read -r -t 1 -sd R 2>/dev/null; then
|
||||
if ! (printf '%s\n' "R" | read -r -t 1 -sd R 2>/dev/null); then
|
||||
## Fast but depends on XTerm.
|
||||
if has resize; then
|
||||
resize_cmd="$(resize)"
|
||||
@ -56,18 +66,21 @@ if ! printf '%s\n' "R" | read -r -t 1 -sd R 2>/dev/null; then
|
||||
exit 0
|
||||
fi
|
||||
## Slow due to heavy stty calls.
|
||||
get_caps
|
||||
termios="$(stty -g)"
|
||||
stty raw -echo min 0 time 1
|
||||
printf '\0337\033[r\033[99999;99999H\033[6n\0338' >/dev/tty
|
||||
printf '%s' "${sc}${csr}${cup}${gc}${rc}" >/dev/tty
|
||||
IFS='[;R' read -r _ rows cols _ </dev/tty
|
||||
stty "${termios}" cols "${cols}" rows "${rows}"
|
||||
unset termios
|
||||
exit 0
|
||||
fi
|
||||
|
||||
msg_unsupported="error: cannot resize screen: unsupported terminal emulator"
|
||||
## Non-POSIX compliant and fast.
|
||||
get_caps
|
||||
stty -echo
|
||||
printf '\e7\e[r\033[99999;99999H\e[6n\e8' >/dev/tty
|
||||
printf '%s' "${sc}${csr}${cup}${gc}${rc}" >/dev/tty
|
||||
# shellcheck disable=3045,SC2034
|
||||
IFS='[;R' read -r -t 1 -s -d R _ rows cols _ </dev/tty || {
|
||||
printf '%s\n' "${msg_unsupported}" >&2
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
## tmux.conf
|
||||
|
||||
## SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
## SPDX-FileCopyrightText: 2023 - 2025 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
##
|
||||
## SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
@ -17,8 +17,13 @@ set-option -g history-limit 10000
|
||||
set-option -g repeat-time 2000
|
||||
set-option -g escape-time 50
|
||||
set-option -g status-position top
|
||||
set-option -g default-terminal screen-256color
|
||||
# set-option -g default-terminal tmux-256color # on newer ncurses
|
||||
run-shell '\
|
||||
colors=$(tput colors) || true 2>/dev/null; \
|
||||
if test "$colors" -lt 256; then \
|
||||
tmux set-option -g default-terminal tmux; \
|
||||
elif test "$colors" -ge 256; then \
|
||||
tmux set-option -g default-terminal tmux-256color; \
|
||||
fi'
|
||||
set-option -g display-panes-time 2000
|
||||
set-option -g display-time 2000
|
||||
set-option -g focus-events on
|
||||
@ -53,7 +58,7 @@ set-option -g status-right-length '40'
|
||||
set-option -g status-right-style 'fg=brightcyan,bg=black'
|
||||
|
||||
## Terminal capabilities and update environment
|
||||
set-option -g terminal-overrides '*256color:Tc,xterm*:XT:Cc=\E]12;%p1%s\007:Cr=\E]112\007:Cs=\E[%p1%d q,rxvt-unicode*:XT:sitm@:ritm@'
|
||||
set-option -g terminal-overrides '*256color:Tc,xterm*:XT:Cc=\033]12;%p1%s\007:Cr=\033]112\007:Cs=\033[%p1%d q,rxvt-unicode*:XT:sitm@:ritm@'
|
||||
set-option -g update-environment "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY XDG_CURRENT_DESKTOP XDG_SESSION_DESKTOP"
|
||||
set-environment -gu DBUS_SESSION_BUS_ADDRESS
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
" SPDX-FileCopyrightText: 2004 - 2022 Tim Pope <https://tpo.pe>
|
||||
" SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
" SPDX-FileCopyrightText: 2023 - 2025 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
"
|
||||
" SPDX-License-Identifier: Vim
|
||||
"
|
||||
@ -556,6 +556,9 @@ if (&t_Co > 2 || has('gui_running')) && has('syntax')
|
||||
endif
|
||||
if has('vim_starting')
|
||||
set list
|
||||
if has('termguicolors') && &t_Co > 256
|
||||
setglobal termguicolors
|
||||
endif
|
||||
if !exists('g:colors_name')
|
||||
colorscheme vividchalk
|
||||
endif
|
||||
|
||||
@ -19,7 +19,9 @@ fi
|
||||
## If running normal OS or Qubes: Dom0, apply settings.
|
||||
# shellcheck disable=3028
|
||||
hostname="${HOSTNAME:-$(hostname)}"
|
||||
if ! command -v qubesdb-read >/dev/null || test "${hostname}" = "dom0"; then
|
||||
if ! command -v qubesdb-read >/dev/null || test "${hostname}" = "dom0" ||
|
||||
test -f /var/run/qubes-service/guivm
|
||||
then
|
||||
## Decrease key repeat delay to X ms.
|
||||
## Increase key repeat rate to Y per second.
|
||||
xset r rate 275 60
|
||||
@ -32,6 +34,7 @@ if ! command -v qubesdb-read >/dev/null || test "${hostname}" = "dom0"; then
|
||||
|
||||
#qvm-prefs dom0 keyboard_layout "us+dvorak+grp:win_space_toggle,ctrl:nocaps"
|
||||
fi
|
||||
unset hostname
|
||||
|
||||
## Autostart desktop applications if the WM does not.
|
||||
desktop_autostart(){
|
||||
@ -45,11 +48,34 @@ desktop_autostart(){
|
||||
|
||||
for f in "${autostart_etc}"/*.desktop "${autostart_home}"/*.desktop; do
|
||||
test -r "${f}" || continue
|
||||
## TODO: check other conditions: (Not|Only)ShowIn
|
||||
# shellcheck disable=SC2091
|
||||
autostart_hidden="$(awk -F '=' -- '/^Hidden=/{print $2}' "${f}")"
|
||||
if test "${autostart_hidden}" = "true"; then
|
||||
continue
|
||||
fi
|
||||
autostart_tryexec="$(awk -F '=' -- '/^TryExec=/{print $2}' "${f}")"
|
||||
if test -n "${autostart_tryexec}"; then
|
||||
case "${autostart_tryexec}" in
|
||||
/*) test -x "${autostart_tryexec}" || continue;;
|
||||
*) command -v "${autostart_tryexec}" >/dev/null || continue;;
|
||||
esac
|
||||
fi
|
||||
autostart_path="$(awk -F '=' -- '/^Path=/{print $2}' "${f}")"
|
||||
autostart_exec="$(awk -F '=' -- '/^Exec=/{print $2}' "${f}")"
|
||||
command -v "${autostart_exec%% *}" >/dev/null || continue
|
||||
case "${autostart_exec}" in
|
||||
/*) test -x "${autostart_exec}" || continue;;
|
||||
*) command -v "${autostart_exec}" >/dev/null || continue;;
|
||||
esac
|
||||
if test -n "${autostart_path}"; then
|
||||
if ! test -d "${autostart_path}"; then
|
||||
continue
|
||||
fi
|
||||
cd "${autostart_path}" || continue
|
||||
fi
|
||||
${autostart_exec} &
|
||||
done
|
||||
unset f autostart_hidden autostart_tryexec autostart_exec autostart_path
|
||||
}
|
||||
|
||||
## Source Xorg profiles.
|
||||
@ -59,6 +85,7 @@ if test -r "${HOME}/.xprofile.local"; then
|
||||
# shellcheck disable=SC1090,SC1091
|
||||
! test -r "${x11_profile}" || . "${x11_profile}"
|
||||
done
|
||||
unset x11_profile
|
||||
fi
|
||||
|
||||
: "${wm_list:="dwm"}"
|
||||
@ -69,6 +96,7 @@ for wm in ${wm_list}; do
|
||||
while true; do
|
||||
xroot_name="$(display-statusbar)"
|
||||
xsetroot -name "${xroot_name}"
|
||||
unset xroot_name
|
||||
sleep 60
|
||||
done &
|
||||
fi
|
||||
@ -76,5 +104,7 @@ for wm in ${wm_list}; do
|
||||
${wm} &
|
||||
wm_pid="${!}"
|
||||
done
|
||||
unset wm
|
||||
|
||||
test -z "${wm_pid:-}" || wait "${wm_pid}"
|
||||
unset wm_pid
|
||||
|
||||
@ -1,15 +1,14 @@
|
||||
! ~/.Xresources
|
||||
|
||||
! vim:set foldmethod=expr foldexpr=getline(v\:lnum)=~'^!##'?'>1'\:'=':
|
||||
! SPDX-FileCopyrightText: 2004 - 2016 Tim Pope <https://tpo.pe>
|
||||
! SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
! SPDX-FileCopyrightText: 2023 - 2025 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
!
|
||||
! SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
!
|
||||
! Credits: https://github.com/tpope/dotfiles/blob/master/.Xresources
|
||||
! vim:set foldmethod=expr foldexpr=getline(v\:lnum)=~'^!##'?'>1'\:'=':
|
||||
|
||||
*international: true
|
||||
*customization: -color
|
||||
*customization: -color
|
||||
|
||||
!## TERMINAL COMMON
|
||||
#ifndef FIXED
|
||||
@ -24,100 +23,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
! http://www.calmar.ws/vim/256-xterm-24bit-rgb-color-chart.html
|
||||
! https://en.wikipedia.org/wiki/X11_color_names
|
||||
! https://upload.wikimedia.org/wikipedia/commons/1/15/Xterm_256color_chart.svg
|
||||
! RGB to HEX https://unix.stackexchange.com/a/269085
|
||||
! https://misc.flogisoft.com/bash/tip_colors_and_formatting
|
||||
! https://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux
|
||||
! https://unix.stackexchange.com/questions/124407/what-color-codes-can-i-use-in-my-bash-ps1-prompt
|
||||
|
||||
! name dark light
|
||||
! black 0 8
|
||||
! red 1 9
|
||||
! green 2 10
|
||||
! yellow 3 11
|
||||
! blue 4 12
|
||||
! purple 5 13
|
||||
! cyan 6 14
|
||||
! white 7 15
|
||||
|
||||
! Tpope colors
|
||||
*color0: #000000
|
||||
*color1: #aa0000
|
||||
*color2: #00aa00
|
||||
*color3: #aa5522
|
||||
*color4: #0000ee
|
||||
*color5: #aa00aa
|
||||
*color6: #00aaaa
|
||||
*color7: #aaaaaa
|
||||
*color8: #555555
|
||||
*color9: #ff4444
|
||||
*color10: #44ff44
|
||||
*color11: #ffff00
|
||||
*color12: #5c5cff
|
||||
*color13: #ff00ff
|
||||
*color14: #00ffff
|
||||
*color15: #ffffff
|
||||
*colorBD: #ffffff
|
||||
|
||||
! *.cursorColor: #ffffff
|
||||
|
||||
! *color0: #000000
|
||||
! *color1: #aa0000
|
||||
! *color2: #00aa00
|
||||
! *color3: #aa5522
|
||||
! *color4: #0000ee
|
||||
! *color5: #aa00aa
|
||||
! *color6: #00aaaa
|
||||
! *color7: #aaaaaa
|
||||
! *color8: #555555
|
||||
! *color9: #ff4444
|
||||
! *color10: #44ff44
|
||||
! *color11: #ffff00
|
||||
! *color12: #5c5cff
|
||||
! *color13: #ff00ff
|
||||
! *color14: #00ffff
|
||||
! *color15: #ffffff
|
||||
! *colorBD: #ffffff
|
||||
|
||||
! ! Black / Grey
|
||||
! *.color0: #000000
|
||||
! ! *.color8: #808080
|
||||
! *.color8: #767676
|
||||
|
||||
! ! Red / Bright Red
|
||||
! *.color1: #800000
|
||||
! *.color9: #FF0000
|
||||
|
||||
! ! Green + Bright Green
|
||||
! ! *.color2: #008000
|
||||
! *.color2: #00af00
|
||||
! *.color10: #00ff00
|
||||
|
||||
! ! Yellow (Orange) + Bright Yellow (Yellow)
|
||||
! *.color3: #808000
|
||||
! *.color11: #ffff00
|
||||
|
||||
! ! Blue + Bright Blue
|
||||
! *.color4: #000080
|
||||
! *.color12: #0000ff
|
||||
|
||||
! ! Magenta (Purple) + Bright Magenta
|
||||
! ! *.color5: #800080
|
||||
! *.color5: #af00d7
|
||||
! *.color13: #0000ff
|
||||
|
||||
! ! Cyan (Aqua) + Bright Cyan
|
||||
! ! *.color6: #800080
|
||||
! *.color6: #008b8b
|
||||
! ! *.color14: #ff00ff
|
||||
! *.color14: #00d7ff
|
||||
|
||||
! ! Light Grey (Selection) + White (Current Line)
|
||||
! *.color7: #c0c0c0
|
||||
! *.color15: #ffffff
|
||||
|
||||
!## [U]XTERM
|
||||
*.selectToClipboard: true
|
||||
*.VT100saveLines: 4096
|
||||
@ -129,16 +34,20 @@
|
||||
*.VT100.background: black
|
||||
*.foreground: white
|
||||
*.VT100.foreground: white
|
||||
*.termName: xterm-256color
|
||||
*.termName: xterm-direct256
|
||||
*.ttyModes: start ^- stop ^-
|
||||
*.boldMode: false
|
||||
*.allowBoldFonts: false
|
||||
*.colorMode: true
|
||||
*.dynamicColors: true
|
||||
*.colorBDMode: false
|
||||
*.colorULMode: false
|
||||
*.underline: false
|
||||
*.VT100.geometry: 80x24
|
||||
*.VT100.scaleHeight: 1.1
|
||||
! For some reason, '*scrollBar' was not working on Fedora.
|
||||
XTerm*.scrollBar: false
|
||||
UXTerm*.scrollBar: false
|
||||
*.colorBDMode: true
|
||||
*.visualBell: false
|
||||
*.eightBitInput: false
|
||||
*.modifyCursorKeys: 2
|
||||
|
||||
@ -1,9 +0,0 @@
|
||||
## SPDX-FileCopyrightText: 2024 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
##
|
||||
## SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
# vim: ft=confini
|
||||
|
||||
FileManager=thunar
|
||||
MailReaders=thunderbid
|
||||
WebBrowser=x-www-browser
|
||||
TerminalEmulator=x-terminal-emulator
|
||||
37
pillar.sls.example
Normal file
37
pillar.sls.example
Normal file
@ -0,0 +1,37 @@
|
||||
{#
|
||||
SPDX-FileCopyrightText: 2024 seven-beep <ebn@entreparentheses.xyz>
|
||||
SPDX-FileCopyrightText: 2025 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
|
||||
SPDX-License-Identifier: CC-BY-SA-4.0
|
||||
|
||||
|
||||
Example of a pillar state structure for https://github.com/ben-grande/dotfiles
|
||||
|
||||
For this file to be active:
|
||||
|
||||
1. Copy the file to the pillar_roots directory without the '.example' suffix;
|
||||
2. Reference this state by a pillar highstate.
|
||||
|
||||
See the README for detailed instructions.
|
||||
|
||||
Each pillar component is optional. Disable a single component by setting them
|
||||
to 'false'. To selectively enable few components, disable 'all' and enable
|
||||
each desired component by setting them to 'true'.
|
||||
|
||||
Entries example: 'dom0' corresponds to 'copy-dom0.sls'.
|
||||
#}
|
||||
|
||||
qusal:
|
||||
dotfiles:
|
||||
all: true
|
||||
dom0: true
|
||||
git: true
|
||||
gtk: true
|
||||
mutt: true
|
||||
net: true
|
||||
pgp: true
|
||||
sh: true
|
||||
ssh: true
|
||||
tmux: true
|
||||
vim: true
|
||||
x11: true
|
||||
20
pillar.top.example
Normal file
20
pillar.top.example
Normal file
@ -0,0 +1,20 @@
|
||||
{#
|
||||
SPDX-FileCopyrightText: 2024 seven-beep <ebn@entreparentheses.xyz>
|
||||
SPDX-FileCopyrightText: 2025 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
||||
|
||||
SPDX-License-Identifier: CC-BY-SA-4.0
|
||||
|
||||
|
||||
Example of a pillar top structure for https://github.com/ben-grande/dotfiles
|
||||
|
||||
For this file to be active:
|
||||
|
||||
1. Copy the file to the pillar_roots directory without the '.example' suffix;
|
||||
2. Enable the pillar highstate.
|
||||
|
||||
See the README for detailed instructions.
|
||||
#}
|
||||
|
||||
base:
|
||||
'*':
|
||||
- qusal.dotfiles
|
||||
Loading…
x
Reference in New Issue
Block a user