This commit is contained in:
Ben Grande 2023-10-30 09:31:16 +00:00
parent 9d3111f1fa
commit f733dbf75f
No known key found for this signature in database
GPG Key ID: 00C64E14F51F9E56
220 changed files with 2520 additions and 7400 deletions

7
.gitignore vendored
View File

@ -1,3 +1,10 @@
# SPDX-FileCopyrightText: 2023 Qusal contributors
#
# SPDX-License-Identifier: CC0-1.0
qusal/qubesos-github-io
qusal/sys-audio
qusal/sys-wireguard
qusal/sys-syncthing
qusal/sys-rsync
qusal/sys-ssh

View File

@ -1,9 +1,18 @@
# SPDX-FileCopyrightText: 2023 Qusal contributors
#
# SPDX-License-Identifier: GPL-3.0-or-later
---
repos:
- repo: local
hooks:
- id: salt-lint
name: salt-lint
entry: scripts/salt-lint.sh
language: script
pass_filenames: false
- repo: local
hooks:
- id: salt-lint
name: salt-lint
entry: scripts/salt-lint.sh
language: script
pass_filenames: false
- id: shellcheck
name: shellcheck
entry: scripts/shell-lint.sh
language: script
pass_filenames: false

12
.pre-commit-hooks.yaml Normal file
View File

@ -0,0 +1,12 @@
# SPDX-FileCopyrightText: 2020 Liferay, Inc. <https://liferay.com>
#
# SPDX-License-Identifier: GPL-3.0-or-later
---
- id: reuse
name: reuse
entry: reuse
args: ["lint"]
language: python
pass_filenames: false
description: "Lint the project for compliance with the REUSE Specification"

View File

