├── CHANGELOG.org ├── LICENSE ├── README-simple.org ├── README.org ├── demos ├── selected-window-accent-mode-demo-blend.gif └── selected-window-accent-mode-demo-pywal.gif ├── docs ├── Makefile ├── README.org ├── selected-window-accent-mode.html ├── selected-window-accent-mode.info ├── selected-window-accent-mode.org └── selected-window-accent-mode.texi ├── img ├── selected-window-accent-mode-00.jpg ├── selected-window-accent-mode-01.jpg ├── selected-window-accent-mode-02.jpg ├── selected-window-accent-mode-03.jpg ├── selected-window-accent-mode-04.jpg ├── selected-window-accent-mode-05.jpg ├── selected-window-accent-mode-06.jpg ├── selected-window-accent-mode-07.jpg ├── selected-window-accent-mode-08.jpg └── selected-window-accent-mode-transient-menu.jpg ├── selected-window-accent-mode.el └── test ├── selected-window-accent-init-file.el ├── selected-window-accent-mode-quick-tests.el ├── selected-window-accent-mode-quick-tests_local.el ├── selected-window-accent-mode-tests.el └── selected-window-accent-mode_unit_test.el /CHANGELOG.org: -------------------------------------------------------------------------------- 1 | #+title: Change log of selected-window-accent-mode 2 | #+author: James Dyer 3 | #+email: captainflasmr@gmail.com 4 | #+language: en 5 | #+options: ':t toc:nil author:nil email:nil num:nil title:nil 6 | #+todo: TODO DOING | DONE 7 | #+startup: showall 8 | 9 | This document contains the release notes for each tagged commit on the 10 | project's main git repository: [[https://github.com/captainflasmr/selected-window-accent-mode]]. 11 | 12 | * Versions 13 | 14 | ** v2.2.0 <2025-04-23> 15 | 16 | Added back in Pywal color support 17 | 18 | Introduce =selected-window-accent-use-pywal= option to allow the usage of a color from the Pywal generated palette. 19 | 20 | ** v2.1.0 <2025-04-05> 21 | 22 | - Added texinfo manual 23 | 24 | ** v2.0.0 <2025-03-04> 25 | 26 | refactored/streamlined selected-window-accent-mode 27 | 28 | - Removed dependencies on json and transient libraries 29 | - Replaced complex color manipulation with straightforward foreground detection 30 | - Removed pywal integration and background blending features 31 | - Eliminated header line special handling logic 32 | - Replaced transient UI with simple keymap for commands 33 | - Consolidated window handling code for cleaner implementation 34 | - Reduced overall codebase by ~50% 35 | - Maintained backward compatibility for core configuration options 36 | 37 | ** v1.1.0 <2025-03-03> 38 | 39 | Add margin compensation to prevent text shifting 40 | 41 | - Introduce `selected-window-accent-use-margin-compensation` to use margins 42 | in non-selected windows instead of fringes. 43 | - Add `selected-window-accent-margin-compensation-factor` for fine-tuning margin size. 44 | - Implement `selected-window-accent--pixels-to-chars` for converting pixel 45 | widths to character widths. 46 | - Refactor `selected-window-accent` to apply fringe and margin adjustments 47 | dynamically based on the selected window. 48 | - Improve handling of header-line formats to prevent unintended changes. 49 | 50 | ** v1.0.0 <2024-10-19> 51 | 52 | feat: add function to sync tab-bar faces with current theme 53 | 54 | - Introduced `selected-window-accent-sync-tab-bar-to-theme`, which synchronizes the tab-bar faces (tab, tab-inactive) with the current theme. 55 | - Sets the tab-bar face background and foreground to match the current `default` face settings. 56 | - Added "Tab Sync to Theme" option under "Other" actions in the selected-window-accent hydra. 57 | 58 | First full version. 59 | 60 | ** v0.9.5 <2024-08-24> 61 | 62 | Enhanced selected-window-accent functionality with blending options 63 | 64 | This means that not only will the modeline, fringes and header be accent colored, but also the whole selected window background color, tinted to the alpha chosen. 65 | 66 | - Introduced =selected-window-accent-use-blend-background= and =selected-window-accent-use-blend-alpha= to allow blending of the accent color with the background of the selected window a selected alpha amount. 67 | - Introduced new toggle functions and added to transient: 68 | - =selected-window-accent-toggle-blend-background= 69 | - =selected-window-accent-toggle-pywal= 70 | - Added function =selected-window-accent-blend-colors= to support blending of two colors. 71 | - Updated =selected-window-accent--set-foreground-color= and =selected-window-accent= functions to incorporate new blending feature. 72 | - Improved existing functions for setting and toggling accent features, ensuring consistent style and formatting. 73 | - Cleaned up indentation and formatting inconsistencies across the file for better readability. 74 | 75 | ** v0.9.0 <2024-08-10> 76 | 77 | Add Pywal color integration to selected-window-accent-mode 78 | 79 | - Introduce `selected-window-accent-use-pywal` option to use a Pywal-generated color palette. 80 | - Add `selected-window-accent--get-pywal-color` function to fetch colors from Pywal palette. 81 | - Update logic in `selected-window-accent` function to use Pywal color if enabled. 82 | - Require `json` package for handling Pywal palette. 83 | 84 | ** v0.8.1 <2024-08-03> 85 | 86 | feat: Add transient dependency and fix indentation 87 | 88 | - Added 'transient' package requirement to `Package-Requires` in the header. 89 | - Fixed indentation inconsistencies across the file for better code readability. 90 | 91 | Details: 92 | - Added `transient` package dependency: 93 | - Updated the header to include `(transient "0.1.0")` in `Package-Requires`. 94 | 95 | ** v0.8.0 <2024-07-15 Mon> 96 | 97 | feat: Add transient menu, enhance foreground customization 98 | 99 | - Added transient menu for interactive adjustments (see README usage) 100 | - Upgraded emacs dependency to 28.1. 101 | - Added `selected-window-accent-fg-color` for custom foreground accent color. 102 | - Introduced various `defcustom` options for finer control over foreground accent: 103 | - `selected-window-accent-foreground-adjust-factor` 104 | - `selected-window-accent--use-complementary-color` 105 | - `selected-window-accent--foreground-invert-state` 106 | - `selected-window-accent--foreground-offset` 107 | - Implemented functions for adjusting foreground brightness: 108 | - `selected-window-accent-flip-foreground-color` 109 | - `selected-window-accent-increment-foreground-color` 110 | - `selected-window-accent-decrement-foreground-color` 111 | - `selected-window-accent-toggle-complementary-color` 112 | - `selected-window-accent-toggle-tab-accent` 113 | - `selected-window-accent-toggle-smart-borders` 114 | - Provided a function to output current settings for copy and paste to emacs init file: `selected-window-accent-output-selected-window-accent-settings` 115 | - Miscellaneous improvements and refactoring. 116 | 117 | ** v0.7.0 <2024-07-09 Tue> 118 | 119 | - ISSUE #4 Doesn't work well with other packages 120 | - ISSUE #3 Package breaks fringes 121 | - restore modeline height when switching between modes 122 | 123 | ** v0.6.0 <2024-02-09 Fri> 124 | 125 | - ISSUE #1 Do not apply highlighting when frame only contains 1 window 126 | - define accent color saturation adjustment 127 | - define accent color darken adjustment 128 | - highlight selected tab with same accent color 129 | - add to MELPA 130 | 131 | ** v0.5.0 <2024-01-29 Mon> 132 | 133 | - minor change to properly format color-theme-buffer-local 134 | 135 | ** v0.4.0 <2024-01-29> 136 | 137 | - pacified package-lint with visual-fill-column 0.0 138 | - Added similar package comparisons as suggested 139 | 140 | ** v0.3.0 <2024-01-25> 141 | 142 | - rename color-name-to-hex to selected-window-accent--color-name-to-hex 143 | 144 | ** v0.2.0 <2024-01-25> 145 | 146 | - Fixing issues to be able to submit to MELPA 147 | - byte-compile / flycheck 148 | - checkdoc 149 | - package-lint 150 | - images to img directory and referenced from README 151 | 152 | ** v0.1.0 <2024-01-12> 153 | 154 | This is considered beta. 155 | 156 | - expand emacs help / documentation 157 | - add GNU header 158 | - cope better with 0 thickness 159 | - Add ChangeLog. 160 | - visual-fill-column-mode not working again! 161 | - improve modeline contrast between fg and bg 162 | 163 | * Testing 164 | 165 | developing locally using: 166 | 167 | #+begin_src elisp 168 | (use-package selected-window-accent-mode 169 | :load-path "~/repos/selected-window-accent-mode" 170 | #+end_src 171 | 172 | and running through and evaluating elisp code in selected-window-accent-mode-quick-tests.el 173 | 174 | * Validation 175 | 176 | ** eval-buffer 177 | 178 | ** flycheck 179 | 180 | ** checkdoc 181 | 182 | Use =checkdoc= to make sure that your package follows the conventions for documentation strings, within reason. 183 | 184 | Buffer comments and tags: Ok 185 | Documentation style: Ok 186 | Message/Query text style: Ok 187 | Unwanted Spaces: Ok 188 | 189 | ** package-lint-current-buffer 190 | 191 | =package-lint= to help identify common errors in package metadata. 192 | 193 | ** check in basic vanilla emacs 194 | 195 | Just in case I am using some dependencies without realising it! 196 | 197 | emacs -q -l ~/source/repos/selected-window-accent-mode/selected-window-accent-init-file.el 198 | 199 | In this case init-file.el can be: 200 | 201 | #+begin_src elisp 202 | ;; 203 | ;; -> package-archives 204 | ;; 205 | 206 | (require 'package) 207 | 208 | (setq package-archives '(("melpa" . "https://melpa.org/packages/") 209 | ("elpa" . "https://elpa.gnu.org/packages/") 210 | ("org" . "https://orgmode.org/elpa/"))) 211 | 212 | (unless (package-installed-p 'use-package) 213 | (package-install 'use-package)) 214 | (setq use-package-verbose t) 215 | (setq use-package-always-ensure t) 216 | (require 'use-package) 217 | (setq load-prefer-newer t) 218 | 219 | ;; (when init-file-debug 220 | (setq use-package-verbose t 221 | use-package-expand-minimally nil 222 | use-package-compute-statistics t 223 | debug-on-error nil) 224 | 225 | ;; 226 | ;; -> selected-window-accent-mode 227 | ;; 228 | 229 | (use-package selected-window-accent-mode 230 | :load-path "~/source/repos/selected-window-accent-mode" 231 | ;; :ensure nil 232 | ;; :vc (:fetcher github :repo "captainflasmr/selected-window-accent-mode") 233 | :config (selected-window-accent-mode 1) 234 | :custom 235 | (selected-window-accent-fringe-thickness 10) 236 | (selected-window-accent-percentage-darken 0) 237 | (selected-window-accent-percentage-desaturate 0) 238 | (selected-window-accent-smart-borders t) 239 | (selected-window-accent-use-blend-background t) 240 | (selected-window-accent-use-blend-alpha 0.2) 241 | (selected-window-accent-tab-accent t) 242 | (selected-window-accent-use-pywal t) 243 | (selected-window-accent-custom-color "cyan4") 244 | (selected-window-accent-mode-style 'default)) 245 | 246 | (eval-after-load 'selected-window-accent-mode 247 | '(progn 248 | (define-key global-map (kbd "C-c w") 'selected-window-accent-transient))) 249 | #+end_src 250 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README-simple.org: -------------------------------------------------------------------------------- 1 | #+title: selected-window-accent-mode 2 | #+author: James Dyer 3 | #+email: captainflasmr@gmail.com 4 | #+language: en 5 | #+options: ':t toc:nil author:nil email:nil num:nil title:nil 6 | #+todo: TODO DOING | DONE 7 | #+startup: showall 8 | 9 | * Streamlining the Selected Window Accent Mode in Emacs 10 | 11 | Today, I'm examining a significant refactoring of my =selected-window-accent-mode= package, which has been transformed from a feature-rich but complex tool to highlight the selected-window into a leaner, more focused implementation. 12 | 13 | ** What is Selected Window Accent Mode? 14 | 15 | For those unfamiliar with this package, =selected-window-accent-mode= is a utility that visually distinguishes your currently active Emacs window by applying accent colors to its fringes, mode line, and other UI elements. This is particularly useful when working with multiple split windows, as it makes it immediately clear which window has focus. 16 | 17 | ** The Evolution: From Complex to Streamlined 18 | 19 | Let's have a look at my streamlining and explore the key differences between the original version and the streamlined implementation. 20 | 21 | *** 1. Reduced Dependencies 22 | 23 | *Original Version:* 24 | #+begin_src elisp 25 | (require 'json) 26 | (require 'color) 27 | (require 'transient) 28 | #+end_src 29 | 30 | *Streamlined Version:* 31 | #+begin_src elisp 32 | (require 'color) 33 | #+end_src 34 | 35 | The new implementation drops the dependencies on =json= and =transient=, eliminating functionality related to JSON parsing (for pywal integration) and the transient interface. This makes the package lighter and reduces potential compatibility issues. 36 | 37 | *** 2. Removed Advanced Features 38 | 39 | Several advanced features have been removed from the streamlined version: 40 | 41 | - *Pywal Integration*: The ability to use colors from pywal-generated palettes 42 | - *Background Blending*: The feature to blend accent colors with window backgrounds 43 | - *Complementary Colors*: The ability to automatically generate complementary foreground colors 44 | - *Header Line Handling*: Special logic for header line formatting and heights 45 | 46 | Just a note on the *Header Line Handling* - Due to technical limitations of the current implementation of Emacs it wasn't quite possible to create a tiling window manager full surrounding border, although I do have hope as I read somewhere that a header-line-active and header-line-inactive was being considered. I also ran into problems when trying to preserve any buffer that already utilized the header-line. So my solution?, is to just remove the calculation so in fact the 'tiling highlighting option now generates an accent around 3 sides, like a bucket! 47 | 48 | *** 3. Simplified Color Handling 49 | 50 | The original version had complex color manipulation functions: 51 | 52 | #+begin_src elisp 53 | (defun selected-window-accent--increment-color-brightness (hex-color factor)...) 54 | (defun selected-window-accent--decrement-color-brightness (hex-color factor)...) 55 | (defun selected-window-accent--invert-color (hex-color)...) 56 | (defun selected-window-accent--set-foreground-color (bg-color)...) 57 | (defun selected-window-accent-blend-colors (color1 color2 alpha)...) 58 | #+end_src 59 | 60 | These have been consolidated into a single, straightforward function in the new version: 61 | 62 | #+begin_src elisp 63 | (defun selected-window-accent--determine-foreground (bg-color) 64 | "Determine appropriate foreground color based on BG-COLOR brightness." 65 | (if (string-greaterp bg-color "#888888") "#000000" "#ffffff")) 66 | #+end_src 67 | 68 | *** 5. Cleaner Window Handling 69 | 70 | The core =selected-window-accent= function has been streamlined significantly. The original version was approximately 120 lines, while the new implementation achieves the same core functionality in about 70 lines. The window handling code is more focused and easier to follow. 71 | 72 | *** 6. Simpler Command Interface 73 | 74 | The original package used a transient interface (similar to Magit) for its commands. 75 | 76 | #+begin_src elisp 77 | (transient-define-prefix selected-window-accent-transient () 78 | "Transient for selected window accent." 79 | ["Selected Window Accent" 80 | ["Main" 81 | ("s" "Switch Style" selected-window-accent-switch-selected-window-accent-style) 82 | ...]]) 83 | #+end_src 84 | 85 | The streamlined version replaces this with a simple keymap: 86 | 87 | #+begin_src elisp 88 | (defvar selected-window-accent-map 89 | (let ((map (make-sparse-keymap))) 90 | (define-key map (kbd "w") 'selected-window-accent-switch-style) 91 | ... 92 | map) 93 | "Keymap for selected-window-accent commands.") 94 | #+end_src 95 | 96 | ** What Was Lost? 97 | 98 | While the streamlined version is more efficient, it does sacrifice some functionality: 99 | 100 | - *Foreground Color Controls*: The ability to fine-tune foreground colors with incremental adjustments 101 | - *Complementary Color Generation*: Automatic creation of complementary color schemes 102 | - *Background Blending*: The feature to blend accent colors with window backgrounds 103 | - *Configuration Export*: The function to export current settings to a buffer 104 | - *Pywal Integration*: The ability to use colors from pywal-generated palettes 105 | - *Transient Interface*: The more sophisticated command menu 106 | 107 | If you want to use the more function rich version, I would recommend pulling a previous version. 108 | 109 | ** Is the Simpler Version Better? 110 | 111 | Whether the streamlined version is "better" depends on your needs: 112 | 113 | - If you want a lightweight, focused tool that simply highlights your active window without fuss, the new version is ideal 114 | - If you need fine-grained control over color schemes, pywal integration, or other advanced features, you might prefer the original version 115 | -------------------------------------------------------------------------------- /README.org: -------------------------------------------------------------------------------- 1 | #+title: selected-window-accent-mode 2 | #+author: James Dyer 3 | #+email: captainflasmr@gmail.com 4 | #+language: en 5 | #+options: ':t toc:nil author:nil email:nil num:nil title:nil 6 | #+todo: TODO DOING | DONE 7 | #+startup: showall 8 | 9 | * Summary 10 | 11 | The Selected Window Accent Mode is an Emacs package designed to visually distinguish the currently selected window by applying a unique accent color to its fringes, mode line, header line, and margins. 12 | 13 | #+attr_org: :width 300px 14 | #+attr_html: :width 100% 15 | [[file:img/selected-window-accent-mode-00.jpg]] 16 | 17 | See [[file:docs/selected-window-accent-mode.org]] for the manual! 18 | 19 | * Whats New 20 | 21 | ** v2.2.0 <2025-04-23> 22 | 23 | Added back in Pywal color support 24 | 25 | Introduce =selected-window-accent-use-pywal= option to allow the usage of a color from the Pywal generated palette. 26 | 27 | ** v2.1.0 <2025-04-05> 28 | 29 | - Added texinfo manual 30 | 31 | ** v2.0.0 <2025-03-04> 32 | 33 | refactored/streamlined selected-window-accent-mode 34 | 35 | - Removed dependencies on json and transient libraries 36 | - Replaced complex color manipulation with straightforward foreground detection 37 | - Removed pywal integration and background blending features 38 | - Eliminated header line special handling logic 39 | - Replaced transient UI with simple keymap for commands 40 | - Consolidated window handling code for cleaner implementation 41 | - Reduced overall codebase by ~50% 42 | - Maintained backward compatibility for core configuration options 43 | 44 | * Quick Start 45 | 46 | To use left and bottom accent based on the themes highlight color: 47 | 48 | #+begin_src elisp 49 | (use-package selected-window-accent-mode 50 | :config (selected-window-accent-mode 1) 51 | :custom 52 | (selected-window-accent-fringe-thickness 10) 53 | (selected-window-accent-custom-color nil) 54 | (selected-window-accent-mode-style 'subtle)) 55 | #+end_src 56 | 57 | OR define your own color: 58 | 59 | #+begin_src elisp 60 | (use-package selected-window-accent-mode 61 | :config (selected-window-accent-mode 1) 62 | :custom 63 | (selected-window-accent-fringe-thickness 10) 64 | (selected-window-accent-custom-color "#427900") 65 | (selected-window-accent-mode-style 'subtle)) 66 | #+end_src 67 | 68 | * Installation 69 | 70 | ** use-package (MELPA) 71 | 72 | #+begin_src elisp 73 | (use-package selected-window-accent-mode 74 | :config (selected-window-accent-mode 1)) 75 | #+end_src 76 | 77 | ** use-package (emacs 30+) 78 | 79 | Put the following into your emacs init file: 80 | 81 | #+begin_src elisp 82 | (use-package selected-window-accent-mode 83 | :vc (:fetcher github :repo "captainflasmr/selected-window-accent-mode") 84 | :config (selected-window-accent-mode 1)) 85 | #+end_src 86 | 87 | ** From source 88 | 89 | Download the `.el` file and place it in your Emacs `load-path`. 90 | 91 | Then either manually load it or add it to your configuration to be loaded at startup. 92 | 93 | #+begin_src elisp 94 | (require 'selected-window-accent-mode) 95 | (selected-window-accent-mode 1) 96 | #+end_src 97 | 98 | * Usage 99 | 100 | Interactively Toggle the mode on and off =M-x selected-window-accent-mode= 101 | 102 | Optionally define a keymap: 103 | 104 | (global-set-key (kbd "C-c w") selected-window-accent-map) 105 | 106 | and then select any of the following keys: 107 | 108 | ** =w= - Switch Window Accent Style 109 | *Command:* =selected-window-accent-switch-style= 110 | 111 | This command allows you to cycle between the three available accent styles: 112 | - =default=: Standard Emacs appearance without special accenting 113 | - =tiling=: Thicker fringes and mode line for a more pronounced window border 114 | - =subtle=: Minimal visual change with accent color applied to fringes 115 | 116 | When invoked, it will prompt you with a minibuffer completion interface to select your preferred style. This is ideal for quickly testing which style works best for your workflow. 117 | 118 | ** =RET= (Enter) - Switch Accent Color 119 | *Command:* =selected-window-accent-switch-color= 120 | 121 | Pressing Enter in the keymap will prompt you to choose a custom color for your window accenting. This opens a color selection interface where you can either: 122 | - Type a color name (like "blue", "tomato", or "forest green") 123 | - Enter a hex code (like "#FF5500") 124 | - Use the color picker if your Emacs supports it 125 | 126 | This command allows you to personalize your window accenting to match your theme or preferences. 127 | 128 | ** =t= - Toggle Tab Bar Accent 129 | *Command:* =selected-window-accent-toggle-tab-accent= 130 | 131 | This toggles whether the tab-bar-tab face should also be accented with your selected color. When enabled, the active tab in your tab bar will match the accent color of your selected window, creating a cohesive visual experience. 132 | 133 | This is particularly useful if you use Emacs with tab-bar-mode enabled and want visual consistency between your active window and active tab. 134 | 135 | ** =l= - Sync Tab Bar to Theme 136 | *Command:* =selected-window-accent-sync-tab-bar-to-theme= 137 | 138 | This command synchronizes your tab bar appearance with your current theme colors. It sets the tab-bar, tab-bar-tab, and tab-bar-tab-inactive faces to use colors derived from your default face. 139 | 140 | This is helpful when switching themes or when you want to reset your tab bar appearance to something that matches your overall Emacs theme rather than your accent color. 141 | 142 | ** =b= - Toggle Smart Borders 143 | *Command:* =selected-window-accent-toggle-smart-borders= 144 | 145 | This toggles the "smart borders" feature, which automatically disables window accenting when you have only a single window displayed in a frame. This is a thoughtful optimization that avoids unnecessary visual elements when they're not needed for distinguishing between windows. 146 | 147 | When enabled, your accent colors only appear when you have multiple windows in a frame; when disabled, accent colors are always applied regardless of window count. 148 | 149 | * Examples 150 | 151 | ** Example 1 - Default / custom color 152 | 153 | #+attr_org: :width 300px 154 | #+attr_html: :width 100% 155 | [[file:img/selected-window-accent-mode-01.jpg]] 156 | 157 | To enable the accent mode automatically upon starting Emacs, add the following line to your `.emacs` or `init.el` file: 158 | 159 | #+begin_src elisp 160 | (use-package selected-window-accent-mode 161 | :config (selected-window-accent-mode 1) 162 | :custom 163 | (selected-window-accent-fringe-thickness 20) 164 | (selected-window-accent-custom-color "goldenrod") 165 | (selected-window-accent-mode-style 'default)) 166 | #+end_src 167 | 168 | This will accent the modeline only for the selected window with the =goldenrod= color. 169 | 170 | ** Example 2 - Tiling / custom color / custom fringe thickness 171 | 172 | #+attr_org: :width 300px 173 | #+attr_html: :width 100% 174 | [[file:img/selected-window-accent-mode-02.jpg]] 175 | 176 | #+begin_src elisp 177 | (use-package selected-window-accent-mode 178 | :config (selected-window-accent-mode 1) 179 | :custom 180 | (selected-window-accent-fringe-thickness 6) 181 | (selected-window-accent-custom-color "#4179b2") 182 | (selected-window-accent-mode-style 'tiling)) 183 | #+end_src 184 | 185 | This will accent the full outline of the window (except the header) of the window with the color #4179b2 more akin to a tiling window manager. 186 | 187 | ** Example 3 - Tiling / theme highlight color 188 | 189 | Example is using the theme doom-one 190 | 191 | #+attr_org: :width 300px 192 | #+attr_html: :width 100% 193 | j[[file:img/selected-window-accent-mode-03.jpg]] 194 | 195 | #+begin_src elisp 196 | (use-package selected-window-accent-mode 197 | :config (selected-window-accent-mode 1) 198 | :custom 199 | (selected-window-accent-fringe-thickness 10) 200 | (selected-window-accent-custom-color nil) 201 | (selected-window-accent-mode-style 'tiling)) 202 | #+end_src 203 | 204 | This will accent the full outline (except the header) of the window with the =highlight= color taken from the current theme. 205 | 206 | ** Example 4 - Subtle / custom fringe thickness (thick) 207 | 208 | Example is using the theme doom-one 209 | 210 | #+attr_org: :width 300px 211 | #+attr_html: :width 100% 212 | [[file:img/selected-window-accent-mode-04.jpg]] 213 | 214 | #+begin_src elisp 215 | (use-package selected-window-accent-mode 216 | :config (selected-window-accent-mode 1) 217 | :custom 218 | (selected-window-accent-fringe-thickness 20) 219 | (selected-window-accent-custom-color nil) 220 | (selected-window-accent-mode-style 'subtle)) 221 | #+end_src 222 | 223 | This will accent the modeline and just the left fringe and in this case be quite a pronounced thick accent. 224 | 225 | ** Example 5 - Subtle / theme accent color with darkening and desaturation 226 | 227 | Example is using the theme doom-one 228 | 229 | The takes the default highlight color from the theme as before but applies darkening and desaturation. 230 | 231 | #+attr_org: :width 300px 232 | #+attr_html: :width 100% 233 | [[file:img/selected-window-accent-mode-05.jpg]] 234 | 235 | #+begin_src elisp 236 | (use-package selected-window-accent-mode 237 | :config (selected-window-accent-mode 1) 238 | :custom 239 | (selected-window-accent-fringe-thickness 20) 240 | (selected-window-accent-percentage-darken 10) 241 | (selected-window-accent-percentage-desaturate 100) 242 | (selected-window-accent-custom-color nil) 243 | (selected-window-accent-mode-style 'subtle)) 244 | #+end_src 245 | 246 | ** Example 6 - Subtle / theme accent color with lightening and saturation and tab accent 247 | 248 | Example is using the theme doom-one 249 | 250 | The takes the default highlight color from the theme as before but applies lightening and saturation along with the same color tab accent. 251 | 252 | #+attr_org: :width 300px 253 | #+attr_html: :width 100% 254 | [[file:img/selected-window-accent-mode-06.jpg]] 255 | 256 | #+begin_src elisp 257 | (use-package selected-window-accent-mode 258 | :config (selected-window-accent-mode 1) 259 | :custom 260 | (selected-window-accent-fringe-thickness 20) 261 | (selected-window-accent-percentage-darken -10) 262 | (selected-window-accent-percentage-desaturate -100) 263 | (selected-window-accent-tab-accent t) 264 | (selected-window-accent-custom-color nil) 265 | (selected-window-accent-mode-style 'subtle)) 266 | #+end_src 267 | 268 | * Customization 269 | 270 | #+begin_src emacs-lisp :results table :colnames '("Custom variable" "Description") :exports results 271 | (let ((rows)) 272 | (mapatoms 273 | (lambda (symbol) 274 | (when (and (string-match "^selected-window-accent-" 275 | (symbol-name symbol)) 276 | (not (string-match "--" (symbol-name symbol))) 277 | (or (custom-variable-p symbol) 278 | (boundp symbol))) 279 | (push `(,symbol 280 | ,(car 281 | (split-string 282 | (or (get (indirect-variable symbol) 283 | 'variable-documentation) 284 | (get symbol 'variable-documentation) 285 | "") 286 | "\n"))) 287 | rows)))) 288 | rows) 289 | #+end_src 290 | 291 | #+RESULTS: 292 | | Custom variable | Description | 293 | |----------------------------------------------+-------------------------------------------------------------------| 294 | | selected-window-accent-custom-color | Custom accent color for the selected window. | 295 | | selected-window-accent-mode-style | Style for accenting the selected window. | 296 | | selected-window-accent-mode-hook | Hook run after entering or leaving `selected-window-accent-mode'. | 297 | | selected-window-accent-percentage-desaturate | Percentage to desaturate the accent color. | 298 | | selected-window-accent-map | Keymap for selected-window-accent commands. | 299 | | selected-window-accent-smart-borders | When non-nil, don't accent single-window frames. | 300 | | selected-window-accent-tab-accent | When non-nil, accent the selected tab in the tab-bar. | 301 | | selected-window-accent-fringe-thickness | Thickness of the accent fringes in pixels. | 302 | | selected-window-accent-mode | Non-nil if Selected-Window-Accent mode is enabled. | 303 | | selected-window-accent-percentage-darken | Percentage to darken the accent color. | 304 | 305 | * Commands 306 | 307 | #+BEGIN_SRC emacs-lisp :results table :colnames '("Command" "Description") :exports results 308 | (let ((rows)) 309 | (mapatoms 310 | (lambda (symbol) 311 | (when (and (string-match "^selected-window-accent-" 312 | (symbol-name symbol)) 313 | (commandp symbol)) 314 | (push `(,(string-join 315 | (seq-filter 316 | (lambda (symbol) 317 | (not (string-match "menu" symbol))) 318 | (mapcar 319 | (lambda (keys) 320 | (key-description keys)) 321 | (or 322 | (where-is-internal 323 | (symbol-function symbol) 324 | comint-mode-map 325 | nil nil (command-remapping 'comint-next-input)) 326 | (where-is-internal 327 | symbol ready-player-major-mode-map nil nil (command-remapping symbol)) 328 | (where-is-internal 329 | (symbol-function symbol) 330 | ready-player-major-mode-map nil nil (command-remapping symbol))))) " or ") 331 | ,(symbol-name symbol) 332 | ,(car 333 | (split-string 334 | (or (documentation symbol t) "") 335 | "\n"))) 336 | rows)))) 337 | rows) 338 | #+END_SRC 339 | 340 | #+RESULTS: 341 | | selected-window-accent-sync-tab-bar-to-theme | Synchronize tab-bar faces with the current theme. | 342 | | selected-window-accent-switch-selected-window-accent-style | Switch the selected window accent style to STYLE and apply it. | 343 | | selected-window-accent-increment-foreground-color | Increment the foreground color brightness. With ARG, adjust by a larger factor. | 344 | | selected-window-accent-decrement-foreground-color | Decrement the foreground color brightness. With ARG, adjust by a larger factor. | 345 | | selected-window-accent-flip-foreground-color | Flip the current foreground color to its opposite value. | 346 | | selected-window-accent-output-selected-window-accent-settings | Output current `selected-window-accent-mode' settings to a new buffer. | 347 | | selected-window-accent-transient | Transient for selected window accent. | 348 | | selected-window-accent-toggle-tab-accent | Toggle between showing the tab accent. | 349 | | selected-window-accent-mode | Toggle selected window accenting. | 350 | | selected-window-accent-toggle-pywal | Toggle between pywal. | 351 | | selected-window-accent-switch-accent-color | Switch the selected window accent color and apply it. | 352 | | selected-window-accent-toggle-blend-background | Toggle between blend background. | 353 | | selected-window-accent-toggle-smart-borders | Toggle between smart borders. | 354 | | selected-window-accent-toggle-complementary-color | Toggle between complementary color for foreground based on background color. | 355 | 356 | * Minor Mode 357 | 358 | The =selected-window-accent-mode= is a global minor mode that you can toggle to enable or disable the accenting of the selected window. 359 | 360 | When enabled, it distinguishes the selected window with a special accent color. 361 | 362 | * Hooks 363 | 364 | Two hooks are used to automatically update the window accents when the window configuration or state changes: 365 | 366 | - window-configuration-change-hook 367 | - window-state-change-hook 368 | 369 | These are added when the =selected-window-accent-mode= is enabled and removed when disabled. 370 | 371 | * Design / Algorithm / Limitations 372 | 373 | Just as a note, the overall design of this package is a little, lets just say clunky, something that has been somewhat shoehorned into the Emacs functional architecture, therefore there will be a few little quirks. In this section I look to explain my general design ideas regarding how I achieved some kind of window highlighting / accenting and the associated limitations. 374 | 375 | This section is mainly for me, as the maintainer of this package, but may be informative to others. This section is to try and fully understand how I have designed this thing for when I come back and have another rethink on improvements. 376 | 377 | Firstly it is important to define the scope of window based visual highlighting in Emacs, which hopefully will help to explain some of the limitations of this package. 378 | 379 | It works well enough I think at the moment and I especially I tend to favour the 'subtle accent mode which inherently has the fewest issues along with providing a satisfying visually distinguishing highlighting mechanism, more bang for the buck if you will. 380 | 381 | ** Emacs repurposed elements 382 | 383 | *** fringe 384 | 385 | position: left, right 386 | face-attribute: 'fringe : all-windows 387 | size: (set-window-fringes left right) : per-window 388 | 389 | *** header-line 390 | 391 | position: top 392 | value: header-line-format : per-window 393 | face-attribute: 'header-line : all-windows 394 | size: face-attribute :height : all-windows 395 | 396 | *** mode-line 397 | 398 | position: bottom 399 | value: mode-line-format : selected-window 400 | face-attribute: 'mode-line-active : selected-window 401 | size: face-attribute :height : all-windows 402 | 403 | *** tab-bar 404 | 405 | face-attribute: 'tab-bar-tab 406 | 407 | ** Pseudo-code 408 | 409 | #+begin_src 410 | calculate accent colors 411 | update global face-attributes 412 | 413 | walk-windows 414 | for each window 415 | update window with accent or default appearance 416 | if window is not selected 417 | reset header-line to nil 418 | reset fringes to 0 419 | #+end_src 420 | 421 | ** Limitations 422 | 423 | As a header-line can only have a single global color it does mean that the header-line-format for each window needs to be made blank in order to preserve accent consistency, this means that modes which change the header-line, such as some modes of magit and org-sticky-header will possibly have to be sacrificed for this selected-window-accent-mode to function coherently. 424 | 425 | There is a possibility that I could add in some extra logic depending on the mode that is set, but that might be for a future version, and at this moment I'm just not sure the effort is worth it. 426 | 427 | The accent is now always alongside an Emacs default margin so as not to overlap with existing packages that utilize the window margin settings, this would make the accent facility look a little less visually appealing then applying a little margin for the selected window along with a compensating margin for non selected windows, but this will have to be sacrificed for not disrupting other Emacs package functionality. 428 | 429 | All non selected windows have been fringe zeroed to preserve fringe accent consistency as the fringe color can only be set globally meaning that any Emacs packages that implement fringe functionality, which I have found to be uncommon, would show varying levels of window accents. 430 | 431 | When a buffer is split into multiple windows in tiling mode the header line is shared, thus leading to an accented header line across all splits, this is an inherent limitation of Emacs and how it processes windows / buffers. 432 | 433 | Phew!, that might be it, this can get quite complicated! 434 | 435 | ** What about overlays? 436 | 437 | At the moment this package works well enough for my needs and I will think about overlays again at some point to see if I can somehow re-purpose them to fit my needs, currently it is the buffer / window scrolling that I think would always tend to look pretty clunky if implemented. 438 | 439 | ** The Future 440 | 441 | I of course shall keep an eye on Emacs development to see if at some time in the future a more flexible per window visual facility becomes available. 442 | 443 | * ISSUES 444 | 445 | #+begin: kanban :layout ("..." . 50) :scope nil :range ("TODO" . "DONE") :sort "O" :depth 3 :match "issues" :compressed t 446 | | TODO | DOING | DONE | 447 | |----------------------------------------------------+---------------------------------------------------+----------------------------------------------------| 448 | | [[file:README.org::*ISSUE #6 - Feature request: accent currently selected/focused frame][ISSUE #6 - Feature request: accent currently se...]] | [[file:README.org::*ISSUE #4 - Doesn't work well with other packages][ISSUE #4 - Doesn't work well with other packages]] | [[file:README.org::*ISSUE #1 - Do not apply highlighting when frame only contains 1 window][ISSUE #1 - Do not apply highlighting when frame...]] | 449 | | [[file:README.org::*Limiting magit-log when enabled][Limiting magit-log when enabled]] | | [[file:README.org::*ISSUE #3 - Package breaks fringes][ISSUE #3 - Package breaks fringes]] | 450 | | | | [[file:README.org::*Add pywal toggle to transient][Add pywal toggle to transient]] | 451 | | | | [[file:README.org::*blend accent color into selected window background][blend accent color into selected window background]] | 452 | | | | [[file:README.org::*Added pywal integration][Added pywal integration]] | 453 | | | | [[file:README.org::*Restore modeline height when switching between modes][Restore modeline height when switching between ...]] | 454 | | | | [[file:README.org::*Define accent color saturation adjustment][Define accent color saturation adjustment]] | 455 | | | | [[file:README.org::*Define accent color darken adjustment][Define accent color darken adjustment]] | 456 | | | | [[file:README.org::*Highlight selected tab with same accent color][Highlight selected tab with same accent color]] | 457 | | | | [[file:README.org::*Add to MELPA][Add to MELPA]] | 458 | | | | [[file:README.org::*Minor change to properly format color-theme-buffer-local][Minor change to properly format color-theme-buf...]] | 459 | | | | [[file:README.org::*Pacified package-lint with visual-fill-column 0.0][Pacified package-lint with visual-fill-column 0.0]] | 460 | | | | [[file:README.org::*Added similar package comparisons as suggested][Added similar package comparisons as suggested]] | 461 | | | | [[file:README.org::*Rename color-name-to-hex to selected-window-accent--color-name-to-hex][Rename color-name-to-hex to selected-window-acc...]] | 462 | | | | [[file:README.org::*Fixing issues to be able to submit to MELPA][Fixing issues to be able to submit to MELPA]] | 463 | | | | [[file:README.org::*Images to img directory and referenced from README][Images to img directory and referenced from README]] | 464 | | | | [[file:README.org::*Expand emacs help / documentation][Expand emacs help / documentation]] | 465 | | | | [[file:README.org::*Add GNU header][Add GNU header]] | 466 | | | | [[file:README.org::*Cope better with 0 thickness][Cope better with 0 thickness]] | 467 | | | | [[file:README.org::*Add ChangeLog.][Add ChangeLog.]] | 468 | | | | [[file:README.org::*isual-fill-column-mode not working again!][isual-fill-column-mode not working again!]] | 469 | | | | [[file:README.org::*Improve modeline contrast between fg and bg][Improve modeline contrast between fg and bg]] | 470 | #+end: 471 | 472 | * ROADMAP 473 | 474 | #+begin: kanban :layout ("..." . 100) :scope nil :range ("TODO" . "DOING") :sort "O" :depth 3 :match "roadmap" :compressed t 475 | | TODO | DOING | 476 | |---------------------------------------------------------------------------------------+-------| 477 | | [[file:README.org::*Incorporate mode-line-active and mode-line-inactive][Incorporate mode-line-active and mode-line-inactive]] | | 478 | | [[file:README.org::*Header-line not shown on window split][Header-line not shown on window split]] | | 479 | | [[file:README.org::*Adjust the not selected-window margin to avoid little window navigation. disruption][Adjust the not selected-window margin to avoid little window navigation. disruption]] | | 480 | | [[file:README.org::*Excess selected-window disruption in header-line. (not sure I can do much about this)][Excess selected-window disruption in header-line. (not sure I can do much about this)]] | | 481 | | [[file:README.org::*Add some form of unit test][Add some form of unit test]] | | 482 | #+end: 483 | 484 | * ISSUES (github) :issues: 485 | 486 | ** TODO ISSUE #6 - Feature request: accent currently selected/focused frame 487 | 488 | If multiple Emacs frames exist, then the selected window in each will be accented. It would be nice if the currently selected/focused frame was accented more than non-focused frames. 489 | 490 | ** DOING ISSUE #4 - Doesn't work well with other packages 491 | 492 | *olivetti & org-sticky-header broken with selected-window-accent-mode* 493 | 494 | I have decided to disable the setting of windows margins as part of this package as this is often used for padding in other packages. This means I can now let packages such as olivetti-mode and visual-fill-column do their own thing without any margin interference. Therefore this package will mainly achieve its functionality via fringe modification rather than fringe/margins. 495 | 496 | The disadvantage of this is that on window transition there will be more of a text in buffer offset shift as the select-window-accent-mode fringe is applied to the select window without a default compensatory margin / fringe shift. This didn't really work anyway and there was always a little shift depending on the width of the native emacs margin character vs fringe pixel size. 497 | 498 | This means I don't have to depend on package checks and maybe packages I am unaware of that depend on window buffer margin changes will work better in the future. 499 | 500 | Maybe I can just define a non selected window compensatory margin in the future, for now I will leave as is and see how it goes! 501 | 502 | However this currently doesn't cover any mode that modifies a window header, like for example org-sticky-header. 503 | 504 | ** DONE ISSUE #1 - Do not apply highlighting when frame only contains 1 window 505 | ** DONE ISSUE #3 - Package breaks fringes 506 | 507 | * ISSUES (other) :issues: 508 | 509 | ** TODO Limiting magit-log when enabled 510 | ** DONE Add pywal toggle to transient 511 | ** DONE blend accent color into selected window background 512 | 513 | ** DONE Added pywal integration 514 | ** DONE Restore modeline height when switching between modes 515 | ** DONE Define accent color saturation adjustment 516 | ** DONE Define accent color darken adjustment 517 | ** DONE Highlight selected tab with same accent color 518 | ** DONE Add to MELPA 519 | ** DONE Minor change to properly format color-theme-buffer-local 520 | ** DONE Pacified package-lint with visual-fill-column 0.0 521 | ** DONE Added similar package comparisons as suggested 522 | ** DONE Rename color-name-to-hex to selected-window-accent--color-name-to-hex 523 | ** DONE Fixing issues to be able to submit to MELPA 524 | - byte-compile / flycheck 525 | - checkdoc 526 | - package-lint 527 | - other 528 | ** DONE Images to img directory and referenced from README 529 | ** DONE Expand emacs help / documentation 530 | ** DONE Add GNU header 531 | ** DONE Cope better with 0 thickness 532 | ** DONE Add ChangeLog. 533 | ** DONE isual-fill-column-mode not working again! 534 | ** DONE Improve modeline contrast between fg and bg 535 | 536 | * ROADMAP :roadmap: 537 | 538 | ** TODO Incorporate mode-line-active and mode-line-inactive 539 | This would make more sense especially in the 'default mode. So in-built Emacs modeline functionality would come into play. 540 | ** TODO Header-line not shown on window split 541 | ** TODO Add some form of unit test 542 | 543 | * Testing 544 | 545 | See CHANGELOG.org 546 | 547 | * Alternative window highlighting packages 548 | 549 | There exist a few Emacs packages that perform window highlighting but that don't quite provide the feature set of selected-window-accent. 550 | 551 | selected-window-accent focusses more on clearly but non-intrusively highlighting the currently selected/focussed window by highlighting aspects of the window border without having to modify the appearance of non-selected windows, hence more akin to a tiling window manager. 552 | 553 | ** selected-window-contrast 554 | 555 | "It Loop windows at frame, measure and adjust contrast. Allow to set color (face) of background and text by comparing their brightness." 556 | 557 | ** dimmer 558 | 559 | "This package provides a minor mode that indicates which buffer is currently active by dimming the faces in the other buffers." 560 | 561 | This is the closest in functionality to selected-window-accent, the difference being that dimmer dims non selected windows rather than accent the selected window. 562 | 563 | dimmer can be used in conjunction and will complement selected-window-accent to further enhance the emphasizing of the selected window. 564 | 565 | ** hiwin 566 | 567 | "This package provides a minor-mode to change the background color of the non active window." 568 | 569 | It uses overlays to highlight non active windows, so is similar to dimmer but is less subtle in its highlighting mechanism and hasn't been updated in excess of 10 years. 570 | 571 | ** color-theme-buffer-local 572 | 573 | "This package lets you set a color-theme on a per-buffer basis." 574 | 575 | Unlike dimmer and hiwin this package isn't related to the concept of a selected window but more of defining different themes for different windows to distinguish them. 576 | 577 | ** solaire-mode 578 | 579 | "This package is designed to visually distinguish "real" buffers (i.e. file-visiting code buffers where you do most of your work) from "unreal" buffers (like popups, sidebars, log buffers, terminals, etc) by giving the latter a slightly different -- often darker -- background" 580 | 581 | Unlike dimmer and hiwin this package isn't related to the concept of a selected window but more of distinguishing between collections of IDE like elements within Emacs. 582 | 583 | * Contributing 584 | 585 | Contributions to arscript-mode are welcome! Whether it's bug reports, feature suggestions, or code contributions, feel free to reach out or submit pull requests on GitHub. 586 | -------------------------------------------------------------------------------- /demos/selected-window-accent-mode-demo-blend.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/captainflasmr/selected-window-accent-mode/44e43b9706bf0cc09f54f36859b060df53ae5278/demos/selected-window-accent-mode-demo-blend.gif -------------------------------------------------------------------------------- /demos/selected-window-accent-mode-demo-pywal.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/captainflasmr/selected-window-accent-mode/44e43b9706bf0cc09f54f36859b060df53ae5278/demos/selected-window-accent-mode-demo-pywal.gif -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Set default values if not specified 2 | PREFIX ?= /usr 3 | infodir ?= $(PREFIX)/share/info 4 | 5 | .PHONY: docs install-docs 6 | 7 | # Build the info documentation 8 | docs: selected-window-accent-mode.info 9 | 10 | selected-window-accent-mode.info: selected-window-accent-mode.texi 11 | makeinfo --no-split $< -o $@ 12 | 13 | # Install the info documentation 14 | install-docs: docs 15 | @echo "Installing info documentation..." 16 | install -d $(DESTDIR)$(infodir) 17 | install -m 644 selected-window-accent-mode.info $(DESTDIR)$(infodir)/ 18 | install-info --info-dir=$(DESTDIR)$(infodir) selected-window-accent-mode.info 19 | -------------------------------------------------------------------------------- /docs/README.org: -------------------------------------------------------------------------------- 1 | #+title: Selected Windows Accent Mode Documentation 2 | #+author: James Dyer 3 | #+email: captainflasmr@gmail.com 4 | #+language: en 5 | #+options: ':t toc:nil author:nil email:nil num:nil title:nil 6 | #+todo: TODO DOING | DONE 7 | #+startup: showall 8 | 9 | Added texinfo documentation for future automatic installation through MELPA and created an Emacs manual. 10 | 11 | If you want to see what the manual would look like, just download the docs directory from github, cd into it, and run: 12 | 13 | #+begin_src bash 14 | make 15 | sudo make install-docs 16 | #+end_src 17 | 18 | #+RESULTS: 19 | : make: Nothing to be done for 'docs'. 20 | 21 | Then calling up =info= =C-h i= and selected window accent mode will be present in the Emacs menu, or just select =m= and search for =Selected Window Accent Mode= 22 | 23 | For those interested in the manual, I have converted it into html format, which is accessible here: 24 | 25 | [[file:docs/selected-window-accent-mode.org]] 26 | 27 | It has been converted using the following command: 28 | 29 | #+begin_src bash 30 | makeinfo --html --no-split selected-window-accent-mode.texi -o selected-window-accent-mode.html 31 | pandoc -f html -t org -o selected-window-accent-mode.org selected-window-accent-mode.html 32 | #+end_src 33 | 34 | #+RESULTS: 35 | -------------------------------------------------------------------------------- /docs/selected-window-accent-mode.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Selected Window Accent Mode User Manual 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 |
36 | 40 |