@ -3,20 +3,12 @@ Upstream-Name: qusal
Upstream-Contact: Benjamin Grande Miranda de Sousa <ben.grande.b@gmail.com>
Source: https://github.com/ben-grande/qusal
Files: *
Copyright: 2023 Qusal contributors
License: GPL-3.0-or-later
Files: .gitignore .pre-commit-config.yaml .salt-lint README.md minion.d/qusal.conf
Copyright: 2023 Qusal contributors
License: GPL-3.0-or-later
Files: */README.md
Copyright: 2023 Qusal contributors
License: GPL-3.0-or-later
License: CC-BY-SA-4.0
Files: qusal/ansible/files/repo/*
Copyright: 2014 Launchpad PPA for Ansible, Inc. <https://ansible.com>
Copyright: 2014 Ansible, Inc. <https://ansible.com>
License: CC0-1.0
Files: qusal/browser/files/repo/*

View File

@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2023 Qusal contributors
#
# SPDX-License-Identifier: GPL-3.0-or-later
---
skip_list:
- 205 # use '.sls' as a Salt State file extension

75
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,75 @@
<!--
SPDX-FileCopyrightText: 2023 Qusal contributors
SPDX-License-Identifier: CC-BY-SA-4.0
-->
# Contributing to Qusal
## Table of Contents
* [Format](#format)
* [File naming](#file-naming)
* [Readme](#readme)
* [Qube naming](#qube-naming)
* [Qrexec](#qrexec)
## Format
### File naming
1. Every State file `.sls` must have a Top file `.top`. This ensures that
every state can be applied with top.
2. Every project must have a `init.top`, it facilitates applying every state
by enabling a single top file.
3. State file naming should be common between the projects, it helps
understand the project as if it was any other.
5. Files names and state IDs should use `-` as separator, not `_`.
### Readme
1. Every project should have a README.md with at least the following sections:
Table of Contents, Description, Installation, Access Control (if changed
Qrexec policy), Usage.
### Qube naming
1. Qube name format:
- TemplateVM: `tpl-NAME`
- StandaloneVM: `NAME`
- AppVM: `NAME`
- DispVM: `disp-NAME`
- DispVM Template (AppVM): `dvm-NAME`
- Service qubes (not a class): `sys-NAME`
2. Label/Color:
- *Black* (Ultimately trusted): You must trust Dom0, Templates, Vaults,
Management qubes, these qubes control your system and hold valuable
information. Examples: dom0, tpl-ssh, vault, default-mgmt-dvm.
- *Gray* (Fully trusted): Trusted storage with extra RPC services that allow
certain operations to be made by the client and executed on the server or
may build components for other qubes. Examples: sys-cacher, sys-git,
sys-pgp, sys-ssh-agent, qubes-builder.
- *Purple* (Much trust): Has the ability to manager remote servers via
encrypted connections and depend on authorization provided by another qube.
Examples: ansible, dev, ssh, terraform.
- *Blue* (Very trusted): TODO
- *Green* (Trusted): TODO
- *Yellow* (Relatively trusted): TODO
- *Orange* (Slightly trusted): Controls the network flow of data to the
client, normally a firewall. Examples: sys-firewall, sys-vpn, sys-pihole.
- *Red* (Untrusted): Holds untrusted data (PCI devices, untrusted programs,
disposables for opening untrusted files or web pages). Examples: sys-net,
sys-usb, dvm-browser.
### Qrexec
1. Don't use `*` for source and destination, use `@anyvm` instead
2. Target qube for policies must be `@default`. It allows for the real target
to be set by Dom0 via the `target=` redirection parameter, instead of
having to modify the client to target a different server via
`qrexec-client-vm`.
3. Target qube for client script must default to `@default`, but other targets
must be allowed via parameters.

99
LICENSES/CC-BY-SA-3.0.txt Normal file
View File

@ -0,0 +1,99 @@
Creative Commons Attribution-ShareAlike 3.0 Unported
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM ITS USE.
License
THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
1. Definitions
a. "Adaptation" means a work based upon the Work, or upon the Work and other pre-existing works, such as a translation, adaptation, derivative work, arrangement of music or other alterations of a literary or artistic work, or phonogram or performance and includes cinematographic adaptations or any other form in which the Work may be recast, transformed, or adapted including in any form recognizably derived from the original, except that a work that constitutes a Collection will not be considered an Adaptation for the purpose of this License. For the avoidance of doubt, where the Work is a musical work, performance or phonogram, the synchronization of the Work in timed-relation with a moving image ("synching") will be considered an Adaptation for the purpose of this License.
b. "Collection" means a collection of literary or artistic works, such as encyclopedias and anthologies, or performances, phonograms or broadcasts, or other works or subject matter other than works listed in Section 1(f) below, which, by reason of the selection and arrangement of their contents, constitute intellectual creations, in which the Work is included in its entirety in unmodified form along with one or more other contributions, each constituting separate and independent works in themselves, which together are assembled into a collective whole. A work that constitutes a Collection will not be considered an Adaptation (as defined below) for the purposes of this License.
c. "Creative Commons Compatible License" means a license that is listed at http://creativecommons.org/compatiblelicenses that has been approved by Creative Commons as being essentially equivalent to this License, including, at a minimum, because that license: (i) contains terms that have the same purpose, meaning and effect as the License Elements of this License; and, (ii) explicitly permits the relicensing of adaptations of works made available under that license under this License or a Creative Commons jurisdiction license with the same License Elements as this License.
d. "Distribute" means to make available to the public the original and copies of the Work or Adaptation, as appropriate, through sale or other transfer of ownership.
e. "License Elements" means the following high-level license attributes as selected by Licensor and indicated in the title of this License: Attribution, ShareAlike.
f. "Licensor" means the individual, individuals, entity or entities that offer(s) the Work under the terms of this License.
g. "Original Author" means, in the case of a literary or artistic work, the individual, individuals, entity or entities who created the Work or if no individual or entity can be identified, the publisher; and in addition (i) in the case of a performance the actors, singers, musicians, dancers, and other persons who act, sing, deliver, declaim, play in, interpret or otherwise perform literary or artistic works or expressions of folklore; (ii) in the case of a phonogram the producer being the person or legal entity who first fixes the sounds of a performance or other sounds; and, (iii) in the case of broadcasts, the organization that transmits the broadcast.
h. "Work" means the literary and/or artistic work offered under the terms of this License including without limitation any production in the literary, scientific and artistic domain, whatever may be the mode or form of its expression including digital form, such as a book, pamphlet and other writing; a lecture, address, sermon or other work of the same nature; a dramatic or dramatico-musical work; a choreographic work or entertainment in dumb show; a musical composition with or without words; a cinematographic work to which are assimilated works expressed by a process analogous to cinematography; a work of drawing, painting, architecture, sculpture, engraving or lithography; a photographic work to which are assimilated works expressed by a process analogous to photography; a work of applied art; an illustration, map, plan, sketch or three-dimensional work relative to geography, topography, architecture or science; a performance; a broadcast; a phonogram; a compilation of data to the extent it is protected as a copyrightable work; or a work performed by a variety or circus performer to the extent it is not otherwise considered a literary or artistic work.
i. "You" means an individual or entity exercising rights under this License who has not previously violated the terms of this License with respect to the Work, or who has received express permission from the Licensor to exercise rights under this License despite a previous violation.
j. "Publicly Perform" means to perform public recitations of the Work and to communicate to the public those public recitations, by any means or process, including by wire or wireless means or public digital performances; to make available to the public Works in such a way that members of the public may access these Works from a place and at a place individually chosen by them; to perform the Work to the public by any means or process and the communication to the public of the performances of the Work, including by public digital performance; to broadcast and rebroadcast the Work by any means including signs, sounds or images.
k. "Reproduce" means to make copies of the Work by any means including without limitation by sound or visual recordings and the right of fixation and reproducing fixations of the Work, including storage of a protected performance or phonogram in digital form or other electronic medium.
2. Fair Dealing Rights. Nothing in this License is intended to reduce, limit, or restrict any uses free from copyright or rights arising from limitations or exceptions that are provided for in connection with the copyright protection under copyright law or other applicable laws.
3. License Grant. Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below:
a. to Reproduce the Work, to incorporate the Work into one or more Collections, and to Reproduce the Work as incorporated in the Collections;
b. to create and Reproduce Adaptations provided that any such Adaptation, including any translation in any medium, takes reasonable steps to clearly label, demarcate or otherwise identify that changes were made to the original Work. For example, a translation could be marked "The original work was translated from English to Spanish," or a modification could indicate "The original work has been modified.";
c. to Distribute and Publicly Perform the Work including as incorporated in Collections; and,
d. to Distribute and Publicly Perform Adaptations.
e. For the avoidance of doubt:
i. Non-waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme cannot be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License;
ii. Waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme can be waived, the Licensor waives the exclusive right to collect such royalties for any exercise by You of the rights granted under this License; and,
iii. Voluntary License Schemes. The Licensor waives the right to collect royalties, whether individually or, in the event that the Licensor is a member of a collecting society that administers voluntary licensing schemes, via that society, from any exercise by You of the rights granted under this License.
The above rights may be exercised in all media and formats whether now known or hereafter devised. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats. Subject to Section 8(f), all rights not expressly granted by Licensor are hereby reserved.
4. Restrictions. The license granted in Section 3 above is expressly made subject to and limited by the following restrictions:
a. You may Distribute or Publicly Perform the Work only under the terms of this License. You must include a copy of, or the Uniform Resource Identifier (URI) for, this License with every copy of the Work You Distribute or Publicly Perform. You may not offer or impose any terms on the Work that restrict the terms of this License or the ability of the recipient of the Work to exercise the rights granted to that recipient under the terms of the License. You may not sublicense the Work. You must keep intact all notices that refer to this License and to the disclaimer of warranties with every copy of the Work You Distribute or Publicly Perform. When You Distribute or Publicly Perform the Work, You may not impose any effective technological measures on the Work that restrict the ability of a recipient of the Work from You to exercise the rights granted to that recipient under the terms of the License. This Section 4(a) applies to the Work as incorporated in a Collection, but this does not require the Collection apart from the Work itself to be made subject to the terms of this License. If You create a Collection, upon notice from any Licensor You must, to the extent practicable, remove from the Collection any credit as required by Section 4(c), as requested. If You create an Adaptation, upon notice from any Licensor You must, to the extent practicable, remove from the Adaptation any credit as required by Section 4(c), as requested.
b. You may Distribute or Publicly Perform an Adaptation only under the terms of: (i) this License; (ii) a later version of this License with the same License Elements as this License; (iii) a Creative Commons jurisdiction license (either this or a later license version) that contains the same License Elements as this License (e.g., Attribution-ShareAlike 3.0 US)); (iv) a Creative Commons Compatible License. If you license the Adaptation under one of the licenses mentioned in (iv), you must comply with the terms of that license. If you license the Adaptation under the terms of any of the licenses mentioned in (i), (ii) or (iii) (the "Applicable License"), you must comply with the terms of the Applicable License generally and the following provisions: (I) You must include a copy of, or the URI for, the Applicable License with every copy of each Adaptation You Distribute or Publicly Perform; (II) You may not offer or impose any terms on the Adaptation that restrict the terms of the Applicable License or the ability of the recipient of the Adaptation to exercise the rights granted to that recipient under the terms of the Applicable License; (III) You must keep intact all notices that refer to the Applicable License and to the disclaimer of warranties with every copy of the Work as included in the Adaptation You Distribute or Publicly Perform; (IV) when You Distribute or Publicly Perform the Adaptation, You may not impose any effective technological measures on the Adaptation that restrict the ability of a recipient of the Adaptation from You to exercise the rights granted to that recipient under the terms of the Applicable License. This Section 4(b) applies to the Adaptation as incorporated in a Collection, but this does not require the Collection apart from the Adaptation itself to be made subject to the terms of the Applicable License.
c. If You Distribute, or Publicly Perform the Work or any Adaptations or Collections, You must, unless a request has been made pursuant to Section 4(a), keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable) if supplied, and/or if the Original Author and/or Licensor designate another party or parties (e.g., a sponsor institute, publishing entity, journal) for attribution ("Attribution Parties") in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; (ii) the title of the Work if supplied; (iii) to the extent reasonably practicable, the URI, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work; and (iv) , consistent with Ssection 3(b), in the case of an Adaptation, a credit identifying the use of the Work in the Adaptation (e.g., "French translation of the Work by Original Author," or "Screenplay based on original Work by Original Author"). The credit required by this Section 4(c) may be implemented in any reasonable manner; provided, however, that in the case of a Adaptation or Collection, at a minimum such credit will appear, if a credit for all contributing authors of the Adaptation or Collection appears, then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors. For the avoidance of doubt, You may only use the credit required by this Section for the purpose of attribution in the manner set out above and, by exercising Your rights under this License, You may not implicitly or explicitly assert or imply any connection with, sponsorship or endorsement by the Original Author, Licensor and/or Attribution Parties, as appropriate, of You or Your use of the Work, without the separate, express prior written permission of the Original Author, Licensor and/or Attribution Parties.
d. Except as otherwise agreed in writing by the Licensor or as may be otherwise permitted by applicable law, if You Reproduce, Distribute or Publicly Perform the Work either by itself or as part of any Adaptations or Collections, You must not distort, mutilate, modify or take other derogatory action in relation to the Work which would be prejudicial to the Original Author's honor or reputation. Licensor agrees that in those jurisdictions (e.g. Japan), in which any exercise of the right granted in Section 3(b) of this License (the right to make Adaptations) would be deemed to be a distortion, mutilation, modification or other derogatory action prejudicial to the Original Author's honor and reputation, the Licensor will waive or not assert, as appropriate, this Section, to the fullest extent permitted by the applicable national law, to enable You to reasonably exercise Your right under Section 3(b) of this License (right to make Adaptations) but not otherwise.
5. Representations, Warranties and Disclaimer
UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.
6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
7. Termination
a. This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Adaptations or Collections from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License.
b. Subject to the above terms and conditions, the license granted here is perpetual (for the duration of the applicable copyright in the Work). Notwithstanding the above, Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated above.
8. Miscellaneous
a. Each time You Distribute or Publicly Perform the Work or a Collection, the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License.
b. Each time You Distribute or Publicly Perform an Adaptation, Licensor offers to the recipient a license to the original Work on the same terms and conditions as the license granted to You under this License.
c. If any provision of this License is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this License, and without further action by the parties to this agreement, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
d. No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the party to be charged with such waiver or consent.
e. This License constitutes the entire agreement between the parties with respect to the Work licensed here. There are no understandings, agreements or representations with respect to the Work not specified here. Licensor shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Licensor and You.
f. The rights granted under, and the subject matter referenced, in this License were drafted utilizing the terminology of the Berne Convention for the Protection of Literary and Artistic Works (as amended on September 28, 1979), the Rome Convention of 1961, the WIPO Copyright Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 and the Universal Copyright Convention (as revised on July 24, 1971). These rights and subject matter take effect in the relevant jurisdiction in which the License terms are sought to be enforced according to the corresponding provisions of the implementation of those treaty provisions in the applicable national law. If the standard suite of rights granted under applicable copyright law includes additional rights not granted under this License, such additional rights are deemed to be included in the License; this License is not intended to restrict the license of any rights under applicable law.
Creative Commons Notice
Creative Commons is not a party to this License, and makes no warranty whatsoever in connection with the Work. Creative Commons will not be liable to You or any party on any legal theory for any damages whatsoever, including without limitation any general, special, incidental or consequential damages arising in connection to this license. Notwithstanding the foregoing two (2) sentences, if Creative Commons has expressly identified itself as the Licensor hereunder, it shall have all rights and obligations of Licensor.
Except for the limited purpose of indicating to the public that the Work is licensed under the CCPL, Creative Commons does not authorize the use by either party of the trademark "Creative Commons" or any related trademark or logo of Creative Commons without the prior written consent of Creative Commons. Any permitted use will be in compliance with Creative Commons' then-current trademark usage guidelines, as may be published on its website or otherwise made available upon request from time to time. For the avoidance of doubt, this trademark restriction does not form part of the License.
Creative Commons may be contacted at http://creativecommons.org/.

170
LICENSES/CC-BY-SA-4.0.txt Normal file
View File

@ -0,0 +1,170 @@
Creative Commons Attribution-ShareAlike 4.0 International
Creative Commons Corporation (“Creative Commons”) is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an “as-is” basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses.
Considerations for licensors: Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC-licensed material, or material used under an exception or limitation to copyright. More considerations for licensors.
Considerations for the public: By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensors permission is not necessary for any reasonfor example, because of any applicable exception or limitation to copyrightthen that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described.
Although not required by our licenses, you are encouraged to respect those requests where reasonable. More considerations for the public.
Creative Commons Attribution-ShareAlike 4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
Section 1 Definitions.
a. Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
c. BY-SA Compatible License means a license listed at creativecommons.org/compatiblelicenses, approved by Creative Commons as essentially the equivalent of this Public License.
d. Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
e. Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
f. Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
g. License Elements means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution and ShareAlike.
h. Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
i. Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
j. Licensor means the individual(s) or entity(ies) granting rights under this Public License.
k. Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
l. Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
m. You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
Section 2 Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
A. reproduce and Share the Licensed Material, in whole or in part; and
B. produce, reproduce, and Share Adapted Material.
2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
3. Term. The term of this Public License is specified in Section 6(a).
4. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
5. Downstream recipients.
A. Offer from the Licensor Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
B. Additional offer from the Licensor Adapted Material. Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapters License You apply.
C. No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
6. No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this Public License.
3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties.
Section 3 License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the following conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified form), You must:
A. retain the following if it is supplied by the Licensor with the Licensed Material:
i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of warranties;
v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
b. ShareAlike.In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply.
1. The Adapters License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-SA Compatible License.
2. You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material.
3. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply.
Section 4 Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database;
b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and
c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
Section 5 Disclaimer of Warranties and Limitation of Liability.
a. Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.
b. To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.
c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
Section 6 Term and Termination.
a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
2. upon express reinstatement by the Licensor.
c. For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
d. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
e. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
Section 7 Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
Section 8 Interpretation.
a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses.
Creative Commons may be contacted at creativecommons.org.

9
LICENSES/MIT.txt Normal file
View File

@ -0,0 +1,9 @@
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,28 +1,29 @@
<!--
SPDX-FileCopyrightText: 2023 Qusal contributors
SPDX-License-Identifier: CC-BY-SA-4.0
-->
# qusal
## Table of Contents
* [Description](#description)
* [Installation](#installation)
* [Requirements](#requirements)
* [DomU](#domu)
* [Dom0](#dom0)
* [Usage](#usage)
* [Format](#format)
* [File naming](#file-naming)
* [Readme](#readme)
* [Qube naming](#qube-naming)
* [Qrexec](#qrexec)
* [Legal](#legal)
* [Copyright](#copyright)
* [License](#license)
## Description
Qusal - Salt Formulas for Qubes OS.
Qusal providers a Free and Open Source solution to customizing various tasks
in Qubes OS, from switching PCI handlers to be disposables or app qubes to
installing different pieces of software on dedicated minimal templates.
in Qubes OS, from switching PCI handlers to be disposables or app qubes,
installing different pieces of software on dedicated minimal templates for
split agent operations for separating the key store from the client.
Each project is in a separate directory, but they may interact with other
projects.
@ -66,7 +67,7 @@ qvm-run -p dev tar -cC /home/user qusal | tar -xvC ~/QubesIncoming/dev qusal
Copy the files to the Salt directories:
```sh
cd qusal
./setup.sh
./scripts/setup.sh
```
The RPM Spec is not ready, don't try it unless for development.
@ -79,72 +80,33 @@ information on how to install the desired package.
Qubes global settings (qubes-prefs) that will be managed:
- **clockvm**: disp-sys-net, sys-net
- **default_audiovm**: dom0 # TODO
- **default_dispvm**: reader
- **default_guivm**: dom0 # TODO
- **default_netvm**: sys-pihole, sys-firewall or disp-sys-firewall
- **management_dispvm**: dvm-mgmt
- **updatevm**: sys-pihole, sys-firewall or disp-sys-firewall
## Format
To be implemented:
- **default_audiovm**: sys-audio
- **default_guivm**: sys-gui
### File naming
## Legal
1. Every State file `.sls` must have a Top file `.top`. This ensures that
every state can be applied with top.
2. Every project must have a `init.top`, it facilitates applying every state
by enabling a single top file.
3. State file naming should be common between the projects, it helps
understand the project as if it was any other.
5. Files names and state IDs should use `-` as separator, not `_`.
This project is [REUSE-compliant](https://reuse.software). It is difficult to
list all licenses and copyrights and keep them up-to-date here.
### Readme
The easiest way to get the copyright and license of the project with the reuse
tool:
```sh
reuse spdx
```
1. Every project should have a README.md with at least the following sections:
Table of Contents, Description, Installation, Access Control (if changed
Qrexec policy), Usage.
You can also check these information manually by checking in the file header,
a companion `.license` or in `.reuse/dep5`.
### Qube naming
Here is a brief summary as of October 2023:
1. Qube name format:
- TemplateVM: `tpl-NAME`
- StandaloneVM: `NAME`
- AppVM: `NAME`
- DispVM: `disp-NAME`
- DispVM Template (AppVM): `dvm-NAME`
- Service qubes (not a class): `sys-NAME`
2. Label:
- Black (Ultimately trusted): You must trust Dom0, Templates, Vaults,
Management qubes, these qubes control your system and hold valuable
information. Examples: dom0, tpl-ssh, vault, default-mgmt-dvm.
- Gray (Fully trusted): Trusted storage with extra RPC services that allow
certain operations to be made by the client and executed on the server.
Examples: sys-cacher, sys-git, sys-pgp, sys-ssh-agent.
- Purple, Blue, Green, Yellow (Relatively trusted per domain): Can be set
per user discretion, normally separated per domain (work, clients,
personal).
- Orange (Slightly trusted) Controls the flow of data to the client,
normally a firewall. Examples: sys-firewall, sys-vpn, sys-pihole.
- Red (Untrusted): Holds untrusted data (PCI devices, untrusted programs,
disposables for opening untrusted files or web pages). Examples: sys-net,
sys-usb, disp-sys-usb, disp-browser.
### Qrexec
1. Don't use `*` for source and destination, use `@anyvm` instead
2. Target qube for policies must be `@default`. It allows for the real target
to be set by Dom0 via the `target=` redirection parameter, instead of
having to modify the client to target a different server via
`qrexec-client-vm`.
3. Target qube for client script must default to `@default`, but other targets
must be allowed via parameters.
## License
All original source code is licensed under GPL-3.0-or-later.
For more accurate information, check the individual files for license and
copyright ownership.
- All original source code is licensed under GPL-3.0-or-later.
- All documentation is licensed under CC-BY-SA-4.0.
- Some configuration and data files are licensed under CC0-1.0.
- Some borrowed code (`qusal/dotfiles/`) is licenses under BSD-2-Clause,
CC-BY-SA-4.0, GPL-2.0-only, GPL-3.0-only, MIT, Vim.

View File

@ -1,3 +0,0 @@
SPDX-FileCopyrightText: 2023 Qusal contributors
SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2023 Qusal contributors
#
# SPDX-License-Identifier: CC0-1.0
---
file_roots:
base:

View File

@ -7,66 +7,71 @@ SPDX-License-Identifier: GPL-3.0-or-later
include:
- .clone
"tpl-{{ slsdotpath }}":
qvm.vm:
- require:
- sls: {{ slsdotpath }}.clone
- name: tpl-{{ slsdotpath }}
- prefs:
- memory: 300
- maxmem: 400
- features:
- set:
- default-menu-items: "qubes-run-terminal.desktop qubes-start.desktop"
- menu-items: "qubes-run-terminal.desktop qubes-start.desktop"
{% load_yaml as defaults -%}
name: tpl-{{ slsdotpath }}
force: True
require:
- sls: {{ slsdotpath }}.clone
prefs:
- memory: 300
- maxmem: 400
features:
- set:
- default-menu-items: "qubes-run-terminal.desktop qubes-start.desktop"
- menu-items: "qubes-run-terminal.desktop qubes-start.desktop"
{%- endload %}
{{ load(defaults) }}
"{{ slsdotpath }}":
qvm.vm:
- name: {{ slsdotpath }}
- require:
- sls: {{ slsdotpath }}.clone
- present:
- template: tpl-{{ slsdotpath }}
- label: blue
- prefs:
- template: tpl-{{ slsdotpath }}
- label: blue
- netvm: ""
- vpus: 1
- memory: 400
- maxmem: 500
- autostart: False
- include_in_backups: True
- features:
- set:
- menu-items: "qubes-run-terminal.desktop qubes-start.desktop"
- disable:
- service.cups
- service.cups-browsed
name: {{ slsdotpath }}
force: True
require:
- sls: {{ slsdotpath }}.clone
present:
- template: tpl-{{ slsdotpath }}
- label: purple
prefs:
- template: tpl-{{ slsdotpath }}
- label: purple
- netvm: ""
- vpus: 1
- memory: 400
- maxmem: 500
- autostart: False
- include_in_backups: True
features:
- set:
- menu-items: "qubes-run-terminal.desktop qubes-start.desktop"
- disable:
- service.cups
- service.cups-browsed
{%- endload %}
{{ load(defaults) }}
"{{ slsdotpath }}-minion":
qvm.vm:
- name: {{ slsdotpath }}-minion
- require:
- sls: {{ slsdotpath }}.clone
- present:
- template: tpl-{{ slsdotpath }}
- label: blue
- prefs:
- template: tpl-{{ slsdotpath }}
- label: blue
- netvm: ""
- vpus: 1
- memory: 400
- maxmem: 500
- autostart: False
- include_in_backups: True
- features:
- set:
- menu-items: "qubes-run-terminal.desktop qubes-start.desktop"
- disable:
- service.cups
- service.cups-browsed
{% load_yaml as defaults -%}
name: {{ slsdotpath }}-minion
force: True
require:
- sls: {{ slsdotpath }}.clone
present:
- template: tpl-{{ slsdotpath }}
- label: purple
prefs:
- template: tpl-{{ slsdotpath }}
- label: purple
- netvm: ""
- vpus: 1
- memory: 400
- maxmem: 500
- autostart: False
- include_in_backups: True
features:
- set:
- menu-items: "qubes-run-terminal.desktop qubes-start.desktop"
- disable:
- service.cups
- service.cups-browsed
{%- endload %}
{{ load(defaults) }}
{% from 'utils/macros/policy.sls' import policy_set with context -%}
{{ policy_set(sls_path, '80') }}

View File

@ -8,6 +8,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
include:
- utils.tools.zsh
- ssh.install
"{{ slsdotpath }}-updated":
pkg.uptodate:
@ -20,18 +21,6 @@ include:
- skip_suggestions: True
- pkgs:
- ansible
{% if grains['os_family']|lower == 'debian' -%}
- openssh-client
- vim-nox
- python3-selinux
{% elif grains['os_family']|lower == 'redhat' -%}
- openssh-clients
- vim-enhanced
- vim-ansible
{% else -%}
- openssh-client
- vim
{% endif -%}
- python3-argcomplete
- python3-jmespath
- openssh-server
@ -39,6 +28,22 @@ include:
- bash-completion
- man-db
{% set pkg = {
'Debian': {
'pkg': ['vim-nox', 'python3-selinux'],
},
'RedHat': {
'pkg': ['vim-enhanced', 'vim-ansible'],
},
}.get(grains.os_family) -%}
"{{ slsdotpath }}-installed-os-specific":
pkg.installed:
- refresh: True
- install_recommends: False
- skip_suggestions: True
- pkgs: {{ pkg.pkg|sequence|yaml }}
"{{ slsdotpath }}-ssh-config":
file.managed:
- name: /etc/ssh/ssh_config.d/99-ssh-ansible.conf

View File

@ -7,35 +7,40 @@ SPDX-License-Identifier: GPL-3.0-or-later
include:
- .clone
"tpl-{{ slsdotpath }}":
qvm.vm:
- require:
- sls: {{ slsdotpath }}.clone
- name: tpl-{{ slsdotpath }}
- prefs:
- memory: 300
- maxmem: 2000
- features:
- set:
- default-menu-items: "firefox-esr.desktop chromium.desktop google-chrome.desktop qubes-run-terminal.desktop qubes-start.desktop"
- menu-items: "firefox-esr.desktop chromium.desktop google-chrome.desktop qubes-run-terminal.desktop qubes-start.desktop"
{% load_yaml as defaults -%}
name: tpl-{{ slsdotpath }}
force: True
require:
- sls: {{ slsdotpath }}.clone
prefs:
- memory: 300
- maxmem: 2000
features:
- set:
- default-menu-items: "firefox-esr.desktop chromium.desktop google-chrome.desktop qubes-run-terminal.desktop qubes-start.desktop"
- menu-items: "firefox-esr.desktop chromium.desktop google-chrome.desktop qubes-run-terminal.desktop qubes-start.desktop"
{%- endload %}
{{ load(defaults) }}
"dvm-{{ slsdotpath }}":
qvm.vm:
- require:
- qvm: tpl-{{ slsdotpath }}
- name: dvm-{{ slsdotpath }}
- present:
- template: tpl-{{ slsdotpath }}
- label: red
- prefs:
- memory: 300
- maxmem: 2000
- vcpus: 1
- template_for_dispvms: True
- include_in_backups: False
- features:
- enable:
- appmenus-dispvm
- set:
- menu-items: "firefox-esr.desktop chromium.desktop google-chrome.desktop qubes-run-terminal.desktop qubes-start.desktop"
{% load_yaml as defaults -%}
name: dvm-{{ slsdotpath }}
force: True
require:
- qvm: tpl-{{ slsdotpath }}
present:
- template: tpl-{{ slsdotpath }}
- label: red
prefs:
- label: red
- memory: 300
- maxmem: 2000
- vcpus: 1
- template_for_dispvms: True
- include_in_backups: False
features:
- enable:
- appmenus-dispvm
- set:
- menu-items: "firefox-esr.desktop chromium.desktop google-chrome.desktop qubes-run-terminal.desktop qubes-start.desktop"
{%- endload %}
{{ load(defaults) }}

View File

@ -9,24 +9,6 @@ SPDX-License-Identifier: GPL-3.0-or-later
include:
- .clone
"{{ template.template_clean }}":
qvm.vm:
- name: {{ template.template_clean }}
- require:
- sls: {{ template.template_clean }}.clone
- present:
- label: black
- prefs:
- label: black
- memory: 300
- maxmem: 600
- vcpus: 1
- include_in_backups: False
- features:
- set:
- menu-items: "qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop"
- default-menu-items: "qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop"
"dvm-{{ template.template }}-absent":
qvm.absent:
- names:
@ -34,27 +16,49 @@ include:
- {{ template.template_clean }}-dvm
- {{ template.template }}-dvm
"dvm-{{ template.template_clean }}":
qvm.vm:
- name: dvm-{{ template.template_clean }}
- require:
- sls: {{ template.template_clean }}.clone
- present:
- template: {{ template.template }}
- label: red
- prefs:
- template: {{ template.template }}
- label: red
- memory: 300
- maxmem: 400
- vcpus: 1
- template_for_dispvms: True
- include_in_backups: False
- features:
- enable:
- appmenus-dispvm
- set:
- menu-items: "qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop"
{% load_yaml as defaults -%}
name: dvm-{{ template.template_clean }}
force: True
require:
- sls: {{ template.template_clean }}.clone
present:
- template: {{ template.template }}
- label: red
prefs:
- template: {{ template.template }}
- label: red
- memory: 300
- maxmem: 400
- vcpus: 1
- template_for_dispvms: True
- include_in_backups: False
features:
- enable:
- appmenus-dispvm
- set:
- menu-items: "qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop"
{%- endload %}
{{ load(defaults) }}
{% load_yaml as defaults -%}
name: {{ template.template_clean }}
force: True
require:
- sls: {{ template.template_clean }}.clone
present:
- label: black
prefs:
- label: black
- memory: 300
- maxmem: 600
- vcpus: 1
- include_in_backups: False
features:
- set:
- menu-items: "qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop"
- default-menu-items: "qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop"
{%- endload %}
{{ load(defaults) }}
"{{ slsdotpath }}-set-default_template":
cmd.run:

View File

@ -9,24 +9,6 @@ SPDX-License-Identifier: GPL-3.0-or-later
include:
- .clone
"{{ template.template_clean }}":
qvm.vm:
- name: {{ template.template_clean }}
- require:
- sls: {{ slsdotpath }}.clone
- present:
- label: black
- prefs:
- label: black
- memory: 300
- maxmem: 600
- vcpus: 1
- include_in_backups: False
- features:
- set:
- menu-items: "qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop"
- default-menu-items: "qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop"
"dvm-{{ template.template }}-absent":
qvm.absent:
- names:
@ -34,24 +16,46 @@ include:
- {{ template.template_clean }}-dvm
- {{ template.template }}-dvm
"dvm-{{ template.template_clean }}":
qvm.vm:
- name: dvm-{{ template.template_clean }}
- require:
- sls: {{ slsdotpath }}.clone
- present:
- template: {{ template.template }}
- label: red
- prefs:
- template: {{ template.template }}
- label: red
- memory: 300
- maxmem: 800
- vcpus: 1
- template_for_dispvms: True
- include_in_backups: False
- features:
- enable:
- appmenus-dispvm
- set:
- menu-items: "qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop"
{% load_yaml as defaults -%}
name: dvm-{{ template.template_clean }}
force: True
require:
- sls: {{ slsdotpath }}.clone
present:
- template: {{ template.template }}
- label: red
prefs:
- template: {{ template.template }}
- label: red
- memory: 300
- maxmem: 800
- vcpus: 1
- template_for_dispvms: True
- include_in_backups: False
features:
- enable:
- appmenus-dispvm
- set:
- menu-items: "qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop"
{%- endload %}
{{ load(defaults) }}
{% load_yaml as defaults -%}
name: {{ template.template_clean }}
force: True
require:
- sls: {{ slsdotpath }}.clone
present:
- label: black
prefs:
- label: black
- memory: 300
- maxmem: 600
- vcpus: 1
- include_in_backups: False
features:
- set:
- menu-items: "qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop"
- default-menu-items: "qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop"
{%- endload %}
{{ load(defaults) }}

View File

@ -7,75 +7,83 @@ SPDX-License-Identifier: GPL-3.0-or-later
include:
- .clone
"{{ slsdotpath }}":
qvm.vm:
- name: {{ slsdotpath }}
- require:
- sls: {{ slsdotpath }}.clone
- present:
- template: tpl-{{ slsdotpath }}
- label: blue
- prefs:
- template: tpl-{{ slsdotpath }}
- label: blue
- netvm: ""
- vpus: 1
- memory: 400
- maxmem: 600
- autostart: False
- include_in_backups: True
- features:
- enable:
- service.split-gpg2-client
- service.crond
- disable:
- service.cups
- service.cups-browsed
{%- from "qvm/template.jinja" import load -%}
"dvm-{{ slsdotpath }}":
qvm.vm:
- name: dvm-{{ slsdotpath }}
- require:
- sls: {{ slsdotpath }}.clone
- present:
- template: tpl-{{ slsdotpath }}
- label: red
- prefs:
- template: tpl-{{ slsdotpath }}
- label: red
- netvm: ""
- vpus: 1
- memory: 400
- maxmem: 600
- autostart: False
- template_for_dispvms: True
- include_in_backups: False
- features:
- enable:
- appmenus-dispvm
- disable:
- service.cups
- service.cups-browsed
{% load_yaml as defaults -%}
name: {{ slsdotpath }}
force: True
require:
- sls: {{ slsdotpath }}.clone
present:
- template: tpl-{{ slsdotpath }}
- label: purple
prefs:
- template: tpl-{{ slsdotpath }}
- label: purple
- netvm: ""
- vpus: 1
- memory: 400
- maxmem: 600
- autostart: False
- include_in_backups: True
features:
- enable:
- service.split-gpg2-client
- service.crond
- disable:
- service.cups
- service.cups-browsed
{%- endload %}
{{ load(defaults) }}
"disp-{{ slsdotpath }}":
qvm.vm:
- name: disp-{{ slsdotpath }}
- require:
- qvm: dvm-{{ slsdotpath }}
- present:
- template: dvm-{{ slsdotpath }}
- label: red
- class: DispVM
- prefs:
- template: dvm-{{ slsdotpath }}
- label: red
- vpus: 1
- memory: 400
- maxmem: 600
- autostart: False
- include_in_backups: False
- features:
- disable:
- appmenus-dispvm
- service.cups
- service.cups-browsed
{% load_yaml as defaults -%}
name: dvm-{{ slsdotpath }}
force: True
require:
- sls: {{ slsdotpath }}.clone
present:
- template: tpl-{{ slsdotpath }}
- label: red
prefs:
- template: tpl-{{ slsdotpath }}
- label: red
- netvm: ""
- vpus: 1
- memory: 400
- maxmem: 600
- autostart: False
- template_for_dispvms: True
- include_in_backups: False
features:
- enable:
- appmenus-dispvm
- disable:
- service.cups
- service.cups-browsed
{%- endload %}
{{ load(defaults) }}
{% load_yaml as defaults -%}
name: disp-{{ slsdotpath }}
force: True
require:
- qvm: dvm-{{ slsdotpath }}
present:
- template: dvm-{{ slsdotpath }}
- label: red
- class: DispVM
prefs:
- template: dvm-{{ slsdotpath }}
- label: red
- vpus: 1
- memory: 400
- maxmem: 600
- autostart: False
- include_in_backups: False
features:
- disable:
- appmenus-dispvm
- service.cups
- service.cups-browsed
{%- endload %}
{{ load(defaults) }}

View File

@ -19,14 +19,30 @@ SPDX-License-Identifier: GPL-3.0-or-later
- python3-pip
- yamllint
- ansible-lint
{% if grains['os_family']|lower == 'redhat' -%}
- salt-lint
{% endif -%}
# {% if grains['os_family']|lower != 'redhat' -%}
# pip-installed-salt-tools:
# cmd.run:
# - name: python3 -m pip install salt-lint
# {% endif -%}
{% set pkg = {
'Debian': {
'pkg': [],
},
'RedHat': {
'pkg': ['salt-lint'],
},
}.get(grains.os_family) -%}
"{{ slsdotpath }}-installed-salt-tools-os-specific":
pkg.installed:
- refresh: True
- install_recommends: False
- skip_suggestions: True
- pkgs: {{ pkg.pkg|sequence|yaml }}
# Fails because of cacher
{#
{% if grains['os_family']|lower != 'redhat' -%}
pip-installed-salt-tools:
cmd.run:
- name: python3 -m pip install --break-system-packages salt-lint
{% endif -%}
#}
{% endif %}

View File

@ -38,23 +38,26 @@ include:
- texinfo
- file
- tree
- reuse
- pre-commit
- gitlint
- ripgrep
- fzf
{% if grains['os_family']|lower == 'debian' -%}
- shellcheck
- vim-nox
- fd-find
{% elif grains['os_family']|lower == 'redhat' -%}
- passwd
- fd-find
- ShellCheck
- vim-enhanced
{% else -%}
- fd
- shellcheck
- vim
{% endif -%}
{% set pkg = {
'Debian': {
'pkg': ['shellcheck', 'vim-nox', 'fd-find'],
},
'RedHat': {
'pkg': ['passwd', 'fd-find', 'ShellCheck', 'vim-enhanced'],
},
}.get(grains.os_family) -%}
"{{ slsdotpath }}-installed-os-specific":
pkg.installed:
- refresh: True
- install_recommends: False
- skip_suggestions: True
- pkgs: {{ pkg.pkg|sequence|yaml }}
{% endif -%}

View File

@ -13,29 +13,24 @@ SPDX-License-Identifier: GPL-3.0-or-later
pkg.uptodate:
- refresh: True
{% set pkg = {
'Debian': {
'pkg_removed': ['docker.io', 'docker-doc', 'docker-compose',
'podman-docker', 'containerd', 'runc'],
},
'RedHat': {
'pkg_removed': ['docker', 'docker-client', 'docker-client-latest',
'docker-common', 'docker-latest',
'docker-latest-logrotate', 'docker-logrotate',
'docker-selinux', 'docker-engine-selinux',
'docker-engine'],
},
}.get(grains.os_family) -%}
{#
"{{ slsdotpath }}-removed":
"{{ slsdotpath }}-removed-os-specific":
pkg.removed:
- pkgs:
{% if grains['os_family']|lower == 'debian' -%}
- docker.io
- docker-doc
- docker-compose
- podman-docker
- containerd
- runc
{% elif grains['os_family']|lower == 'redhat' -%}
- docker
- docker-client
- docker-client-latest
- docker-common
- docker-latest
- docker-latest-logrotate
- docker-logrotate
- docker-selinux
- docker-engine-selinux
- docker-engine
{% endif -%}
- pkgs: {{ pkg.pkg_removed|sequence|yaml }}
#}
"{{ slsdotpath }}-installed":

View File

@ -1,9 +1,12 @@
#!/bin/sh
# SPDX-FileCopyrightText: 2018 Oded Arbel <https://geek.co.li>
# SPDX-FileCopyrightText: 2023 Qusal contributors
#
# SPDX-License-Identifier: GPL-3.0-or-later
## Credits: https://geek.co.il/2018/07/30/script-day-different-default-browser-per-kde-activity
set -eu
if ! command -v notify-send >/dev/null &&
@ -17,7 +20,6 @@ case "${XDG_SESSION_DESKTOP:-}" in
*) exit 1;;
esac
## https://geek.co.il/2018/07/30/script-day-different-default-browser-per-kde-activity
service="org.kde.ActivityManager"
interface="$service.Activities"
path="/ActivityManager/Activities"

View File

@ -1,53 +0,0 @@
#!/bin/sh
# SPDX-FileCopyrightText: 2023 Qusal contributors
#
# SPDX-License-Identifier: GPL-3.0-or-later
# shellcheck disable=SC1090,SC2317
## Wrapper around kwriteconfig to write key=values to specific groups.
## TODO: finish
set -eu
echo "Unfinished work" >&2
exit 2
# shellcheck disable=SC1091
test -r "$HOME/.profile" && . "$HOME/.profile"
: "${XDG_CONFIG_HOME:=$HOME/.config}"
file="$XDG_CONFIG_HOME/kwinrulesrc"
writeconf(){
group="$1"
key="$2"
value="$3"
kwriteconfig \
--file "$file" \
--group "rules-$group" \
--key "$key" "$value"
}
writeconf_group(){
chosen_group="$1"
chosen_activity="$2"
writeconf "$chosen_group" Description "$chosen_group"
if test -n "$chosen_activity"; then
chosen_activity_id="$(kactivities-cli --list-activities |
cut -d " " -f 2,3 | grep -F " $chosen_activity" | cut -d " " -f 1)"
if test -z "$chosen_activity_id"; then
printf '%s\n' "Invalid activity name: $chosen_activity"
exit 1
fi
writeconf "$chosen_group" activity "$chosen_activity_id"
writeconf "$chosen_group" activityrule 2
fi
writeconf "$chosen_group" title "^\\[$chosen_group\\] .*"
writeconf "$chosen_group" titlematch 3
writeconf "$chosen_group" wmclass "$chosen_group"
writeconf "$chosen_group" wmclasscomplete false
writeconf "$chosen_group" wmclassmatch 2
}
#writeconf_group dev
#writeconf_group disp
#writeconf disp title "^\\[disp[0-9]{4}\\] .*"

View File

@ -0,0 +1,72 @@
#!/bin/sh
# SPDX-FileCopyrightText: 2023 Qusal contributors
#
# SPDX-License-Identifier: GPL-3.0-or-later
## Write KWin rules for window of specific domain to be in specific activity.
# shellcheck disable=SC1090,SC2317
set -eu
file="${XDG_CONFIG_HOME:=$HOME/.config}/kwinrulesrc"
usage(){
echo "Usage: ${0##*/} <group> <activity>
Example: ${0##*/} personal personal
Example: ${0##*/} fun personal
Example: ${0##*/} work work
If domain is work, dvm-work, disp-work and work-something will all be present
in the work activity" >&2
exit 1
}
writeconf(){
group="$1"
key="$2"
value="$3"
group_id="$(grep -B1 -- "^Description=$group$" "$file" | head -1 | tr -d "[" | tr -d "]")"
if test -z "${group_id}"; then
highest_id="$(grep -- "\[[0-9]\+\]" "$file" | tr -d "[" | tr -d "]" | sort | tail -1)"
if test -n "${highest_id}"; then
group_id="$((highest_id+1))"
else
group_id="0"
fi
fi
kwriteconfig --file "$file" --group "$group_id" --key "$key" "$value"
}
writeconf_group(){
chosen_group="$1"
chosen_activity="$2"
writeconf "$chosen_group" Description "$chosen_group"
if test -n "$chosen_activity"; then
chosen_activity_id="$(kactivities-cli --list-activities |
awk -v activity="$chosen_activity" '$3 ~ activity {print $2}')"
if test -z "$chosen_activity_id"; then
printf '%s\n' "Invalid activity name: $chosen_activity"
exit 1
fi
writeconf "$chosen_group" activity "$chosen_activity_id"
writeconf "$chosen_group" activityrule 2
fi
## Regex: https://doc.qt.io/qt-6/qregularexpression.html
writeconf "$chosen_group" title "^\\[(disp-|dvm-)?$chosen_group(-\\S+)?\\] .*"
writeconf "$chosen_group" titlematch 3
writeconf "$chosen_group" wmclass "$chosen_group"
writeconf "$chosen_group" wmclasscomplete false
writeconf "$chosen_group" wmclassmatch 2
}
case "${1-}" in
""|-h|--?help) usage
esac
case "${2-}" in
"") usage
esac
writeconf_group "${1}" "${2}"
dbus-send --type=signal /KWin org.kde.KWin.reloadConfig

View File

@ -54,4 +54,13 @@ SPDX-License-Identifier: GPL-3.0-or-later
- mode: '0755'
- makedirs: True
"{{ slsdotpath }}-qubes-kde-win-rules":
file.managed:
- name: /home/user/.local/bin/qubes-kde-win-rules
- source: salt://{{ slsdotpath }}/files/bin/qubes-kde-win-rules
- user: user
- group: user
- mode: '0755'
- makedirs: True
{% endif -%}

View File

@ -1,74 +0,0 @@
# dotfiles
## Table of Contents
* [Description](#description)
* [Installation](#installation)
* [Usage](#usage)
## Description
Ben Grande's Dotfiles.
Configuration and scripts targeting:
- Usability:
- Vi keybindings for application movement
- Emacs keybindings for command-line editing
- XDG Specification to not clutter $HOME
- Portability:
- POSIX compliant code
- Drop-in configuration files
- Tested on Qubes OS Dom0, Debian, Fedora
- Tasks:
- GUI: x11, gtk
- SCM: git, tig, git-shell
- Keys: gpg, ssh
- Networking: curl, urlview, wget, w3m
- Productivity: tmux, vim
- Shell: sh, bash, zsh, less, dircolors
## Installation
You can simply deploy all configurations with:
```sh
./files/setup.sh
```
Or target specific ones by specifying the directory name:
```sh
./files/setup.sh sh bash
```
Note that some files might depend on other directories, specially `sh` which
is a base for `bash` and `zsh` but might also have environment variables for
`net` and `vim`. It also adds `$HOME/.local/bin` and
`$HOME/.local/bin/$HOSTNAME` to the `$PATH` variable, so if the project has
scripts, install the `sh` directory.
Reload your shell:
```sh
exec $SHELL
```
Reload you X server:
```sh
. ~/.config/x11/xprofile
```
You need to logout and login again for some changes to take effect.
## Usage
The deployment replaces existing files and that is the goal, to make sure that
we have the same configuration of every machine. Support for local
configuration is implemented by including a local file per application.
Supported programs and the expected file names in `$HOME`:
- **bash**: .bashrc.local
- **git**: .gitconfig.local
- **sh**: .profile.local, .shrc.local
- **ssh**: .ssh/config.d/*.conf, .ssh/known_hosts.d/*.host
- **tmux**: .tmux.conf.local
- **vim**: .vimrc.local
- **x11**: .xprofile.local
- **zsh**: .zshrc.local

View File

@ -1,52 +0,0 @@
{#
SPDX-FileCopyrightText: 2023 Qusal contributors
SPDX-License-Identifier: GPL-3.0-or-later
#}
include:
- .copy-git
- .copy-gtk
- .copy-net
- .copy-pgp
- .copy-sh
- .copy-ssh
- .copy-tmux
- .copy-vim
- .copy-x11
{#
Unfortunately salt.states.file does not keep permissions when using salt-ssh.
Best option is 'file.managed mode: keep' or 'file.recurse file_mode: keep'.
https://docs.saltproject.io/en/latest/ref/states/all/salt.states.file.html
#}
{#
"{{ slsdotpath }}-absent-dotfiles-client":
file.absent:
- name: /tmp/dotfiles
"{{ slsdotpath }}-copy-dotfiles-client":
file.recurse:
- source: salt://{{ slsdotpath }}/files
- name: /tmp/dotfiles
- file_mode: '0644'
- dir_mode: '0700'
- user: user
- group: user
"{{ slsdotpath }}-apply-dotfiles-client":
cmd.run:
- name: sh /tmp/dotfiles/setup.sh
- runas: user
"{{ slsdotpath }}-fix-executables-permission":
file.directory:
- name: /home/user/.local/bin
- mode: '0755'
- recurse:
- mode
"{{ slsdotpath }}-absent-end-dotfiles-client":
file.absent:
- name: /tmp/dotfiles
#}

View File

@ -1,65 +0,0 @@
{#
SPDX-FileCopyrightText: 2023 Qusal contributors
SPDX-License-Identifier: GPL-3.0-or-later
#}
"{{ slsdotpath }}-copy-git-home":
file.recurse:
- name: /home/user
- source: salt://{{ slsdotpath }}/files/git
- file_mode: '0644'
- dir_mode: '0700'
- user: user
- group: user
"{{ slsdotpath }}-fix-executables-git-template-dir-home":
file.directory:
- name: /home/user/.config/git/template/hooks
- mode: '0755'
- recurse:
- mode
"{{ slsdotpath }}-fix-executables-git-shell-dir-home":
file.directory:
- name: /home/user/.config/git/shell
- mode: '0755'
- recurse:
- mode
"{{ slsdotpath }}-fix-executables-git-bin-dir-home":
file.directory:
- name: /home/user/.local/bin
- mode: '0755'
- recurse:
- mode
"{{ slsdotpath }}-copy-git-skel":
file.recurse:
- name: /etc/skel
- source: salt://{{ slsdotpath }}/files/git
- file_mode: '0644'
- dir_mode: '0700'
- user: root
- group: root
"{{ slsdotpath }}-fix-executables-git-template-dir-skel":
file.directory:
- name: /etc/skel/.config/git/template/hooks
- mode: '0755'
- recurse:
- mode
"{{ slsdotpath }}-fix-executables-git-shell-dir-skel":
file.directory:
- name: /home/user/.config/git/shell
- mode: '0755'
- recurse:
- mode
"{{ slsdotpath }}-fix-executables-git-bin-dir-skel":
file.directory:
- name: /home/user/.local/bin
- mode: '0755'
- recurse:
- mode

View File

@ -1,23 +0,0 @@
{#
SPDX-FileCopyrightText: 2023 Qusal contributors
SPDX-License-Identifier: GPL-3.0-or-later
#}
"{{ slsdotpath }}-copy-gtk-home":
file.recurse:
- name: /home/user/
- source: salt://{{ slsdotpath }}/files/gtk/
- file_mode: '0644'
- dir_mode: '0700'
- user: user
- group: user
"{{ slsdotpath }}-copy-gtk-skel":
file.recurse:
- name: /etc/skel
- source: salt://{{ slsdotpath }}/files/gtk/
- file_mode: '0644'
- dir_mode: '0700'
- user: root
- group: root

View File

@ -1,27 +0,0 @@
{#
SPDX-FileCopyrightText: 2023 Qusal contributors
SPDX-License-Identifier: GPL-3.0-or-later
#}
"{{ slsdotpath }}-copy-net-home":
file.recurse:
- name: /home/user/
- source: salt://{{ slsdotpath }}/files/net/
- file_mode: '0644'
- dir_mode: '0700'
- user: user
- group: user
- keep_symlinks: True
- force_symlinks: True
"{{ slsdotpath }}-copy-net-skel":
file.recurse:
- name: /etc/skel
- source: salt://{{ slsdotpath }}/files/net/
- file_mode: '0644'
- dir_mode: '0700'
- user: root
- group: root
- keep_symlinks: True
- force_symlinks: True

View File

@ -1,23 +0,0 @@
{#
SPDX-FileCopyrightText: 2023 Qusal contributors
SPDX-License-Identifier: GPL-3.0-or-later
#}
"{{ slsdotpath }}-copy-pgp-home":
file.recurse:
- name: /home/user/
- source: salt://{{ slsdotpath }}/files/pgp/
- file_mode: '0600'
- dir_mode: '0700'
- user: user
- group: user
"{{ slsdotpath }}-copy-pgp-skel":
file.recurse:
- name: /etc/skel/
- source: salt://{{ slsdotpath }}/files/pgp/
- file_mode: '0600'
- dir_mode: '0700'
- user: root
- group: root

View File

@ -1,9 +0,0 @@
{#
SPDX-FileCopyrightText: 2023 Qusal contributors
SPDX-License-Identifier: GPL-3.0-or-later
#}
base:
'*':
- dotfiles.copy-pgp

View File

@ -1,43 +0,0 @@
{#
SPDX-FileCopyrightText: 2023 Qusal contributors
SPDX-License-Identifier: GPL-3.0-or-later
#}
"{{ slsdotpath }}-copy-sh-home":
file.recurse:
- name: /home/user/
- source: salt://{{ slsdotpath }}/files/sh
- file_mode: '0644'
- dir_mode: '0700'
- user: user
- group: user
- keep_symlinks: True
- force_symlinks: True
"{{ slsdotpath }}-fix-executables-sh-dir-home":
file.directory:
- name: /home/user/.local/bin
- file_mode: '0755'
- dir_mode: '0755'
- recurse:
- mode
"{{ slsdotpath }}-copy-sh-skel":
file.recurse:
- name: /etc/skel
- source: salt://{{ slsdotpath }}/files/sh
- file_mode: '0644'
- dir_mode: '0700'
- user: root
- group: root
- keep_symlinks: True
- force_symlinks: True
"{{ slsdotpath }}-fix-executables-sh-dir-skel":
file.directory:
- name: /etc/skel/.local/bin
- file_mode: '0755'
- dir_mode: '0755'
- recurse:
- mode

View File

@ -1,9 +0,0 @@
{#
SPDX-FileCopyrightText: 2023 Qusal contributors
SPDX-License-Identifier: GPL-3.0-or-later
#}
base:
'*':
- dotfiles.copy-sh

View File

@ -1,24 +0,0 @@
{#
SPDX-FileCopyrightText: 2023 Qusal contributors
SPDX-License-Identifier: GPL-3.0-or-later
#}
"{{ slsdotpath }}-copy-ssh-home":
file.recurse:
- name: /home/user/
- source: salt://{{ slsdotpath }}/files/ssh/
- file_mode: '0600'
- dir_mode: '0700'
- user: user
- group: user
- backup: minion
"{{ slsdotpath }}-copy-ssh-skel":
file.recurse:
- name: /etc/skel/
- source: salt://{{ slsdotpath }}/files/ssh/
- file_mode: '0600'
- dir_mode: '0700'
- user: root
- group: root

View File

@ -1,9 +0,0 @@
{#
SPDX-FileCopyrightText: 2023 Qusal contributors
SPDX-License-Identifier: GPL-3.0-or-later
#}
base:
'*':
- dotfiles.copy-ssh

View File

@ -1,37 +0,0 @@
{#
SPDX-FileCopyrightText: 2023 Qusal contributors
SPDX-License-Identifier: GPL-3.0-or-later
#}
"{{ slsdotpath }}-copy-tmux-home":
file.recurse:
- name: /home/user/
- source: salt://{{ slsdotpath }}/files/tmux/
- file_mode: '0644'
- dir_mode: '0700'
- user: user
- group: user
"{{ slsdotpath }}-fix-executables-tmux-home":
file.directory:
- name: /home/user/.local/bin
- mode: '0755'
- recurse:
- mode
"{{ slsdotpath }}-copy-tmux-skel":
file.recurse:
- name: /etc/skel
- source: salt://{{ slsdotpath }}/files/tmux/
- file_mode: '0644'
- dir_mode: '0700'
- user: root
- group: root
"{{ slsdotpath }}-fix-executables-tmux-skel":
file.directory:
- name: /home/user/.local/bin
- mode: '0755'
- recurse:
- mode

View File

@ -1,9 +0,0 @@
{#
SPDX-FileCopyrightText: 2023 Qusal contributors
SPDX-License-Identifier: GPL-3.0-or-later
#}
base:
'*':
- dotfiles.copy-tmux

View File

@ -1,23 +0,0 @@
{#
SPDX-FileCopyrightText: 2023 Qusal contributors
SPDX-License-Identifier: GPL-3.0-or-later
#}
"{{ slsdotpath }}-copy-vim-home":
file.recurse:
- name: /home/user/
- source: salt://{{ slsdotpath }}/files/vim/
- file_mode: '0644'
- dir_mode: '0700'
- user: user
- group: user
"{{ slsdotpath }}-copy-vim-skel":
file.recurse:
- name: /etc/skel
- source: salt://{{ slsdotpath }}/files/vim/
- file_mode: '0644'
- dir_mode: '0700'
- user: root
- group: root

View File

@ -1,9 +0,0 @@
{#
SPDX-FileCopyrightText: 2023 Qusal contributors
SPDX-License-Identifier: GPL-3.0-or-later
#}
base:
'*':
- dotfiles.copy-vim

View File

@ -1,27 +0,0 @@
{#
SPDX-FileCopyrightText: 2023 Qusal contributors
SPDX-License-Identifier: GPL-3.0-or-later
#}
"{{ slsdotpath }}-copy-x11-home":
file.recurse:
- name: /home/user/
- source: salt://{{ slsdotpath }}/files/x11
- file_mode: '0755'
- dir_mode: '0755'
- user: user
- group: user
- keep_symlinks: True
- force_symlinks: True
"{{ slsdotpath }}-copy-x11-skel":
file.recurse:
- name: /etc/skel/
- source: salt://{{ slsdotpath }}/files/x11
- file_mode: '0755'
- dir_mode: '0755'
- user: root
- group: root
- keep_symlinks: True
- force_symlinks: True

View File

@ -1,9 +0,0 @@
{#
SPDX-FileCopyrightText: 2023 Qusal contributors
SPDX-License-Identifier: GPL-3.0-or-later
#}
base:
'*':
- dotfiles.copy-x11

View File

@ -1,37 +0,0 @@
# SPDX-FileCopyrightText: 2023 Qusal contributors
#
# SPDX-License-Identifier: GPL-3.0-or-later
[General]
window_size=@Size(824 500)
[columns]
Backup=true
Default%20DispVM=true
Disk%20Usage=true
IP=true
Internal=false
Is%20DVM%20Template=false
Label=true
Last%20backup=true
Name=true
NetVM=true
State=true
Template=true
Type=false
Virt%20Mode=false
[show]
all=true
halted=true
network=true
running=true
standalone=true
templates=true
[view]
compactview=true
sort_column=3
sort_order=0
# vim: ft=toml

View File

@ -1,154 +0,0 @@
; Global Git Config
; SPDX-FileCopyrightText: 2010 - 2017 Tim Pope <https://tpo.pe>
; SPDX-FileCopyrightText: 2016 The Qubes OS Project <https://www.qubes-os.org>
; SPDX-FileCopyrightText: 2023 Qusal contributors
;
; SPDX-License-Identifier: GPL-2.0-only
;
[alias]
; https://git.wiki.kernel.org/index.php/Aliases
; https://github.com/schacon/gitscm/tree/master
; Abbreviations
co = checkout
br = branch
sw = switch
ci = commit
cm = commit
st = status
df = diff
dc = diff --cached
gi = init
gib = init --bare
cu = rev-parse --abbrev-ref --symbolic-full-name @{upstream}
lg = !sh -c 'git log --color \"$@\"|fmt -s -w 79|less -FRSX' _
lgg = log --graph --pretty='format:%C(yellow)%h%C(reset) %C(magenta)%G?%C(reset) -%C(red)%d%C(reset) %C(reset)%s %C(green)(%cs)%C(reset) %C(blue)%aN%C(reset)'
r = remote
rl = remote -v
cf = config --file "$HOME/.gitconfig.local"
; Helpers
aliases = "!sh -c 'if test -n \"$1\"; then git config --get alias.$1; else git config --get-regexp \"alias.*\" | colrm 1 6 | sed \"s/[ ]/ = /\"; fi'" -
; Patch with subject prefix containing repository name and output
; directory has the child directories the repository and branch name.
fp = "!sh -c '\
git rev-parse --show-toplevel 2>&1 >/dev/null || return; \
repo=\"$(basename $(git rev-parse --show-toplevel) | \
sed s/^qubes-//)\"; \
outdir=\"$(git config format.outputDirectory)\"; \
ref=\"$(git symbolic-ref --short HEAD)\"; \
git format-patch \
--output-directory \"${outdir%*/}/${repo}/${ref}\" \
--subject-prefix=\"PATCH ${repo}\" \"${@}\" \
--diff-algorithm=histogram \
'" -
last = log -1 HEAD
unstage = reset HEAD --
undo = reset --soft HEAD^
changes = diff --name-status -r
diffstat = diff --stat -r
who = shortlog -s --
; whois <author name/e-mail>
whois = log -i -1 --pretty='format:%an <%ae>' --author
; whatis <commit name>
whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short
; See what commits have been created by the last command, eg: git pull
new = !sh -c 'git log $1@{1}..$1@{0} "$@"'
; List commits with the same the abbreviated hash.
abbr = "!sh -c 'git rev-list --all | grep ^$1 | while read commit; do git --no-pager log -n1 --pretty=format:\"%H %ci %an %s%n\" $commit; done' -"
; Solve merge conflicts
edit-unmerged = "!f() { git diff --name-status --diff-filter=U | cut -f2 ; }; vim $(f)"
add-unmerged = "!f() { git diff --name-status --diff-filter=U | cut -f2 ; }; git add $(f)"
; List tips of branches that are not in the first arg.
; git tips origin/master ^origin/alternate | git oneline
oneline ="!_() { $(test $# -eq 0 && echo xargs -L1) git log --no-walk --decorate --oneline \"$@\"; }; _"
tips = "!_() { t=$(git rev-list --no-merges --max-count=1 \"$@\"); if test -n \"$t\"; then echo $t; _ \"$@\" ^$t; fi; }; _"
; Submodules.
sub-update-recurse = !sh -c 'git checkout $1 && git submodule update --recursive'
; Signed tags and commits
stag = "!sh -c '\
commit_id=\"$(git rev-parse --verify HEAD)\"; \
tag_name=\"signed_tag_for_$(echo $commit_id | head -c 8)\"; \
git tag -s \"$tag_name\" -m \"Tag for commit $commit_id\"; \
echo \"$tag_name\"'"
ptag = !git push $(git config branch.$(git branch --show-current).remote) $(git describe)
vtag = !git verify-tag -v $(git describe)
vhead = !git verify-commit -v $(git rev-parse HEAD)
[blame]
coloring = repeatedLines
[branch]
autoSetupMerge = always
[color]
ui = auto
diff = auto
status = auto
branch = auto
interactive = auto
grep = auto
[commit]
gpgSign = true
verbose = true
template = ~/.config/git/message
[core]
excludesFile = ~/.config/git/ignore
pager = git-pager
[delta]
navigate = true
light = false
[diff]
algorithm = histogram
colorMoved = default
[diff "image"]
textConv = identify
[format]
coverLetter = auto
coverFromDescription = auto
thread = shallow
signOff = true
signatureFile = ~/.signature
outputDirectory = /tmp/patch
[gpg]
program = gpgw
minTrustLevel = fully
[grep]
extendedRegexp = true
lineNumber = true
[init]
defaultbranch = main
templatedir = ~/.config/git/template
[interactive]
diffFilter = delta --color-only
[mailinfo]
scissors = true
[merge]
verifySignatures = true
tool = vimdiff
conflictStyle = diff3
summary = true
[pull]
; Rebase does not verify signatures. Does not prevent manual rebase.
rebase = false
[push]
autoSetupRemote = true
default = nothing
followTags = true
[rebase]
autoSquash = true
[sendemail]
annotate = true
multiEdit = true
confirm = always
thread = shallow
chainReplyTo = true
xmailer = false
[tag]
forceSignAnnotated = true
gpgSign = true
[user]
hideTimezone = true
[includeIf "gitdir:~/**/qubes-*/**"]
path = ~/.config/git/config.d/qubes-devel
[include]
path = ~/.gitconfig.local
; vim: ft=gitconfig

View File

@ -1,10 +0,0 @@
; SPDX-FileCopyrightText: 2023 Qusal contributors
;
; SPDX-License-Identifier: GPL-3.0-or-later
[format]
to = qubes-devel@googlegroups.com
[sendemail]
to = qubes-devel@googlegroups.com
; vim: ft=gitconfig

View File

@ -1,35 +0,0 @@
# SPDX-FileCopyrightText: 2023 Qusal contributors
#
# SPDX-License-Identifier: GPL-3.0-or-later
# Local
*.local
!.local/
!rc.local
# Code
*.patch
*.diff
# Editor
.*.sw?
.*.tmp
*~
.#*
[#]*#
Session.vim
/tags
/doc/tags
## Debian build artifacts
**/debhelper-build-stamp
**/debian/files
**/debian/*.debhelper*
debian/*.postinst.debhelper
debian/*.postrm.debhelper
debian/*.preinst.debhelper
debian/*.prerm.debhelper
debian/*.substvars
*-build-deps_*.deb
*-build-deps_*.buildinfo
*-build-deps_*.changes

View File

@ -1,3 +0,0 @@
# Title: 50c, summary, imperative, start uppercase, end without period
# Body: 72c, explain 'what' and 'why' vs. 'how', include task ID

View File

@ -1,12 +0,0 @@
; ~/.gitconfig.local
; SPDX-FileCopyrightText: 2023 Qusal contributors
;
; SPDX-License-Identifier: GPL-3.0-or-later
[user]
email = your-mail@your-provider.domain
name = Your Name
signingKey = 0x012345678ABC
; vim: ft=gitconfig

View File

@ -1,28 +0,0 @@
# SPDX-FileCopyrightText: 2023 Qusal contributors
#
# SPDX-License-Identifier: GPL-3.0-or-later
## guarantee commands are run from $HOME
cd
base="src"
fail_invalid_name(){
printf '%s\n' "error: invalid $1 name"
exit 1
}
test_name(){
name="$1"
if ! (echo "$name" | grep -q "^[A-Za-z0-9][A-Za-z0-9_.-]\+[A-Za-z0-9]$")
then
fail_invalid_name repository
fi
}
clean_repo_name(){
case "${repo-}" in
*.git) repo="";;
*) repo="$repo.git";;
esac
}

View File

@ -1,26 +0,0 @@
#!/bin/sh
## SPDX-FileCopyrightText: 2023 Qusal contributors
##
## SPDX-License-Identifier: GPL-3.0-or-later
set -eu
# shellcheck disable=SC1090
. ~/git-shell-commands/.git-shell-lib
usage(){
printf '%s\n' "usage: ${0##*/} SECTION REPOSITORY"
printf '%s\n' "regex: ^[A-Za-z0-9][A-Za-z0-9_.-]\+[A-Za-z0-9]$"
exit 1
}
test -n "${2-}" || usage
section="$2"
test_name "$section"
repo="$2"
test_name "$repo"
clean_repo_name
# shellcheck disable=SC2154
cat | cut -c 1-80 | tee "$base/$section/$repo/description"

View File

@ -1,9 +0,0 @@
#!/bin/sh
## SPDX-FileCopyrightText: 2023 Qusal contributors
##
## SPDX-License-Identifier: GPL-3.0-or-later
set -eu
ls ~/git-shell-commands

View File

@ -1,35 +0,0 @@
#!/bin/sh
## SPDX-FileCopyrightText: 2023 Qusal contributors
##
## SPDX-License-Identifier: GPL-3.0-or-later
set -eu
# shellcheck disable=SC1090
. ~/git-shell-commands/.git-shell-lib
usage(){
printf '%s\n' "usage: ${0##*/} SECTION REPOSITORY [BRANCH]"
printf '%s\n' "regex: ^[A-Za-z0-9][A-Za-z0-9_.-]\+[A-Za-z0-9]$"
exit 1
}
test -n "${1-}" || usage
section="$1"
test_name "$section"
repo="$2"
test_name "$repo"
clean_repo_name
branch=""
test -n "${3-}" && branch="$3"
if test -n "${branch}"; then
test_name "$branch"
fi
# shellcheck disable=SC2154
git init \
--bare \
${branch:+--initial-branch $branch} \
-- "$base/$section/$repo"

View File

@ -1,17 +0,0 @@
#!/bin/sh
## SPDX-FileCopyrightText: 2023 Qusal contributors
##
## SPDX-License-Identifier: GPL-3.0-or-later
set -eu
# shellcheck disable=SC1090
. ~/git-shell-commands/.git-shell-lib
# shellcheck disable=SC2154
if command -v tree >/dev/null; then
tree -L 1 "$base"
else
find "$base" -maxdepth 1 -type d
fi

View File

@ -1,23 +0,0 @@
#!/bin/sh
## SPDX-FileCopyrightText: 2023 Qusal contributors
##
## SPDX-License-Identifier: GPL-3.0-or-later
set -eu
command -v git >/dev/null || exit 1
printf '%s\n' "Hi $USER! You've successfully authenticated, but I do not"
printf '%s\n' "provide interactive shell access."
printf '%s\n' "You have access to these repositories:"
for dir in ~/src/*.git; do
test -d "$dir" || continue
test git -C "$dir" rev-parse --is-bare-repository = "true" || continue
printf '%s\t\t' "${dir##*/}"
if grep -q "^Unnamed repository" "$dir"/description; then
printf '\n'; continue
fi
cat "$dir"/description
done
exit 128