Selected Window Accent Mode

41 | 42 |

The Selected Window Accent Mode is an Emacs package designed to 43 | visually distinguish the currently selected window by applying a 44 | unique accent color to its fringes, mode line, header line, and 45 | margins. 46 |

47 | 48 | 58 |
59 |
60 | 64 |

1 Introduction

65 | 66 | 70 |
71 |

1.1 Overview

72 | 73 |

Selected Window Accent Mode is an Emacs package that helps you keep track of which 74 | window has focus by visually accenting it. It applies distinctive colors to the 75 | fringes, mode line, and potentially tabs of the active window. 76 |

77 |

This is particularly helpful when working with complex window layouts or when using 78 | themes where the distinction between active and inactive windows is subtle. 79 |

80 |
81 |
82 |

1.2 Features

83 | 84 |
    85 |
  • Visually highlights the currently selected window 86 |
  • Multiple accent styles (default, tiling, subtle) 87 |
  • Customizable accent colors 88 |
  • Optional tab-bar integration 89 |
  • Smart borders option for single-window frames 90 |
  • Theme integration via highlight color 91 |
92 | 93 |
94 |
95 |
96 |
97 | 101 |

2 Installation

102 | 103 | 107 |
108 |

2.1 Package Repositories

109 | 110 |

The easiest way to install Selected Window Accent Mode is through MELPA. 111 |