View File

@ -1,17 +0,0 @@
; SPDX-FileCopyrightText: 2023 Qusal contributors
;
; SPDX-License-Identifier: GPL-3.0-or-later
[branch "main"]
remote = origin
merge = refs/heads/main
rebase = true
[core]
repositoryFormatVersion = 0
fileMode = true
bare = false
logAllRefUpdates = true
[init]
defaultBranch = main
; vim: ft=gitconfig

View File

@ -1,51 +0,0 @@
#!/bin/sh
# SPDX-FileCopyrightText: 2023 Qusal contributors
#
# SPDX-License-Identifier: GPL-3.0-or-later
## TODO: unfinished
# shellcheck disable=SC2317
exit 0
set -eu
command -v git >/dev/null || exit 1
exit_code=0
zero_commit="0000000000000000000000000000000000000000"
while read -r oldrev newrev ref; do
#read -r oldrev newrev ref
echo "$oldrev $newrev $ref"
test "$newrev" = "$zero_commit" && continue
if test "$oldrev" = "$zero_commit"; then
objects="$(git rev-list "$newrev")"
else
objects="$(git rev-list "$oldrev..$newrev")"
fi
for commit in $objects; do
git verify-commit "$commit" >/dev/null 2>&1 && return
## WARNING: tag verification is not working as expected.
commit_tag="$(git tag --points-at="$commit")"
if test -z "$commit_tag"; then
echo "Commit couldn't be verified and no tag points to it: $commit"
exit_code=1
continue
fi
if git verify-tag "$commit_tag" >/dev/null 2>&1; then
echo "Tag verification succeeded for commit: $commit"
continue
fi
echo "Commit verification failed: $commit"
exit_code=1
done
if test "$exit_code" != "0"; then
exit "$exit_code"
fi
done

View File

@ -1,5 +0,0 @@
# SPDX-FileCopyrightText: 2023 Qusal contributors
#
# SPDX-License-Identifier: GPL-3.0-or-later
*.local

View File

@ -1,75 +0,0 @@
# SPDX-FileCopyrightText: 2020 Jona Fonseca <jonas.fonseca@gmail.com>
#
# SPDX-License-Identifier: GPL-3.0-or-later
# Credits: https://github.com/jonas/tig/blob/master/contrib/vim.tigrc
bind generic h scroll-left
bind generic j move-down
bind generic k move-up
bind generic l scroll-right
bind generic g none
bind generic gg move-first-line
bind generic gj next
bind generic gk previous
bind generic gp parent
bind generic gP back
bind generic gn view-next
bind main G move-last-line
bind generic G move-last-line
bind generic <C-f> move-page-down
bind generic <C-b> move-page-up
bind generic v none
bind generic vm view-main
bind generic vd view-diff
bind generic vl view-log
bind generic vt view-tree
bind generic vb view-blob
bind generic vx view-blame
bind generic vr view-refs
bind generic vs view-status
bind generic vu view-stage
bind generic vy view-stash
bind generic vg view-grep
bind generic vp view-pager
bind generic vh view-help
bind generic o none
bind generic oo :toggle sort-order
bind generic os :toggle sort-field
bind generic on :toggle line-number
bind generic od :toggle date
bind generic oa :toggle author
bind generic og :toggle line-graphics
bind generic of :toggle file-name
bind generic op :toggle ignore-space
bind generic oi :toggle id
bind generic ot :toggle commit-title-overflow
bind generic oF :toggle file-filter
bind generic or :toggle commit-title-refs
bind generic @ none
bind generic @j :/^@@
bind generic @k :?^@@
bind generic @- :toggle diff-context -1
bind generic @+ :toggle diff-context +1
bind status u none
bind stage u none
bind generic uu status-update
bind generic ur status-revert
bind generic um status-merge
bind generic ul stage-update-line
# bind generic up stage-update-parte
bind generic us stage-split-chunk
bind generic c none
bind generic cc !git commit
bind generic ca !?@git commit --amend --no-edit
bind generic K view-help
bind generic <C-w><C-w> view-next

View File

@ -1,5 +0,0 @@
# SPDX-FileCopyrightText: 2023 The Qubes OS Project <https://www.qubes-os.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
file:///home/user/QubesIncoming

View File

@ -1,19 +0,0 @@
# SPDX-FileCopyrightText: 2023 Qusal contributors
#
# SPDX-License-Identifier: GPL-3.0-or-later
gtk-theme-name=Adwaita-Dark
gtk-icon-theme-name=Adwaita
gtk-font-name="Sans 10"
gtk-cursor-theme-size=0
gtk-toolbar-style=GTK_TOOLBAR_TEXT
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
gtk-button-images=0
gtk-menu-images=1
gtk-enable-event-sounds=1
gtk-enable-input-feedback-sounds=1
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle=hintfull
gtk-xft-rgba=rgb
gtk-cursor-theme-name=Adwaita

View File

@ -1,3 +0,0 @@
# SPDX-FileCopyrightText: 2023 The Qubes OS Project <https://www.qubes-os.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,5 +0,0 @@
# SPDX-FileCopyrightText: 2023 The Qubes OS Project <https://www.qubes-os.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
file:///home/user/QubesIncoming

View File

@ -1,3 +0,0 @@
# SPDX-FileCopyrightText: 2023 The Qubes OS Project <https://www.qubes-os.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later

View File

@ -1,20 +0,0 @@
# SPDX-FileCopyrightText: 2023 Qusal contributors
#
# SPDX-License-Identifier: GPL-3.0-or-later
[Settings]
gtk-theme-name=Adwaita-Dark
gtk-icon-theme-name=Adwaita
gtk-font-name=Sans 10
gtk-cursor-theme-size=0
gtk-toolbar-style=GTK_TOOLBAR_TEXT
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
gtk-button-images=0
gtk-menu-images=1
gtk-enable-event-sounds=1
gtk-enable-input-feedback-sounds=1
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle=hintfull
gtk-xft-rgba=rgb
gtk-cursor-theme-name=Adwaita

View File

@ -1,5 +0,0 @@
# SPDX-FileCopyrightText: 2023 The Qubes OS Project <https://www.qubes-os.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
file:///home/user/QubesIncoming

View File

@ -1,20 +0,0 @@
# SPDX-FileCopyrightText: 2023 Qusal contributors
#
# SPDX-License-Identifier: GPL-3.0-or-later
[Settings]
gtk-theme-name=Adwaita-Dark
gtk-icon-theme-name=Adwaita
gtk-font-name=Sans 10
gtk-cursor-theme-size=0
gtk-toolbar-style=GTK_TOOLBAR_TEXT
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
gtk-button-images=0
gtk-menu-images=1
gtk-enable-event-sounds=1
gtk-enable-input-feedback-sounds=1
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle=hintfull
gtk-xft-rgba=rgb
gtk-cursor-theme-name=Adwaita

View File

@ -1 +0,0 @@
curlrc

View File

@ -1,5 +0,0 @@
# SPDX-FileCopyrightText: 2023 Qusal contributors
#
# SPDX-License-Identifier: GPL-3.0-or-later
show-error

View File