112 |
113 |
M-x package-install RET selected-window-accent-mode RET
114 | 
115 | 116 |
117 |
118 |

2.2 Manual Installation

119 | 120 |

You can also install manually by downloading the package from GitHub: 121 | https://github.com/captainflasmr/selected-window-accent-mode 122 |

123 |
124 |
125 |
126 |
127 | 131 |

3 Configuration

132 | 133 | 139 |
140 |

3.1 Basic Configuration

141 | 142 |

Here’s a simple configuration using use-package: 143 |

144 |
145 |
(use-package selected-window-accent-mode
146 |   :config (selected-window-accent-mode 1)
147 |   :custom
148 |   (selected-window-accent-fringe-thickness 10)
149 |   (selected-window-accent-custom-color nil)
150 |   (selected-window-accent-mode-style 'subtle))
151 | 
152 | 153 |

This will enable the mode with a subtle style, using the current theme’s highlight 154 | color for accents and setting the fringe thickness to 10 pixels. 155 |

156 |
157 |
158 |

3.2 Using a Custom Color

159 | 160 |

If you want to specify your own accent color: 161 |

162 |
163 |
(use-package selected-window-accent-mode
164 |   :config (selected-window-accent-mode 1)
165 |   :custom
166 |   (selected-window-accent-fringe-thickness 10)
167 |   (selected-window-accent-custom-color "orange")
168 |   (selected-window-accent-mode-style 'tiling)
169 |   (selected-window-accent-percentage-darken 0)
170 |   (selected-window-accent-percentage-desaturate 0)
171 |   (selected-window-accent-tab-accent t)
172 |   (selected-window-accent-smart-borders t))
173 | 
174 | 175 |
176 |
177 |

3.3 Tweaking Theme Highlight Color

178 | 179 |

You can also use the theme’s highlight color but adjust it: 180 |

181 |
182 |
(use-package selected-window-accent-mode
183 |   :config (selected-window-accent-mode 1)
184 |   :custom
185 |   (selected-window-accent-fringe-thickness 10)
186 |   (selected-window-accent-custom-color nil)
187 |   (selected-window-accent-mode-style 'tiling)
188 |   (selected-window-accent-percentage-darken 20)
189 |   (selected-window-accent-percentage-desaturate 20)
190 |   (selected-window-accent-tab-accent t)
191 |   (selected-window-accent-smart-borders t))
192 | 
193 | 194 |
195 |
196 |

3.4 Keybinding Setup

197 | 198 |

To set up a key binding for the command map: 199 |

200 |
201 |
(global-set-key (kbd "C-c w") selected-window-accent-map)
202 | 
203 | 204 |
205 |
206 |
207 |
208 | 212 |

4 Usage

213 | 214 | 220 |
221 |

4.1 Basic Usage

222 | 223 |

Once enabled, the mode will automatically highlight the selected window. No further 224 | actions are required for basic functionality. 225 |

226 |
227 |
228 |

4.2 Switching Styles

229 | 230 |

You can interactively switch between different accent styles using: 231 |

232 |
233 |
M-x selected-window-accent-switch-style RET
234 | 
235 | 236 |

You’ll be prompted to choose between: 237 |

    238 |
  • default - Standard Emacs appearance 239 |
  • tiling - Thicker fringes and mode line 240 |
  • subtle - Minimal visual change with accent color 241 |
242 | 243 |
244 |
245 |

4.3 Changing Color

246 | 247 |

To interactively change the accent color: 248 |

249 |
250 |
M-x selected-window-accent-switch-color RET
251 | 
252 | 253 |
254 |
255 |

4.4 Using the Command Map

256 | 257 |

If you’ve set up the keybinding for the command map (e.g., C-c w), you can access 258 | the following commands: 259 |

260 |
261 |
C-c w w
262 |

Switch accent style 263 |

264 |
C-c w RET
265 |

Change accent color 266 |

267 |
C-c w t
268 |

Toggle tab bar accenting 269 |

270 |
C-c w l
271 |

Synchronize tab bar with theme 272 |

273 |
C-c w b
274 |

Toggle smart borders 275 |

276 |
277 | 278 |
279 |
280 |
281 |
282 | 286 |

5 Command Reference

287 | 288 |
289 |
selected-window-accent-mode
290 |

Toggle the minor mode on or off. When enabled, the selected window will be visually 291 | accented. 292 |

293 |
294 |
selected-window-accent-switch-style
295 |

Switch between different accent styles (default, tiling, or subtle). 296 |

297 |
298 |
selected-window-accent-switch-color
299 |

Interactively choose a new accent color. 300 |

301 |
302 |
selected-window-accent-toggle-tab-accent
303 |

Toggle whether to apply the accent color to the tab bar. 304 |

305 |
306 |
selected-window-accent-toggle-smart-borders
307 |

Toggle whether to use smart borders (don’t accent single-window frames). 308 |

309 |
310 |
selected-window-accent-sync-tab-bar-to-theme
311 |

Synchronize tab bar faces with the current theme. 312 |

313 |
314 | 315 |
316 |
317 |
318 | 322 |

6 Customization

323 | 324 | 328 |
329 |

6.1 Available Options

330 | 331 |
332 |
selected-window-accent-fringe-thickness
333 |

The thickness of the accent fringes in pixels. Default is 6. 334 |

335 |
336 |
selected-window-accent-custom-color
337 |

Custom accent color for the selected window. When nil, uses the current theme’s highlight color. 338 |

339 |
340 |
selected-window-accent-mode-style
341 |

Style for accenting the selected window: ’default, ’tiling, or ’subtle. 342 |

343 |
344 |
selected-window-accent-percentage-darken
345 |

Percentage to darken the accent color. Default is 20. 346 |

347 |
348 |
selected-window-accent-percentage-desaturate
349 |

Percentage to desaturate the accent color. Default is 20. 350 |

351 |
352 |
selected-window-accent-tab-accent
353 |

When non-nil, accent the selected tab in the tab-bar. 354 |

355 |
356 |
selected-window-accent-smart-borders
357 |

When non-nil, don’t accent single-window frames. 358 |

359 |
360 | 361 |
362 |
363 |

6.2 Accessing Customization Interface

364 | 365 |

You can access all customization options through the Emacs customization interface: 366 |

367 |
368 |
M-x customize-group RET selected-window-accent RET
369 | 
370 | 371 |
372 |
373 |
374 |
375 | 379 |

7 License

380 | 381 |

Selected Window Accent Mode is licensed under the GNU General Public License version 3 or later. 382 |

383 |
384 |
385 |
386 | 390 |

Index

391 | 392 | 393 |
394 |
395 | 396 | 397 | 398 | 399 | 400 | -------------------------------------------------------------------------------- /docs/selected-window-accent-mode.info: -------------------------------------------------------------------------------- 1 | This is selected-window-accent-mode.info, produced by makeinfo version 2 | 7.2 from selected-window-accent-mode.texi. 3 | 4 | INFO-DIR-SECTION Emacs 5 | START-INFO-DIR-ENTRY 6 | * Selected Window Accent Mode: (selected-window-accent-mode). Visually highlight the selected window. 7 | END-INFO-DIR-ENTRY 8 | 9 |  10 | File: selected-window-accent-mode.info, Node: Top, Next: Introduction, Up: (dir) 11 | 12 | Selected Window Accent Mode 13 | *************************** 14 | 15 | The Selected Window Accent Mode is an Emacs package designed to visually 16 | distinguish the currently selected window by applying a unique accent 17 | color to its fringes, mode line, header line, and margins. 18 | 19 | * Menu: 20 | 21 | * Introduction:: What is Selected Window Accent Mode? 22 | * Installation:: How to install the package 23 | * Configuration:: Basic and advanced configuration options 24 | * Usage:: How to use the package 25 | * Command Reference:: List of available commands 26 | * Customization:: Customizing the package behavior 27 | * License:: License information 28 | * Index:: Complete index 29 | 30 |  31 | File: selected-window-accent-mode.info, Node: Introduction, Next: Installation, Prev: Top, Up: Top 32 | 33 | 1 Introduction 34 | ************** 35 | 36 | 1.1 Overview 37 | ============ 38 | 39 | Selected Window Accent Mode is an Emacs package that helps you keep 40 | track of which window has focus by visually accenting it. It applies 41 | distinctive colors to the fringes, mode line, and potentially tabs of 42 | the active window. 43 | 44 | This is particularly helpful when working with complex window layouts 45 | or when using themes where the distinction between active and inactive 46 | windows is subtle. 47 | 48 | 1.2 Features 49 | ============ 50 | 51 | • Visually highlights the currently selected window 52 | • Multiple accent styles (default, tiling, subtle) 53 | • Customizable accent colors 54 | • Optional tab-bar integration 55 | • Smart borders option for single-window frames 56 | • Theme integration via highlight color 57 | 58 |  59 | File: selected-window-accent-mode.info, Node: Installation, Next: Configuration, Prev: Introduction, Up: Top 60 | 61 | 2 Installation 62 | ************** 63 | 64 | 2.1 Package Repositories 65 | ======================== 66 | 67 | The easiest way to install Selected Window Accent Mode is through MELPA. 68 | 69 | M-x package-install RET selected-window-accent-mode RET 70 | 71 | 2.2 Manual Installation 72 | ======================= 73 | 74 | You can also install manually by downloading the package from GitHub: 75 | 76 | 77 |  78 | File: selected-window-accent-mode.info, Node: Configuration, Next: Usage, Prev: Installation, Up: Top 79 | 80 | 3 Configuration 81 | *************** 82 | 83 | 3.1 Basic Configuration 84 | ======================= 85 | 86 | Here's a simple configuration using ‘use-package’: 87 | 88 | (use-package selected-window-accent-mode 89 | :config (selected-window-accent-mode 1) 90 | :custom 91 | (selected-window-accent-fringe-thickness 10) 92 | (selected-window-accent-custom-color nil) 93 | (selected-window-accent-mode-style 'subtle)) 94 | 95 | This will enable the mode with a subtle style, using the current 96 | theme's highlight color for accents and setting the fringe thickness to 97 | 10 pixels. 98 | 99 | 3.2 Using a Custom Color 100 | ======================== 101 | 102 | If you want to specify your own accent color: 103 | 104 | (use-package selected-window-accent-mode 105 | :config (selected-window-accent-mode 1) 106 | :custom 107 | (selected-window-accent-fringe-thickness 10) 108 | (selected-window-accent-custom-color "orange") 109 | (selected-window-accent-mode-style 'tiling) 110 | (selected-window-accent-percentage-darken 0) 111 | (selected-window-accent-percentage-desaturate 0) 112 | (selected-window-accent-tab-accent t) 113 | (selected-window-accent-smart-borders t)) 114 | 115 | 3.3 Tweaking Theme Highlight Color 116 | ================================== 117 | 118 | You can also use the theme's highlight color but adjust it: 119 | 120 | (use-package selected-window-accent-mode 121 | :config (selected-window-accent-mode 1) 122 | :custom 123 | (selected-window-accent-fringe-thickness 10) 124 | (selected-window-accent-custom-color nil) 125 | (selected-window-accent-mode-style 'tiling) 126 | (selected-window-accent-percentage-darken 20) 127 | (selected-window-accent-percentage-desaturate 20) 128 | (selected-window-accent-tab-accent t) 129 | (selected-window-accent-smart-borders t)) 130 | 131 | 3.4 Keybinding Setup 132 | ==================== 133 | 134 | To set up a key binding for the command map: 135 | 136 | (global-set-key (kbd "C-c w") selected-window-accent-map) 137 | 138 |  139 | File: selected-window-accent-mode.info, Node: Usage, Next: Command Reference, Prev: Configuration, Up: Top 140 | 141 | 4 Usage 142 | ******* 143 | 144 | 4.1 Basic Usage 145 | =============== 146 | 147 | Once enabled, the mode will automatically highlight the selected window. 148 | No further actions are required for basic functionality. 149 | 150 | 4.2 Switching Styles 151 | ==================== 152 | 153 | You can interactively switch between different accent styles using: 154 | 155 | M-x selected-window-accent-switch-style RET 156 | 157 | You'll be prompted to choose between: 158 | • ‘default’ - Standard Emacs appearance 159 | • ‘tiling’ - Thicker fringes and mode line 160 | • ‘subtle’ - Minimal visual change with accent color 161 | 162 | 4.3 Changing Color 163 | ================== 164 | 165 | To interactively change the accent color: 166 | 167 | M-x selected-window-accent-switch-color RET 168 | 169 | 4.4 Using the Command Map 170 | ========================= 171 | 172 | If you've set up the keybinding for the command map (e.g., ‘C-c w’), you 173 | can access the following commands: 174 | 175 | ‘C-c w w’ 176 | Switch accent style 177 | ‘C-c w RET’ 178 | Change accent color 179 | ‘C-c w t’ 180 | Toggle tab bar accenting 181 | ‘C-c w l’ 182 | Synchronize tab bar with theme 183 | ‘C-c w b’ 184 | Toggle smart borders 185 | 186 |  187 | File: selected-window-accent-mode.info, Node: Command Reference, Next: Customization, Prev: Usage, Up: Top 188 | 189 | 5 Command Reference 190 | ******************* 191 | 192 | ‘selected-window-accent-mode’ 193 | Toggle the minor mode on or off. When enabled, the selected window 194 | will be visually accented. 195 | 196 | ‘selected-window-accent-switch-style’ 197 | Switch between different accent styles (default, tiling, or 198 | subtle). 199 | 200 | ‘selected-window-accent-switch-color’ 201 | Interactively choose a new accent color. 202 | 203 | ‘selected-window-accent-toggle-tab-accent’ 204 | Toggle whether to apply the accent color to the tab bar. 205 | 206 | ‘selected-window-accent-toggle-smart-borders’ 207 | Toggle whether to use smart borders (don't accent single-window 208 | frames). 209 | 210 | ‘selected-window-accent-sync-tab-bar-to-theme’ 211 | Synchronize tab bar faces with the current theme. 212 | 213 |  214 | File: selected-window-accent-mode.info, Node: Customization, Next: License, Prev: Command Reference, Up: Top 215 | 216 | 6 Customization 217 | *************** 218 | 219 | 6.1 Available Options 220 | ===================== 221 | 222 | ‘selected-window-accent-fringe-thickness’ 223 | The thickness of the accent fringes in pixels. Default is 6. 224 | 225 | ‘selected-window-accent-custom-color’ 226 | Custom accent color for the selected window. When nil, uses the 227 | current theme's highlight color. 228 | 229 | ‘selected-window-accent-mode-style’ 230 | Style for accenting the selected window: 'default, 'tiling, or 231 | 'subtle. 232 | 233 | ‘selected-window-accent-percentage-darken’ 234 | Percentage to darken the accent color. Default is 20. 235 | 236 | ‘selected-window-accent-percentage-desaturate’ 237 | Percentage to desaturate the accent color. Default is 20. 238 | 239 | ‘selected-window-accent-tab-accent’ 240 | When non-nil, accent the selected tab in the tab-bar. 241 | 242 | ‘selected-window-accent-smart-borders’ 243 | When non-nil, don't accent single-window frames. 244 | 245 | 6.2 Accessing Customization Interface 246 | ===================================== 247 | 248 | You can access all customization options through the Emacs customization 249 | interface: 250 | 251 | M-x customize-group RET selected-window-accent RET 252 | 253 |  254 | File: selected-window-accent-mode.info, Node: License, Next: Index, Prev: Customization, Up: Top 255 | 256 | 7 License 257 | ********* 258 | 259 | Selected Window Accent Mode is licensed under the GNU General Public 260 | License version 3 or later. 261 | 262 |  263 | File: selected-window-accent-mode.info, Node: Index, Prev: License, Up: Top 264 | 265 | Index 266 | ***** 267 | 268 |  269 | Tag Table: 270 | Node: Top281 271 | Node: Introduction1117 272 | Node: Installation1982 273 | Node: Configuration2499 274 | Node: Usage4476 275 | Node: Command Reference5651 276 | Node: Customization6508 277 | Node: License7731 278 | Node: Index7954 279 |  280 | End Tag Table 281 | 282 |  283 | Local Variables: 284 | coding: utf-8 285 | End: 286 | -------------------------------------------------------------------------------- /docs/selected-window-accent-mode.org: -------------------------------------------------------------------------------- 1 | <> 2 | 3 | Next: [[#Introduction][Introduction]]   [[[#Index][Index]]] 4 | 5 | * Selected Window Accent Mode [[#Selected-Window-Accent-Mode][¶]] 6 | :PROPERTIES: 7 | :CUSTOM_ID: Selected-Window-Accent-Mode 8 | :CLASS: top 9 | :END: 10 | The Selected Window Accent Mode is an Emacs package designed to visually 11 | distinguish the currently selected window by applying a unique accent 12 | color to its fringes, mode line, header line, and margins. 13 | 14 | - [[#Introduction][Introduction]] 15 | - [[#Installation][Installation]] 16 | - [[#Configuration][Configuration]] 17 | - [[#Usage][Usage]] 18 | - [[#Command-Reference][Command Reference]] 19 | - [[#Customization][Customization]] 20 | - [[#License][License]] 21 | - [[#Index][Index]] 22 | 23 | -------------- 24 | 25 | <> 26 | 27 | Next: [[#Installation][Installation]], Previous: [[#Top][Selected Window 28 | Accent Mode]], Up: [[#Top][Selected Window Accent Mode]]   29 | [[[#Index][Index]]] 30 | 31 | ** 1 Introduction [[#Introduction-1][¶]] 32 | :PROPERTIES: 33 | :CUSTOM_ID: Introduction-1 34 | :CLASS: chapter 35 | :END: 36 | - [[#Overview][Overview]] 37 | - [[#Features][Features]] 38 | 39 | <> 40 | *** 1.1 Overview [[#Overview][¶]] 41 | :PROPERTIES: 42 | :CUSTOM_ID: overview 43 | :CLASS: section 44 | :END: 45 | Selected Window Accent Mode is an Emacs package that helps you keep 46 | track of which window has focus by visually accenting it. It applies 47 | distinctive colors to the fringes, mode line, and potentially tabs of 48 | the active window. 49 | 50 | This is particularly helpful when working with complex window layouts or 51 | when using themes where the distinction between active and inactive 52 | windows is subtle. 53 | 54 | <> 55 | *** 1.2 Features [[#Features][¶]] 56 | :PROPERTIES: 57 | :CUSTOM_ID: features 58 | :CLASS: section 59 | :END: 60 | - Visually highlights the currently selected window 61 | - Multiple accent styles (default, tiling, subtle) 62 | - Customizable accent colors 63 | - Optional tab-bar integration 64 | - Smart borders option for single-window frames 65 | - Theme integration via highlight color 66 | 67 | -------------- 68 | 69 | <> 70 | 71 | Next: [[#Configuration][Configuration]], Previous: 72 | [[#Introduction][Introduction]], Up: [[#Top][Selected Window Accent 73 | Mode]]   [[[#Index][Index]]] 74 | 75 | ** 2 Installation [[#Installation-1][¶]] 76 | :PROPERTIES: 77 | :CUSTOM_ID: Installation-1 78 | :CLASS: chapter 79 | :END: 80 | - [[#Package-Repositories][Package Repositories]] 81 | - [[#Manual-Installation][Manual Installation]] 82 | 83 | <> 84 | *** 2.1 Package Repositories [[#Package-Repositories][¶]] 85 | :PROPERTIES: 86 | :CUSTOM_ID: package-repositories 87 | :CLASS: section 88 | :END: 89 | The easiest way to install Selected Window Accent Mode is through MELPA. 90 | 91 | #+begin_src example-preformatted 92 | M-x package-install RET selected-window-accent-mode RET 93 | #+end_src 94 | 95 | <> 96 | *** 2.2 Manual Installation [[#Manual-Installation][¶]] 97 | :PROPERTIES: 98 | :CUSTOM_ID: manual-installation 99 | :CLASS: section 100 | :END: 101 | You can also install manually by downloading the package from GitHub: 102 | [[https://github.com/captainflasmr/selected-window-accent-mode]] 103 | 104 | -------------- 105 | 106 | <> 107 | 108 | Next: [[#Usage][Usage]], Previous: [[#Installation][Installation]], Up: 109 | [[#Top][Selected Window Accent Mode]]   [[[#Index][Index]]] 110 | 111 | ** 3 Configuration [[#Configuration-1][¶]] 112 | :PROPERTIES: 113 | :CUSTOM_ID: Configuration-1 114 | :CLASS: chapter 115 | :END: 116 | - [[#Basic-Configuration][Basic Configuration]] 117 | - [[#Using-a-Custom-Color][Using a Custom Color]] 118 | - [[#Tweaking-Theme-Highlight-Color][Tweaking Theme Highlight Color]] 119 | - [[#Keybinding-Setup][Keybinding Setup]] 120 | 121 | <> 122 | *** 3.1 Basic Configuration [[#Basic-Configuration][¶]] 123 | :PROPERTIES: 124 | :CUSTOM_ID: basic-configuration 125 | :CLASS: section 126 | :END: 127 | Here's a simple configuration using =use-package=: 128 | 129 | #+begin_src example-preformatted 130 | (use-package selected-window-accent-mode 131 | :config (selected-window-accent-mode 1) 132 | :custom 133 | (selected-window-accent-fringe-thickness 10) 134 | (selected-window-accent-custom-color nil) 135 | (selected-window-accent-mode-style 'subtle)) 136 | #+end_src 137 | 138 | This will enable the mode with a subtle style, using the current theme's 139 | highlight color for accents and setting the fringe thickness to 10 140 | pixels. 141 | 142 | <> 143 | *** 3.2 Using a Custom Color [[#Using-a-Custom-Color][¶]] 144 | :PROPERTIES: 145 | :CUSTOM_ID: using-a-custom-color 146 | :CLASS: section 147 | :END: 148 | If you want to specify your own accent color: 149 | 150 | #+begin_src example-preformatted 151 | (use-package selected-window-accent-mode 152 | :config (selected-window-accent-mode 1) 153 | :custom 154 | (selected-window-accent-fringe-thickness 10) 155 | (selected-window-accent-custom-color "orange") 156 | (selected-window-accent-mode-style 'tiling) 157 | (selected-window-accent-percentage-darken 0) 158 | (selected-window-accent-percentage-desaturate 0) 159 | (selected-window-accent-tab-accent t) 160 | (selected-window-accent-smart-borders t)) 161 | #+end_src 162 | 163 | <> 164 | *** 3.3 Tweaking Theme Highlight Color [[#Tweaking-Theme-Highlight-Color][¶]] 165 | :PROPERTIES: 166 | :CUSTOM_ID: tweaking-theme-highlight-color 167 | :CLASS: section 168 | :END: 169 | You can also use the theme's highlight color but adjust it: 170 | 171 | #+begin_src example-preformatted 172 | (use-package selected-window-accent-mode 173 | :config (selected-window-accent-mode 1) 174 | :custom 175 | (selected-window-accent-fringe-thickness 10) 176 | (selected-window-accent-custom-color nil) 177 | (selected-window-accent-mode-style 'tiling) 178 | (selected-window-accent-percentage-darken 20) 179 | (selected-window-accent-percentage-desaturate 20) 180 | (selected-window-accent-tab-accent t) 181 | (selected-window-accent-smart-borders t)) 182 | #+end_src 183 | 184 | <> 185 | *** 3.4 Keybinding Setup [[#Keybinding-Setup][¶]] 186 | :PROPERTIES: 187 | :CUSTOM_ID: keybinding-setup 188 | :CLASS: section 189 | :END: 190 | To set up a key binding for the command map: 191 | 192 | #+begin_src example-preformatted 193 | (global-set-key (kbd "C-c w") selected-window-accent-map) 194 | #+end_src 195 | 196 | -------------- 197 | 198 | <> 199 | 200 | Next: [[#Command-Reference][Command Reference]], Previous: 201 | [[#Configuration][Configuration]], Up: [[#Top][Selected Window Accent 202 | Mode]]   [[[#Index][Index]]] 203 | 204 | ** 4 Usage [[#Usage-1][¶]] 205 | :PROPERTIES: 206 | :CUSTOM_ID: Usage-1 207 | :CLASS: chapter 208 | :END: 209 | - [[#Basic-Usage][Basic Usage]] 210 | - [[#Switching-Styles][Switching Styles]] 211 | - [[#Changing-Color][Changing Color]] 212 | - [[#Using-the-Command-Map][Using the Command Map]] 213 | 214 | <> 215 | *** 4.1 Basic Usage [[#Basic-Usage][¶]] 216 | :PROPERTIES: 217 | :CUSTOM_ID: basic-usage 218 | :CLASS: section 219 | :END: 220 | Once enabled, the mode will automatically highlight the selected window. 221 | No further actions are required for basic functionality. 222 | 223 | <> 224 | *** 4.2 Switching Styles [[#Switching-Styles][¶]] 225 | :PROPERTIES: 226 | :CUSTOM_ID: switching-styles 227 | :CLASS: section 228 | :END: 229 | You can interactively switch between different accent styles using: 230 | 231 | #+begin_src example-preformatted 232 | M-x selected-window-accent-switch-style RET 233 | #+end_src 234 | 235 | You'll be prompted to choose between: 236 | 237 | - =default= - Standard Emacs appearance 238 | - =tiling= - Thicker fringes and mode line 239 | - =subtle= - Minimal visual change with accent color 240 | 241 | <> 242 | *** 4.3 Changing Color [[#Changing-Color][¶]] 243 | :PROPERTIES: 244 | :CUSTOM_ID: changing-color 245 | :CLASS: section 246 | :END: 247 | To interactively change the accent color: 248 | 249 | #+begin_src example-preformatted 250 | M-x selected-window-accent-switch-color RET 251 | #+end_src 252 | 253 | <> 254 | *** 4.4 Using the Command Map [[#Using-the-Command-Map][¶]] 255 | :PROPERTIES: 256 | :CUSTOM_ID: using-the-command-map 257 | :CLASS: section 258 | :END: 259 | If you've set up the keybinding for the command map (e.g., =C-c w=), you 260 | can access the following commands: 261 | 262 | - C-c w w :: Switch accent style 263 | 264 | - C-c w RET :: Change accent color 265 | 266 | - C-c w t :: Toggle tab bar accenting 267 | 268 | - C-c w l :: Synchronize tab bar with theme 269 | 270 | - C-c w b :: Toggle smart borders 271 | 272 | -------------- 273 | 274 | <> 275 | 276 | Next: [[#Customization][Customization]], Previous: [[#Usage][Usage]], 277 | Up: [[#Top][Selected Window Accent Mode]]   [[[#Index][Index]]] 278 | 279 | ** 5 Command Reference [[#Command-Reference-1][¶]] 280 | :PROPERTIES: 281 | :CUSTOM_ID: Command-Reference-1 282 | :CLASS: chapter 283 | :END: 284 | - =selected-window-accent-mode= :: Toggle the minor mode on or off. When 285 | enabled, the selected window will be visually accented. 286 | 287 | - =selected-window-accent-switch-style= :: Switch between different 288 | accent styles (default, tiling, or subtle). 289 | 290 | - =selected-window-accent-switch-color= :: Interactively choose a new 291 | accent color. 292 | 293 | - =selected-window-accent-toggle-tab-accent= :: Toggle whether to apply 294 | the accent color to the tab bar. 295 | 296 | - =selected-window-accent-toggle-smart-borders= :: Toggle whether to use 297 | smart borders (don't accent single-window frames). 298 | 299 | - =selected-window-accent-sync-tab-bar-to-theme= :: Synchronize tab bar 300 | faces with the current theme. 301 | 302 | -------------- 303 | 304 | <> 305 | 306 | Next: [[#License][License]], Previous: [[#Command-Reference][Command 307 | Reference]], Up: [[#Top][Selected Window Accent Mode]]   308 | [[[#Index][Index]]] 309 | 310 | ** 6 Customization [[#Customization-1][¶]] 311 | :PROPERTIES: 312 | :CUSTOM_ID: Customization-1 313 | :CLASS: chapter 314 | :END: 315 | - [[#Available-Options][Available Options]] 316 | - [[#Accessing-Customization-Interface][Accessing Customization 317 | Interface]] 318 | 319 | <> 320 | *** 6.1 Available Options [[#Available-Options][¶]] 321 | :PROPERTIES: 322 | :CUSTOM_ID: available-options 323 | :CLASS: section 324 | :END: 325 | - =selected-window-accent-fringe-thickness= :: The thickness of the 326 | accent fringes in pixels. Default is 6. 327 | 328 | - =selected-window-accent-custom-color= :: Custom accent color for the 329 | selected window. When nil, uses the current theme's highlight color. 330 | 331 | - =selected-window-accent-mode-style= :: Style for accenting the 332 | selected window: 'default, 'tiling, or 'subtle. 333 | 334 | - =selected-window-accent-percentage-darken= :: Percentage to darken the 335 | accent color. Default is 20. 336 | 337 | - =selected-window-accent-percentage-desaturate= :: Percentage to 338 | desaturate the accent color. Default is 20. 339 | 340 | - =selected-window-accent-tab-accent= :: When non-nil, accent the 341 | selected tab in the tab-bar. 342 | 343 | - =selected-window-accent-smart-borders= :: When non-nil, don't accent 344 | single-window frames. 345 | 346 | <> 347 | *** 6.2 Accessing Customization Interface [[#Accessing-Customization-Interface][¶]] 348 | :PROPERTIES: 349 | :CUSTOM_ID: accessing-customization-interface 350 | :CLASS: section 351 | :END: 352 | You can access all customization options through the Emacs customization 353 | interface: 354 | 355 | #+begin_src example-preformatted 356 | M-x customize-group RET selected-window-accent RET 357 | #+end_src 358 | 359 | -------------- 360 | 361 | <> 362 | 363 | Next: [[#Index][Index]], Previous: [[#Customization][Customization]], 364 | Up: [[#Top][Selected Window Accent Mode]]   [[[#Index][Index]]] 365 | 366 | ** 7 License [[#License-1][¶]] 367 | :PROPERTIES: 368 | :CUSTOM_ID: License-1 369 | :CLASS: chapter 370 | :END: 371 | Selected Window Accent Mode is licensed under the GNU General Public 372 | License version 3 or later. 373 | 374 | -------------- 375 | 376 | <> 377 | 378 | Previous: [[#License][License]], Up: [[#Top][Selected Window Accent 379 | Mode]]   [[[#Index][Index]]] 380 | 381 | ** Index [[#Index-1][¶]] 382 | :PROPERTIES: 383 | :CUSTOM_ID: Index-1 384 | :CLASS: unnumbered 385 | :END: 386 | -------------------------------------------------------------------------------- /docs/selected-window-accent-mode.texi: -------------------------------------------------------------------------------- 1 | \input texinfo @c -*- texinfo -*- 2 | @c %**start of header 3 | @setfilename selected-window-accent-mode.info 4 | @settitle Selected Window Accent Mode User Manual 5 | @documentencoding UTF-8 6 | @c %**end of header 7 | 8 | @dircategory Emacs 9 | @direntry 10 | * Selected Window Accent Mode: (selected-window-accent-mode). Visually highlight the selected window. 11 | @end direntry 12 | 13 | @titlepage 14 | @title Selected Window Accent Mode User Manual 15 | @author James Dyer 16 | @end titlepage 17 | 18 | @ifnottex 19 | @node Top 20 | @top Selected Window Accent Mode 21 | 22 | The Selected Window Accent Mode is an Emacs package designed to 23 | visually distinguish the currently selected window by applying a 24 | unique accent color to its fringes, mode line, header line, and 25 | margins. 26 | @end ifnottex 27 | 28 | @menu 29 | * Introduction:: What is Selected Window Accent Mode? 30 | * Installation:: How to install the package 31 | * Configuration:: Basic and advanced configuration options 32 | * Usage:: How to use the package 33 | * Command Reference:: List of available commands 34 | * Customization:: Customizing the package behavior 35 | * License:: License information 36 | * Index:: Complete index 37 | @end menu 38 | 39 | @node Introduction 40 | @chapter Introduction 41 | 42 | @section Overview 43 | 44 | Selected Window Accent Mode is an Emacs package that helps you keep track of which 45 | window has focus by visually accenting it. It applies distinctive colors to the 46 | fringes, mode line, and potentially tabs of the active window. 47 | 48 | This is particularly helpful when working with complex window layouts or when using 49 | themes where the distinction between active and inactive windows is subtle. 50 | 51 | @section Features 52 | 53 | @itemize @bullet 54 | @item Visually highlights the currently selected window 55 | @item Multiple accent styles (default, tiling, subtle) 56 | @item Customizable accent colors 57 | @item Optional tab-bar integration 58 | @item Smart borders option for single-window frames 59 | @item Theme integration via highlight color 60 | @end itemize 61 | 62 | @node Installation 63 | @chapter Installation 64 | 65 | @section Package Repositories 66 | 67 | The easiest way to install Selected Window Accent Mode is through MELPA. 68 | 69 | @example 70 | M-x package-install RET selected-window-accent-mode RET 71 | @end example 72 | 73 | @section Manual Installation 74 | 75 | You can also install manually by downloading the package from GitHub: 76 | @url{https://github.com/captainflasmr/selected-window-accent-mode} 77 | 78 | @node Configuration 79 | @chapter Configuration 80 | 81 | @section Basic Configuration 82 | 83 | Here's a simple configuration using @code{use-package}: 84 | 85 | @example 86 | (use-package selected-window-accent-mode 87 | :config (selected-window-accent-mode 1) 88 | :custom 89 | (selected-window-accent-fringe-thickness 10) 90 | (selected-window-accent-custom-color nil) 91 | (selected-window-accent-mode-style 'subtle)) 92 | @end example 93 | 94 | This will enable the mode with a subtle style, using the current theme's highlight 95 | color for accents and setting the fringe thickness to 10 pixels. 96 | 97 | @section Using a Custom Color 98 | 99 | If you want to specify your own accent color: 100 | 101 | @example 102 | (use-package selected-window-accent-mode 103 | :config (selected-window-accent-mode 1) 104 | :custom 105 | (selected-window-accent-fringe-thickness 10) 106 | (selected-window-accent-custom-color "orange") 107 | (selected-window-accent-mode-style 'tiling) 108 | (selected-window-accent-percentage-darken 0) 109 | (selected-window-accent-percentage-desaturate 0) 110 | (selected-window-accent-tab-accent t) 111 | (selected-window-accent-smart-borders t)) 112 | @end example 113 | 114 | @section Tweaking Theme Highlight Color 115 | 116 | You can also use the theme's highlight color but adjust it: 117 | 118 | @example 119 | (use-package selected-window-accent-mode 120 | :config (selected-window-accent-mode 1) 121 | :custom 122 | (selected-window-accent-fringe-thickness 10) 123 | (selected-window-accent-custom-color nil) 124 | (selected-window-accent-mode-style 'tiling) 125 | (selected-window-accent-percentage-darken 20) 126 | (selected-window-accent-percentage-desaturate 20) 127 | (selected-window-accent-tab-accent t) 128 | (selected-window-accent-smart-borders t)) 129 | @end example 130 | 131 | @section Keybinding Setup 132 | 133 | To set up a key binding for the command map: 134 | 135 | @example 136 | (global-set-key (kbd "C-c w") selected-window-accent-map) 137 | @end example 138 | 139 | @node Usage 140 | @chapter Usage 141 | 142 | @section Basic Usage 143 | 144 | Once enabled, the mode will automatically highlight the selected window. No further 145 | actions are required for basic functionality. 146 | 147 | @section Switching Styles 148 | 149 | You can interactively switch between different accent styles using: 150 | 151 | @example 152 | M-x selected-window-accent-switch-style RET 153 | @end example 154 | 155 | You'll be prompted to choose between: 156 | @itemize @bullet 157 | @item @code{default} - Standard Emacs appearance 158 | @item @code{tiling} - Thicker fringes and mode line 159 | @item @code{subtle} - Minimal visual change with accent color 160 | @end itemize 161 | 162 | @section Changing Color 163 | 164 | To interactively change the accent color: 165 | 166 | @example 167 | M-x selected-window-accent-switch-color RET 168 | @end example 169 | 170 | @section Using the Command Map 171 | 172 | If you've set up the keybinding for the command map (e.g., @code{C-c w}), you can access 173 | the following commands: 174 | 175 | @table @kbd 176 | @item C-c w w 177 | Switch accent style 178 | @item C-c w RET 179 | Change accent color 180 | @item C-c w t 181 | Toggle tab bar accenting 182 | @item C-c w l 183 | Synchronize tab bar with theme 184 | @item C-c w b 185 | Toggle smart borders 186 | @end table 187 | 188 | @node Command Reference 189 | @chapter Command Reference 190 | 191 | @table @code 192 | @item selected-window-accent-mode 193 | Toggle the minor mode on or off. When enabled, the selected window will be visually 194 | accented. 195 | 196 | @item selected-window-accent-switch-style 197 | Switch between different accent styles (default, tiling, or subtle). 198 | 199 | @item selected-window-accent-switch-color 200 | Interactively choose a new accent color. 201 | 202 | @item selected-window-accent-toggle-tab-accent 203 | Toggle whether to apply the accent color to the tab bar. 204 | 205 | @item selected-window-accent-toggle-smart-borders 206 | Toggle whether to use smart borders (don't accent single-window frames). 207 | 208 | @item selected-window-accent-sync-tab-bar-to-theme 209 | Synchronize tab bar faces with the current theme. 210 | @end table 211 | 212 | @node Customization 213 | @chapter Customization 214 | 215 | @section Available Options 216 | 217 | @table @code 218 | @item selected-window-accent-fringe-thickness 219 | The thickness of the accent fringes in pixels. Default is 6. 220 | 221 | @item selected-window-accent-custom-color 222 | Custom accent color for the selected window. When nil, uses the current theme's highlight color. 223 | 224 | @item selected-window-accent-mode-style 225 | Style for accenting the selected window: 'default, 'tiling, or 'subtle. 226 | 227 | @item selected-window-accent-percentage-darken 228 | Percentage to darken the accent color. Default is 20. 229 | 230 | @item selected-window-accent-percentage-desaturate 231 | Percentage to desaturate the accent color. Default is 20. 232 | 233 | @item selected-window-accent-tab-accent 234 | When non-nil, accent the selected tab in the tab-bar. 235 | 236 | @item selected-window-accent-smart-borders 237 | When non-nil, don't accent single-window frames. 238 | @end table 239 | 240 | @section Accessing Customization Interface 241 | 242 | You can access all customization options through the Emacs customization interface: 243 | 244 | @example 245 | M-x customize-group RET selected-window-accent RET 246 | @end example 247 | 248 | @node License 249 | @chapter License 250 | 251 | Selected Window Accent Mode is licensed under the GNU General Public License version 3 or later. 252 | 253 | @node Index 254 | @unnumbered Index 255 | 256 | @printindex cp 257 | 258 | @bye 259 | -------------------------------------------------------------------------------- /img/selected-window-accent-mode-00.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/captainflasmr/selected-window-accent-mode/44e43b9706bf0cc09f54f36859b060df53ae5278/img/selected-window-accent-mode-00.jpg -------------------------------------------------------------------------------- /img/selected-window-accent-mode-01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/captainflasmr/selected-window-accent-mode/44e43b9706bf0cc09f54f36859b060df53ae5278/img/selected-window-accent-mode-01.jpg -------------------------------------------------------------------------------- /img/selected-window-accent-mode-02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/captainflasmr/selected-window-accent-mode/44e43b9706bf0cc09f54f36859b060df53ae5278/img/selected-window-accent-mode-02.jpg -------------------------------------------------------------------------------- /img/selected-window-accent-mode-03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/captainflasmr/selected-window-accent-mode/44e43b9706bf0cc09f54f36859b060df53ae5278/img/selected-window-accent-mode-03.jpg -------------------------------------------------------------------------------- /img/selected-window-accent-mode-04.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/captainflasmr/selected-window-accent-mode/44e43b9706bf0cc09f54f36859b060df53ae5278/img/selected-window-accent-mode-04.jpg -------------------------------------------------------------------------------- /img/selected-window-accent-mode-05.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/captainflasmr/selected-window-accent-mode/44e43b9706bf0cc09f54f36859b060df53ae5278/img/selected-window-accent-mode-05.jpg -------------------------------------------------------------------------------- /img/selected-window-accent-mode-06.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/captainflasmr/selected-window-accent-mode/44e43b9706bf0cc09f54f36859b060df53ae5278/img/selected-window-accent-mode-06.jpg -------------------------------------------------------------------------------- /img/selected-window-accent-mode-07.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/captainflasmr/selected-window-accent-mode/44e43b9706bf0cc09f54f36859b060df53ae5278/img/selected-window-accent-mode-07.jpg -------------------------------------------------------------------------------- /img/selected-window-accent-mode-08.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/captainflasmr/selected-window-accent-mode/44e43b9706bf0cc09f54f36859b060df53ae5278/img/selected-window-accent-mode-08.jpg -------------------------------------------------------------------------------- /img/selected-window-accent-mode-transient-menu.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/captainflasmr/selected-window-accent-mode/44e43b9706bf0cc09f54f36859b060df53ae5278/img/selected-window-accent-mode-transient-menu.jpg -------------------------------------------------------------------------------- /selected-window-accent-mode.el: -------------------------------------------------------------------------------- 1 | ;;; selected-window-accent-mode.el --- Accent Selected Window -*- lexical-binding: t; -*- 2 | ;; 3 | ;; Author: James Dyer 4 | ;; Version: 2.1.0 5 | ;; Package-Requires: ((emacs "28.1")(transient "0.1.0")) 6 | ;; Keywords: convenience 7 | ;; URL: https://github.com/captainflasmr/selected-window-accent-mode 8 | ;; 9 | ;; This file is not part of GNU Emacs. 10 | ;; 11 | ;; This program is free software; you can redistribute it and/or modify 12 | ;; it under the terms of the GNU General Public License as published by 13 | ;; the Free Software Foundation, either version 3 of the License, or (at 14 | ;; your option) any later version. 15 | ;; 16 | ;; This program is distributed in the hope that it will be useful, 17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | ;; GNU General Public License for more details. 20 | ;; 21 | ;; You should have received a copy of the GNU General Public License 22 | ;; along with this program. If not, see . 23 | ;; 24 | ;;; Commentary: 25 | ;; 26 | ;; The Selected Window Accent Mode is an Emacs package designed to 27 | ;; visually distinguish the currently selected window by applying a 28 | ;; unique accent color to its fringes, mode line, header line, and 29 | ;; margins. 30 | ;; 31 | ;;; Quick Start 32 | ;; 33 | ;; To use left and bottom accent based on the themes highlight colour: 34 | ;; 35 | ;; (use-package selected-window-accent-mode 36 | ;; :config (selected-window-accent-mode 1) 37 | ;; :custom 38 | ;; (selected-window-accent-fringe-thickness 10) 39 | ;; (selected-window-accent-custom-color nil) 40 | ;; (selected-window-accent-mode-style 'subtle)) 41 | ;; 42 | ;;; Define your own colour 43 | ;; 44 | ;; (use-package selected-window-accent-mode 45 | ;; :config (selected-window-accent-mode 1) 46 | ;; :custom 47 | ;; (selected-window-accent-fringe-thickness 10) 48 | ;; (selected-window-accent-custom-color "orange") 49 | ;; (selected-window-accent-mode-style 'tiling) 50 | ;; (selected-window-accent-percentage-darken 0) 51 | ;; (selected-window-accent-percentage-desaturate 0) 52 | ;; (selected-window-accent-tab-accent t) 53 | ;; (selected-window-accent-smart-borders t)) 54 | ;; 55 | ;;; Tweak a themes highlight colour 56 | ;; 57 | ;; (use-package selected-window-accent-mode 58 | ;; :config (selected-window-accent-mode 1) 59 | ;; :custom 60 | ;; (selected-window-accent-fringe-thickness 10) 61 | ;; (selected-window-accent-custom-color nil) 62 | ;; (selected-window-accent-mode-style 'tiling) 63 | ;; (selected-window-accent-percentage-darken 20) 64 | ;; (selected-window-accent-percentage-desaturate 20) 65 | ;; (selected-window-accent-tab-accent t) 66 | ;; (selected-window-accent-smart-borders t)) 67 | ;; 68 | ;; (global-set-key (kbd "C-c w") selected-window-accent-map) 69 | ;; 70 | 71 | ;;; Code: 72 | 73 | (require 'color) 74 | 75 | (defgroup selected-window-accent nil 76 | "Customization group for the `selected-window-accent-mode' package." 77 | :group 'convenience) 78 | 79 | (defcustom selected-window-accent-fringe-thickness 6 80 | "Thickness of the accent fringes in pixels." 81 | :type 'integer 82 | :group 'selected-window-accent) 83 | 84 | (defcustom selected-window-accent-custom-color nil 85 | "Custom accent color for the selected window. 86 | When nil, uses the current theme's highlight color." 87 | :type '(choice (const :tag "None" nil) 88 | (color :tag "Custom Color")) 89 | :group 'selected-window-accent) 90 | 91 | (defcustom selected-window-accent-mode-style 'default 92 | "Style for accenting the selected window. 93 | - `default': Standard Emacs appearance 94 | - `tiling': Thicker fringes and mode line 95 | - `subtle': Minimal visual change with accent color" 96 | :type '(choice (const :tag "Default Style" default) 97 | (const :tag "Tiling Style" tiling) 98 | (const :tag "Subtle Style" subtle)) 99 | :group 'selected-window-accent) 100 | 101 | (defcustom selected-window-accent-percentage-darken 20 102 | "Percentage to darken the accent color." 103 | :type 'integer 104 | :group 'selected-window-accent) 105 | 106 | (defcustom selected-window-accent-percentage-desaturate 20 107 | "Percentage to desaturate the accent color." 108 | :type 'integer 109 | :group 'selected-window-accent) 110 | 111 | (defcustom selected-window-accent-tab-accent nil 112 | "When non-nil, accent the selected tab in the tab-bar." 113 | :type 'boolean 114 | :group 'selected-window-accent) 115 | 116 | (defcustom selected-window-accent-smart-borders nil 117 | "When non-nil, don't accent single-window frames." 118 | :type 'boolean 119 | :group 'selected-window-accent) 120 | 121 | (defcustom selected-window-accent-use-pywal nil 122 | "When non-nil, use a color from Pywal generated palette." 123 | :type 'boolean 124 | :group 'selected-window-accent-group) 125 | 126 | (defun selected-window-accent--pixels-to-chars (pixels) 127 | "Convert PIXELS to an approximate character width." 128 | (round (/ pixels (frame-char-width)))) 129 | 130 | (defun selected-window-accent--color-name-to-hex (color-name) 131 | "Convert COLOR-NAME to its hexadecimal representation." 132 | (let ((rgb (color-name-to-rgb color-name))) 133 | (when rgb 134 | (apply #'format "#%02x%02x%02x" 135 | (mapcar (lambda (x) (round (* x 255))) rgb))))) 136 | 137 | (defun selected-window-accent--more-than-one-window-p () 138 | "Return t if the current frame has more than one window." 139 | (> (length (window-list)) 1)) 140 | 141 | (defun selected-window-accent--determine-foreground (bg-color) 142 | "Determine appropriate foreground color based on BG-COLOR brightness." 143 | (if (string-greaterp bg-color "#888888") "#000000" "#ffffff")) 144 | 145 | (defun selected-window-accent-sync-tab-bar-to-theme () 146 | "Synchronize tab-bar faces with the current theme." 147 | (interactive) 148 | (let ((default-bg (face-background 'default)) 149 | (default-fg (face-foreground 'default)) 150 | (inactive-fg (face-foreground 'mode-line-inactive))) ;; Fallback to mode-line-inactive 151 | (custom-set-faces 152 | `(tab-bar ((t (:inherit default :background ,default-bg :foreground ,default-fg)))) 153 | `(tab-bar-tab ((t (:inherit default :background ,default-fg :foreground ,default-bg)))) 154 | `(tab-bar-tab-inactive ((t (:inherit default :background ,default-bg :foreground ,inactive-fg))))))) 155 | 156 | (defun selected-window-accent--get-pywal-color () 157 | "Get the first color from Pywal palette." 158 | (let* ((wal-colors-file (expand-file-name "~/.cache/wal/colors.json")) 159 | (colors-data (when (file-exists-p wal-colors-file) 160 | (with-temp-buffer 161 | (insert-file-contents wal-colors-file) 162 | (goto-char (point-min)) 163 | (json-parse-buffer :object-type 'hash-table))))) 164 | (when colors-data 165 | (let ((colors (gethash "colors" colors-data))) 166 | (when colors 167 | (gethash "color1" colors)))))) 168 | 169 | (defun selected-window-accent (&optional custom-accent-color) 170 | "Set accent colors for the selected window. 171 | With optional CUSTOM-ACCENT-COLOR, use the provided color." 172 | (interactive "P") 173 | (when custom-accent-color 174 | (setq selected-window-accent-custom-color (read-color "Enter custom accent color: "))) 175 | 176 | (let* ((background-color (selected-window-accent--color-name-to-hex 177 | (face-attribute 'default :background))) 178 | (accent-bg-color (cond 179 | ((and selected-window-accent-use-pywal (file-exists-p "~/.cache/wal/colors.json")) 180 | (setq accent-bg-color (selected-window-accent--get-pywal-color))) 181 | (selected-window-accent-custom-color 182 | (selected-window-accent--color-name-to-hex 183 | selected-window-accent-custom-color)) 184 | (t 185 | (let ((base-color (selected-window-accent--color-name-to-hex 186 | (face-attribute 'highlight :background)))) 187 | (setq base-color (color-darken-name base-color 188 | selected-window-accent-percentage-darken)) 189 | (color-desaturate-name base-color 190 | selected-window-accent-percentage-desaturate))))) 191 | (accent-fg-color (selected-window-accent--determine-foreground accent-bg-color)) 192 | (smart-borders-active (and selected-window-accent-smart-borders 193 | (not (selected-window-accent--more-than-one-window-p)))) 194 | (fringe-chars (selected-window-accent--pixels-to-chars 195 | selected-window-accent-fringe-thickness))) 196 | 197 | ;; Configure faces based on style 198 | (pcase selected-window-accent-mode-style 199 | ('tiling 200 | (set-face-attribute 'fringe nil :background accent-bg-color :foreground accent-bg-color) 201 | (set-face-attribute 'mode-line-active nil 202 | :height (* 8 selected-window-accent-fringe-thickness))) 203 | ('subtle 204 | (set-face-attribute 'fringe nil :background accent-bg-color :foreground accent-bg-color) 205 | (set-face-attribute 'mode-line-active nil :height 'unspecified)) 206 | 207 | ('default 208 | (set-face-attribute 'fringe nil :background background-color :foreground background-color) 209 | (set-face-attribute 'mode-line-active nil :height 'unspecified))) 210 | 211 | ;; Set mode-line colors 212 | (if smart-borders-active 213 | (set-face-attribute 'mode-line-active nil :background 'unspecified :foreground 'unspecified) 214 | (set-face-attribute 'mode-line-active nil :background accent-bg-color :foreground accent-fg-color)) 215 | 216 | ;; Set tab colors if requested 217 | (if selected-window-accent-tab-accent 218 | (set-face-attribute 'tab-bar-tab nil :background accent-bg-color :foreground accent-fg-color) 219 | (set-face-attribute 'tab-bar-tab nil :background 'unspecified :foreground 'unspecified)) 220 | 221 | ;; Configure windows 222 | (walk-windows 223 | (lambda (window) 224 | (let ((is-selected (and (not smart-borders-active) (eq window (selected-window))))) 225 | (with-selected-window window 226 | (if is-selected 227 | (progn 228 | ;; Selected window: use fringes, no margins 229 | (pcase selected-window-accent-mode-style 230 | ('tiling 231 | (set-window-margins window 0 0) 232 | (set-window-fringes window 233 | selected-window-accent-fringe-thickness 234 | selected-window-accent-fringe-thickness 0 t)) 235 | ('subtle 236 | (set-window-margins window 0 0) 237 | (set-window-fringes window 238 | selected-window-accent-fringe-thickness 0 0 t)))) 239 | ;; Non-selected window: use margins to compensate for missing fringes 240 | (progn 241 | (pcase selected-window-accent-mode-style 242 | ('tiling 243 | (set-window-fringes window 0 0 0 t) 244 | (set-window-margins window fringe-chars fringe-chars)) 245 | ('subtle 246 | (set-window-fringes window 0 0 0 t) 247 | (set-window-margins window fringe-chars 0)))))))) 248 | nil t))) 249 | 250 | (defun selected-window-accent--reset () 251 | "Reset window accents to defaults." 252 | (set-face-attribute 'fringe nil :background 'unspecified :foreground 'unspecified) 253 | (set-face-attribute 'mode-line-active nil :background 'unspecified 254 | :foreground 'unspecified :height 'unspecified) 255 | (set-face-attribute 'tab-bar-tab nil :background 'unspecified :foreground 'unspecified) 256 | 257 | (walk-windows 258 | (lambda (window) 259 | (set-window-margins window 0 0) 260 | (set-window-fringes window 0 0 0 t)) 261 | nil t)) 262 | 263 | ;;;###autoload 264 | (define-minor-mode selected-window-accent-mode 265 | "Toggle selected window accenting." 266 | :global t 267 | :lighter " SWA" 268 | (if selected-window-accent-mode 269 | (progn 270 | (add-hook 'window-configuration-change-hook #'selected-window-accent) 271 | (add-hook 'window-state-change-hook #'selected-window-accent) 272 | (selected-window-accent)) 273 | (progn 274 | (remove-hook 'window-configuration-change-hook #'selected-window-accent) 275 | (remove-hook 'window-state-change-hook #'selected-window-accent) 276 | (selected-window-accent--reset)))) 277 | 278 | (defun selected-window-accent-switch-style (style) 279 | "Switch the selected window accent STYLE and apply it." 280 | (interactive 281 | (list (intern (completing-read "Choose accent style: " '(default tiling subtle))))) 282 | (customize-set-variable 'selected-window-accent-mode-style style) 283 | (selected-window-accent)) 284 | 285 | (defun selected-window-accent-switch-color () 286 | "Switch the selected window accent color." 287 | (interactive) 288 | (selected-window-accent t)) 289 | 290 | (defun selected-window-accent-toggle-tab-accent () 291 | "Toggle tab bar accenting." 292 | (interactive) 293 | (setq selected-window-accent-tab-accent 294 | (not selected-window-accent-tab-accent)) 295 | (selected-window-accent)) 296 | 297 | (defun selected-window-accent-toggle-smart-borders () 298 | "Toggle smart borders behavior." 299 | (interactive) 300 | (setq selected-window-accent-smart-borders 301 | (not selected-window-accent-smart-borders)) 302 | (selected-window-accent)) 303 | 304 | ;; Simple command map for key bindings 305 | (defvar selected-window-accent-map 306 | (let ((map (make-sparse-keymap))) 307 | (define-key map (kbd "w") 'selected-window-accent-switch-style) 308 | (define-key map (kbd "RET") 'selected-window-accent-switch-color) 309 | (define-key map (kbd "t") 'selected-window-accent-toggle-tab-accent) 310 | (define-key map (kbd "l") 'selected-window-accent-sync-tab-bar-to-theme) 311 | (define-key map (kbd "b") 'selected-window-accent-toggle-smart-borders) 312 | map) 313 | "Keymap for selected-window-accent commands.") 314 | 315 | (provide 'selected-window-accent-mode) 316 | 317 | ;;; selected-window-accent-mode.el ends here 318 | -------------------------------------------------------------------------------- /test/selected-window-accent-init-file.el: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; -> package-archives 3 | ;; 4 | 5 | (require 'package) 6 | 7 | (setq package-archives '(("melpa" . "https://melpa.org/packages/") 8 | ("elpa" . "https://elpa.gnu.org/packages/") 9 | ("org" . "https://orgmode.org/elpa/"))) 10 | 11 | (unless (package-installed-p 'use-package) 12 | (package-install 'use-package)) 13 | (setq use-package-verbose t) 14 | (setq use-package-always-ensure t) 15 | (require 'use-package) 16 | (setq load-prefer-newer t) 17 | 18 | ;; (when init-file-debug 19 | (setq use-package-verbose t 20 | use-package-expand-minimally nil 21 | use-package-compute-statistics t 22 | debug-on-error nil) 23 | 24 | ;; 25 | ;; -> selected-window-accent-mode 26 | ;; 27 | 28 | (use-package selected-window-accent-mode 29 | :load-path "~/source/repos/selected-window-accent-mode" 30 | ;; :ensure nil 31 | ;; :vc (:fetcher github :repo "captainflasmr/selected-window-accent-mode") 32 | :config (selected-window-accent-mode 1) 33 | :custom 34 | (selected-window-accent-fringe-thickness 10) 35 | (selected-window-accent-percentage-darken 0) 36 | (selected-window-accent-percentage-desaturate 0) 37 | (selected-window-accent-smart-borders t) 38 | (selected-window-accent-use-blend-background t) 39 | (selected-window-accent-use-blend-alpha 0.2) 40 | (selected-window-accent-tab-accent t) 41 | (selected-window-accent-use-pywal t) 42 | (selected-window-accent-custom-color "cyan4") 43 | (selected-window-accent-mode-style 'default)) 44 | 45 | (eval-after-load 'selected-window-accent-mode 46 | '(progn 47 | (define-key global-map (kbd "C-c w") 'selected-window-accent-transient))) 48 | -------------------------------------------------------------------------------- /test/selected-window-accent-mode-quick-tests.el: -------------------------------------------------------------------------------- 1 | ;; This file is a list of tests, just evaluate each statement 2 | ;; and see what happens!, maybe in a random order if you want 3 | 4 | ;; initialisation 5 | 6 | (use-package selected-window-accent-mode 7 | :config (selected-window-accent-mode 1)) 8 | 9 | (require 'selected-window-accent-mode) 10 | (selected-window-accent-mode 1) 11 | 12 | ;; check mode compatibility 13 | 14 | (use-package visual-fill-column 15 | :init (visual-fill-column-mode 1)) 16 | 17 | (use-package olivetti 18 | :init (olivetti-mode 1)) 19 | 20 | ;; general quick checks 21 | 22 | (use-package selected-window-accent-mode 23 | :config (selected-window-accent-mode 1) 24 | :custom 25 | (selected-window-accent-use-pywal nil) 26 | (selected-window-accent-fringe-thickness 10) 27 | (selected-window-accent-custom-color nil) 28 | (selected-window-accent-mode-style 'subtle)) 29 | 30 | (use-package selected-window-accent-mode 31 | :config (selected-window-accent-mode 1) 32 | :custom 33 | (selected-window-accent-use-pywal nil) 34 | (selected-window-accent-fringe-thickness 10) 35 | (selected-window-accent-custom-color "#427900") 36 | (selected-window-accent-mode-style 'subtle)) 37 | 38 | ;; keymap function calls 39 | 40 | (defvar my-win-keymap (make-sparse-keymap)) 41 | (global-set-key (kbd "M-o") my-win-keymap) 42 | (define-key my-win-keymap (kbd "a") 'selected-window-accent-mode) 43 | (define-key my-win-keymap (kbd "y") 'selected-window-accent--switch-selected-window-accent-style) 44 | 45 | ;; Example 1 - Default / custom color 46 | 47 | (use-package selected-window-accent-mode 48 | :config (selected-window-accent-mode 1) 49 | :custom 50 | (selected-window-accent-use-pywal nil) 51 | (selected-window-accent-fringe-thickness 20) 52 | (selected-window-accent-custom-color "goldenrod") 53 | (selected-window-accent-mode-style 'default)) 54 | 55 | ;; Example 2 - Tiling / custom color / custom fringe thickness 56 | 57 | (use-package selected-window-accent-mode 58 | :config (selected-window-accent-mode 1) 59 | :custom 60 | (selected-window-accent-use-pywal nil) 61 | (selected-window-accent-fringe-thickness 6) 62 | (selected-window-accent-custom-color "#4179b2") 63 | (selected-window-accent-mode-style 'tiling)) 64 | 65 | ;; Example 3 - Tiling / theme highlight color 66 | 67 | (use-package selected-window-accent-mode 68 | :config (selected-window-accent-mode 1) 69 | :custom 70 | (selected-window-accent-use-pywal nil) 71 | (selected-window-accent-fringe-thickness 10) 72 | (selected-window-accent-custom-color nil) 73 | (selected-window-accent-mode-style 'tiling)) 74 | 75 | ;; Example 4 - Subtle / custom fringe thickness (thick) 76 | 77 | (use-package selected-window-accent-mode 78 | :config (selected-window-accent-mode 1) 79 | :custom 80 | (selected-window-accent-use-pywal nil) 81 | (selected-window-accent-fringe-thickness 20) 82 | (selected-window-accent-custom-color nil) 83 | (selected-window-accent-mode-style 'subtle)) 84 | 85 | ;; Example 5 - Subtle / theme accent colour with darkening and desaturation 86 | 87 | (use-package selected-window-accent-mode 88 | :config (selected-window-accent-mode 1) 89 | :custom 90 | (selected-window-accent-use-pywal nil) 91 | (selected-window-accent-fringe-thickness 20) 92 | (selected-window-accent-percentage-darken 10) 93 | (selected-window-accent-percentage-desaturate 100) 94 | (selected-window-accent-custom-color nil) 95 | (selected-window-accent-mode-style 'subtle)) 96 | 97 | ;; Example 6 - Subtle / theme accent colour with lightening and saturation and tab accent 98 | 99 | (use-package selected-window-accent-mode 100 | :config (selected-window-accent-mode 1) 101 | :custom 102 | (selected-window-accent-use-pywal nil) 103 | (selected-window-accent-fringe-thickness 20) 104 | (selected-window-accent-percentage-darken -10) 105 | (selected-window-accent-percentage-desaturate -100) 106 | (selected-window-accent-tab-accent t) 107 | (selected-window-accent-custom-color nil) 108 | (selected-window-accent-mode-style 'subtle)) 109 | 110 | ;; Example 7 - Blending #1 111 | 112 | (use-package selected-window-accent-mode 113 | :config (selected-window-accent-mode 1) 114 | :custom 115 | (selected-window-accent-use-pywal nil) 116 | (selected-window-accent-fringe-thickness 10) 117 | (selected-window-accent-use-blend-background t) 118 | (selected-window-accent-use-blend-alpha 0.2) 119 | (selected-window-accent-tab-accent t) 120 | (selected-window-accent-custom-color "cyan4") 121 | (selected-window-accent-mode-style 'default)) 122 | 123 | ;; Example 8 - Blending #2 124 | 125 | (use-package selected-window-accent-mode 126 | :config (selected-window-accent-mode 1) 127 | :custom 128 | (selected-window-accent-use-pywal nil) 129 | (selected-window-accent-fringe-thickness 10) 130 | (selected-window-accent-use-blend-background t) 131 | (selected-window-accent-use-blend-alpha 0.1) 132 | (selected-window-accent-tab-accent t) 133 | (selected-window-accent-custom-color "orange") 134 | (selected-window-accent-mode-style 'subtle)) 135 | -------------------------------------------------------------------------------- /test/selected-window-accent-mode-quick-tests_local.el: -------------------------------------------------------------------------------- 1 | ;; This file is a list of local tests, just evaluate each statement 2 | ;; and see what happens!, maybe in a random order if you want 3 | 4 | ;; initialisation 5 | 6 | (use-package selected-window-accent-mode 7 | :load-path "~/source/repos/selected-window-accent-mode" 8 | :config (selected-window-accent-mode 1)) 9 | 10 | (require 'selected-window-accent-mode) 11 | (selected-window-accent-mode 1) 12 | 13 | ;; check mode compatibility 14 | (use-package visual-fill-column 15 | :init (visual-fill-column-mode 1)) 16 | 17 | (use-package olivetti 18 | :init (olivetti-mode 1)) 19 | 20 | ;; general quick checks 21 | 22 | (use-package selected-window-accent-mode 23 | :load-path "~/source/repos/selected-window-accent-mode" 24 | :config (selected-window-accent-mode 1) 25 | :custom 26 | (selected-window-accent-use-pywal nil) 27 | (selected-window-accent-fringe-thickness 10) 28 | (selected-window-accent-custom-color nil) 29 | (selected-window-accent-mode-style 'subtle)) 30 | 31 | (use-package selected-window-accent-mode 32 | :load-path "~/source/repos/selected-window-accent-mode" 33 | :config (selected-window-accent-mode 1) 34 | :custom 35 | (selected-window-accent-use-pywal nil) 36 | (selected-window-accent-fringe-thickness 10) 37 | (selected-window-accent-custom-color "#427900") 38 | (selected-window-accent-mode-style 'subtle)) 39 | 40 | ;; Example 1 - Default / custom color 41 | 42 | (use-package selected-window-accent-mode 43 | :load-path "~/source/repos/selected-window-accent-mode" 44 | :config (selected-window-accent-mode 1) 45 | :custom 46 | (selected-window-accent-use-pywal nil) 47 | (selected-window-accent-fringe-thickness 20) 48 | (selected-window-accent-custom-color "goldenrod") 49 | (selected-window-accent-mode-style 'default)) 50 | 51 | ;; Example 2 - Tiling / custom color / custom fringe thickness 52 | 53 | (use-package selected-window-accent-mode 54 | :load-path "~/source/repos/selected-window-accent-mode" 55 | :config (selected-window-accent-mode 1) 56 | :custom 57 | (selected-window-accent-use-pywal nil) 58 | (selected-window-accent-fringe-thickness 6) 59 | (selected-window-accent-custom-color "#4179b2") 60 | (selected-window-accent-mode-style 'tiling)) 61 | 62 | ;; Example 3 - Tiling / theme highlight color 63 | 64 | (use-package selected-window-accent-mode 65 | :load-path "~/source/repos/selected-window-accent-mode" 66 | :config (selected-window-accent-mode 1) 67 | :custom 68 | (selected-window-accent-use-pywal nil) 69 | (selected-window-accent-fringe-thickness 10) 70 | (selected-window-accent-custom-color nil) 71 | (selected-window-accent-mode-style 'tiling)) 72 | 73 | ;; Example 4 - Subtle / custom fringe thickness (thick) 74 | 75 | (use-package selected-window-accent-mode 76 | :load-path "~/source/repos/selected-window-accent-mode" 77 | :config (selected-window-accent-mode 1) 78 | :custom 79 | (selected-window-accent-use-pywal nil) 80 | (selected-window-accent-fringe-thickness 20) 81 | (selected-window-accent-custom-color nil) 82 | (selected-window-accent-mode-style 'subtle)) 83 | 84 | ;; Example 5 - Subtle / theme accent colour with darkening and desaturation 85 | 86 | (use-package selected-window-accent-mode 87 | :load-path "~/source/repos/selected-window-accent-mode" 88 | :config (selected-window-accent-mode 1) 89 | :custom 90 | (selected-window-accent-use-pywal nil) 91 | (selected-window-accent-fringe-thickness 20) 92 | (selected-window-accent-percentage-darken 10) 93 | (selected-window-accent-percentage-desaturate 100) 94 | (selected-window-accent-custom-color nil) 95 | (selected-window-accent-mode-style 'subtle)) 96 | 97 | ;; Example 6 - Subtle / theme accent colour with lightening and saturation and tab accent 98 | 99 | (use-package selected-window-accent-mode 100 | :load-path "~/source/repos/selected-window-accent-mode" 101 | :config (selected-window-accent-mode 1) 102 | :custom 103 | (selected-window-accent-use-pywal nil) 104 | (selected-window-accent-fringe-thickness 20) 105 | (selected-window-accent-percentage-darken -10) 106 | (selected-window-accent-percentage-desaturate -100) 107 | (selected-window-accent-tab-accent t) 108 | (selected-window-accent-custom-color nil) 109 | (selected-window-accent-mode-style 'subtle)) 110 | 111 | ;; Example 7 - Blending #1 112 | 113 | (use-package selected-window-accent-mode 114 | :load-path "~/source/repos/selected-window-accent-mode" 115 | :config (selected-window-accent-mode 1) 116 | :custom 117 | (selected-window-accent-use-pywal nil) 118 | (selected-window-accent-fringe-thickness 10) 119 | (selected-window-accent-use-blend-background t) 120 | (selected-window-accent-use-blend-alpha 0.2) 121 | (selected-window-accent-tab-accent t) 122 | (selected-window-accent-custom-color "cyan4") 123 | (selected-window-accent-mode-style 'default)) 124 | 125 | ;; Example 8 - Blending #2 126 | 127 | (use-package selected-window-accent-mode 128 | :load-path "~/source/repos/selected-window-accent-mode" 129 | :config (selected-window-accent-mode 1) 130 | :custom 131 | (selected-window-accent-use-pywal nil) 132 | (selected-window-accent-fringe-thickness 10) 133 | (selected-window-accent-use-blend-background t) 134 | (selected-window-accent-use-blend-alpha 0.1) 135 | (selected-window-accent-tab-accent t) 136 | (selected-window-accent-custom-color "orange") 137 | (selected-window-accent-mode-style 'subtle)) 138 | -------------------------------------------------------------------------------- /test/selected-window-accent-mode-tests.el: -------------------------------------------------------------------------------- 1 | ;; 2 | ;; Quick Start 3 | 4 | (use-package selected-window-accent-mode 5 | :load-path "/mnt/hgfs/SharedVM/selected-window-accent-mode-main" 6 | :config (selected-window-accent-mode 1) 7 | :custom 8 | (selected-window-accent-fringe-thickness 10) 9 | (selected-window-accent-custom-color nil) 10 | (selected-window-accent-mode-style 'subtle)) 11 | 12 | ;; Define your own colour 13 | 14 | (use-package selected-window-accent-mode 15 | :load-path "/mnt/hgfs/SharedVM/selected-window-accent-mode-main" 16 | :config (selected-window-accent-mode 1) 17 | :custom 18 | (selected-window-accent-fringe-thickness 10) 19 | (selected-window-accent-custom-color "orange") 20 | (selected-window-accent-mode-style 'tiling) 21 | (selected-window-accent-percentage-darken 0) 22 | (selected-window-accent-percentage-desaturate 0) 23 | (selected-window-accent-tab-accent t) 24 | (selected-window-accent-smart-borders t)) 25 | 26 | ;; Tweak a themes highlight colour 27 | 28 | (use-package selected-window-accent-mode 29 | :load-path "/mnt/hgfs/SharedVM/selected-window-accent-mode-main" 30 | :config (selected-window-accent-mode 1) 31 | :custom 32 | (selected-window-accent-fringe-thickness 10) 33 | (selected-window-accent-custom-color nil) 34 | (selected-window-accent-mode-style 'tiling) 35 | (selected-window-accent-percentage-darken 20) 36 | (selected-window-accent-percentage-desaturate 20) 37 | (selected-window-accent-tab-accent t) 38 | (selected-window-accent-smart-borders t)) 39 | (global-set-key (kbd "C-c w") selected-window-accent-map) 40 | -------------------------------------------------------------------------------- /test/selected-window-accent-mode_unit_test.el: -------------------------------------------------------------------------------- 1 | ;;; Tests for 'selected-window-accent-mode' 2 | 3 | (require 'selected-window-accent-mode) 4 | (require 'ert) ;; Emacs Lisp's testing framework 5 | 6 | ;;; Testing helper functions 7 | 8 | (ert-deftest test-selected-window-accent--color-name-to-hex () 9 | "Test the conversion of color names to hex." 10 | (should (equal (selected-window-accent--color-name-to-hex "white") "#ffffff")) 11 | (should (equal (selected-window-accent--color-name-to-hex "black") "#000000")) 12 | (should (equal (selected-window-accent--color-name-to-hex "red") "#ff0000"))) 13 | 14 | (ert-deftest test-selected-window-accent--invert-color () 15 | "Test inverting a color." 16 | (should (equal (selected-window-accent--invert-color "#ffffff") "#000000")) 17 | (should (equal (selected-window-accent--invert-color "#000000") "#ffffff")) 18 | (should (equal (selected-window-accent--invert-color "#123456") "#edcba9"))) 19 | 20 | (ert-deftest test-selected-window-accent--increment-color-brightness () 21 | "Test incrementing the brightness of a color." 22 | (should (equal (selected-window-accent--increment-color-brightness "#000000" 0.1) "#191919")) 23 | (should (equal (selected-window-accent--increment-color-brightness "#123456" 0.1) "#263d60")) 24 | (should-error (selected-window-accent--increment-color-brightness "invalid-color" 0.1))) 25 | 26 | (ert-deftest test-selected-window-accent--decrement-color-brightness () 27 | "Test decrementing the brightness of a color." 28 | (should (equal (selected-window-accent--decrement-color-brightness "#ffffff" 0.1) "#e5e5e5")) 29 | (should (equal (selected-window-accent--decrement-color-brightness "#123456" 0.1) "#0e283f")) 30 | (should-error (selected-window-accent--decrement-color-brightness "invalid-color" 0.1))) 31 | 32 | (ert-deftest test-selected-window-accent-blend-colors () 33 | "Test blending two colors together." 34 | (should (equal (selected-window-accent-blend-colors "#000000" "#ffffff" 0.5) "#808080")) 35 | (should (equal (selected-window-accent-blend-colors "#ff0000" "#0000ff" 0.5) "#800080")) 36 | (should (equal (selected-window-accent-blend-colors "#123456" "#654321" 0.3) "#213a52"))) 37 | 38 | (ert-deftest test-selected-window-accent--more-than-one-window-p () 39 | "Test whether more than one window is open in the current frame." 40 | ;; Mocking could be done here if needed for `window-list` behavior. 41 | (should-not (selected-window-accent--more-than-one-window-p)) 42 | ;; Open a new window temporarily for testing 43 | (let ((initial-window (selected-window))) 44 | (split-window-right) 45 | (unwind-protect 46 | (should (selected-window-accent--more-than-one-window-p)) 47 | (delete-other-windows)))) 48 | 49 | ;;; Integration-level tests 50 | 51 | (ert-deftest test-selected-window-accent () 52 | "Test the main `selected-window-accent` function." 53 | (let ((selected-window-accent-mode-style 'tiling) 54 | (selected-window-accent-custom-color "#ff0000") 55 | (selected-window-accent-tab-accent t)) 56 | ;; Mock environment validation 57 | (with-temp-buffer 58 | ;; Simulate environment changes 59 | (selected-window-accent) 60 | ;; Validate that the fringe face attributes were updated 61 | (should (equal (face-attribute 'fringe :background) "#ff0000")) 62 | ;; Validate tab accents 63 | (should (equal (face-attribute 'tab-bar-tab :background) "#ff0000"))))) 64 | 65 | (ert-deftest test-selected-window-accent-sync-tab-bar-to-theme () 66 | "Test syncing tab-bar faces with the current theme." 67 | (let ((default-bg "#282c34") 68 | (default-fg "#ffffff") 69 | (inactive-fg "#d8dee9")) 70 | ;; Temporarily modify the default face attributes 71 | (set-face-attribute 'default nil :background default-bg :foreground default-fg) 72 | (set-face-attribute 'mode-line-inactive nil :foreground inactive-fg) 73 | ;; Call the sync function 74 | (selected-window-accent-sync-tab-bar-to-theme) 75 | ;; Check the updated attributes 76 | (should (equal (face-attribute 'tab-bar :background) default-bg)) 77 | (should (equal (face-attribute 'tab-bar-tab :background) default-fg)) 78 | (should (equal (face-attribute 'tab-bar-tab :foreground) default-bg)) 79 | (should (equal (face-attribute 'tab-bar-tab-inactive :foreground) inactive-fg)))) 80 | 81 | (ert-deftest test-selected-window-accent-switch-selected-window-accent-style () 82 | "Test switching the selected window accent style." 83 | (selected-window-accent-switch-selected-window-accent-style 'subtle) 84 | (should (eq selected-window-accent-mode-style 'subtle)) 85 | ;; Ensure the style application 86 | (should-not (eq (face-attribute 'mode-line-active :height) 'unspecified))) 87 | 88 | ;;; Test toggles 89 | 90 | (ert-deftest test-selected-window-accent-toggle-smart-borders () 91 | "Test toggling the smart borders feature." 92 | (let ((selected-window-accent-smart-borders nil)) 93 | (selected-window-accent-toggle-smart-borders) 94 | (should selected-window-accent-smart-borders))) 95 | 96 | (ert-deftest test-selected-window-accent-toggle-tab-accent () 97 | "Test toggling the tab accent feature." 98 | (let ((selected-window-accent-tab-accent nil)) 99 | (selected-window-accent-toggle-tab-accent) 100 | (should selected-window-accent-tab-accent))) 101 | 102 | (ert-deftest test-selected-window-accent-output-selected-window-accent-settings () 103 | "Test exporting current settings into a buffer." 104 | (selected-window-accent-output-selected-window-accent-settings) 105 | (let ((output-buffer (get-buffer "*selected-window-accent-mode-settings*"))) 106 | (should output-buffer) 107 | (with-current-buffer output-buffer 108 | (should (string-match "(use-package selected-window-accent-mode" (buffer-string)))))) 109 | 110 | ;;; Run all tests 111 | 112 | ;; You can invoke this via `M-x ert` or programmatically 113 | (when noninteractive 114 | (ert-run-tests-batch-and-exit)) 115 | ``` 116 | 117 | ### Key Notes: 118 | 1. **Helper Functions:** 119 | - Focus tests on small utility functions like `selected-window-accent--color-name-to-hex`, `selected-window-accent--invert-color`, etc., to ensure correctness independently of the larger GUI context. 120 | 121 | 2. **Mocking:** 122 | - Mocking functionality like `window-list` or face attributes might be optional during Emacs unit testing since the goal is to validate changes rather than simulate OS behavior. 123 | 124 | 3. **Buffer and Face Management:** 125 | - Temporary buffers and face modifications are used to ensure the test environment doesn't interfere with the user's session or other tests. 126 | 127 | 4. **Interactive Functions:** 128 | - For functions like `selected-window-accent-toggle-smart-borders`, toggling is tested by observing changes in related global variables' state. 129 | 130 | 5. **Test Execution:** 131 | - Use `M-x ert` for an interactive report or attach `(ert-run-tests-batch-and-exit)` for CI pipelines and batch modes. 132 | 133 | With the above coverage, you address core functions, integration (effect application to the Emacs environment), and feature toggles. 134 | --------------------------------------------------------------------------------