@ -1,5 +0,0 @@
# SPDX-FileCopyrightText: 2023 Qusal contributors
#
# SPDX-License-Identifier: GPL-3.0-or-later
REGEXP \b(((https?|ftp|gopher)|mailto):(//)?[^ <>"\t]*|(www|ftp)[0-9]?\.[-a-z0-9.]+)[^ .,;\t\n\r<">\):]?[^, <>"\t]*[^] .,;\t\n\r<">\):]

View File

@ -1,5 +0,0 @@
# SPDX-FileCopyrightText: 2023 Qusal contributors
#
# SPDX-License-Identifier: GPL-3.0-or-later
hsts-file=~/.cache/wget-hsts

View File

@ -1 +0,0 @@
.config/urlview/urlview

View File

@ -1,256 +0,0 @@
## SPDX-FileCopyrightText: 2023 Qusal contributors
##
## SPDX-License-Identifier: GPL-3.0-only
## w3m vim-like keymap file
## Credits: https://github.com/sansna/keymap.w3m/blob/master/keymap.w3m
########## invalidate defaults ##########
keymap K NULL
keymap J NULL
keymap SPC NULL
keymap - NULL
keymap + NULL
keymap C-v NULL
keymap ESC-v NULL
keymap C-f NULL
keymap C-b NULL
keymap C-n NULL
keymap C-p NULL
keymap < NULL
keymap > NULL
keymap . NULL
keymap , NULL
keymap ^ NULL
keymap C-a NULL
keymap W NULL
keymap ^[[6~ NULL
keymap ^[[5~ NULL
keymap g NULL
keymap ^[[1~ NULL
keymap ^[[4~ NULL
keymap ESC-< NULL
keymap ESC-> NULL
keymap [ NULL
keymap ] NULL
keymap ^[[Z NULL
keymap ESC-m NULL
keymap ( NULL
keymap ) NULL
keymap C-j NULL
keymap C-m NULL
keymap ESC-C-j NULL
keymap ESC-C-m NULL
keymap ESC-w NULL
keymap ESC-W NULL
keymap C-s NULL
keymap = NULL
keymap ESC-l NULL
keymap U NULL
keymap V NULL
keymap v NULL
keymap R NULL
keymap ESC-s NULL
keymap : NULL
keymap C-q NULL
keymap T NULL
keymap } NULL
keymap { NULL
keymap ESC-a NULL
keymap ESC-b NULL
keymap c NULL
keymap ESC-: NULL
keymap C-h NULL
keymap q NULL
keymap Q NULL
keymap C-w NULL
keymap C-d NULL
keymap C-u NULL
keymap RIGHT NULL
keymap l NULL
keymap LEFT NULL
keymap h NULL
keymap j NULL
keymap DOWN NULL
keymap k NULL
keymap UP NULL
keymap C-e NULL
keymap C-y NULL
keymap 0 NULL
keymap $ NULL
keymap Z NULL
keymap z NULL
keymap ESC-g NULL
keymap gg NULL
keymap G NULL
keymap w NULL
keymap b NULL
keymap C-n NULL
keymap C-p NULL
keymap ESC-TAB NULL
keymap f NULL
keymap C-o NULL
keymap TAB NULL
keymap C-j NULL
keymap C-] NULL
keymap I NULL
keymap ESC-I NULL
keymap ESC-C-j NULL
keymap y NULL
keymap u NULL
keymap i NULL
keymap gC-g NULL
keymap C-g NULL
keymap ";" NULL
keymap M NULL
keymap ESC-M NULL
keymap F NULL
keymap ESC-u NULL
keymap t NULL
keymap @ NULL
keymap "#" NULL
keymap | NULL
keymap B NULL
keymap L NULL
keymap H NULL
keymap s NULL
keymap gf NULL
keymap S NULL
keymap E NULL
keymap ESC-e NULL
keymap C-r NULL
keymap r NULL
keymap C-l NULL
keymap C-t NULL
keymap d NULL
keymap gt NULL
keymap gT NULL
keymap ESC-t NULL
keymap C-wL NULL
keymap C-wH NULL
keymap a NULL
keymap n NULL
keymap N NULL
keymap / NULL
keymap ? NULL
keymap C-@ NULL
keymap ESC-n NULL
keymap ESC-p NULL
keymap \" NULL
keymap ^[[2~ NULL
keymap ^[[28~ NULL
keymap ^[[E NULL
keymap ^[[L NULL
keymap o NULL
keymap C-k NULL
keymap D NULL
keymap m NULL
keymap ESC-c NULL
keymap ESC-o NULL
keymap ESC-k NULL
keymap \\ NULL
keymap ! NULL
keymap C-z NULL
keymap ZZ NULL
keymap ZQ NULL
########## command ##########
keymap :: COMMAND
keymap :H HELP
keymap :O OPTIONS
keymap :d DOWNLOAD_LIST
########## history navigation ##########
keymap L NEXT
keymap H PREV
keymap :p SELECT_MENU
keymap :h HISTORY
########## scrolling ##########
keymap C-e UP
keymap C-y DOWN
keymap gg BEGIN
keymap G END
keymap C-f NEXT_PAGE
keymap C-d NEXT_PAGE
keymap d NEXT_PAGE
keymap C-b PREV_PAGE
keymap C-u PREV_PAGE
keymap u PREV_PAGE
keymap zz CENTER_V
########## cursor ##########
#keymap l MOVE_RIGHT
keymap l NEXT_TAB
#keymap h MOVE_LEFT
keymap h PREV_TAB
#keymap j MOVE_DOWN1
keymap j UP
#keymap k MOVE_UP1
keymap k DOWN
keymap RIGHT MOVE_RIGHT
keymap LEFT MOVE_LEFT
keymap DOWN MOVE_DOWN1
keymap UP MOVE_UP1
keymap 0 LINE_BEGIN
keymap $ LINE_END
keymap w NEXT_WORD
keymap b PREV_WORD
########## cursor history ##########
keymap C-i REDO
keymap C-o UNDO
########## navigation ##########
keymap f MOVE_LIST_MENU
keymap F LIST_MENU
keymap C-n NEXT_LINK
keymap C-p PREV_LINK
keymap :l PEEK_LINK
# reload
keymap r RELOAD
keymap C-r RELOAD
# save/load
keymap :w SAVE
keymap :W PRINT
keymap :o GOTO
keymap :e LOAD
# jump
keymap ESC-C-j SUBMIT
keymap C-] TAB_LINK
keymap C-j GOTO_LINK
########## info ##########
keymap y PEEK
keymap gC-g INFO
keymap C-g LINE_INFO
keymap gf VIEW
########## search ##########
keymap / ISEARCH
keymap ? ISEARCH_BACK
keymap n SEARCH_NEXT
keymap N SEARCH_PREV
########## bookmarks ##########
keymap a ADD_BOOKMARK
keymap :b VIEW_BOOKMARK
########## tab ##########
keymap x CLOSE_TAB
keymap gh GOTO http://www.google.com/en
keymap gH TAB_GOTO http://www.google.com/en
keymap C-t NEW_TAB
keymap gt NEXT_TAB
keymap gT PREV_TAB
keymap C-wL TAB_RIGHT
keymap C-wH TAB_LEFT
keymap t TAB_GOTO
keymap T TAB_MENU
########## quit ##########
keymap ZZ EXIT
keymap C-Q EXIT
keymap ZQ QUIT
keymap :q QUIT

View File

@ -1,23 +0,0 @@
## SPDX-FileCopyrightText: 2012 - 2013 Jacob Appelbaum <jacob@torproject.org>
## SPDX-FileCopyrightText: 2012 - 2013 Sukhbir Singh <sukhbir@torproject.org>
## SPDX-FileCopyrightText: 2023 Qusal contributors
##
## SPDX-License-Identifier: BSD-2-Clause
## Credits: https://github.com/ioerror/torbirdy/blob/master/gpg.conf
## Algo
personal-digest-preferences SHA512
cert-digest-algo SHA512
default-preference-list SHA512 SHA384 SHA256 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed
## Show
display-charset utf-8
keyid-format long
list-options show-uid-validity
no-comments
verify-options show-uid-validity
with-fingerprint
with-subkey-fingerprint
## vim: ft=gpg

View File

@ -1,38 +0,0 @@
#!/bin/sh
##
## SPDX-FileCopyrightText: 2023 Qusal contributors
##
## SPDX-License-Identifier: GPL-3.0-or-later
##
## Benefits of this method:
## - faster than salt, no need for a dispvm.
## - preserve permisions, salt-ssh doesnt.
## Disadvantages:
## - files need be copied to dom0 preserving permissions or setting again.
##
## Commands to run:
## sudo ./qvm-copy-dotfiles QUBE
set -eu
test -n "${1:-}" || { echo "usage: ${0##*/} QUBE"; exit 1; }
test "$(id -u)" = "0" || { echo "Program requires root."; exit 1; }
vm="$1"
qvm-check "$vm" >/dev/null 2>&1 || { echo "VM doesn't exist: '$vm'"; exit 1; }
test -f ./setup.sh || { echo "File doesn't exist: './setup.sh'"; exit 1; }
if test "$vm" = "dom0"; then
sh ./dotfiles/setup.sh
sudo -u user mkdir -pv /home/user/.cache
tmpdir="$(sudo -u user mktemp -d /home/user/.cache/XXXXXX)"
trap 'rm -rf -- "$tmpdir"' EXIT INT HUP QUIT ABRT
cp -r ./dotfiles "$tmpdir"
chown -R user:user "$tmpdir"
sudo -u user "$tmpdir/dotfiles/setup.sh"
exit
fi
qvm-run -q "$vm" -- "rm -rf ~/QubesIncoming/dom0/files"
qvm-copy-to-vm "$vm" ../files
qvm-run -q "$vm" -- "sh ~/QubesIncoming/dom0/files/setup.sh"
qvm-run -q "$vm" -- "rm -rf ~/QubesIncoming/dom0/files"

View File

@ -1,45 +0,0 @@
#!/bin/sh
## SPDX-FileCopyrightText: 2023 Qusal contributors
##
## SPDX-License-Identifier: GPL-3.0-or-later
set -eu
prg="$0"
if ! test -e "$prg"; then
case "$prg" in
(*/*) exit 1;;
(*) prg=$(command -v -- "$prg") || exit;;
esac
fi
dir="$(cd -P -- "$(dirname -- "$prg")" && pwd -P)" || exit 1
prg="$dir/$(basename -- "$prg")" || exit 1
cd -- "$dir" || exit 1
usage(){
printf '%s\n' "Usage: ${0##*/} [-h|--help] DIR [DIR2...]"
printf '%s\n' "Example: ${0##*/} # deploy all"
printf '%s\n' "Example: ${0##*/} sh vim ... # deploy specific dirs"
}
case "${1-}" in
-h|--help) usage; exit 1;;
""|--all) args="$(find . -maxdepth 1 -type d)";;
*) args="${*}";;
esac
for dir in $args; do
case "${dir##*/}" in "."|"..") continue;; esac
dir="${dir%*/}"
test -f "$dir" && continue
if ! test -d "$dir"; then
printf '%s\n' "Directory doesn't exist: '$dir'." >&2
exit 1
fi
for file in "$dir"/.*; do
test -e "$file" || continue
case "${file##*/}" in "."|"..") continue;; esac
cp -rv "$file" "$HOME"
done
done

View File

@ -1 +0,0 @@
.config/bash/bash_env

View File

@ -1 +0,0 @@
.config/bash/bash_logout

View File

@ -1 +0,0 @@
.config/bash/bash_profile

View File

@ -1 +0,0 @@
.config/bash/bashrc

View File

@ -1,15 +0,0 @@
#!/bin/sh
## SPDX-FileCopyrightText: 2004 - 2022 Tim Pope <https://tpo.pe>
## SPDX-FileCopyrightText: 2023 Qusal contributors
##
## SPDX-License-Identifier: GPL-3.0-or-later
# shellcheck disable=SC1090,SC1091
if test -z "$ENV" && test -n "$PATH"; then
case $- in
*l*) ;;
*) . "$HOME/.bash_profile" >/dev/null ;;
esac
fi

View File

@ -1,9 +0,0 @@
#!/usr/bin/env bash
## SPDX-FileCopyrightText: 2004 - 2022 Tim Pope <https://tpo.pe>
## SPDX-FileCopyrightText: 2023 Qusal contributors
##
## SPDX-License-Identifier: GPL-3.0-or-later
test "0${SHLVL-}" -le 1 && test -z "${SSH_TTY-}" &&
test "${TERM-}" = linux && clear

View File

@ -1,10 +0,0 @@
#!/bin/sh
## SPDX-FileCopyrightText: 2023 Qusal contributors
##
## SPDX-License-Identifier: GPL-3.0-or-later
# shellcheck disable=SC1090,1091
. "$HOME/.profile"
case $- in *i*) . "$HOME/.bashrc";; esac

View File

@ -1,106 +0,0 @@
#!/usr/bin/env bash
## SPDX-FileCopyrightText: 2023 Qusal contributors
##
## SPDX-License-Identifier: GPL-3.0-or-later
## {{{ Requirements
## If not running interactively, return.
case $- in
*i*) ;;
*) return;;
esac
## Source default files.
# shellcheck disable=SC1090,SC1091
source "$HOME/.profile"
# shellcheck disable=SC1090
source "$ENV"
## }}}
## {{{ Options
HISTCONTROL=ignoredups
shopt -s autocd
shopt -s direxpand
shopt -s cdspell
shopt -s dirspell
shopt -s histappend
shopt -s checkwinsize
shopt -s extglob
shopt -s globstar
## }}}
## {{{ Alias
alias reload="exec bash"
## }}}
## {{{ Prompt
if test -z "${debian_chroot:-}" && test -r /etc/debian_chroot; then
debian_chroot="$(cat /etc/debian_chroot)"
fi
_reset_line() {
## Credit: Can't find the source, posted on StackExchange or alike.
## Does not work well on Bash 5.0 and older.
test "$(echo "${BASH_VERSION%.*}" | tr -d ".")" -lt 51 && return
local termios cur_y
## Ask the terminal for any pending (line buffered) input.
termios=$(stty --save) && stty -icanon && stty "$termios"
## 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 ]]
}
then
## Print line ending char with reversed video and end with newline.
printf '%b' "\033[41m\033[0m\033[7m%\033[m\n\r"
fi
}
_print_ec(){
test "${_ec_ps1}" = "0" && return
if test "${color_prompt:-}" = "yes"; then
printf %s"(\001\033[31m\002${_ec_ps1}\001\033[0m\002)"
else
printf '%s' "(${_ec_ps1})"
fi
}
_save_ec() { _ec_ps1=$?; }
PROMPT_COMMAND=(_save_ec)
newline=$'\n'
if test "${color_prompt:-}" = "yes"; then
# shellcheck disable=SC2154
PS1="\$(_reset_line)\[\033[35m\][\[${reset_color}\]${debian_chroot:+($debian_chroot)}\[${usercolor}\]\u@\h \[${dircolor}\]\w\[${reset_color}\]\$(_git_prompt_info)\[\033[35m\]]\[${reset_color}\]${newline-}\$(_print_ec)${ps1_symbol} "
else
PS1="\$(_reset_line)[${debian_chroot:+($debian_chroot)}\u@\h:\w\$(_git_prompt_info)]${newline-}\$(_print_ec)${ps1_symbol} "
fi
## If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
esac
## Reset cursor to steady block after command input and before execution.
# shellcheck disable=SC2034
PS0="\e[2 q\2"
if ! shopt -oq posix; then
source_readable /usr/share/bash-completion/bash_completion
fi
unset newline ps1_symbol
## }}}
## {{{ Plugins
if has zoxide; then
eval "$(zoxide init bash)"
fi
source_readable /usr/share/doc/fzf/examples/key-bindings.bash
source_readable /usr/share/doc/fzf/examples/completion.bash
## }}}
## {{{ End
## Source local bash configuration.
source_readable "$HOME/.bashrc.local"
## }}}

View File

@ -1,136 +0,0 @@
# inputrc
## SPDX-FileCopyrightText: 2023 Qusal contributors
##
## SPDX-License-Identifier: GPL-3.0-or-later
$include /etc/inputrc
## Options
set bell-style none
set show-all-if-ambiguous on
set colored-stats on
set visible-stats on
set mark-symlinked-directories on
set colored-completion-prefix on
set menu-complete-display-prefix on
set skip-completed-text
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"
$else
set emacs-mode-string "\1\e[6 q\2"
set vi-ins-mode-string "\1\e[6 q\2"
set vi-cmd-mode-string "\1\e[2 q\2"
$endif
## Mode
$if mode=emacs
set keymap emacs-ctlx
v: vi-editing-mode
Control-v: "\C-xv\e"
Esc: "\C-xv\e"
set keymap emacs
$else
set keymap vi-insert
Control-a: beginning-of-line
Control-b: backward-char
Control-d: delete-char
Control-e: end-of-line
Control-f: forward-char
Control-j: accept-line
Control-k: kill-line
Control-l: clear-screen
Control-m: accept-line
Control-n: next-history
Control-p: previous-history
Control-r: reverse-search-history
Control-s: forward-search-history
Control-t: transpose-chars
Control-u: unix-line-discard
Control-v: quoted-insert
Control-w: backward-kill-word
Control-y: yank
Control-[: vi-movement-mode
Control-_: undo
Control-?: backward-delete-char
Space: self-insert
set keymap vi-command
Control-d: vi-eof-maybe
Control-h: backward-char
Control-j: accept-line
Control-k: kill-line
Control-l: clear-screen
Control-m: accept-line
Control-n: next-history
Control-p: previous-history
Control-q: quoted-insert
Control-r: vi-redo
Control-t: transpose-chars
Control-u: unix-line-discard
Control-v: quoted-insert
Control-w: backward-kill-word
Control-y: yank
Control-u: vi-undo
Control-?: backward-delete-char
Space: forward-char
$endif
## Application
$if Bash
Control-w: backward-kill-word
$endif
## Home
"\e[1~": beginning-of-line
"\e[H": beginning-of-line
"\eOH": beginning-of-line
## End
"\e[4~": end-of-line
"\e[F": end-of-line
"\eOF": end-of-line
## Delete
"\e[3~": delete-char
"\e[P": delete-char
"\eOP": delete-char
## Insert
"\e[2~": quoted-insert
"\e[L": quoted-insert
## PgUp
"\e[5~": beginning-of-history
"\e[I": beginning-of-history
## PgDown
"\e[6~": end-of-history
"\e[G": end-of-history
## Ctrl+RighArrow
"\e[1;5C": forward-word
"\e[5C": forward-word
"\e\e[C": forward-word
## Ctrl+LeftArrow
"\e[1;5D": backward-word
"\e[5D": backward-word
"\e\e[D": backward-word
## Terminal
$if term=rxvt
"\e[7~": beginning-of-line
"\e[8~": end-of-line
"\eOc": forward-word
"\eOd": backward-word
$endif

View File

@ -1,174 +0,0 @@
# dircolors
## SPDX-FileCopyrightText: 2004 - 2022 Tim Pope <https://tpo.pe>
## SPDX-FileCopyrightText: 2023 Qusal contributors
##
## SPDX-License-Identifier: GPL-3.0-or-later
# Credits: https://github.com/tpope/dotfiles/blob/master/.dir_colors
# vim: set ft=dircolors
# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
# slackware version of dircolors) are recognized but ignored.
# Below are TERM entries, which can be a glob patterns, to match
# against the TERM environment variable to determine if it is colorizable.
TERM Eterm
TERM ansi
TERM *color*
TERM con[0-9]*x[0-9]*
TERM cons25
TERM console
TERM cygwin
TERM dtterm
TERM gnome
TERM hurd
TERM jfbterm
TERM konsole
TERM kterm
TERM linux
TERM linux-c
TERM mlterm
TERM putty
TERM rxvt*
TERM screen*
TERM st
TERM terminator
TERM tmux*
TERM vt100
TERM xterm*
# Below are the color init strings for the basic file types.
# One can use codes for 256 or more colors supported by modern terminals.
# The default color codes use the capabilities of an 8 color terminal
# with some additional attributes as per the following codes:
# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
#NORMAL 00 # no color code at all
#FILE 00 # regular file: use no color at all
#RESET 0 # reset to "normal" color
DIR 01;34 # directory
LINK 01;36 # symbolic link. (If you set this to 'target' instead of a
# numerical value, the color is as for the file pointed to.)
# MULTIHARDLINK 00 # regular file with more than one link
FIFO 33 # pipe
SOCK 01;35 # socket
# DOOR 01;44 # door
BLK 00;35 # block device driver
CHR 01;33 # character device driver
ORPHAN 00;41 # symlink to nonexistent file
MISSING 00;45 # said nonexistent file
SETUID 37;41 # file that is setuid (u+s)
SETGID 30;43 # file that is setgid (g+s)
#CAPABILITY 30;41 # file with capability
STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w)
OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable
# This is for files with execute permission:
EXEC 01;32
# List any file extensions like '.gz' or '.tar' that you would like ls
# to colorize below. Put the extension, a space, and the color init string.
# (and any comments you want to add after a '#')
# If you use DOS-style suffixes, you may want to uncomment the following:
.cmd 00;32
.exe 00;32
.com 00;32
.btm 00;32
.bat 00;32
# Or if you want to colorize scripts even if they do not have the
# executable bit actually set.
#.sh 01;32
#.csh 01;32
# archives or compressed (bright red)
.tar 01;31
.tgz 01;31
.arc 01;31
.arj 01;31
.taz 01;31
.lha 01;31
.lz4 01;31
.lzh 01;31
.lzma 01;31
.tlz 01;31
.txz 01;31
.tzo 01;31
.t7z 01;31
.zip 01;31
.ZIP 01;31
.z 01;31
.Z 01;31
.dz 01;31
.gz 01;31
.lrz 01;31
.lz 01;31
.lzo 01;31
.xz 01;31
.zst 01;31
.tzst 01;31
.bz2 01;31
.bz 01;31
.tbz 01;31
.tbz2 01;31
.tz 01;31
.deb 01;31
.rpm 01;31
.jar 01;31
.war 01;31
.ear 01;31
.sar 01;31
.rar 01;31
.alz 01;31
.ace 01;31
.zoo 01;31
.cpio 01;31
.7z 01;31
.rz 01;31
.cab 01;31
.wim 01;31
.swm 01;31
.dwm 01;31
.esd 01;31
# backup and temporary files
*~ 01;30
*- 01;30
.old 01;30
.OLD 01;30
.bak 01;30
.BAK 01;30
.back 01;30
.dpkg-old 01;30
.swp 01;30
.swo 01;30
.aux 01;30
.bbl 01;30
.glo 01;30
.gls 01;30
.ind 01;30
.idx 01;30
.blg 01;30
# system libraries, etc.
.so 00;33
.o 00;33
.a 00;33
.dll 00;33
.rbc 00;33
.pyc 00;33
.class 00;33
# patches
.diff 00;31
.patch 00;31
# misc.
.dpkg-dist 01;37
*core 01;37
.lnk 01;36
.url 01;36

View File

@ -1,20 +0,0 @@
#!/bin/sh
## SPDX-FileCopyrightText: 2004 - 2022 Tim Pope <https://tpo.pe>
## SPDX-FileCopyrightText: 2023 Qusal contributors
##
## SPDX-License-Identifier: GPL-3.0-or-later
## Credits: https://github.com/tpope/dotfiles/blob/master/.lessfilter
set -eu
if test -d "$1"; then
exec ls -lF "$1"
else
case $1 in
*.json) command -v jq >/dev/null && exec jq -C . "$1";;
esac
fi
exit 1

View File

@ -1,21 +0,0 @@
## SPDX-FileCopyrightText: 2013 - 2016 Tim Pope <https://tpo.pe>
##
## SPDX-License-Identifier: GPL-3.0-or-later
## Credits: https://github.com/tpope/dotfiles/blob/master/.lesskey
#command
h left-scroll
l right-scroll
i toggle-option i
\b back-screen
^H back-screen
^? back-screen
\\ quit
#line-edit
^A home
^B left
^E end
^F right
^N down
^P up
\ef word-right

View File

@ -1,133 +0,0 @@
#!/bin/sh
## SPDX-FileCopyrightText: 2023 Qusal contributors
##
## SPDX-License-Identifier: GPL-3.0-or-later
## Not so invasive because it only assigns a value if it is empty.
: "${HOME:=$(cd ~ && pwd)}"
: "${USER:=$(id -un || printf %s "${HOME##*/}")}"
: "${UID:=$(id -u || awk -F':' -v user="$USER" '/^user:/{print $3}' /etc/passwd)}"
: "${HOSTNAME:=$(hostname)}"
export HOME USER UID HOSTNAME
## Set XDG_*_HOME variables.
XDG_CONFIG_HOME="$HOME/.config"
XDG_CACHE_HOME="$HOME/.cache"
XDG_DATA_HOME="$HOME/.local/share"
XDG_STATE_HOME="$HOME/.local/state"
export XDG_CONFIG_HOME XDG_CACHE_HOME XDG_DATA_HOME XDG_STATE_HOME
mkdir -p "$XDG_CONFIG_HOME" "$XDG_CACHE_HOME" "$XDG_DATA_HOME" "$XDG_STATE_HOME"
## Set XDG_*_DIR variables.
eval "$(grep "^[ ]*XDG_[A-Z].*_DIR=" "$XDG_CONFIG_HOME/user-dirs.dirs" |
sed "s/^/export /")"
## Set directory to be used for coding.
CODEDIR="$HOME/src"
export CODEDIR
## Set shell configuration directories.
SHDIR="$XDG_CONFIG_HOME/sh"
BASHDIR="$XDG_CONFIG_HOME/bash"
ZDOTDIR="$XDG_CONFIG_HOME/zsh"
export SHDIR BASHDIR ZDOTDIR
## Set general variables.
PATH="$HOME/bin:$HOME/.local/bin/$HOSTNAME:$HOME/.local/bin"
PATH="$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
PATH="$PATH:/usr/local/games:/usr/games"
# INFOPATH="/usr/local/share/info:/usr/local/info:/usr/share/info:/usr/info"
# MANPATH="/usr/local/man:/usr/local/share/man:/usr/share/man:/usr/man"
ENV="$SHDIR/shrc"
BASH_ENV="$BASHDIR/bash_env"
TMPDIR="/tmp"
LANG="en_US.UTF-8"
LANGUAGE="${LANG%.*}"
LC_ALL="$LANG"
GNUPGHOME="$HOME/.gnupg"
export PATH INFOPATH MANPATH ENV TMPDIR LANG LANGUAGE LC_ALL GNUPGHOME
## Set interactive shell variables.
HISTSIZE=10000
EDITOR="$(has -s vim vim.tiny vi)"
test -n "$EDITOR" && VISUAL="$EDITOR"
TERMINAL="xterm"
BROWSER="chromium"
PAGER="less"
LESS="FRq#10"
GPG_TTY="$(tty)"
BLOCKSIZE="K"
RSYNC_RSH="ssh -ax"
SYSTEMD_PAGER=""
if test -s /rw/config/gpg-split-domain; then
QUBES_GPG_DOMAIN="$(cat /rw/config/gpg-split-domain)"
else
QUBES_GPG_DOMAIN="@default"
fi
export HISTSIZE EDITOR VISUAL TERMINAL BROWSER PAGER LESS GPG_TTY BLOCKSIZE
export RSYNC_RSH SYSTEMD_PAGER QUBES_GPG_DOMAIN
if has fd; then
FZF_DEFAULT_COMMAND='fd --type=f --hidden --exclude=.git'
elif has fdind; then
FZF_DEFAULT_COMMAND='fdfind --type=f --hidden --exclude=.git'
fi
FZF_DEFAULT_OPTS="--layout=reverse --height 40%"
FZF_TMUX=1
export FZF_DEFAULT_COMMAND FZF_DEFAULT_OPTS FZF_TMUX
## 'vim.tiny' and 'vi' fails if VIMINIT is set to our vimrc.
if has vim; then
if test -f "$XDG_CONFIG_HOME/vim/vimrc"; then
# shellcheck disable=SC2016,SC2089
VIMINIT='let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc" | so $MYVIMRC'
# shellcheck disable=SC2090
export VIMINIT
fi
fi
## XDG_CONFIG_HOME: user-specific configuration files
GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc-2.0"
KDEHOME="$XDG_CONFIG_HOME/kde"
#KDEROOTHOME="/root/.config/kde"
CURL_HOME="$XDG_CONFIG_HOME/curl"
WGETRC="$XDG_CONFIG_HOME/wget/wgetrc"
INPUTRC="$BASHDIR/inputrc"
XINITRC="$XDG_CONFIG_HOME/x11/xinitrc"
if has less; then
if test "$(less -V | head -1 | cut -d " " -f2)" -ge 590; then
LESSKEY="$XDG_CONFIG_HOME/less/lesskey"
else
LESSKEY="$XDG_CONFIG_HOME/less/lesskey-old"
fi
fi
export GTK2_RC_FILES KDEHOME KDEROOTHOME CURL_HOME WGETRC INPUTRC XINITRC
export LESSKEY
## XDG_DATA_HOME: user-specific data files
RUSTUP_HOME="$XDG_DATA_HOME/rustup"
CARGO_HOME="$XDG_DATA_HOME/cargo"
GOPATH="$XDG_DATA_HOME/go"
WORKON_HOME="$XDG_DATA_HOME/virtualenvs"
ELECTRUMDIR="$XDG_DATA_HOME/electrum"
TERMINFO="$XDG_DATA_HOME/terminfo"
export RUSTUP_HOME CARGO_HOME GOPATH WORKON_HOME ELECTRUMDIR TERMINFO
## XDG_STATE_HOME: user-specific state files, persists application restarts
LESSHISTFILE="$XDG_STATE_HOME/history-less"
HISTFILE="$XDG_STATE_HOME/history-shell"
export LESSHISTFILE HISTFILE
## XDG_CACHE_HOME: user-specific non-essential data files
GOCACHE="$XDG_CACHE_HOME/go-build"
GOMODCACHE="$XDG_CACHE_HOME/go/mod"
export GOCACHE GOMODCACHE
## Start agents
if test -z "${SSH_AUTH_SOCK-}" && has ssh-agent; then
eval "$(ssh-agent -s)" >/dev/null
fi
## Source local profile.
# shellcheck disable=SC1090,SC1091
! test -r "$HOME/.profile.local" || . "$HOME/.profile.local"

View File

@ -1,284 +0,0 @@
#!/bin/sh
## SPDX-FileCopyrightText: 2004 - 2022 Tim Pope <https://tpo.pe>
## SPDX-FileCopyrightText: 2023 Qusal contributors
##
## SPDX-License-Identifier: GPL-3.0-or-later
## Credits: https://github.com/tpope/dotfiles/blob/master/.shrc
## {{{ Requirements
## If not running interactively, return.
case $- in
*i*) ;;
*) return;;
esac
## Source profile.
# shellcheck disable=SC1091
. "$HOME/.profile"
## }}}
## {{{ Options
stty -ixon
set -o noclobber
set -o notify
## Vi-mode does not work on Debian Bullseye with Dash 5.11 (2020).
## Debian Boowkworm has Dash >5.11 (2021) with adds libedit to the shell.
## https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=561663
#set -o vi
#stty quit undef
stty werase undef
## }}}
## {{{ Alias
## Standard commands.
test -n "$VISUAL" && alias vi='$VISUAL'
alias du="du -h"
alias df="df -h"
alias cp="cp -i"
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'
fi
if ! grep --color 2>&1 | grep -q "unrecognized option"; then
alias grep="grep --exclude='.*.swp' --exclude='*~' --color=auto"
fi
alias fgrep="grep -F"
alias egrep="grep -E"
alias diff="diff --color=auto"
has dir && alias dir="dir --color=auto"
has vdir && alias vdir="vdir --color=auto"
alias ip="ip -color=auto"
has highlight && alias highlight="highlight --out-format=ansi"
has pygmentize && alias pygmentize="pygmentize -f terminal"
## Helpers.
alias reload='. $ENV' r="reload"
alias reload-xprofile='. $XDG_CONFIG_HOME/x11/xprofile' rx="reload-xprofile"
## POSIX cd does not allow '--' and other shells breaks when not using it.
alias -- -="cd -" 2>/dev/null || true
test -n "$EDITOR" && alias e='$EDITOR'
test -n "$VISUAL" && alias v='$VISUAL'
alias j="jobs"
alias h="history"
alias l="ls -CF"
alias ll="ls -Fl"
alias la="ls -Fa"
alias lla="ls -Fla"
alias laa='ls -Fd .* 2>/dev/null'
alias llaa='ls -Fdl .* 2>/dev/null'
alias lr='ls -R'
alias lx='ll -BX'
alias lz='ll -rS'
alias lt='ll -rt'
alias lm='la | more'
alias now="date +%a\ %Y-%m-%d\ %T"
alias mkd="mkdir -pv"
mkcd(){ mkd "$1" && cd "$1" || return; }
## Non-standard programs.
has info && alias info="info --vi-keys"
has htop && alias top="htop"
has yt-dlp && alias yt="yt-dlp --add-metadata -ic"
has fdfind && alias fd="fdfind"
has lynx && alias lynx="lynx -vikeys"
has qubesctl && alias qubesctl="sudo qubesctl --show-output" qctl="qubesctl"
has gpg && alias gpgs="gpg --show-keys"
has gpg2 && alias gpg="gpg2"
if has qubes-gpg-client-wrapper; then
alias qubes-gpg="qubes-gpg-client-wrapper"
alias qgpg="qubes-gpg"
fi
## {{{ Tmux
has tmux && {
alias t="tmux"
alias td="t detach"
alias tls="t list-sessions" tl="tls"
alias tlw="t list-windows"
alias tlp="t list-panes"
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"
done
}
}
## }}}
## {{{ Mutt
if has mutt; then
alias m="mutt"
alias mp="mutt -e 'unset signature' -e 'set pgp_autoinline=yes crypt_autosign=yes' -H"
fi
## }}}
## {{{ Git
if has git; then
alias g="git"
alias gcd='cd "$(git rev-parse --show-toplevel)"'
## Use git aliases with 'g' prefix.
g_alias="$(git config --get-regexp 'alias.*' | sed 's/^alias\.//;s/ .*//')"
for key in $(printf '%s\n' "${g_alias}"); do
# shellcheck disable=SC2139,SC2140
alias "g$key"="git $key"
done
unset g_alias
fi
## }}}
## }}}
## {{{ Colors
## Colorise "ls" output.
if has dircolors; then
## Use dircolors if available.
if test -r "$XDG_CONFIG_HOME/dircolors/dircolors"; then
eval "$(dircolors -b "$XDG_CONFIG_HOME/dircolors/dircolors")"
else
eval "$(dircolors -b)"
fi
## Fix bold on some terminals.
case "$TERM" in
xterm*|screen*)
LS_COLORS="$(echo "$LS_COLORS" | sed -e 's/01;3/00;9/g')"
;;
esac
export LS_COLORS
else
## BSD
CLICOLOR=1 CLICOLOR_FORCE=1 LSCOLORS=ExGxFxdxCxfxDxxbadacad ls -hF
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:quote=01"
export GCC_COLORS
## 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 reverse video
LESS_TERMCAP_se="$(tput rmso; tput sgr0)" # reset reverse 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
export GROFF_NO_SGR
export LESS_TERMCAP_mb LESS_TERMCAP_md LESS_TERMCAP_me
export LESS_TERMCAP_so LESS_TERMCAP_se LESS_TERMCAP_us
export LESS_TERMCAP_ue LESS_TERMCAP_mr LESS_TERMCAP_mh
## }}}
## {{{ Prompt
## Set ability to color terminal.
color_prompt=""
# shellcheck disable=2034
case "$TERM" in
iterm|*-truecolor)
export COLORTERM=truecolor; color_prompt=yes
;;
*-color|*-256color)
color_prompt=yes
;;
vte*) ;;
esac
# shellcheck disable=SC3028
_get_prompt_time(){
test -n "${SECONDS:-}" || return
# shellcheck disable=SC2154
_ptime="$((SECONDS-_saved_prompt_time))"
printf "%02d:%02d:%02d" \
"$((_ptime/3600))" "$(((_ptime%3600)/60))" "$((_ptime%60))"
}
_git_prompt_info(){
has git || return
ref="$(git symbolic-ref HEAD 2>/dev/null | cut -d '/' -f3)"
test "${ref-}" || ref="$(git describe --tags --exact-match HEAD 2>/dev/null)"
test "${ref-}" || ref="$(git rev-parse HEAD 2>/dev/null | head -c 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' ;;
esac
if test -n "${ZSH_VERSION-}"; then
# shellcheck disable=2016
print -Pn '(%%{$branchcolor%%}%20>...>$ref%<<%%{\e[00m%%})'
else
printf '%s' "($branchcolor$ref$reset_color)"
fi
}
# shellcheck disable=SC2034
usercolor="$(printf '%b' "\e[00;93m")"
dircolor="$(printf '%b' "\e[01;34m")"
# 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")"
;;
*-88color|rxvt-unicode)
usercolor="$(printf '%b' "\e[38;5;56m")"
dircolor="$(printf '%b' "\e[38;5;23m")"
;;
esac
# shellcheck disable=SC2034
test "$(id -u)" -eq 0 && usercolor="$(printf '%b' "\e[00;97m")"
# shellcheck disable=SC2034
reset_color="$(printf '%b' '\e[00m')"
case "${ZSH_VERSION-}" in
"") ps1_symbol="$";;
*) ps1_symbol="%%";;
esac
test "$(id -u)" = "0" && ps1_symbol="#"
## Do not colorize this prompt, Sh fails to count the correct number of
## characters on the prompt leading to problems.
PS1="$(id -un)@$(hostname -s)${ps1_symbol} "
## }}}
## {{{ External Functions
## Source file if it is readable.
## Usage: source_readable FILE
source_readable(){
for _file in "$@"; do
# shellcheck disable=SC1090
! test -r "${_file}" || . "${_file}"
done
}
_fzf_comprun() {
_fzf_command="$1"
shift
case "$_fzf_command" in
cd) if has tree; then
fzf --preview 'tree -C {} | head -200' "$@"
else
fzf "$@"
fi
;;
export|unset)
fzf --preview "eval 'echo \$'{}" "$@"
;;
ssh)
fzf --preview 'dig {}' "$@"
;;
*)
fzf --preview 'test -d {} || cat {}' "$@"
;;
esac
}
## }}}
## {{{ End
## Source local shell configuration file.
source_readable "$HOME/.shrc.local"
## }}}

View File

@ -1,19 +0,0 @@
## SPDX-FileCopyrightText: 2023 Qusal contributors
##
## SPDX-License-Identifier: GPL-3.0-or-later
# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run.
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
#
XDG_DESKTOP_DIR="$HOME/"
XDG_DOWNLOAD_DIR="$HOME/"
XDG_TEMPLATES_DIR="$HOME/"
XDG_PUBLICSHARE_DIR="$HOME/"
XDG_DOCUMENTS_DIR="$HOME/"
XDG_MUSIC_DIR="$HOME/"
XDG_PICTURES_DIR="$HOME/"
XDG_VIDEOS_DIR="$HOME/"

View File

@ -1,5 +0,0 @@
## SPDX-FileCopyrightText: 2023 Qusal contributors
##
## SPDX-License-Identifier: GPL-3.0-or-later
en_US

View File

@ -1 +0,0 @@
zlogout

View File

@ -1 +0,0 @@
zprofile

View File

@ -1 +0,0 @@
zshenv

View File

@ -1 +0,0 @@
zshrc

View File

@ -1,9 +0,0 @@
#!/usr/bin/env zsh
## SPDX-FileCopyrightText: 2004 - 2022 Tim Pope <https://tpo.pe>
## SPDX-FileCopyrightText: 2023 Qusal contributors
##
## SPDX-License-Identifier: GPL-3.0-or-later
test "0${SHLVL-}" -le 1 && test -z "${SSH_TTY-}" &&
test "${TERM-}" = linux && clear

View File

@ -1,12 +0,0 @@
#!/usr/bin/env zsh
## SPDX-FileCopyrightText: 2023 Qusal contributors
##
## SPDX-License-Identifier: GPL-3.0-or-later
## Zsh does not source /etc/profile as it is not a Bourne based Shell, but
## some distributions such as Qubes, Whonix, Debian, Gentoo ship files to
## /etc/profile.d.
emulate sh -c "source /etc/profile"
. "$HOME/.profile"

View File

@ -1,12 +0,0 @@
#!/usr/bin/env zsh
## SPDX-FileCopyrightText: 2023 Qusal contributors
##
## SPDX-License-Identifier: GPL-3.0-or-later
if test -z "$ENV" && test -n "$PATH"; then
case $- in
*l*) ;;
*) . "$HOME/.zprofile" >/dev/null ;;
esac
fi

View File

@ -1,462 +0,0 @@
#!/usr/bin/env zsh
## SPDX-FileCopyrightText: 2004 - 2022 Tim Pope <https://tpo.pe>
## SPDX-FileCopyrightText: 2023 Qusal contributors
##
## SPDX-License-Identifier: GPL-3.0-or-later
## Credits: https://github.com/tpope/dotfiles/blob/master/.zshrc
## {{{ Requirements
## If not running interactively, return.
case $- in
*i*) ;;
*) return;;
esac
## Source default files.
# shellcheck disable=SC1090
source "$HOME/.zprofile"
source "$ENV"
## }}}
## {{{ Options
## - Quiet
setopt no_beep
## - Words
setopt interactive_comments
## - History
SAVEHIST="$HISTSIZE"
setopt hist_expire_dups_first # purge dups first
setopt hist_ignore_dups # ignore dups in history list
setopt hist_verify # if command has hist expansion, show it before executing
## - Expansion
setopt auto_cd
setopt no_no_match # if a pattern has no matches print an error
setopt numeric_glob_sort # sort file names numerically when relevant
setopt magic_equal_subst # filename expansion for opt=arg
setopt no_equals # don't interpret =string as a command
## - Prompt
setopt prompt_subst
setopt transient_rprompt
setopt print_exit_value
set zle_bracketed_paste
autoload -Uz bracketed-paste-magic
zle -N bracketed-paste bracketed-paste-magic
autoload -Uz url-quote-magic
zle -N self-insert url-quote-magic
pasteinit() {
OLD_SELF_INSERT=${${(s.:.)widgets[self-insert]}[2,3]}
zle -N self-insert url-quote-magic
}
pastefinish() {
zle -N self-insert $OLD_SELF_INSERT
}
zstyle :bracketed-paste-magic paste-init pasteinit
zstyle :bracketed-paste-magic paste-finish pastefinish
## }}}
## {{{ Alias
alias reload="exec zsh"
## }}}
## {{{ Prompt
autoload -U colors && colors
[[ "${COLORTERM-}" == (24bit|truecolor) || "${terminfo[colors]}" -eq '16777216' ]] || zmodload zsh/nearcolor
newline=$'\n'
if test "$color_prompt" = "yes"; then
PS1="%F{magenta}[%{$usercolor%}%n@%M%F{reset_color%} %{$dircolor%}%50<...<%~%<<%F{reset_color%}\$(_git_prompt_info)%F{magenta}]%F{reset_color}${newline-}${ps1_symbol} "
RPS1="%(?..(%{"$'\e[31m'"%}%?%{$reset_color%}%)%<<)"
else
PS1="[%n@%M %~\$(_git_prompt_info)]${newline}${ps1_symbol} "
RPS1="%(?..(%?%)%<<)"
fi
## Set window title
_set_title() {
case "${1:-}" in
*install*)
hash -r ;;
esac
print -Pn '\e]1;%l@%m${1+*}\a'
print -Pn '\e]2;%n@%m:%~'
if test -n "${1:-}"; then
print -Pnr ' (%24>..>$1%>>)' | tr '\0-\037' '?'
fi
print -Pn " [%l]\a"
}
case $TERM in
screen*)
precmd() {
_set_title "$@"
if [ "${STY:-}" -o "${TMUX:-}" ]; then
# print -Pn "\e]1;\a\e]1;@%m\a"
print -Pn '\ek@\e\\'
else
print -Pn '\ek@%m\e\\'
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
}
;;
xterm*|rxvt*|Eterm*|kterm*|putty*|dtterm*|ansi*|cygwin*)
precmd () { _set_title "$@" }
preexec() { _set_title "$@" }
;;
linux*|vt220*) ;;
*)
PS1="%n@%m:%~%# "
RPS1="%(?..(%?%)%<<)"
;;
esac
unset hostcolor hostletter hostcode dircolor usercolor usercode reset_color
unset newline
## }}}
## {{{ Completions
## Enable completion.
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path $XDG_CACHE_HOME/zsh/zcompcache
zstyle ':completion:*' auto-description 'Specify: %d'
zstyle ':completion:*' completer _expand _complete _ignored _approximate
zstyle ':completion:*' expand prefix suffix
zstyle ':completion:*' file-sort name
zstyle ':completion:*' group-name ''
zstyle ':completion:*' ignore-parents parent pwd ..
zstyle ':completion:*' insert-unambiguous true
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
zstyle ':completion:*' list-suffixes true
zstyle ':completion:*' matcher-list '' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'r:|[._-]=** r:|=**' 'l:|=* r:|=*'
zstyle ':completion:*' menu select=1
zstyle ':completion:*' original true
zstyle ':completion:*' preserve-prefix '//[^/]##/'
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' special-dirs true
zstyle ':completion:*' squeeze-slashes true
zstyle ':completion:*' use-compctl true
zstyle ':completion:*' verbose true
zstyle ':completion:*:*:-command-:*:*' file-patterns \
'*(#q-*):executables:Executables *(-/):directories:Directories'
zstyle -e ':completion:*:*:-command-:*:*' tag-order '
reply=("
executables:Executables:Executables
builtins:Builtins:Builtins
commands:Commands:Commands
aliases:Aliases:Aliases
functions:Functions:Functions
parameters:Variables:Variables
reserved-words:Keywords:Keywords
directories:Directories
" -
)'
## Completion per utility.
zstyle ':completion:*:sudo::' environ \
HOME="/root" \
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
zstyle ':completion:*:doas::' environ \
HOME="/root" \
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
## Colored completions.
# zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*:*:*:*:descriptions' format '%B%F{blue}-- %d --%b%f'
zstyle ':completion:*:messages' format ' %B%F{purple} -- %d --%f%b'
zstyle ':completion:*:warnings' format ' %B%F{red}-- no matches found --%f%b'
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*:*:kill:*' list-colors '=(#b) #([0-9]#)*( *[a-z])*=94=91=93'
## Load completions.
autoload -Uz compinit
zmodload zsh/complist
mkdir -p $XDG_CACHE_HOME/zsh
compinit -u -d $XDG_CACHE_HOME/zsh/zcompdump
# _comp_options+=(globdots)
if has zoxide; then
eval "$(zoxide init zsh)"
fi
## }}}
## {{{ Plugins
source_readable /usr/share/doc/fzf/examples/key-bindings.zsh
source_readable /usr/share/doc/fzf/examples/completion.zsh
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"
typeset -a ZSH_AUTOSUGGEST_CLEAR_WIDGETS
ZSH_AUTOSUGGEST_CLEAR_WIDGETS+=(bracketed-paste)
source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh
fi
## Highlight commands as you type
if test -f /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh; then
## https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters
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'
ZSH_HIGHLIGHT_STYLES[command]='fg=green'
ZSH_HIGHLIGHT_STYLES[precommand]='fg=green'
ZSH_HIGHLIGHT_STYLES[comment]='fg=black,bold'
ZSH_HIGHLIGHT_STYLES[globbing]='fg=cyan'
typeset -A ZSH_HIGHLIGHT_REGEXP
ZSH_HIGHLIGHT_REGEXP+=('^sudo' 'fg=magenta')
ZSH_HIGHLIGHT_REGEXP+=('^doas' 'fg=magenta')
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
fi
fi
## }}}
## {{{ Bindkeys
## Widgets
##
function bindkey-multi () {
## Usage: bindkey-multi mode Nmode -- bind nbind terminfoname -- widgetname
local i j widget nomap
local -a maps sequences
test "$1" = "--" && nomap=1
while [[ "$1" != "--" ]]; do
maps+=( "$1" )
shift
done
shift
while [[ "$1" != "--" ]]; do
sequences+=( "$1" )
shift
done
shift
widget="$1"
test -z "$widget" && return 1
if test -n "$nomap"; then
for j in "${sequences[@]}"; do
test "$j" || continue
bindkey -- "$j" "$widget"
done
return 0
fi
for i in "${maps[@]}"; do
test "$i" || continue
for j in "${sequences[@]}"; do
test "$j" || continue
bindkey -M "$i" -- "$j" "$widget"
done
done
return 0
}
function clear-screen-and-scrollback() {
test -n "${TTY-}" || return
echoti civis >"$TTY"
printf '%b' "\e[H\e[2J" >"$TTY"
zle .reset-prompt
zle -R
printf '%b' "\e[3J" >"$TTY"
echoti cnorm >"$TTY"
}
zle -N clear-screen-and-scrollback
fg-widget() {
if [[ $#BUFFER -eq 0 ]]; then
if jobs %- >/dev/null 2>&1; then
BUFFER='fg %-'
else
BUFFER='fg'
fi
zle accept-line
else
zle push-input
zle clear-screen
fi
}
zle -N fg-widget
change-first-word(){
zle beginning-of-line -N
zle kill-word
}
zle -N change-first-word
new-screen() {
test -z "$STY" || screen < "$TTY"
test -z "$TMUX" || tmux new-window
}
zle -N new-screen
zle-keymap-select zle-line-init() {
case $KEYMAP in
vicmd) print -n -- "\e[2 q";;
viins|main) print -n -- "\e[5 q";;
esac
zle reset-prompt
zle -R
}
zle-line-finish() {
print -n -- "\e[2 q"
}
zle -N zle-line-init
zle -N zle-line-finish
zle -N zle-keymap-select
set-keymap-vi(){
export KEYTIMEOUT=1
bindkey -v
}
set-keymap-emacs(){
bindkey -e
bindkey -r "^Q"
}
## Keymap mode
set-keymap-emacs
autoload -Uz select-word-style
select-word-style bash
## Viins
bindkey -M viins "^A" beginning-of-line
bindkey -M viins "^B" backward-char
bindkey -M viins "^D" delete-char-or-list
bindkey -M viins "^E" end-of-line
bindkey -M viins "^F" forward-char
bindkey-multi emacs viins vicmd -- "^G" -- which-command
bindkey -M viins "^J" accept-search
bindkey -M viins "^K" kill-line
bindkey -M viins "^L" clear-screen-and-scrollback
bindkey -M viins "^M" accept-line
bindkey -M viins "^N" down-line-or-history
bindkey -M viins "^P" up-line-or-history
bindkey -M viins "^R" history-incremental-search-backward
bindkey -M viins "^S" history-incremental-search-forward
bindkey -M viins "^T" transpose-chars
bindkey-multi emacs viins -- "^W" -- vi-backward-kill-word
bindkey -M viins "^U" backward-kill-line
bindkey -M emacs "^U" backward-kill-line
bindkey -M viins "^Y" yank
bindkey-multi emacs viins vicmd -- "^Z" -- fg-widget
bindkey -M viins "^_" undo
bindkey -M viins "^@" redo
bindkey -M viins " " magic-space
bindkey -M emacs " " magic-space
bindkey -M emacs "^X^[" vi-cmd-mode
## Viins alt
bindkey -M viins "^[u" undo
bindkey -M viins "^[r" redo
bindkey -M viins "^[m" copy-prev-shell-word
## Misc
bindkey -M isearch "^J" accept-search 2>/dev/null
bindkey -M menuselect "h" vi-backward-char
bindkey -M menuselect "k" vi-up-line-or-history
bindkey -M menuselect "l" vi-forward-char
bindkey -M menuselect "j" vi-down-line-or-history
bindkey -M menuselect "^C" send-break
bindkey -M menuselect "^J" accept-and-infer-next-history # accept-search
bindkey -M menuselect "^M" accept-line
## Keys for multiple modes and multiple bindings.
## https://invisible-island.net/xterm/xterm-function-keys.html
##
## Shit+Tab
bindkey-multi viins menuselect -- "\E[Z" "${terminfo[kcbt]}" \
-- reverse-menu-complete
## Backspace
bindkey-multi viins vicmd menuselect -- "^H" "^?" "${terminfo[kbs]}" \
-- backward-delete-char
## Home
bindkey-multi viins vicmd -- "\E[1~" "\E[7~" "\E[H" "\EOH" \
"${terminfo[khome]}" \
-- beginning-of-line
## Insert
bindkey-multi viins vicmd -- "\E[2~" "\E[L" "${terminfo[kich1]}" \
-- overwrite-mode
## Delete
bindkey-multi viins vicmd -- "\E[3~" "\E[P" "\EOP" "${terminfo[kdch1]}" \
-- vi-delete-char
## End
bindkey-multi viins vicmd -- "\E[4~" "\E[8~" "\E[F" "\EOF" \
"${terminfo[kend]}" \
-- end-of-line
## PgUp
bindkey-multi viins -- "\E[5~" "\E[I" "${terminfo[kpp]}" \
-- beginning-of-buffer-or-history
## PgDown
bindkey-multi viins -- "\E[6~" "\E[G" "${terminfo[knp]}" \
-- end-of-buffer-or-history
## Up arrow
bindkey-multi viins vicmd -- "\E[A" "\EOA" "${terminfo[kcuu1]}" \
-- up-line-or-history
## Down arrow
bindkey-multi viins vicmd -- "\E[B" "\EOB" "${terminfo[kcud1]}" \
-- down-line-or-history
## Right arrow
bindkey-multi viins vicmd -- "\E[C" "\EOC" "${terminfo[kcuf1]}" \
-- forward-char
## Left arrow
bindkey-multi viins vicmd -- "\E[D" "\EOD" "${terminfo[kcub1]}" \
-- backward-char
## Ctrl-Delete
bindkey-multi viins vicmd -- "\E[3;5~" "\E[3\^" "${terminfo[kDC5]}" \
-- kill-word
## Ctrl-RightArrow
bindkey-multi viins vicmd -- "\E[1;5C" "\E0c" "${terminfo[kRIT5]}" \
-- forward-word
## Ctrl-LeftArrow
bindkey-multi viins vicmd -- "\E[1;5D" "\E0d" "${terminfo[kLFT5]}" \
-- backward-word
## F11
bindkey-multi viins -- "\E[23~" "${terminfo[kf11]}" -- new-screen
autoload -Uz edit-command-line
zle -N edit-command-line
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 "^XD" describe-key-briefly
for binding in ${(f)$(bindkey -M emacs|grep '^"\^X')}; do
bindkey -M viins "${(@Qz)binding}"
done
unset binding
## Make sure the terminal is in application mode, when zle is active.
## Only then are the values from $terminfo valid.
if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then
autoload -Uz add-zle-hook-widget
function zle_application_mode_start { echoti smkx }
function zle_application_mode_stop { echoti rmkx }
add-zle-hook-widget -Uz zle-line-init zle_application_mode_start
add-zle-hook-widget -Uz zle-line-finish zle_application_mode_stop
fi
## }}}
## {{{ End
## Source local zsh configuration.
source_readable "$HOME/.zshrc.local"
## }}}

Some files were not shown because too many files have changed in this diff Show More