├── .gitignore ├── LICENSE ├── README.md ├── animations └── animations.go ├── binds └── binds.go ├── decoration ├── blur.go ├── decoration.go ├── dim.go ├── opacity.go └── shadow.go ├── general ├── border.go ├── colors.go ├── cursor.go ├── gap.go └── general.go ├── gestures └── gestures.go ├── go.mod ├── go.sum ├── group ├── group.go └── groupbar.go ├── information └── information.go ├── input ├── cursor.go ├── input.go ├── keyboard.go ├── tablet.go ├── touchdevice.go └── touchpad.go ├── main.go ├── misc └── misc.go ├── opengl └── opengl.go ├── src └── hyprsettings.gif ├── utils ├── display.go ├── hyprlang.go ├── page.go ├── settingPage.go └── utils.go └── xwayland └── xwayland.go /.gitignore: -------------------------------------------------------------------------------- 1 | PKGBUILD 2 | hyprsettings 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Hadi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Hyprsettings 2 | 3 | --- 4 | 5 | ### **/!\\ Deprecated** 6 | 7 | --- 8 | 9 | ![hyprsettings](src/hyprsettings.gif) 10 | 11 | The hyprlandsettings utility is a powerful tool designed for modifying settings within the Hyprland Window Manager (WM) through a Text User Interface (TUI). 12 | This package provides a seamless and intuitive way for users to interactively tweak and customize various aspects of the Hyprland WM, enhancing the user experience and allowing for personalized desktop environments. 13 | 14 | Built with [hyprlang-parser](https://github.com/anotherhadi/hyprlang-parser) and [gml-ui](https://github.com/anotherhadi/gml-ui) 15 | 16 | ## Installation 17 | 18 | Install it with `go`: 19 | 20 | ```bash 21 | go install github.com/anotherhadi/hyprsettings@latest 22 | ``` 23 | 24 | ## Todo: 25 | 26 | - Handle Multiple-file configurations 27 | - Add bind, exec-once, monitor, env and windowrule settings 28 | 29 | ## Key features: 30 | 31 | - **Interactive TUI Interface**: The package offers an interactive text-based interface, allowing users to navigate through different settings easily. This intuitive interface simplifies the customization process. 32 | - **Comprehensive Settings**: Users can modify a wide range of settings, including but not limited to window behavior, appearance, keybindings, and system preferences. This ensures a comprehensive and tailored experience for each user. 33 | - **Efficient Configuration**: The tool is designed with efficiency in mind, enabling users to quickly and effortlessly adjust Hyprland WM settings without the need for extensive command-line knowledge. 34 | 35 | -------------------------------------------------------------------------------- /animations/animations.go: -------------------------------------------------------------------------------- 1 | package animations 2 | 3 | import ( 4 | hyprsettings_utils "github.com/anotherhadi/hyprsettings/utils" 5 | ) 6 | 7 | func Animations() hyprsettings_utils.Page { 8 | return hyprsettings_utils.Page{ 9 | Title: "Animations", 10 | Description: "Change animations settings", 11 | Child: []hyprsettings_utils.Page{ 12 | 13 | { 14 | Title: "Enabled", 15 | Description: "enable animations", 16 | PageType: "bool", 17 | Setting: hyprsettings_utils.Setting{ 18 | Section: "animations/", 19 | Variable: "enabled", 20 | BoolSetting: hyprsettings_utils.BoolSetting{ 21 | DefaultVal: true, 22 | }, 23 | }, 24 | }, 25 | 26 | { 27 | Title: "First launch animation", 28 | Description: "enable first launch animation", 29 | PageType: "bool", 30 | Setting: hyprsettings_utils.Setting{ 31 | Section: "animations/", 32 | Variable: "first_launch_animation", 33 | BoolSetting: hyprsettings_utils.BoolSetting{ 34 | DefaultVal: true, 35 | }, 36 | }, 37 | }, 38 | 39 | // TODO: ALL animations settings, list thing 40 | }, 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /binds/binds.go: -------------------------------------------------------------------------------- 1 | package binds 2 | 3 | import hyprsettings_utils "github.com/anotherhadi/hyprsettings/utils" 4 | 5 | func Binds() hyprsettings_utils.Page { 6 | 7 | return hyprsettings_utils.Page{ 8 | Title: "Binds", 9 | Description: "Change binds settings", 10 | Child: []hyprsettings_utils.Page{ 11 | 12 | { 13 | Title: "Pass mouse when bound", 14 | Description: "if disabled, will not pass the mouse events to apps / dragging windows around if a keybind has been triggered.", 15 | PageType: "bool", 16 | Setting: hyprsettings_utils.Setting{ 17 | Section: "binds/", 18 | Variable: "pass_mouse_when_bound", 19 | BoolSetting: hyprsettings_utils.BoolSetting{ 20 | DefaultVal: false, 21 | }, 22 | }, 23 | }, 24 | 25 | { 26 | Title: "Scroll event delay", 27 | Description: "in ms, how many ms to wait after a scroll event to allow to pass another one for the binds.", 28 | PageType: "int", 29 | Setting: hyprsettings_utils.Setting{ 30 | Section: "misc/", 31 | Variable: "scroll_event_delay", 32 | IntSetting: hyprsettings_utils.IntSetting{ 33 | DefaultVal: 300, 34 | Minimum: 0, 35 | Maximum: 6000, 36 | }, 37 | }, 38 | }, 39 | 40 | { 41 | Title: "Workspace back and forth", 42 | Description: "If enabled, an attempt to switch to the currently focused workspace will instead switch to the previous workspace. Akin to i3’s auto_back_and_forth.", 43 | PageType: "bool", 44 | Setting: hyprsettings_utils.Setting{ 45 | Section: "binds/", 46 | Variable: "workspace_back_and_forth", 47 | BoolSetting: hyprsettings_utils.BoolSetting{ 48 | DefaultVal: false, 49 | }, 50 | }, 51 | }, 52 | 53 | { 54 | Title: "Allow workspace cycles", 55 | Description: "If enabled, workspaces don’t forget their previous workspace, so cycles can be created by switching to the first workspace in a sequence, then endlessly going to the previous workspace.", 56 | PageType: "bool", 57 | Setting: hyprsettings_utils.Setting{ 58 | Section: "binds/", 59 | Variable: "allow_workspaces_cycles", 60 | BoolSetting: hyprsettings_utils.BoolSetting{ 61 | DefaultVal: false, 62 | }, 63 | }, 64 | }, 65 | 66 | { 67 | Title: "Workspace center on", 68 | Description: "Whether switching workspaces should center the cursor on the workspace (0) or on the last active window for that workspace (1)", 69 | PageType: "int", 70 | Setting: hyprsettings_utils.Setting{ 71 | Section: "misc/", 72 | Variable: "workspace_center_on", 73 | IntSetting: hyprsettings_utils.IntSetting{ 74 | DefaultVal: 0, 75 | Minimum: 0, 76 | Maximum: 1, 77 | }, 78 | }, 79 | }, 80 | 81 | { 82 | Title: "Focus preferred method", 83 | Description: "sets the preferred focus finding method when using focuswindow/movewindow/etc with a direction. 0 - history (recent have priority), 1 - length (longer shared edges have priority)", 84 | PageType: "int", 85 | Setting: hyprsettings_utils.Setting{ 86 | Section: "misc/", 87 | Variable: "focus_preferred_method", 88 | IntSetting: hyprsettings_utils.IntSetting{ 89 | DefaultVal: 0, 90 | Minimum: 0, 91 | Maximum: 1, 92 | }, 93 | }, 94 | }, 95 | 96 | { 97 | Title: "Ignore group lock", 98 | Description: "If enabled, dispatchers like moveintogroup, moveoutofgroup and movewindoworgroup will ignore lock per group.", 99 | PageType: "bool", 100 | Setting: hyprsettings_utils.Setting{ 101 | Section: "binds/", 102 | Variable: "ignore_group_lock", 103 | BoolSetting: hyprsettings_utils.BoolSetting{ 104 | DefaultVal: false, 105 | }, 106 | }, 107 | }, 108 | 109 | { 110 | Title: "Movefocus cycles fullscreen", 111 | Description: "If enabled, when on a fullscreen window, movefocus will cycle fullscreen, if not, it will move the focus in a direction.", 112 | PageType: "bool", 113 | Setting: hyprsettings_utils.Setting{ 114 | Section: "binds/", 115 | Variable: "movefocus_cycles_fullscreen", 116 | BoolSetting: hyprsettings_utils.BoolSetting{ 117 | DefaultVal: true, 118 | }, 119 | }, 120 | }, 121 | }, 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /decoration/blur.go: -------------------------------------------------------------------------------- 1 | package decoration 2 | 3 | import hyprsettings_utils "github.com/anotherhadi/hyprsettings/utils" 4 | 5 | func blur() hyprsettings_utils.Page { 6 | return hyprsettings_utils.Page{ 7 | Title: "Blur", 8 | Description: "Size, passes, noise, contrast..", 9 | Child: []hyprsettings_utils.Page{ 10 | 11 | { 12 | Title: "Enabled", 13 | Description: "enable kawase window background blur ", 14 | PageType: "bool", 15 | Setting: hyprsettings_utils.Setting{ 16 | Section: "decoration/blur/", 17 | Variable: "enabled", 18 | BoolSetting: hyprsettings_utils.BoolSetting{ 19 | DefaultVal: true, 20 | }, 21 | }, 22 | }, 23 | 24 | { 25 | Title: "Size", 26 | Description: "blur size (distance)", 27 | PageType: "int", 28 | Setting: hyprsettings_utils.Setting{ 29 | Section: "decoration/blur/", 30 | Variable: "size", 31 | IntSetting: hyprsettings_utils.IntSetting{ 32 | DefaultVal: 8, 33 | Minimum: 1, 34 | Maximum: 100, 35 | }, 36 | }, 37 | }, 38 | 39 | { 40 | Title: "Passes", 41 | Description: "the amount of passes to perform", 42 | PageType: "int", 43 | Setting: hyprsettings_utils.Setting{ 44 | Section: "decoration/blur/", 45 | Variable: "passes", 46 | IntSetting: hyprsettings_utils.IntSetting{ 47 | DefaultVal: 1, 48 | Minimum: 1, 49 | Maximum: 100, 50 | }, 51 | }, 52 | }, 53 | 54 | { 55 | Title: "Ignore Opacity", 56 | Description: "make the blur layer ignore the opacity of the window", 57 | PageType: "bool", 58 | Setting: hyprsettings_utils.Setting{ 59 | Section: "decoration/blur/", 60 | Variable: "ignore_opacity", 61 | BoolSetting: hyprsettings_utils.BoolSetting{ 62 | DefaultVal: false, 63 | }, 64 | }, 65 | }, 66 | 67 | { 68 | Title: "New Optimizations", 69 | Description: "whether to enable further optimizations to the blur. Recommended to leave on, as it will massively improve performance.", 70 | PageType: "bool", 71 | Setting: hyprsettings_utils.Setting{ 72 | Section: "decoration/blur/", 73 | Variable: "new_optimizations", 74 | BoolSetting: hyprsettings_utils.BoolSetting{ 75 | DefaultVal: true, 76 | }, 77 | }, 78 | }, 79 | 80 | { 81 | Title: "Xray", 82 | Description: "if enabled, floating windows will ignore tiled windows in their blur. Only available if blur_new_optimizations is true. Will reduce overhead on floating blur significantly.", 83 | PageType: "bool", 84 | Setting: hyprsettings_utils.Setting{ 85 | Section: "decoration/blur/", 86 | Variable: "xray", 87 | BoolSetting: hyprsettings_utils.BoolSetting{ 88 | DefaultVal: false, 89 | }, 90 | }, 91 | }, 92 | 93 | // TODO: Float with X decimal 94 | { 95 | Title: "Noise", 96 | Description: "how much noise to apply.", 97 | PageType: "float", 98 | Setting: hyprsettings_utils.Setting{ 99 | Section: "decoration/blur", 100 | Variable: "noise", 101 | FloatSetting: hyprsettings_utils.FloatSetting{ 102 | DefaultVal: 0.0117, 103 | Minimum: 0, 104 | Maximum: 1, 105 | }, 106 | }, 107 | }, 108 | 109 | { 110 | Title: "Contrast", 111 | Description: "contrast modulation for blur.", 112 | PageType: "float", 113 | Setting: hyprsettings_utils.Setting{ 114 | Section: "decoration/blur", 115 | Variable: "contrast", 116 | FloatSetting: hyprsettings_utils.FloatSetting{ 117 | DefaultVal: 0.8916, 118 | Minimum: 0, 119 | Maximum: 2, 120 | }, 121 | }, 122 | }, 123 | 124 | { 125 | Title: "Brightness", 126 | Description: "brightness modulation for blur.", 127 | PageType: "float", 128 | Setting: hyprsettings_utils.Setting{ 129 | Section: "decoration/blur", 130 | Variable: "brightness", 131 | FloatSetting: hyprsettings_utils.FloatSetting{ 132 | DefaultVal: 0.8172, 133 | Minimum: 0, 134 | Maximum: 2, 135 | }, 136 | }, 137 | }, 138 | 139 | { 140 | Title: "Vibrancy", 141 | Description: "Increase saturation of blurred colors", 142 | PageType: "float", 143 | Setting: hyprsettings_utils.Setting{ 144 | Section: "decoration/blur", 145 | Variable: "vibrancy", 146 | FloatSetting: hyprsettings_utils.FloatSetting{ 147 | DefaultVal: 0.1696, 148 | Minimum: 0, 149 | Maximum: 1, 150 | }, 151 | }, 152 | }, 153 | 154 | { 155 | Title: "Vibrancy Darkness", 156 | Description: "How strong the effect of vibrancy is on dark areas", 157 | PageType: "float", 158 | Setting: hyprsettings_utils.Setting{ 159 | Section: "decoration/blur", 160 | Variable: "vibrancy_darkness", 161 | FloatSetting: hyprsettings_utils.FloatSetting{ 162 | DefaultVal: 0, 163 | Minimum: 0, 164 | Maximum: 1, 165 | }, 166 | }, 167 | }, 168 | 169 | { 170 | Title: "Blur Special Workspace", 171 | Description: "whether to blur behind the special workspace", 172 | PageType: "bool", 173 | Setting: hyprsettings_utils.Setting{ 174 | Section: "decoration/blur/", 175 | Variable: "special", 176 | BoolSetting: hyprsettings_utils.BoolSetting{ 177 | DefaultVal: false, 178 | }, 179 | }, 180 | }, 181 | 182 | { 183 | Title: "Popups", 184 | Description: "wheter to blur popups", 185 | PageType: "bool", 186 | Setting: hyprsettings_utils.Setting{ 187 | Section: "decoration/blur/", 188 | Variable: "popups", 189 | BoolSetting: hyprsettings_utils.BoolSetting{ 190 | DefaultVal: false, 191 | }, 192 | }, 193 | }, 194 | 195 | { 196 | Title: "Popups Ignore alpha", 197 | Description: "works like ignorealpha in layer rules. If pixel opacity is below set value, will not blur.", 198 | PageType: "float", 199 | Setting: hyprsettings_utils.Setting{ 200 | Section: "decoration/blur/", 201 | Variable: "popups_ignorealpha", 202 | FloatSetting: hyprsettings_utils.FloatSetting{ 203 | DefaultVal: 0.2, 204 | Minimum: 0, 205 | Maximum: 1, 206 | }, 207 | }, 208 | }, 209 | }, 210 | } 211 | } 212 | -------------------------------------------------------------------------------- /decoration/decoration.go: -------------------------------------------------------------------------------- 1 | package decoration 2 | 3 | import hyprsettings_utils "github.com/anotherhadi/hyprsettings/utils" 4 | 5 | func Decoration() hyprsettings_utils.Page { 6 | return hyprsettings_utils.Page{ 7 | Title: "Decoration", 8 | Description: "Rounding, blur, shadow, dim..", 9 | Child: []hyprsettings_utils.Page{ 10 | 11 | { 12 | Title: "Rounding", 13 | Description: "Rounded corners' radius (in layout px)", 14 | PageType: "int", 15 | Setting: hyprsettings_utils.Setting{ 16 | Section: "decoration/", 17 | Variable: "rounding", 18 | IntSetting: hyprsettings_utils.IntSetting{ 19 | DefaultVal: 0, 20 | Minimum: 0, 21 | Maximum: 100, 22 | }, 23 | }, 24 | }, 25 | 26 | opacity(), 27 | shadow(), 28 | dim(), 29 | blur(), 30 | 31 | { 32 | Title: "Screen Shader", 33 | Description: "a path to a custom shader to be applied at the end of rendering. See examples/screenShader.frag for an example.", 34 | PageType: "string", 35 | Setting: hyprsettings_utils.Setting{ 36 | Section: "decoration/", 37 | Variable: "screen_shader", 38 | StringSetting: hyprsettings_utils.StringSetting{ 39 | DefaultVal: "", 40 | }, 41 | }, 42 | }, 43 | }, 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /decoration/dim.go: -------------------------------------------------------------------------------- 1 | package decoration 2 | 3 | import hyprsettings_utils "github.com/anotherhadi/hyprsettings/utils" 4 | 5 | func dim() hyprsettings_utils.Page { 6 | return hyprsettings_utils.Page{ 7 | Title: "Dim", 8 | Description: "Change dim settings", 9 | Child: []hyprsettings_utils.Page{ 10 | { 11 | Title: "Dim innactive window", 12 | Description: "enables dimming of inactive windows ", 13 | PageType: "bool", 14 | Setting: hyprsettings_utils.Setting{ 15 | Section: "decoration/", 16 | Variable: "dim_inactive", 17 | BoolSetting: hyprsettings_utils.BoolSetting{ 18 | DefaultVal: false, 19 | }, 20 | }, 21 | }, 22 | 23 | { 24 | Title: "Dim Strength", 25 | Description: "how much inactive windows should be dimmed.", 26 | PageType: "float", 27 | Setting: hyprsettings_utils.Setting{ 28 | Section: "decoration/", 29 | Variable: "dim_strength", 30 | FloatSetting: hyprsettings_utils.FloatSetting{ 31 | DefaultVal: 0.5, 32 | Minimum: 0, 33 | Maximum: 1, 34 | }, 35 | }, 36 | }, 37 | 38 | { 39 | Title: "Dim Special", 40 | Description: "how much to dim the rest of the screen by when a special workspace is open.", 41 | PageType: "float", 42 | Setting: hyprsettings_utils.Setting{ 43 | Section: "decoration/", 44 | Variable: "dim_special", 45 | FloatSetting: hyprsettings_utils.FloatSetting{ 46 | DefaultVal: 0.2, 47 | Minimum: 0, 48 | Maximum: 1, 49 | }, 50 | }, 51 | }, 52 | 53 | { 54 | Title: "Dim Around", 55 | Description: "how much the dimaround window rule should dim by.", 56 | PageType: "float", 57 | Setting: hyprsettings_utils.Setting{ 58 | Section: "decoration/", 59 | Variable: "dim_around", 60 | FloatSetting: hyprsettings_utils.FloatSetting{ 61 | DefaultVal: 0.4, 62 | Minimum: 0, 63 | Maximum: 1, 64 | }, 65 | }, 66 | }, 67 | }, 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /decoration/opacity.go: -------------------------------------------------------------------------------- 1 | package decoration 2 | 3 | import hyprsettings_utils "github.com/anotherhadi/hyprsettings/utils" 4 | 5 | func opacity() hyprsettings_utils.Page { 6 | return hyprsettings_utils.Page{ 7 | Title: "Opacity", 8 | Description: "Active/Inactive and Fullscreen opacity", 9 | Child: []hyprsettings_utils.Page{ 10 | { 11 | Title: "Active Opacity", 12 | Description: "opacity of active windows.", 13 | PageType: "float", 14 | Setting: hyprsettings_utils.Setting{ 15 | Section: "decoration/", 16 | Variable: "active_opacity", 17 | FloatSetting: hyprsettings_utils.FloatSetting{ 18 | DefaultVal: 1, 19 | Minimum: 0, 20 | Maximum: 1, 21 | }, 22 | }, 23 | }, 24 | 25 | { 26 | Title: "Inactive Opacity", 27 | Description: "opacity of inactive windows.", 28 | PageType: "float", 29 | Setting: hyprsettings_utils.Setting{ 30 | Section: "decoration/", 31 | Variable: "inactive_opacity", 32 | FloatSetting: hyprsettings_utils.FloatSetting{ 33 | DefaultVal: 1, 34 | Minimum: 0, 35 | Maximum: 1, 36 | }, 37 | }, 38 | }, 39 | 40 | { 41 | Title: "Fullscreen Opacity", 42 | Description: "opacity of fullscreen windows.", 43 | PageType: "float", 44 | Setting: hyprsettings_utils.Setting{ 45 | Section: "decoration/", 46 | Variable: "fullscreen_opacity", 47 | FloatSetting: hyprsettings_utils.FloatSetting{ 48 | DefaultVal: 1, 49 | Minimum: 0, 50 | Maximum: 1, 51 | }, 52 | }, 53 | }, 54 | }, 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /decoration/shadow.go: -------------------------------------------------------------------------------- 1 | package decoration 2 | 3 | import hyprsettings_utils "github.com/anotherhadi/hyprsettings/utils" 4 | 5 | func shadow() hyprsettings_utils.Page { 6 | return hyprsettings_utils.Page{ 7 | Title: "Shadow", 8 | Description: "Drop shadow, colors, power", 9 | Child: []hyprsettings_utils.Page{ 10 | { 11 | Title: "Drop Shadow", 12 | Description: "enable drop shadows on windows", 13 | PageType: "bool", 14 | Setting: hyprsettings_utils.Setting{ 15 | Section: "decoration/", 16 | Variable: "drop_shadow", 17 | BoolSetting: hyprsettings_utils.BoolSetting{ 18 | DefaultVal: false, 19 | }, 20 | }, 21 | }, 22 | 23 | { 24 | Title: "Shadow Range", 25 | Description: "Shadow range ('size') in layout px", 26 | PageType: "int", 27 | Setting: hyprsettings_utils.Setting{ 28 | Section: "decoration/", 29 | Variable: "shadow_range", 30 | IntSetting: hyprsettings_utils.IntSetting{ 31 | DefaultVal: 4, 32 | Minimum: 0, 33 | Maximum: 100, 34 | }, 35 | }, 36 | }, 37 | 38 | { 39 | Title: "Shadow Render power", 40 | Description: "in what power to render the falloff (more power, the faster the falloff)", 41 | PageType: "int", 42 | Setting: hyprsettings_utils.Setting{ 43 | Section: "decoration/", 44 | Variable: "shadow_render_power", 45 | IntSetting: hyprsettings_utils.IntSetting{ 46 | DefaultVal: 3, 47 | Minimum: 1, 48 | Maximum: 4, 49 | }, 50 | }, 51 | }, 52 | 53 | { 54 | Title: "Shadow ignore window", 55 | Description: "if true, the shadow will not be rendered behind the window itself, only around it.", 56 | PageType: "bool", 57 | Setting: hyprsettings_utils.Setting{ 58 | Section: "decoration/", 59 | Variable: "shadow_ignore_window", 60 | BoolSetting: hyprsettings_utils.BoolSetting{ 61 | DefaultVal: true, 62 | }, 63 | }, 64 | }, 65 | 66 | { 67 | Title: "Shadow's Color", 68 | Description: "shadow’s color. Alpha dictates shadow’s opacity.", 69 | PageType: "color", 70 | Setting: hyprsettings_utils.Setting{ 71 | Section: "decoration/", 72 | Variable: "col.shadow", 73 | ColorSetting: hyprsettings_utils.ColorSetting{ 74 | DefaultVal: "1a1a1aee", 75 | }, 76 | }, 77 | }, 78 | 79 | { 80 | Title: "Inactive Shadow Color", 81 | Description: "inactive shadow color. (if not set, will fall back to col.shadow)", 82 | PageType: "color", 83 | Setting: hyprsettings_utils.Setting{ 84 | Section: "decoration/", 85 | Variable: "col.shadow_inactive", 86 | ColorSetting: hyprsettings_utils.ColorSetting{ 87 | DefaultVal: "", 88 | }, 89 | }, 90 | }, 91 | 92 | // VECTOR 93 | 94 | { 95 | Title: "Shadow Scale", 96 | Description: "shadow’s scale.", 97 | PageType: "float", 98 | Setting: hyprsettings_utils.Setting{ 99 | Section: "decoration/", 100 | Variable: "shadow_scale", 101 | FloatSetting: hyprsettings_utils.FloatSetting{ 102 | DefaultVal: 1, 103 | Minimum: 0, 104 | Maximum: 1, 105 | }, 106 | }, 107 | }, 108 | }, 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /general/border.go: -------------------------------------------------------------------------------- 1 | package general 2 | 3 | import hyprsettings_utils "github.com/anotherhadi/hyprsettings/utils" 4 | 5 | func Borders() hyprsettings_utils.Page { 6 | return hyprsettings_utils.Page{ 7 | Title: "Borders", 8 | Description: "Size, resize, floating..", 9 | Child: []hyprsettings_utils.Page{ 10 | 11 | { 12 | Title: "Border Size", 13 | Description: "Size of the border around windows", 14 | PageType: "int", 15 | Setting: hyprsettings_utils.Setting{ 16 | Section: "general/", 17 | Variable: "border_size", 18 | IntSetting: hyprsettings_utils.IntSetting{ 19 | DefaultVal: 1, 20 | Minimum: 0, 21 | Maximum: 100, 22 | }, 23 | }, 24 | }, 25 | 26 | { 27 | Title: "No Border On Floating", 28 | Description: "Disable borders for floating windows", 29 | PageType: "bool", 30 | Setting: hyprsettings_utils.Setting{ 31 | Section: "general/", 32 | Variable: "no_border_on_floating", 33 | BoolSetting: hyprsettings_utils.BoolSetting{ 34 | DefaultVal: false, 35 | }, 36 | }, 37 | }, 38 | 39 | { 40 | Title: "Resize on Border", 41 | Description: "enables resizing windows by clicking and dragging on borders and gaps", 42 | PageType: "bool", 43 | Setting: hyprsettings_utils.Setting{ 44 | Section: "general/", 45 | Variable: "resize_on_border", 46 | BoolSetting: hyprsettings_utils.BoolSetting{ 47 | DefaultVal: false, 48 | }, 49 | }, 50 | }, 51 | 52 | { 53 | Title: "Extend border grab area", 54 | Description: "extends the area around the border where you can click and drag on, only used when general:resize_on_border is on.", 55 | PageType: "int", 56 | Setting: hyprsettings_utils.Setting{ 57 | Section: "general/", 58 | Variable: "extend_border_grab_area", 59 | IntSetting: hyprsettings_utils.IntSetting{ 60 | DefaultVal: 15, 61 | Minimum: 0, 62 | Maximum: 200, 63 | }, 64 | }, 65 | }, 66 | 67 | { 68 | Title: "Hover icon on border", 69 | Description: "show a cursor icon when hovering over borders, only used when general:resize_on_border is on.", 70 | PageType: "bool", 71 | Setting: hyprsettings_utils.Setting{ 72 | Section: "general/", 73 | Variable: "hover_icon_on_border", 74 | BoolSetting: hyprsettings_utils.BoolSetting{ 75 | DefaultVal: true, 76 | }, 77 | }, 78 | }, 79 | }, 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /general/colors.go: -------------------------------------------------------------------------------- 1 | package general 2 | 3 | import hyprsettings_utils "github.com/anotherhadi/hyprsettings/utils" 4 | 5 | func Colors() hyprsettings_utils.Page { 6 | return hyprsettings_utils.Page{ 7 | Title: "Colors", 8 | Description: "Change borders colors", 9 | Child: []hyprsettings_utils.Page{ 10 | 11 | { 12 | Title: "Inactive Border Color", 13 | Description: "border color for inactive windows", 14 | PageType: "gradient", 15 | Setting: hyprsettings_utils.Setting{ 16 | Section: "general/", 17 | Variable: "col.inactive_border", 18 | GradientSetting: hyprsettings_utils.GradientSetting{ 19 | DefaultVal: "ffffffff", 20 | }, 21 | }, 22 | }, 23 | 24 | { 25 | Title: "Active Border Color", 26 | Description: "border color for active windows", 27 | PageType: "gradient", 28 | Setting: hyprsettings_utils.Setting{ 29 | Section: "general/", 30 | Variable: "col.active_border", 31 | GradientSetting: hyprsettings_utils.GradientSetting{ 32 | DefaultVal: "444444ff", 33 | }, 34 | }, 35 | }, 36 | 37 | { 38 | Title: "Nogroup Border Color", 39 | Description: "inactive border color for window that cannot be added to a group", 40 | PageType: "gradient", 41 | Setting: hyprsettings_utils.Setting{ 42 | Section: "general/", 43 | Variable: "col.nogroup_border", 44 | GradientSetting: hyprsettings_utils.GradientSetting{ 45 | DefaultVal: "ffaaffff", 46 | }, 47 | }, 48 | }, 49 | { 50 | Title: "Nogroup Active Border Color", 51 | Description: "active border color for window that cannot be added to a group", 52 | PageType: "gradient", 53 | Setting: hyprsettings_utils.Setting{ 54 | Section: "general/", 55 | Variable: "col.nogroup_border_active", 56 | GradientSetting: hyprsettings_utils.GradientSetting{ 57 | DefaultVal: "ff00ffff", 58 | }, 59 | }, 60 | }, 61 | }, 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /general/cursor.go: -------------------------------------------------------------------------------- 1 | package general 2 | 3 | import hyprsettings_utils "github.com/anotherhadi/hyprsettings/utils" 4 | 5 | func Cursor() hyprsettings_utils.Page { 6 | return hyprsettings_utils.Page{ 7 | Title: "Cursor", 8 | Description: "Change cursor settings", 9 | Child: []hyprsettings_utils.Page{ 10 | { 11 | Title: "Cursor Inactive Timeout", 12 | Description: "in seconds, after how many seconds of cursor’s inactivity to hide it. Set to 0 for never.", 13 | PageType: "int", 14 | Setting: hyprsettings_utils.Setting{ 15 | Section: "general/", 16 | Variable: "cursor_inactive_timeout", 17 | IntSetting: hyprsettings_utils.IntSetting{ 18 | DefaultVal: 0, 19 | Minimum: 0, 20 | Maximum: 1000, 21 | }, 22 | }, 23 | }, 24 | 25 | { 26 | Title: "No Cursor Warps", 27 | Description: "if true, will not warp the cursor in many cases (focusing, keybinds, etc)", 28 | PageType: "bool", 29 | Setting: hyprsettings_utils.Setting{ 30 | Section: "general/", 31 | Variable: "no_cursor_warps", 32 | BoolSetting: hyprsettings_utils.BoolSetting{ 33 | DefaultVal: false, 34 | }, 35 | }, 36 | }, 37 | 38 | { 39 | Title: "No Focus Fallback", 40 | Description: "if true, will not fall back to the next available window when moving focus in a direction where no window was found", 41 | PageType: "bool", 42 | Setting: hyprsettings_utils.Setting{ 43 | Section: "general/", 44 | Variable: "no_focus_fallback", 45 | BoolSetting: hyprsettings_utils.BoolSetting{ 46 | DefaultVal: false, 47 | }, 48 | }, 49 | }, 50 | }, 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /general/gap.go: -------------------------------------------------------------------------------- 1 | package general 2 | 3 | import hyprsettings_utils "github.com/anotherhadi/hyprsettings/utils" 4 | 5 | func Gaps() hyprsettings_utils.Page { 6 | return hyprsettings_utils.Page{ 7 | Title: "Gaps", 8 | Description: "Change gaps in & out, workspaces", 9 | Child: []hyprsettings_utils.Page{ 10 | { 11 | Title: "Gaps In", 12 | Description: "Gaps between windows", 13 | PageType: "int", 14 | Setting: hyprsettings_utils.Setting{ 15 | Section: "general/", 16 | Variable: "gaps_in", 17 | IntSetting: hyprsettings_utils.IntSetting{ 18 | DefaultVal: 5, 19 | Minimum: 0, 20 | Maximum: 100, 21 | }, 22 | }, 23 | }, 24 | 25 | { 26 | Title: "Gaps Out", 27 | Description: "Gaps between windows and monitor edges", 28 | PageType: "int", 29 | Setting: hyprsettings_utils.Setting{ 30 | Section: "general/", 31 | Variable: "gaps_out", 32 | IntSetting: hyprsettings_utils.IntSetting{ 33 | DefaultVal: 20, 34 | Minimum: 0, 35 | Maximum: 100, 36 | }, 37 | }, 38 | }, 39 | 40 | { 41 | Title: "Gaps Workspaces", 42 | Description: "Gaps between workspaces. Stack with gaps_out", 43 | PageType: "int", 44 | Setting: hyprsettings_utils.Setting{ 45 | Section: "general/", 46 | Variable: "gaps_workspaces", 47 | IntSetting: hyprsettings_utils.IntSetting{ 48 | DefaultVal: 0, 49 | Minimum: 0, 50 | Maximum: 100, 51 | }, 52 | }, 53 | }, 54 | }, 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /general/general.go: -------------------------------------------------------------------------------- 1 | package general 2 | 3 | import hyprsettings_utils "github.com/anotherhadi/hyprsettings/utils" 4 | 5 | func General() hyprsettings_utils.Page { 6 | return hyprsettings_utils.Page{ 7 | Title: "General", 8 | Description: "Colors, borders, gaps, cursor & layout settings", 9 | Child: []hyprsettings_utils.Page{ 10 | Colors(), 11 | Borders(), 12 | Gaps(), 13 | Cursor(), 14 | 15 | { 16 | Title: "Layout", 17 | Description: "Which layout to use", 18 | PageType: "list", 19 | Setting: hyprsettings_utils.Setting{ 20 | Section: "general/", 21 | Variable: "layout", 22 | ListSetting: hyprsettings_utils.ListSetting{ 23 | Options: []string{"dwindle", "master"}, 24 | }, 25 | }, 26 | }, 27 | 28 | { 29 | Title: "Apply Sensivity to Raw", 30 | Description: "if on, will also apply the sensitivity to raw mouse output (e.g. sensitivity in games) NOTICE: really not recommended.", 31 | PageType: "bool", 32 | Setting: hyprsettings_utils.Setting{ 33 | Section: "general/", 34 | Variable: "apply_sens_to_raw", 35 | BoolSetting: hyprsettings_utils.BoolSetting{ 36 | DefaultVal: false, 37 | }, 38 | }, 39 | }, 40 | 41 | { 42 | Title: "Allow tearing", 43 | Description: "master switch for allowing tearing to occur. See the Tearing page on the wiki.", 44 | PageType: "bool", 45 | Setting: hyprsettings_utils.Setting{ 46 | Section: "general/", 47 | Variable: "allow_tearing", 48 | BoolSetting: hyprsettings_utils.BoolSetting{ 49 | DefaultVal: false, 50 | }, 51 | }, 52 | }, 53 | }, 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /gestures/gestures.go: -------------------------------------------------------------------------------- 1 | package gestures 2 | 3 | import hyprsettings_utils "github.com/anotherhadi/hyprsettings/utils" 4 | 5 | func Gestures() hyprsettings_utils.Page { 6 | 7 | return hyprsettings_utils.Page{ 8 | Title: "Gesture", 9 | Description: "Gesture and swipe settings", 10 | Child: []hyprsettings_utils.Page{ 11 | 12 | { 13 | Title: "Workspace swipe", 14 | Description: "enable workspace swipe gesture", 15 | PageType: "bool", 16 | Setting: hyprsettings_utils.Setting{ 17 | Section: "gesture/", 18 | Variable: "workspace_swipe", 19 | BoolSetting: hyprsettings_utils.BoolSetting{ 20 | DefaultVal: false, 21 | }, 22 | }, 23 | }, 24 | 25 | { 26 | Title: "Workspace swipe fingers", 27 | Description: "how many fingers for the gesture", 28 | PageType: "int", 29 | Setting: hyprsettings_utils.Setting{ 30 | Section: "gesture/", 31 | Variable: "workspace_swipe_fingers", 32 | IntSetting: hyprsettings_utils.IntSetting{ 33 | DefaultVal: 3, 34 | Minimum: 1, 35 | Maximum: 5, 36 | }, 37 | }, 38 | }, 39 | 40 | { 41 | Title: "Swipe distance", 42 | Description: "in px, the distance of the gesture", 43 | PageType: "int", 44 | Setting: hyprsettings_utils.Setting{ 45 | Section: "gesture/", 46 | Variable: "workspace_swipe_distance", 47 | IntSetting: hyprsettings_utils.IntSetting{ 48 | DefaultVal: 300, 49 | Minimum: 0, 50 | Maximum: 5000, 51 | }, 52 | }, 53 | }, 54 | 55 | { 56 | Title: "Swipe invert", 57 | Description: "invert the direction", 58 | PageType: "bool", 59 | Setting: hyprsettings_utils.Setting{ 60 | Section: "gesture/", 61 | Variable: "workspace_swipe_invert", 62 | BoolSetting: hyprsettings_utils.BoolSetting{ 63 | DefaultVal: true, 64 | }, 65 | }, 66 | }, 67 | 68 | { 69 | Title: "Swipe minimum speed to force", 70 | Description: "minimum speed in px per timepoint to force the change ignoring cancel_ratio. Setting to 0 will disable this mechanic.", 71 | PageType: "int", 72 | Setting: hyprsettings_utils.Setting{ 73 | Section: "gesture/", 74 | Variable: "workspace_swipe_min_speed_to_force", 75 | IntSetting: hyprsettings_utils.IntSetting{ 76 | DefaultVal: 30, 77 | Minimum: 0, 78 | Maximum: 5000, 79 | }, 80 | }, 81 | }, 82 | 83 | { 84 | Title: "Swipe cancel ratio", 85 | Description: "how much the swipe has to proceed in order to commence it. (0.7 -> if > 0.7 * distance, switch, if less, revert)", 86 | PageType: "float", 87 | Setting: hyprsettings_utils.Setting{ 88 | Section: "gesture/", 89 | Variable: "workspace_swipe_cancel_ratio", 90 | FloatSetting: hyprsettings_utils.FloatSetting{ 91 | DefaultVal: 0.5, 92 | Minimum: 0, 93 | Maximum: 1, 94 | }, 95 | }, 96 | }, 97 | 98 | { 99 | Title: "Swipe create new", 100 | Description: "whether a swipe right on the last workspace should create a new one.", 101 | PageType: "bool", 102 | Setting: hyprsettings_utils.Setting{ 103 | Section: "gesture/", 104 | Variable: "workspace_swipe_create_new", 105 | BoolSetting: hyprsettings_utils.BoolSetting{ 106 | DefaultVal: true, 107 | }, 108 | }, 109 | }, 110 | 111 | { 112 | Title: "Swipe direction lock", 113 | Description: "if enabled, switching direction will be locked when you swipe past the direction_lock_threshold.", 114 | PageType: "bool", 115 | Setting: hyprsettings_utils.Setting{ 116 | Section: "gesture/", 117 | Variable: "workspace_swipe_direction_lock", 118 | BoolSetting: hyprsettings_utils.BoolSetting{ 119 | DefaultVal: true, 120 | }, 121 | }, 122 | }, 123 | 124 | { 125 | Title: "Swipe direction lock treshold", 126 | Description: "in px, the distance to swipe before direction lock activates.", 127 | PageType: "int", 128 | Setting: hyprsettings_utils.Setting{ 129 | Section: "gesture/", 130 | Variable: "workspace_swipe_min_speed_to_force", 131 | IntSetting: hyprsettings_utils.IntSetting{ 132 | DefaultVal: 10, 133 | Minimum: 0, 134 | Maximum: 5000, 135 | }, 136 | }, 137 | }, 138 | 139 | { 140 | Title: "Swipe forever", 141 | Description: "if enabled, swiping will not clamp at the neighboring workspaces but continue to the further ones.", 142 | PageType: "bool", 143 | Setting: hyprsettings_utils.Setting{ 144 | Section: "gesture/", 145 | Variable: "workspace_swipe_forever", 146 | BoolSetting: hyprsettings_utils.BoolSetting{ 147 | DefaultVal: false, 148 | }, 149 | }, 150 | }, 151 | 152 | { 153 | Title: "Swipe numbered", 154 | Description: "if enabled, swiping will swipe on consecutive numbered workspaces.", 155 | PageType: "bool", 156 | Setting: hyprsettings_utils.Setting{ 157 | Section: "gesture/", 158 | Variable: "workspace_swipe_numbered", 159 | BoolSetting: hyprsettings_utils.BoolSetting{ 160 | DefaultVal: false, 161 | }, 162 | }, 163 | }, 164 | 165 | { 166 | Title: "Swipe use r", 167 | Description: "if enabled, swiping will use the r prefix instead of the m prefix for finding workspaces. (requires disabled workspace_swipe_numbered)", 168 | PageType: "bool", 169 | Setting: hyprsettings_utils.Setting{ 170 | Section: "gesture/", 171 | Variable: "workspace_swipe_usr_r", 172 | BoolSetting: hyprsettings_utils.BoolSetting{ 173 | DefaultVal: false, 174 | }, 175 | }, 176 | }, 177 | }, 178 | } 179 | } 180 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/anotherhadi/hyprsettings 2 | 3 | go 1.21.5 4 | 5 | require ( 6 | github.com/anotherhadi/gml-ui v0.0.0-20240106151348-f9cd1db755a9 7 | github.com/anotherhadi/hyprlang-parser v0.0.0-20240116201859-4468702859fd 8 | github.com/shirou/gopsutil v3.21.11+incompatible 9 | ) 10 | 11 | require ( 12 | github.com/go-ole/go-ole v1.2.6 // indirect 13 | github.com/pkg/term v1.1.0 // indirect 14 | github.com/stretchr/testify v1.8.4 // indirect 15 | github.com/tklauser/go-sysconf v0.3.13 // indirect 16 | github.com/tklauser/numcpus v0.7.0 // indirect 17 | github.com/yusufpapurcu/wmi v1.2.3 // indirect 18 | golang.org/x/sys v0.16.0 // indirect 19 | golang.org/x/term v0.15.0 // indirect 20 | ) 21 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/anotherhadi/gml-ui v0.0.0-20240106151348-f9cd1db755a9 h1:N7XtmF+HbYNIor8BMCbL4L5oVww9uEJSZdbHF8Tu7mU= 2 | github.com/anotherhadi/gml-ui v0.0.0-20240106151348-f9cd1db755a9/go.mod h1:9FQAHQ+4u1wtnSrw4Oe7IbsEriS81W9HjaBKT3jvTCM= 3 | github.com/anotherhadi/hyprlang-parser v0.0.0-20240116201859-4468702859fd h1:M7YZw0CQBZhoGTkuXXi68qJoG1D9zodT/U5Tq//qYX8= 4 | github.com/anotherhadi/hyprlang-parser v0.0.0-20240116201859-4468702859fd/go.mod h1:uCQ+qk1ZjIqYyS4IbVE3nYeoty2aKE1dq/3qmmoUSGU= 5 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 6 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 7 | github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= 8 | github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= 9 | github.com/pkg/term v1.1.0 h1:xIAAdCMh3QIAy+5FrE8Ad8XoDhEU4ufwbaSozViP9kk= 10 | github.com/pkg/term v1.1.0/go.mod h1:E25nymQcrSllhX42Ok8MRm1+hyBdHY0dCeiKZ9jpNGw= 11 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 12 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 13 | github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= 14 | github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= 15 | github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= 16 | github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= 17 | github.com/tklauser/go-sysconf v0.3.13 h1:GBUpcahXSpR2xN01jhkNAbTLRk2Yzgggk8IM08lq3r4= 18 | github.com/tklauser/go-sysconf v0.3.13/go.mod h1:zwleP4Q4OehZHGn4CYZDipCgg9usW5IJePewFCGVEa0= 19 | github.com/tklauser/numcpus v0.7.0 h1:yjuerZP127QG9m5Zh/mSO4wqurYil27tHrqwRoRjpr4= 20 | github.com/tklauser/numcpus v0.7.0/go.mod h1:bb6dMVcj8A42tSE7i32fsIUCbQNllK5iDguyOZRUzAY= 21 | github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw= 22 | github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= 23 | golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 24 | golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 25 | golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= 26 | golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 27 | golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= 28 | golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= 29 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 30 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 31 | -------------------------------------------------------------------------------- /group/group.go: -------------------------------------------------------------------------------- 1 | package group 2 | 3 | import hyprsettings_utils "github.com/anotherhadi/hyprsettings/utils" 4 | 5 | func Group() hyprsettings_utils.Page { 6 | 7 | return hyprsettings_utils.Page{ 8 | Title: "Group", 9 | Description: "Change group settings", 10 | Child: []hyprsettings_utils.Page{ 11 | 12 | { 13 | Title: "Insert after current", 14 | Description: "whether new windows in a group spawn after current or at group tail", 15 | PageType: "bool", 16 | Setting: hyprsettings_utils.Setting{ 17 | Section: "group/", 18 | Variable: "insert_after_current", 19 | BoolSetting: hyprsettings_utils.BoolSetting{ 20 | DefaultVal: true, 21 | }, 22 | }, 23 | }, 24 | 25 | { 26 | Title: "Focus removed window", 27 | Description: "whether Hyprland should focus on the window that has just been moved out of the group", 28 | PageType: "bool", 29 | Setting: hyprsettings_utils.Setting{ 30 | Section: "group/", 31 | Variable: "focus_removed_window", 32 | BoolSetting: hyprsettings_utils.BoolSetting{ 33 | DefaultVal: true, 34 | }, 35 | }, 36 | }, 37 | 38 | { 39 | Title: "Active border color", 40 | Description: "active group border color", 41 | PageType: "gradient", 42 | Setting: hyprsettings_utils.Setting{ 43 | Section: "group/", 44 | Variable: "col.border_active", 45 | GradientSetting: hyprsettings_utils.GradientSetting{ 46 | DefaultVal: "ffff0066", 47 | }, 48 | }, 49 | }, 50 | 51 | { 52 | Title: "Inactive border color", 53 | Description: "inactive (out of focus) group border color", 54 | PageType: "gradient", 55 | Setting: hyprsettings_utils.Setting{ 56 | Section: "group/", 57 | Variable: "col.border_inactive", 58 | GradientSetting: hyprsettings_utils.GradientSetting{ 59 | DefaultVal: "77770066", 60 | }, 61 | }, 62 | }, 63 | 64 | { 65 | Title: "Active locked border color", 66 | Description: "active locked group border color", 67 | PageType: "gradient", 68 | Setting: hyprsettings_utils.Setting{ 69 | Section: "group/", 70 | Variable: "col.border_locked_active", 71 | GradientSetting: hyprsettings_utils.GradientSetting{ 72 | DefaultVal: "ff550066", 73 | }, 74 | }, 75 | }, 76 | 77 | { 78 | Title: "Inactive locked border color", 79 | Description: "inactive locked group border color", 80 | PageType: "gradient", 81 | Setting: hyprsettings_utils.Setting{ 82 | Section: "group/", 83 | Variable: "col.border_locked_inactive", 84 | GradientSetting: hyprsettings_utils.GradientSetting{ 85 | DefaultVal: "77550066", 86 | }, 87 | }, 88 | }, 89 | 90 | groupbar(), 91 | }, 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /group/groupbar.go: -------------------------------------------------------------------------------- 1 | package group 2 | 3 | import hyprsettings_utils "github.com/anotherhadi/hyprsettings/utils" 4 | 5 | func groupbar() hyprsettings_utils.Page { 6 | 7 | return hyprsettings_utils.Page{ 8 | Title: "Group Bars", 9 | Description: "Change group bars settings", 10 | Child: []hyprsettings_utils.Page{ 11 | 12 | { 13 | Title: "Enabled", 14 | Description: "enables groupbars", 15 | PageType: "bool", 16 | Setting: hyprsettings_utils.Setting{ 17 | Section: "group/groupbar/", 18 | Variable: "enabled", 19 | BoolSetting: hyprsettings_utils.BoolSetting{ 20 | DefaultVal: true, 21 | }, 22 | }, 23 | }, 24 | 25 | { 26 | Title: "Font family", 27 | Description: "font used to display groupbar titles", 28 | PageType: "string", 29 | Setting: hyprsettings_utils.Setting{ 30 | Section: "group/groupbar/", 31 | Variable: "font_family", 32 | StringSetting: hyprsettings_utils.StringSetting{ 33 | DefaultVal: "Sans", 34 | }, 35 | }, 36 | }, 37 | 38 | { 39 | Title: "Font size", 40 | Description: "font size for the above", 41 | PageType: "int", 42 | Setting: hyprsettings_utils.Setting{ 43 | Section: "group/groupbar/", 44 | Variable: "font_size", 45 | IntSetting: hyprsettings_utils.IntSetting{ 46 | DefaultVal: 8, 47 | Minimum: 0, 48 | Maximum: 40, 49 | }, 50 | }, 51 | }, 52 | 53 | { 54 | Title: "Gradients", 55 | Description: "whether to draw gradients under the titles of the above", 56 | PageType: "bool", 57 | Setting: hyprsettings_utils.Setting{ 58 | Section: "group/groupbar/", 59 | Variable: "gradients", 60 | BoolSetting: hyprsettings_utils.BoolSetting{ 61 | DefaultVal: true, 62 | }, 63 | }, 64 | }, 65 | 66 | { 67 | Title: "Priority", 68 | Description: "sets the decoration priority for groupbars", 69 | PageType: "int", 70 | Setting: hyprsettings_utils.Setting{ 71 | Section: "group/groupbar/", 72 | Variable: "priority", 73 | IntSetting: hyprsettings_utils.IntSetting{ 74 | DefaultVal: 3, 75 | Minimum: 0, 76 | Maximum: 40, 77 | }, 78 | }, 79 | }, 80 | 81 | { 82 | Title: "Render titles", 83 | Description: "whether to render titles in the group bar decoration", 84 | PageType: "bool", 85 | Setting: hyprsettings_utils.Setting{ 86 | Section: "group/groupbar/", 87 | Variable: "render_titles", 88 | BoolSetting: hyprsettings_utils.BoolSetting{ 89 | DefaultVal: true, 90 | }, 91 | }, 92 | }, 93 | 94 | { 95 | Title: "Scrolling", 96 | Description: "whether scrolling in the groupbar changes group active window", 97 | PageType: "bool", 98 | Setting: hyprsettings_utils.Setting{ 99 | Section: "group/groupbar/", 100 | Variable: "scrolling", 101 | BoolSetting: hyprsettings_utils.BoolSetting{ 102 | DefaultVal: true, 103 | }, 104 | }, 105 | }, 106 | 107 | { 108 | Title: "Text Color", 109 | Description: "controls the group bar text color", 110 | PageType: "color", 111 | Setting: hyprsettings_utils.Setting{ 112 | Section: "group/groupbar/", 113 | Variable: "text_color", 114 | ColorSetting: hyprsettings_utils.ColorSetting{ 115 | DefaultVal: "ffffffff", 116 | }, 117 | }, 118 | }, 119 | 120 | { 121 | Title: "Active border color", 122 | Description: "active group border color", 123 | PageType: "gradient", 124 | Setting: hyprsettings_utils.Setting{ 125 | Section: "group/groupbar/", 126 | Variable: "col.active", 127 | GradientSetting: hyprsettings_utils.GradientSetting{ 128 | DefaultVal: "ffff0066", 129 | }, 130 | }, 131 | }, 132 | 133 | { 134 | Title: "Inactive border color", 135 | Description: "inactive (out of focus) group border color", 136 | PageType: "gradient", 137 | Setting: hyprsettings_utils.Setting{ 138 | Section: "group/groupbar/", 139 | Variable: "col.inactive", 140 | GradientSetting: hyprsettings_utils.GradientSetting{ 141 | DefaultVal: "77770066", 142 | }, 143 | }, 144 | }, 145 | 146 | { 147 | Title: "Active locked border color", 148 | Description: "active locked group border color", 149 | PageType: "gradient", 150 | Setting: hyprsettings_utils.Setting{ 151 | Section: "group/groupbar/", 152 | Variable: "col.locked_active", 153 | GradientSetting: hyprsettings_utils.GradientSetting{ 154 | DefaultVal: "ff550066", 155 | }, 156 | }, 157 | }, 158 | 159 | { 160 | Title: "Inactive locked border color", 161 | Description: "inactive locked group border color", 162 | PageType: "gradient", 163 | Setting: hyprsettings_utils.Setting{ 164 | Section: "group/groupbar/", 165 | Variable: "col.locked_inactive", 166 | GradientSetting: hyprsettings_utils.GradientSetting{ 167 | DefaultVal: "77550066", 168 | }, 169 | }, 170 | }, 171 | }, 172 | } 173 | } 174 | -------------------------------------------------------------------------------- /information/information.go: -------------------------------------------------------------------------------- 1 | package information 2 | 3 | import ( 4 | "fmt" 5 | "os/exec" 6 | "strings" 7 | 8 | hyprsettings_utils "github.com/anotherhadi/hyprsettings/utils" 9 | 10 | "github.com/shirou/gopsutil/cpu" 11 | "github.com/shirou/gopsutil/disk" 12 | "github.com/shirou/gopsutil/host" 13 | "github.com/shirou/gopsutil/mem" 14 | ) 15 | 16 | func getProcessorName() (string, error) { 17 | info, err := cpu.Info() 18 | if err != nil { 19 | return "", err 20 | } 21 | return info[0].ModelName, nil 22 | } 23 | 24 | func getGPUName() (string, error) { 25 | cmd := exec.Command("lspci", "-v") 26 | output, err := cmd.CombinedOutput() 27 | if err != nil { 28 | return "", err 29 | } 30 | lines := strings.Split(string(output), "\n") 31 | for _, line := range lines { 32 | if strings.Contains(line, "VGA compatible controller") { 33 | parts := strings.Split(line, ":") 34 | return strings.TrimSpace(parts[len(parts)-1]), nil 35 | } 36 | } 37 | return "", nil 38 | } 39 | 40 | func getDiskSize() (float64, error) { 41 | partitions, err := disk.Partitions(true) 42 | if err != nil { 43 | return 0, err 44 | } 45 | var totalSize uint64 46 | for _, partition := range partitions { 47 | usage, err := disk.Usage(partition.Mountpoint) 48 | if err == nil { 49 | totalSize += usage.Total 50 | } 51 | } 52 | return float64(totalSize) / (1024 * 1024 * 1024), nil 53 | } 54 | 55 | func getRAMSize() (float64, error) { 56 | info, err := mem.VirtualMemory() 57 | if err != nil { 58 | return 0, err 59 | } 60 | return float64(info.Total) / (1024 * 1024 * 1024), nil 61 | } 62 | 63 | func getUsername() (string, error) { 64 | info, err := host.Info() 65 | if err != nil { 66 | return "", err 67 | } 68 | return info.Hostname, nil 69 | } 70 | func Information() hyprsettings_utils.Page { 71 | processorName, err := getProcessorName() 72 | if err != nil { 73 | panic(err) 74 | } 75 | gpuName, err := getGPUName() 76 | if err != nil { 77 | panic(err) 78 | } 79 | diskSize, err := getDiskSize() 80 | if err != nil { 81 | panic(err) 82 | } 83 | ramSize, err := getRAMSize() 84 | if err != nil { 85 | panic(err) 86 | } 87 | username, err := getUsername() 88 | if err != nil { 89 | panic(err) 90 | } 91 | return hyprsettings_utils.Page{ 92 | Title: "Informations", 93 | Description: "System & Hyprsettings informations", 94 | PageType: "info", 95 | Setting: hyprsettings_utils.Setting{ 96 | Info: hyprsettings_utils.Info{ 97 | Paragraph: []string{ 98 | "System informations:", 99 | "Username: " + username, 100 | "CPU: " + processorName, 101 | "GPU: " + gpuName, 102 | fmt.Sprintf("Ram Size: %.2fGb", ramSize), 103 | fmt.Sprintf("Disk Size: %.2fGb", diskSize), 104 | "", 105 | "Hyprsettings by @anotherhadi", 106 | }, 107 | }, 108 | }, 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /input/cursor.go: -------------------------------------------------------------------------------- 1 | package input 2 | 3 | import hyprsettings_utils "github.com/anotherhadi/hyprsettings/utils" 4 | 5 | func cursor() hyprsettings_utils.Page { 6 | return hyprsettings_utils.Page{ 7 | Title: "Mouse/Cursor", 8 | Description: "Sensitivity, acceleration, left handed..", 9 | Child: []hyprsettings_utils.Page{ 10 | { 11 | Title: "Sensitivity", 12 | Description: "Sets the mouse input sensitivity. Value will be clamped to the range -1.0 to 1.0.", 13 | PageType: "float", 14 | Setting: hyprsettings_utils.Setting{ 15 | Section: "input/", 16 | Variable: "sensitivity", 17 | FloatSetting: hyprsettings_utils.FloatSetting{ 18 | DefaultVal: 0, 19 | Minimum: -1, 20 | Maximum: 1, 21 | }, 22 | }, 23 | }, 24 | 25 | { 26 | Title: "Acceleration Profile", 27 | Description: "Sets the cursor acceleration profile. Can be one of adaptive, flat. Leave empty to use libinput’s default mode for your input device.", 28 | PageType: "str", 29 | Setting: hyprsettings_utils.Setting{ 30 | Section: "input/", 31 | Variable: "accel_profile", 32 | StringSetting: hyprsettings_utils.StringSetting{ 33 | DefaultVal: "", 34 | }, 35 | }, 36 | }, 37 | 38 | { 39 | Title: "Force no acceleration", 40 | Description: "Force no cursor acceleration. This bypasses most of your pointer settings to get as raw of a signal as possible. Enabling this is not recommended due to potential cursor desynchronization.", 41 | PageType: "bool", 42 | Setting: hyprsettings_utils.Setting{ 43 | Section: "input/", 44 | Variable: "force_no_accel", 45 | BoolSetting: hyprsettings_utils.BoolSetting{ 46 | DefaultVal: false, 47 | }, 48 | }, 49 | }, 50 | 51 | { 52 | Title: "Left Handed", 53 | Description: "Switches RMB and LMB", 54 | PageType: "bool", 55 | Setting: hyprsettings_utils.Setting{ 56 | Section: "input/", 57 | Variable: "left_handed", 58 | BoolSetting: hyprsettings_utils.BoolSetting{ 59 | DefaultVal: false, 60 | }, 61 | }, 62 | }, 63 | 64 | { 65 | Title: "Scroll Points", 66 | Description: "Sets the scroll acceleration profile, when accel_profile is set to custom. Has to be in the form . Leave empty to have a flat scroll curve.", 67 | PageType: "str", 68 | Setting: hyprsettings_utils.Setting{ 69 | Section: "input/", 70 | Variable: "scroll_points", 71 | StringSetting: hyprsettings_utils.StringSetting{ 72 | DefaultVal: "", 73 | }, 74 | }, 75 | }, 76 | 77 | { 78 | Title: "Scroll Method", 79 | Description: "Sets the scroll method. Can be one of 2fg (2 fingers), edge, on_button_down, no_scroll.", 80 | PageType: "list", 81 | Setting: hyprsettings_utils.Setting{ 82 | Section: "input/", 83 | Variable: "scroll_method", 84 | ListSetting: hyprsettings_utils.ListSetting{ 85 | Options: []string{"2fg", "edge", "on_button_down", "no_scroll"}, 86 | }, 87 | }, 88 | }, 89 | 90 | { 91 | Title: "Scroll button", 92 | Description: "Sets the scroll button. Has to be an int, cannot be a string. Check wev if you have any doubts regarding the ID. 0 means default.", 93 | PageType: "int", 94 | Setting: hyprsettings_utils.Setting{ 95 | Section: "input/", 96 | Variable: "scroll_button", 97 | IntSetting: hyprsettings_utils.IntSetting{ 98 | DefaultVal: 0, 99 | Minimum: -1000, 100 | Maximum: 1000, 101 | }, 102 | }, 103 | }, 104 | 105 | { 106 | Title: "Scroll button lock", 107 | Description: "If the scroll button lock is enabled, the button does not need to be held down. Pressing and releasing the button once enables the button lock, the button is now considered logically held down. Pressing and releasing the button a second time logically releases the button. While the button is logically held down, motion events are converted to scroll events.", 108 | PageType: "bool", 109 | Setting: hyprsettings_utils.Setting{ 110 | Section: "input/", 111 | Variable: "scroll_button_lock", 112 | BoolSetting: hyprsettings_utils.BoolSetting{ 113 | DefaultVal: false, 114 | }, 115 | }, 116 | }, 117 | 118 | { 119 | Title: "Follow Mouse", 120 | Description: "Specify if and how cursor movement should affect window focus. See the note on the wiki", 121 | PageType: "int", 122 | Setting: hyprsettings_utils.Setting{ 123 | Section: "input/", 124 | Variable: "follow_mouse", 125 | IntSetting: hyprsettings_utils.IntSetting{ 126 | DefaultVal: 1, 127 | Minimum: 0, 128 | Maximum: 3, 129 | }, 130 | }, 131 | }, 132 | 133 | { 134 | Title: "Mouse refocus", 135 | Description: "If disabled and follow_mouse=1 then mouse focus will not switch to the hovered window unless the mouse crosses a window boundary.", 136 | PageType: "bool", 137 | Setting: hyprsettings_utils.Setting{ 138 | Section: "input/", 139 | Variable: "mouse_refocus", 140 | BoolSetting: hyprsettings_utils.BoolSetting{ 141 | DefaultVal: true, 142 | }, 143 | }, 144 | }, 145 | 146 | { 147 | Title: "Float switch override focus", 148 | Description: "If enabled (1 or 2), focus will change to the window under the cursor when changing from tiled-to-floating and vice versa. If 2, focus will also follow mouse on float-to-float switches.", 149 | PageType: "int", 150 | Setting: hyprsettings_utils.Setting{ 151 | Section: "input/", 152 | Variable: "float_switch_override_focus", 153 | IntSetting: hyprsettings_utils.IntSetting{ 154 | DefaultVal: 1, 155 | Minimum: 0, 156 | Maximum: 2, 157 | }, 158 | }, 159 | }, 160 | }, 161 | } 162 | } 163 | -------------------------------------------------------------------------------- /input/input.go: -------------------------------------------------------------------------------- 1 | package input 2 | 3 | import ( 4 | hyprsettings_utils "github.com/anotherhadi/hyprsettings/utils" 5 | ) 6 | 7 | func Input() hyprsettings_utils.Page { 8 | return hyprsettings_utils.Page{ 9 | Title: "Input", 10 | Description: "Change input settings", 11 | Child: []hyprsettings_utils.Page{ 12 | keyboard(), 13 | cursor(), 14 | touchpad(), 15 | touchdevice(), 16 | tablet(), 17 | }, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /input/keyboard.go: -------------------------------------------------------------------------------- 1 | package input 2 | 3 | import ( 4 | "os" 5 | "os/exec" 6 | "strings" 7 | 8 | hyprsettings_utils "github.com/anotherhadi/hyprsettings/utils" 9 | ) 10 | 11 | func getLocaleCtl(name string) []string { 12 | cmd := exec.Command("localectl", "list-x11-keymap-"+name) 13 | output, err := cmd.Output() 14 | if err != nil { 15 | os.Exit(1) 16 | } 17 | outputStr := string(output) 18 | 19 | return strings.Split(strings.TrimSpace(outputStr), "\n") 20 | } 21 | 22 | func keyboard() hyprsettings_utils.Page { 23 | 24 | layouts := getLocaleCtl("layouts") 25 | models := getLocaleCtl("models") 26 | variants := getLocaleCtl("variants") 27 | options := getLocaleCtl("options") 28 | 29 | return hyprsettings_utils.Page{ 30 | Title: "Keyboard", 31 | Description: "Layout, model, variants ..", 32 | Child: []hyprsettings_utils.Page{ 33 | 34 | { 35 | Title: "Keyboard Layout", 36 | Description: "Appropriate XKB keymap parameter", 37 | PageType: "list", 38 | Setting: hyprsettings_utils.Setting{ 39 | Section: "input/", 40 | Variable: "kb_layout", 41 | ListSetting: hyprsettings_utils.ListSetting{ 42 | Options: layouts, 43 | }, 44 | }, 45 | }, 46 | 47 | { 48 | Title: "Keyboard Model", 49 | Description: "Appropriate XKB keymap parameter", 50 | PageType: "list", 51 | Setting: hyprsettings_utils.Setting{ 52 | Section: "input/", 53 | Variable: "kb_model", 54 | ListSetting: hyprsettings_utils.ListSetting{ 55 | Options: models, 56 | }, 57 | }, 58 | }, 59 | 60 | { 61 | Title: "Keyboard Variant", 62 | Description: "Appropriate XKB keymap parameter", 63 | PageType: "list", 64 | Setting: hyprsettings_utils.Setting{ 65 | Section: "input/", 66 | Variable: "kb_variant", 67 | ListSetting: hyprsettings_utils.ListSetting{ 68 | Options: variants, 69 | }, 70 | }, 71 | }, 72 | 73 | { 74 | Title: "Keyboard Options", 75 | Description: "Appropriate XKB keymap parameter", 76 | PageType: "list", 77 | Setting: hyprsettings_utils.Setting{ 78 | Section: "input/", 79 | Variable: "kb_options", 80 | ListSetting: hyprsettings_utils.ListSetting{ 81 | Options: options, 82 | }, 83 | }, 84 | }, 85 | 86 | { 87 | Title: "Keyboard Rules", 88 | Description: "Appropriate XKB keymap parameter", 89 | PageType: "str", 90 | Setting: hyprsettings_utils.Setting{ 91 | Section: "input/", 92 | Variable: "kb_rules", 93 | StringSetting: hyprsettings_utils.StringSetting{ 94 | DefaultVal: "", 95 | }, 96 | }, 97 | }, 98 | 99 | { 100 | Title: "Keyboard File", 101 | Description: "If you prefer, you can use a path to your custom .xkb file.", 102 | PageType: "str", 103 | Setting: hyprsettings_utils.Setting{ 104 | Section: "input/", 105 | Variable: "kb_file", 106 | StringSetting: hyprsettings_utils.StringSetting{ 107 | DefaultVal: "", 108 | }, 109 | }, 110 | }, 111 | 112 | { 113 | Title: "Numlock by default", 114 | Description: "Engage numlock by default.", 115 | PageType: "bool", 116 | Setting: hyprsettings_utils.Setting{ 117 | Section: "input/", 118 | Variable: "numlock_by_default", 119 | BoolSetting: hyprsettings_utils.BoolSetting{ 120 | DefaultVal: false, 121 | }, 122 | }, 123 | }, 124 | 125 | { 126 | Title: "Repeat rate", 127 | Description: "The repeat rate for held-down keys, in repeats per second.", 128 | PageType: "int", 129 | Setting: hyprsettings_utils.Setting{ 130 | Section: "input/", 131 | Variable: "repeat_rate", 132 | IntSetting: hyprsettings_utils.IntSetting{ 133 | DefaultVal: 25, 134 | Minimum: 0, 135 | Maximum: 300, 136 | }, 137 | }, 138 | }, 139 | 140 | { 141 | Title: "Repeat delay", 142 | Description: "Delay before a held-down key is repeated, in milliseconds.", 143 | PageType: "int", 144 | Setting: hyprsettings_utils.Setting{ 145 | Section: "input/", 146 | Variable: "repeat_delay", 147 | IntSetting: hyprsettings_utils.IntSetting{ 148 | DefaultVal: 600, 149 | Minimum: 0, 150 | Maximum: 10000, 151 | }, 152 | }, 153 | }, 154 | }, 155 | } 156 | } 157 | -------------------------------------------------------------------------------- /input/tablet.go: -------------------------------------------------------------------------------- 1 | package input 2 | 3 | import hyprsettings_utils "github.com/anotherhadi/hyprsettings/utils" 4 | 5 | func tablet() hyprsettings_utils.Page { 6 | return hyprsettings_utils.Page{ 7 | Title: "Tablet", 8 | Description: "Change tablet settings", 9 | Child: []hyprsettings_utils.Page{ 10 | 11 | { 12 | Title: "Transform", 13 | Description: "transform the input from tablets. The possible transformations are the same as those of the monitors", 14 | PageType: "int", 15 | Setting: hyprsettings_utils.Setting{ 16 | Section: "input/tablet/", 17 | Variable: "transform", 18 | IntSetting: hyprsettings_utils.IntSetting{ 19 | DefaultVal: 0, 20 | Minimum: 0, 21 | Maximum: 100, 22 | }, 23 | }, 24 | }, 25 | 26 | { 27 | Title: "Output", 28 | Description: "the monitor to bind tablets. Empty means unset and will use the current / autodetected.", 29 | PageType: "string", 30 | Setting: hyprsettings_utils.Setting{ 31 | Section: "input/tablet/", 32 | Variable: "output", 33 | StringSetting: hyprsettings_utils.StringSetting{ 34 | DefaultVal: "", 35 | }, 36 | }, 37 | }, 38 | 39 | // TODO: ADD VECTOR2 40 | 41 | { 42 | Title: "Relative Input", 43 | Description: "whether the input should be relative", 44 | PageType: "bool", 45 | Setting: hyprsettings_utils.Setting{ 46 | Section: "input/tablet/", 47 | Variable: "relative_input", 48 | BoolSetting: hyprsettings_utils.BoolSetting{ 49 | DefaultVal: false, 50 | }, 51 | }, 52 | }, 53 | }, 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /input/touchdevice.go: -------------------------------------------------------------------------------- 1 | package input 2 | 3 | import hyprsettings_utils "github.com/anotherhadi/hyprsettings/utils" 4 | 5 | func touchdevice() hyprsettings_utils.Page { 6 | return hyprsettings_utils.Page{ 7 | Title: "Touch Device", 8 | Description: "Change Touch Device settings", 9 | Child: []hyprsettings_utils.Page{ 10 | 11 | { 12 | Title: "Transform", 13 | Description: "transform the input from touchdevices. The possible transformations are the same as those of the monitors", 14 | PageType: "int", 15 | Setting: hyprsettings_utils.Setting{ 16 | Section: "input/touchdevice/", 17 | Variable: "transform", 18 | IntSetting: hyprsettings_utils.IntSetting{ 19 | DefaultVal: 0, 20 | Minimum: 0, 21 | Maximum: 100, 22 | }, 23 | }, 24 | }, 25 | 26 | { 27 | Title: "Output", 28 | Description: "the monitor to bind touch devices. Empty means unset and will use the current / autodetected.", 29 | PageType: "string", 30 | Setting: hyprsettings_utils.Setting{ 31 | Section: "input/touchdevice/", 32 | Variable: "output", 33 | StringSetting: hyprsettings_utils.StringSetting{ 34 | DefaultVal: "", 35 | }, 36 | }, 37 | }, 38 | }, 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /input/touchpad.go: -------------------------------------------------------------------------------- 1 | package input 2 | 3 | import hyprsettings_utils "github.com/anotherhadi/hyprsettings/utils" 4 | 5 | func touchpad() hyprsettings_utils.Page { 6 | return hyprsettings_utils.Page{ 7 | Title: "Touchpad", 8 | Description: "Change touchpad settings", 9 | Child: []hyprsettings_utils.Page{ 10 | 11 | { 12 | Title: "Disable while typing", 13 | Description: "Disable the touchpad while typing.", 14 | PageType: "bool", 15 | Setting: hyprsettings_utils.Setting{ 16 | Section: "input/touchpad/", 17 | Variable: "disable_while_typing", 18 | BoolSetting: hyprsettings_utils.BoolSetting{ 19 | DefaultVal: true, 20 | }, 21 | }, 22 | }, 23 | 24 | { 25 | Title: "Natural scroll", 26 | Description: "Inverts scrolling direction. When enabled, scrolling moves content directly instead of manipulating a scrollbar.", 27 | PageType: "bool", 28 | Setting: hyprsettings_utils.Setting{ 29 | Section: "input/touchpad/", 30 | Variable: "natural_scroll", 31 | BoolSetting: hyprsettings_utils.BoolSetting{ 32 | DefaultVal: true, 33 | }, 34 | }, 35 | }, 36 | 37 | { 38 | Title: "Scroll factor", 39 | Description: "Multiplier applied to the amount of scroll movement.", 40 | PageType: "float", 41 | Setting: hyprsettings_utils.Setting{ 42 | Section: "input/touchpad/", 43 | Variable: "scroll_factor", 44 | FloatSetting: hyprsettings_utils.FloatSetting{ 45 | DefaultVal: 1, 46 | Minimum: 0, 47 | Maximum: 1000, 48 | }, 49 | }, 50 | }, 51 | 52 | { 53 | Title: "Middle Button emulation", 54 | Description: "Sending LMB and RMB simultaneously will be interpreted as a middle click. This disables any touchpad area that would normally send a middle click based on location.", 55 | PageType: "bool", 56 | Setting: hyprsettings_utils.Setting{ 57 | Section: "input/touchpad/", 58 | Variable: "middle_button_emulation", 59 | BoolSetting: hyprsettings_utils.BoolSetting{ 60 | DefaultVal: false, 61 | }, 62 | }, 63 | }, 64 | 65 | { 66 | Title: "Tap button map", 67 | Description: "Sets the tap button mapping for touchpad button emulation. Can be one of lrm (default) or lmr (Left, Middle, Right Buttons).", 68 | PageType: "list", 69 | Setting: hyprsettings_utils.Setting{ 70 | Section: "input/touchpad/", 71 | Variable: "tap_button_map", 72 | ListSetting: hyprsettings_utils.ListSetting{ 73 | Options: []string{"lrm", "lmr"}, 74 | }, 75 | }, 76 | }, 77 | 78 | { 79 | Title: "Clickfinger behavior", 80 | Description: "Button presses with 1, 2, or 3 fingers will be mapped to LMB, RMB, and MMB respectively. This disables interpretation of clicks based on location on the touchpad.", 81 | PageType: "bool", 82 | Setting: hyprsettings_utils.Setting{ 83 | Section: "input/touchpad/", 84 | Variable: "clickfinger_behavior", 85 | BoolSetting: hyprsettings_utils.BoolSetting{ 86 | DefaultVal: false, 87 | }, 88 | }, 89 | }, 90 | 91 | { 92 | Title: "Tap to click", 93 | Description: "Tapping on the touchpad with 1, 2, or 3 fingers will send LMB, RMB, and MMB respectively.", 94 | PageType: "bool", 95 | Setting: hyprsettings_utils.Setting{ 96 | Section: "input/touchpad/", 97 | Variable: "tap-to-click", 98 | BoolSetting: hyprsettings_utils.BoolSetting{ 99 | DefaultVal: true, 100 | }, 101 | }, 102 | }, 103 | 104 | { 105 | Title: "Drag lock", 106 | Description: "When enabled, lifting the finger off for a short time while dragging will not drop the dragged item.", 107 | PageType: "bool", 108 | Setting: hyprsettings_utils.Setting{ 109 | Section: "input/touchpad/", 110 | Variable: "drag_lock", 111 | BoolSetting: hyprsettings_utils.BoolSetting{ 112 | DefaultVal: false, 113 | }, 114 | }, 115 | }, 116 | 117 | { 118 | Title: "Tap and drag", 119 | Description: "Sets the tap and drag mode for the touchpad", 120 | PageType: "bool", 121 | Setting: hyprsettings_utils.Setting{ 122 | Section: "input/touchpad/", 123 | Variable: "tap-and-drag", 124 | BoolSetting: hyprsettings_utils.BoolSetting{ 125 | DefaultVal: false, 126 | }, 127 | }, 128 | }, 129 | }, 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/anotherhadi/hyprsettings/animations" 5 | "github.com/anotherhadi/hyprsettings/binds" 6 | "github.com/anotherhadi/hyprsettings/decoration" 7 | "github.com/anotherhadi/hyprsettings/general" 8 | "github.com/anotherhadi/hyprsettings/gestures" 9 | "github.com/anotherhadi/hyprsettings/group" 10 | "github.com/anotherhadi/hyprsettings/information" 11 | "github.com/anotherhadi/hyprsettings/input" 12 | "github.com/anotherhadi/hyprsettings/misc" 13 | "github.com/anotherhadi/hyprsettings/opengl" 14 | hyprsettings_utils "github.com/anotherhadi/hyprsettings/utils" 15 | "github.com/anotherhadi/hyprsettings/xwayland" 16 | ) 17 | 18 | func main() { 19 | hyprsettings_utils.InitHyprSettings() 20 | defer hyprsettings_utils.Cleanup() 21 | 22 | var pages hyprsettings_utils.Page = hyprsettings_utils.Page{ 23 | Title: "HyprSettings", 24 | Description: "Change your Hyprland settings here. Select a page:", 25 | Child: []hyprsettings_utils.Page{ 26 | 27 | general.General(), 28 | decoration.Decoration(), 29 | animations.Animations(), 30 | input.Input(), 31 | gestures.Gestures(), 32 | group.Group(), 33 | misc.Misc(), 34 | binds.Binds(), 35 | xwayland.Xwayland(), 36 | opengl.Opengl(), 37 | 38 | information.Information(), 39 | }, 40 | } 41 | 42 | var breadCrumbs []string 43 | breadCrumbs = append(breadCrumbs, "HyprSettings") 44 | var breadCrumbsPointer *[]string = &breadCrumbs 45 | var msg string = "Welcome to HyprSettings" 46 | var messagePointer *string = &msg 47 | hyprsettings_utils.DisplayPage(pages, breadCrumbsPointer, messagePointer) 48 | } 49 | -------------------------------------------------------------------------------- /misc/misc.go: -------------------------------------------------------------------------------- 1 | package misc 2 | 3 | import hyprsettings_utils "github.com/anotherhadi/hyprsettings/utils" 4 | 5 | func Misc() hyprsettings_utils.Page { 6 | 7 | return hyprsettings_utils.Page{ 8 | Title: "Misc", 9 | Description: "Change Miscellaneous settings", 10 | Child: []hyprsettings_utils.Page{ 11 | 12 | { 13 | Title: "Disable hyprland logo", 14 | Description: "disables the random hyprland logo / anime girl background. :(", 15 | PageType: "bool", 16 | Setting: hyprsettings_utils.Setting{ 17 | Section: "misc/", 18 | Variable: "disable_hyprland_logo", 19 | BoolSetting: hyprsettings_utils.BoolSetting{ 20 | DefaultVal: false, 21 | }, 22 | }, 23 | }, 24 | 25 | { 26 | Title: "Disable splash rendering", 27 | Description: "disables the hyprland splash rendering. (requires a monitor reload to take effect)", 28 | PageType: "bool", 29 | Setting: hyprsettings_utils.Setting{ 30 | Section: "misc/", 31 | Variable: "disable_splash_rendering", 32 | BoolSetting: hyprsettings_utils.BoolSetting{ 33 | DefaultVal: false, 34 | }, 35 | }, 36 | }, 37 | 38 | { 39 | Title: "Force hypr chan", 40 | Description: "makes the background always have hypr-chan, the hyprland mascot", 41 | PageType: "bool", 42 | Setting: hyprsettings_utils.Setting{ 43 | Section: "misc/", 44 | Variable: "force_hypr_chan", 45 | BoolSetting: hyprsettings_utils.BoolSetting{ 46 | DefaultVal: false, 47 | }, 48 | }, 49 | }, 50 | 51 | { 52 | Title: "Force default wallpaper", 53 | Description: "Enforce any of the 3 default wallpapers. Setting this to 0 disables the anime background. -1 means “random”", 54 | PageType: "int", 55 | Setting: hyprsettings_utils.Setting{ 56 | Section: "misc/", 57 | Variable: "force_default_wallpaper", 58 | IntSetting: hyprsettings_utils.IntSetting{ 59 | DefaultVal: -1, 60 | Minimum: -1, 61 | Maximum: 3, 62 | }, 63 | }, 64 | }, 65 | 66 | { 67 | Title: "VFR", 68 | Description: "controls the VFR status of hyprland. Heavily recommended to leave on true to conserve resources.", 69 | PageType: "bool", 70 | Setting: hyprsettings_utils.Setting{ 71 | Section: "misc/", 72 | Variable: "vfr", 73 | BoolSetting: hyprsettings_utils.BoolSetting{ 74 | DefaultVal: true, 75 | }, 76 | }, 77 | }, 78 | 79 | { 80 | Title: "VRR", 81 | Description: "controls the VRR (Adaptive Sync) of your monitors. 0 - off, 1 - on, 2 - fullscreen only", 82 | PageType: "int", 83 | Setting: hyprsettings_utils.Setting{ 84 | Section: "misc/", 85 | Variable: "vrr", 86 | IntSetting: hyprsettings_utils.IntSetting{ 87 | DefaultVal: 0, 88 | Minimum: 0, 89 | Maximum: 2, 90 | }, 91 | }, 92 | }, 93 | 94 | { 95 | Title: "Mouse move enables DPMS", 96 | Description: "If DPMS is set to off, wake up the monitors if the mouse moves.", 97 | PageType: "bool", 98 | Setting: hyprsettings_utils.Setting{ 99 | Section: "misc/", 100 | Variable: "mouse_move_enables_dpms", 101 | BoolSetting: hyprsettings_utils.BoolSetting{ 102 | DefaultVal: false, 103 | }, 104 | }, 105 | }, 106 | 107 | { 108 | Title: "Key press enables DPMS", 109 | Description: "If DPMS is set to off, wake up the monitors if a key is pressed.", 110 | PageType: "bool", 111 | Setting: hyprsettings_utils.Setting{ 112 | Section: "misc/", 113 | Variable: "key_press_enables_dpms", 114 | BoolSetting: hyprsettings_utils.BoolSetting{ 115 | DefaultVal: false, 116 | }, 117 | }, 118 | }, 119 | 120 | { 121 | Title: "Always follow on dnd", 122 | Description: "Will make mouse focus follow the mouse when drag and dropping. Recommended to leave it enabled, especially for people using focus follows mouse at 0.", 123 | PageType: "bool", 124 | Setting: hyprsettings_utils.Setting{ 125 | Section: "misc/", 126 | Variable: "always_follow_on_dnd", 127 | BoolSetting: hyprsettings_utils.BoolSetting{ 128 | DefaultVal: true, 129 | }, 130 | }, 131 | }, 132 | 133 | { 134 | Title: "Layers hog keyboard focus", 135 | Description: "If true, will make keyboard-interactive layers keep their focus on mouse move (e.g. wofi, bemenu)", 136 | PageType: "bool", 137 | Setting: hyprsettings_utils.Setting{ 138 | Section: "misc/", 139 | Variable: "layers_hog_keyboard_focus", 140 | BoolSetting: hyprsettings_utils.BoolSetting{ 141 | DefaultVal: true, 142 | }, 143 | }, 144 | }, 145 | 146 | { 147 | Title: "Animate manual resizes", 148 | Description: "If true, will animate manual window resizes/moves", 149 | PageType: "bool", 150 | Setting: hyprsettings_utils.Setting{ 151 | Section: "misc/", 152 | Variable: "animate_manual_resizes", 153 | BoolSetting: hyprsettings_utils.BoolSetting{ 154 | DefaultVal: false, 155 | }, 156 | }, 157 | }, 158 | 159 | { 160 | Title: "Animate mouse windowdragging", 161 | Description: "If true, will animate windows being dragged by mouse, note that this can cause weird behavior on some curves", 162 | PageType: "bool", 163 | Setting: hyprsettings_utils.Setting{ 164 | Section: "misc/", 165 | Variable: "animate_mouse_windowdragging", 166 | BoolSetting: hyprsettings_utils.BoolSetting{ 167 | DefaultVal: false, 168 | }, 169 | }, 170 | }, 171 | 172 | { 173 | Title: "Disable autoreload", 174 | Description: "If true, the config will not reload automatically on save, and instead needs to be reloaded with hyprctl reload. Might save on battery.", 175 | PageType: "bool", 176 | Setting: hyprsettings_utils.Setting{ 177 | Section: "misc/", 178 | Variable: "disable_autoreload", 179 | BoolSetting: hyprsettings_utils.BoolSetting{ 180 | DefaultVal: false, 181 | }, 182 | }, 183 | }, 184 | 185 | { 186 | Title: "Enable swallow", 187 | Description: "Enable window swallowing", 188 | PageType: "bool", 189 | Setting: hyprsettings_utils.Setting{ 190 | Section: "misc/", 191 | Variable: "enable_swallow", 192 | BoolSetting: hyprsettings_utils.BoolSetting{ 193 | DefaultVal: false, 194 | }, 195 | }, 196 | }, 197 | 198 | { 199 | Title: "Swallow regex", 200 | Description: "The class regex to be used for windows that should be swallowed (usually, a terminal). To know more about the list of regex which can be used the wiki", 201 | PageType: "string", 202 | Setting: hyprsettings_utils.Setting{ 203 | Section: "misc/", 204 | Variable: "swallow_regex", 205 | StringSetting: hyprsettings_utils.StringSetting{ 206 | DefaultVal: "", 207 | }, 208 | }, 209 | }, 210 | 211 | { 212 | Title: "Swallow Exception regex", 213 | Description: "The title regex to be used for windows that should not be swallowed by the windows specified in swallow_regex (e.g. wev). The regex is matched against the parent (e.g. Kitty) window’s title on the assumption that it changes to whatever process it’s running.", 214 | PageType: "string", 215 | Setting: hyprsettings_utils.Setting{ 216 | Section: "misc/", 217 | Variable: "swallow_exception_regex", 218 | StringSetting: hyprsettings_utils.StringSetting{ 219 | DefaultVal: "", 220 | }, 221 | }, 222 | }, 223 | 224 | { 225 | Title: "Focus on activate", 226 | Description: "Whether Hyprland should focus an app that requests to be focused (an activate request)", 227 | PageType: "bool", 228 | Setting: hyprsettings_utils.Setting{ 229 | Section: "misc/", 230 | Variable: "focus_on_activate", 231 | BoolSetting: hyprsettings_utils.BoolSetting{ 232 | DefaultVal: false, 233 | }, 234 | }, 235 | }, 236 | 237 | { 238 | Title: "No direct Scannout", 239 | Description: "Disables direct scanout. Direct scanout attempts to reduce lag when there is only one fullscreen application on a screen (e.g. game). It is also recommended to set this to true if the fullscreen application shows graphical glitches.", 240 | PageType: "bool", 241 | Setting: hyprsettings_utils.Setting{ 242 | Section: "misc/", 243 | Variable: "no_direct_scannout", 244 | BoolSetting: hyprsettings_utils.BoolSetting{ 245 | DefaultVal: true, 246 | }, 247 | }, 248 | }, 249 | 250 | { 251 | Title: "Hide cursor on touch", 252 | Description: "Hides the cursor when the last input was a touch input until a mouse input is done.", 253 | PageType: "bool", 254 | Setting: hyprsettings_utils.Setting{ 255 | Section: "misc/", 256 | Variable: "hide_cursor_on_touch", 257 | BoolSetting: hyprsettings_utils.BoolSetting{ 258 | DefaultVal: true, 259 | }, 260 | }, 261 | }, 262 | 263 | { 264 | Title: "Mouse move focuses monitor", 265 | Description: "Whether mouse moving into a different monitor should focus it", 266 | PageType: "bool", 267 | Setting: hyprsettings_utils.Setting{ 268 | Section: "misc/", 269 | Variable: "mouse_move_focuses_monitor", 270 | BoolSetting: hyprsettings_utils.BoolSetting{ 271 | DefaultVal: true, 272 | }, 273 | }, 274 | }, 275 | 276 | { 277 | Title: "Suppress portal warnings", 278 | Description: "disables warnings about incompatible portal implementations.", 279 | PageType: "bool", 280 | Setting: hyprsettings_utils.Setting{ 281 | Section: "misc/", 282 | Variable: "suppress_portal_warnings", 283 | BoolSetting: hyprsettings_utils.BoolSetting{ 284 | DefaultVal: false, 285 | }, 286 | }, 287 | }, 288 | 289 | { 290 | Title: "Render ahead of time", 291 | Description: "[Warning: buggy] starts rendering before your monitor displays a frame in order to lower latency", 292 | PageType: "bool", 293 | Setting: hyprsettings_utils.Setting{ 294 | Section: "misc/", 295 | Variable: "render_ahead_of_time", 296 | BoolSetting: hyprsettings_utils.BoolSetting{ 297 | DefaultVal: false, 298 | }, 299 | }, 300 | }, 301 | 302 | { 303 | Title: "Render ahead safezone", 304 | Description: "how many ms of safezone to add to rendering ahead of time. Recommended 1-2.", 305 | PageType: "int", 306 | Setting: hyprsettings_utils.Setting{ 307 | Section: "misc/", 308 | Variable: "render_ahead_safezone", 309 | IntSetting: hyprsettings_utils.IntSetting{ 310 | DefaultVal: 1, 311 | Minimum: 0, 312 | Maximum: 1000, 313 | }, 314 | }, 315 | }, 316 | 317 | { 318 | Title: "Cursor zoom factor", 319 | Description: "the factor to zoom by around the cursor. AKA. Magnifying glass. Minimum 1.0 (meaning no zoom)", 320 | PageType: "float", 321 | Setting: hyprsettings_utils.Setting{ 322 | Section: "misc/", 323 | Variable: "cursor_zoom_factor", 324 | FloatSetting: hyprsettings_utils.FloatSetting{ 325 | DefaultVal: 1, 326 | Minimum: 1, 327 | Maximum: 1000, 328 | }, 329 | }, 330 | }, 331 | 332 | { 333 | Title: "Cursor zoom rigid", 334 | Description: "whether the zoom should follow the cursor rigidly (cursor is always centered if it can be) or loosely", 335 | PageType: "bool", 336 | Setting: hyprsettings_utils.Setting{ 337 | Section: "misc/", 338 | Variable: "cursor_zoom_rigid", 339 | BoolSetting: hyprsettings_utils.BoolSetting{ 340 | DefaultVal: false, 341 | }, 342 | }, 343 | }, 344 | 345 | { 346 | Title: "Allow session lock restore", 347 | Description: "if true, will allow you to restart a lockscreen app in case it crashes (red screen of death)", 348 | PageType: "bool", 349 | Setting: hyprsettings_utils.Setting{ 350 | Section: "misc/", 351 | Variable: "allow_session_lock_restore", 352 | BoolSetting: hyprsettings_utils.BoolSetting{ 353 | DefaultVal: false, 354 | }, 355 | }, 356 | }, 357 | 358 | { 359 | Title: "Background Color", 360 | Description: "change the background color. (requires enabled disable_hyprland_logo)", 361 | PageType: "color", 362 | Setting: hyprsettings_utils.Setting{ 363 | Section: "misc/", 364 | Variable: "background_color", 365 | ColorSetting: hyprsettings_utils.ColorSetting{ 366 | DefaultVal: "11111111", 367 | }, 368 | }, 369 | }, 370 | 371 | { 372 | Title: "Close special on empty", 373 | Description: "close the special workspace if the last window is removed", 374 | PageType: "bool", 375 | Setting: hyprsettings_utils.Setting{ 376 | Section: "misc/", 377 | Variable: "close_special_on_empty", 378 | BoolSetting: hyprsettings_utils.BoolSetting{ 379 | DefaultVal: true, 380 | }, 381 | }, 382 | }, 383 | 384 | { 385 | Title: "New window takes over fullscreen", 386 | Description: "if there is a fullscreen window, whether a new tiled window opened should replace the fullscreen one or stay behind. 0 - behind, 1 - takes over, 2 - unfullscreen the current fullscreen window", 387 | PageType: "int", 388 | Setting: hyprsettings_utils.Setting{ 389 | Section: "misc/", 390 | Variable: "new_window_takes_over_fullscreen", 391 | IntSetting: hyprsettings_utils.IntSetting{ 392 | DefaultVal: 0, 393 | Minimum: 0, 394 | Maximum: 2, 395 | }, 396 | }, 397 | }, 398 | }, 399 | } 400 | } 401 | -------------------------------------------------------------------------------- /opengl/opengl.go: -------------------------------------------------------------------------------- 1 | package opengl 2 | 3 | import hyprsettings_utils "github.com/anotherhadi/hyprsettings/utils" 4 | 5 | func Opengl() hyprsettings_utils.Page { 6 | 7 | return hyprsettings_utils.Page{ 8 | Title: "OpenGL", 9 | Description: "Change OpenGL settings", 10 | Child: []hyprsettings_utils.Page{ 11 | 12 | { 13 | Title: "Nvidia anti flicker", 14 | Description: "reduces flickering on nvidia at the cost of possible frame drops on lower-end GPUs. On non-nvidia, this is ignored.", 15 | PageType: "bool", 16 | Setting: hyprsettings_utils.Setting{ 17 | Section: "opengl/", 18 | Variable: "nvidia_anti_flicker", 19 | BoolSetting: hyprsettings_utils.BoolSetting{ 20 | DefaultVal: true, 21 | }, 22 | }, 23 | }, 24 | }, 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/hyprsettings.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anotherhadi/hyprsettings/8e230a60d09e8392fecb0f6916b16f15eecffa7b/src/hyprsettings.gif -------------------------------------------------------------------------------- /utils/display.go: -------------------------------------------------------------------------------- 1 | package hyprsettings_utils 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | "unicode" 7 | 8 | "github.com/anotherhadi/gml-ui/ansi" 9 | "github.com/anotherhadi/gml-ui/asciimoji" 10 | "github.com/anotherhadi/gml-ui/asciitext" 11 | "github.com/anotherhadi/gml-ui/getsize" 12 | "github.com/anotherhadi/gml-ui/paragraph" 13 | ) 14 | 15 | func InitHyprSettings() { 16 | ansi.EnableAlternativeBuffer() 17 | ansi.CursorInvisible() 18 | } 19 | 20 | func clear() { 21 | ansi.ClearScreen() 22 | ansi.CursorHome() 23 | } 24 | 25 | func Cleanup() { 26 | ansi.DisableAlternativeBuffer() 27 | ansi.CursorVisible() 28 | } 29 | 30 | func displayNotification(message string) { 31 | ansi.CursorSave() 32 | maxLength := 40 33 | 34 | cols, _, err := getsize.GetSize() 35 | if err != nil { 36 | fmt.Print(err) 37 | cols = maxLength 38 | } 39 | 40 | line := 2 41 | col := cols - 7 - maxLength 42 | 43 | ansi.CursorMove(line, col) 44 | line++ 45 | fmt.Print(ansi.BrightBlack) 46 | fmt.Print("┌") 47 | fmt.Print(repeat("─", maxLength+4)) 48 | fmt.Print("┐") 49 | newMessage := message 50 | ansi.CursorMove(line, col+2) 51 | if strings.HasPrefix(message, "SUCCESS:") { 52 | newMessage = strings.TrimPrefix(message, "SUCCESS:") 53 | fmt.Print(ansi.Green + asciimoji.Envelope) 54 | } else if strings.HasPrefix(message, "ERROR:") { 55 | newMessage = strings.TrimPrefix(message, "ERROR:") 56 | fmt.Print(ansi.Red + asciimoji.Envelope) 57 | } else if strings.HasPrefix(message, "INFO:") { 58 | newMessage = strings.TrimPrefix(message, "INFO:") 59 | fmt.Print(ansi.BrightBlack + asciimoji.Envelope) 60 | } else { 61 | fmt.Print(ansi.BrightWhite + asciimoji.Envelope) 62 | } 63 | splitedMessages := splitPrompt(newMessage, maxLength) 64 | for i, msg := range splitedMessages { 65 | ansi.CursorMove(line, col) 66 | line++ 67 | fmt.Print(ansi.BrightBlack) 68 | fmt.Print("│ ") 69 | if i == 0 { 70 | ansi.CursorRight(1) 71 | } else { 72 | fmt.Print(" ") 73 | } 74 | fmt.Print(" ") 75 | fmt.Print(ansi.White) 76 | fmt.Print(msg) 77 | fmt.Print(repeat(" ", maxLength-len(msg))) 78 | fmt.Print(ansi.BrightBlack) 79 | fmt.Print(" │") 80 | } 81 | fmt.Print(ansi.BrightBlack) 82 | ansi.CursorMove(line, col) 83 | fmt.Print("└") 84 | fmt.Print(repeat("─", maxLength+4)) 85 | fmt.Print("┘") 86 | 87 | ansi.CursorRestore() 88 | } 89 | 90 | func pageHead(breadcrumbs *[]string, page Page, message *string) (remainingRows int) { 91 | clear() 92 | fmt.Print("\n") 93 | ascii := asciitext.AsciiText(page.Title) 94 | splitedAscii := strings.Split(ascii, "\n") 95 | cols, rows, err := getsize.GetSize() 96 | if err != nil { 97 | cols = 200 98 | rows = 100 99 | } 100 | for _, asc := range splitedAscii { 101 | if len(asc) > cols { 102 | fmt.Print(asc[:cols]) 103 | } else { 104 | fmt.Print(asc) 105 | } 106 | fmt.Print("\n") 107 | 108 | } 109 | var bc string 110 | for i, title := range *breadcrumbs { 111 | if i < len(*breadcrumbs)-1 { 112 | bc += ansi.BrightBlack + title + " > " 113 | } else { 114 | bc += ansi.FgRgb(180, 190, 254) + title 115 | } 116 | } 117 | paragraph.Paragraph(bc, paragraph.Settings{ 118 | MaxCols: cols - 10, 119 | }) 120 | descriptionSettings := paragraph.Settings{ 121 | TopPadding: 1, 122 | BottomPadding: 1, 123 | MaxCols: cols - 10, 124 | } 125 | if page.Description != "" { 126 | t := []rune(strings.ToLower(page.Description)) 127 | t[0] = unicode.ToUpper(t[0]) 128 | description := string(t) 129 | if !strings.HasSuffix(description, ".") { 130 | description += "." 131 | } 132 | paragraph.Paragraph(ansi.BrightBlack+asciimoji.Right+" "+ansi.White+description, descriptionSettings) 133 | } 134 | if *message != "" { 135 | displayNotification(*message) 136 | *message = "" 137 | } 138 | remainingRows = rows - len(splitedAscii) - len(bc)/(cols-10) - len(page.Description)/(cols-10) - 8 139 | return 140 | } 141 | -------------------------------------------------------------------------------- /utils/hyprlang.go: -------------------------------------------------------------------------------- 1 | package hyprsettings_utils 2 | 3 | import ( 4 | "os/user" 5 | 6 | "github.com/anotherhadi/hyprlang-parser" 7 | ) 8 | 9 | func readConfig() []string { 10 | usr, err := user.Current() 11 | exitOnError(err) 12 | homedir := usr.HomeDir 13 | content, err := hyprlang_parser.ReadConfig(homedir + "/.config/hypr/hyprland.conf") 14 | exitOnError(err) 15 | return content 16 | } 17 | 18 | func writeConfig(content []string) { 19 | usr, err := user.Current() 20 | exitOnError(err) 21 | homedir := usr.HomeDir 22 | err = hyprlang_parser.WriteConfig(content, homedir+"/.config/hypr/hyprland.conf") 23 | exitOnError(err) 24 | } 25 | -------------------------------------------------------------------------------- /utils/page.go: -------------------------------------------------------------------------------- 1 | package hyprsettings_utils 2 | 3 | import ( 4 | "os" 5 | "strings" 6 | "unicode" 7 | 8 | "github.com/anotherhadi/gml-ui/list" 9 | ) 10 | 11 | type IntSetting struct { 12 | DefaultVal int 13 | Minimum int 14 | Maximum int 15 | } 16 | 17 | type FloatSetting struct { 18 | DefaultVal float64 19 | Minimum float64 20 | Maximum float64 21 | } 22 | 23 | type BoolSetting struct { 24 | DefaultVal bool 25 | } 26 | 27 | type StringSetting struct { 28 | DefaultVal string 29 | } 30 | 31 | type ColorSetting struct { 32 | DefaultVal string 33 | } 34 | 35 | type GradientSetting struct { 36 | DefaultVal string 37 | } 38 | 39 | type ListSetting struct { 40 | Options []string 41 | } 42 | 43 | type Info struct { 44 | Paragraph []string 45 | } 46 | 47 | type Setting struct { 48 | Section string 49 | Variable string 50 | StringSetting StringSetting 51 | BoolSetting BoolSetting 52 | IntSetting IntSetting 53 | FloatSetting FloatSetting 54 | ColorSetting ColorSetting 55 | GradientSetting GradientSetting 56 | ListSetting ListSetting 57 | Info Info 58 | } 59 | 60 | type Page struct { 61 | Title string 62 | Description string 63 | PageType string // "page", "int", "float", "string", "bool", "list" 64 | Setting Setting 65 | Child []Page 66 | } 67 | 68 | func gobackPage(ismain bool) Page { 69 | if ismain { 70 | return Page{ 71 | Title: "Exit HyprSettings", 72 | Description: "⮜ ───────────────", 73 | } 74 | } else { 75 | 76 | return Page{ 77 | Title: "Go Back", 78 | Description: "⮜ ─────", 79 | } 80 | } 81 | } 82 | 83 | func DisplayPage(page Page, breadcrumbs *[]string, message *string) { 84 | if page.PageType == "" || page.PageType == "page" { 85 | remainingRows := pageHead(breadcrumbs, page, message) 86 | 87 | childPages := page.Child 88 | childPages = append(childPages, gobackPage(page.Title == "HyprSettings")) 89 | pagesList := pagesToList(childPages) 90 | selected, err := list.List(list.Settings{ 91 | Options: pagesList, 92 | MaxRows: remainingRows, 93 | }) 94 | exitOnError(err) 95 | if selected == len(pagesList)-1 { 96 | if page.Title == "HyprSettings" { 97 | Cleanup() 98 | os.Exit(0) 99 | } 100 | *breadcrumbs = (*breadcrumbs)[:len(*breadcrumbs)-1] 101 | return 102 | } else { 103 | 104 | t := []rune(strings.ToLower(childPages[selected].Title)) 105 | t[0] = unicode.ToUpper(t[0]) 106 | title := string(t) 107 | *breadcrumbs = append(*breadcrumbs, title) 108 | DisplayPage(childPages[selected], breadcrumbs, message) 109 | } 110 | } else { 111 | displaySettingPage(page, breadcrumbs, message) 112 | *breadcrumbs = (*breadcrumbs)[:len(*breadcrumbs)-1] 113 | return 114 | } 115 | DisplayPage(page, breadcrumbs, message) 116 | } 117 | 118 | func pagesToList(pages []Page) (listOptions []list.Options) { 119 | for i, page := range pages { 120 | description := "" 121 | if i != len(pages)-1 { 122 | t := []rune(strings.ToLower(cutString(page.Description, 60))) 123 | t[0] = unicode.ToUpper(t[0]) 124 | description = string(t) 125 | if !strings.HasSuffix(description, ".") { 126 | description += "." 127 | } 128 | } else { 129 | description = page.Description 130 | } 131 | listOptions = append(listOptions, list.Options{ 132 | Title: page.Title, 133 | Description: description, 134 | }) 135 | } 136 | return 137 | } 138 | -------------------------------------------------------------------------------- /utils/settingPage.go: -------------------------------------------------------------------------------- 1 | package hyprsettings_utils 2 | 3 | import ( 4 | "fmt" 5 | "strconv" 6 | "strings" 7 | 8 | "github.com/anotherhadi/gml-ui/ansi" 9 | "github.com/anotherhadi/gml-ui/confirm" 10 | "github.com/anotherhadi/gml-ui/input" 11 | "github.com/anotherhadi/gml-ui/list" 12 | "github.com/anotherhadi/gml-ui/number_picker" 13 | "github.com/anotherhadi/gml-ui/paragraph" 14 | "github.com/anotherhadi/gml-ui/rgba_picker" 15 | "github.com/anotherhadi/gml-ui/selection_filter" 16 | "github.com/anotherhadi/hyprlang-parser" 17 | ) 18 | 19 | func displaySettingPage(page Page, breadcrumbs *[]string, message *string) { 20 | pageHead(breadcrumbs, page, message) 21 | 22 | switch page.PageType { 23 | case "int": 24 | changeInt(page.Setting.Section, page.Setting.Variable, page.Title, page.Setting.IntSetting.DefaultVal, page.Setting.IntSetting.Minimum, page.Setting.IntSetting.Maximum, message) 25 | case "float": 26 | changeFloat(page.Setting.Section, page.Setting.Variable, page.Title, page.Setting.FloatSetting.DefaultVal, page.Setting.FloatSetting.Minimum, page.Setting.FloatSetting.Maximum, message) 27 | case "bool": 28 | changeBool(page.Setting.Section, page.Setting.Variable, page.Title, page.Setting.BoolSetting.DefaultVal, message) 29 | case "string": 30 | changeString(page.Setting.Section, page.Setting.Variable, page.Title, page.Setting.StringSetting.DefaultVal, message) 31 | case "color": 32 | changeRgba(page.Setting.Section, page.Setting.Variable, page.Title, page.Setting.ColorSetting.DefaultVal, message) 33 | case "gradient": 34 | changeGradient(page.Setting.Section, page.Setting.Variable, page.Title, page.Setting.GradientSetting.DefaultVal, message) 35 | case "list": 36 | changeList(page.Setting.Section, page.Setting.Variable, page.Title, page.Setting.ListSetting.Options, message) 37 | case "info": 38 | infoPage(page.Title, page.Setting.Info.Paragraph, message) 39 | } 40 | 41 | } 42 | 43 | func infoPage(title string, paragraphs []string, message *string) { 44 | settings := paragraph.Settings{ 45 | MaxCols: 100, 46 | BottomPadding: 1, 47 | } 48 | for _, p := range paragraphs { 49 | paragraph.Paragraph(p, settings) 50 | } 51 | _, err := list.List(list.Settings{ 52 | Options: []list.Options{ 53 | { 54 | Title: "Go Back", 55 | Description: "⮜ ─────", 56 | }, 57 | }, 58 | }) 59 | exitOnError(err) 60 | } 61 | 62 | func changeInt(section, variable, title string, defaultVal, minimum, maximum int, message *string) { 63 | content := readConfig() 64 | current := hyprlang_parser.GetFirst(content, section, variable) 65 | 66 | if current == "" { 67 | current = "None" 68 | } 69 | paragraph.Paragraph("Current '" + title + "' is " + current) 70 | 71 | changeIt, err := confirm.Confirm(confirm.Settings{ 72 | Prompt: "Do you want to change it?", 73 | }) 74 | exitOnError(err) 75 | 76 | if changeIt { 77 | var defaultValue float64 78 | 79 | if current == "None" { 80 | defaultValue = float64(defaultVal) 81 | } else { 82 | defaultValue, err = strconv.ParseFloat(current, 64) 83 | exitOnError(err) 84 | } 85 | 86 | number, err := number_picker.NumberPicker(number_picker.Settings{ 87 | Default: defaultValue, 88 | Prompt: "Enter new '" + title + "'" + ansi.BrightBlack + " [arrow/vim keys to +/-, enter to save]", 89 | Minimum: float64(minimum), 90 | Maximum: float64(maximum), 91 | MaxCols: 100, 92 | }) 93 | exitOnError(err) 94 | 95 | changeto := fmt.Sprint(int(number)) 96 | 97 | content = hyprlang_parser.EditFirst(content, section, variable, changeto) 98 | 99 | writeConfig(content) 100 | 101 | *message = "SUCCESS:" + title + " changed!" 102 | } 103 | } 104 | 105 | func changeFloat(section, variable, title string, defaultVal, minimum, maximum float64, message *string) { 106 | content := readConfig() 107 | current := hyprlang_parser.GetFirst(content, section, variable) 108 | 109 | if current == "" { 110 | current = "None" 111 | } 112 | paragraph.Paragraph("Current '" + title + "' is " + current) 113 | 114 | changeIt, err := confirm.Confirm(confirm.Settings{ 115 | Prompt: "Do you want to change it?", 116 | }) 117 | exitOnError(err) 118 | 119 | if changeIt { 120 | var defaultValue float64 121 | if current == "None" { 122 | defaultValue = defaultVal 123 | } else { 124 | defaultValue, err = strconv.ParseFloat(current, 64) 125 | exitOnError(err) 126 | } 127 | 128 | number, err := number_picker.NumberPicker(number_picker.Settings{ 129 | Default: defaultValue, 130 | Prompt: "Enter new '" + title + "'" + ansi.BrightBlack + " [arrow/vim keys to +/-, enter to save]", 131 | Minimum: minimum, 132 | Maximum: maximum, 133 | Decimal: true, 134 | Round: 1, 135 | Increment: 0.1, 136 | MaxCols: 100, 137 | }) 138 | exitOnError(err) 139 | 140 | changeto := fmt.Sprint(number) 141 | 142 | content = hyprlang_parser.EditFirst(content, section, variable, changeto) 143 | 144 | writeConfig(content) 145 | 146 | *message = "SUCCESS:" + title + " changed!" 147 | } 148 | } 149 | 150 | func changeRgba(section, variable, title string, defaultVal string, message *string) { 151 | content := readConfig() 152 | current := hyprlang_parser.GetFirst(content, section, variable) 153 | 154 | if current == "" { 155 | current = "None" 156 | } 157 | paragraph.Paragraph("Current '" + title + "' is " + current) 158 | 159 | changeIt, err := confirm.Confirm(confirm.Settings{ 160 | Prompt: "Do you want to change it?", 161 | }) 162 | exitOnError(err) 163 | 164 | if changeIt { 165 | var defaultValue [4]int 166 | 167 | if current == "None" { 168 | defaultValue = hexToRGBA(defaultVal) 169 | } else { 170 | current = strings.TrimPrefix(current, "rgba(") 171 | current = strings.TrimPrefix(current, "rgb(") 172 | current = strings.TrimPrefix(current, "0x") 173 | current = strings.TrimSuffix(current, ")") 174 | defaultValue = hexToRGBA(current) 175 | } 176 | 177 | rgba, err := rgba_picker.RgbaPicker(rgba_picker.Settings{ 178 | Default: defaultValue, 179 | Prompt: "Enter new color for '" + title + "'" + ansi.BrightBlack + " [arrow/vim keys to move, enter to save]", 180 | MaxCols: 100, 181 | }) 182 | exitOnError(err) 183 | 184 | rgbaStr := rgbaToHex(uint8(rgba[0]), uint8(rgba[1]), uint8(rgba[2]), uint8(rgba[3])) 185 | changeto := "rgba(" + rgbaStr + ")" 186 | 187 | content = hyprlang_parser.EditFirst(content, section, variable, changeto) 188 | 189 | writeConfig(content) 190 | 191 | *message = "SUCCESS:" + title + " changed!" 192 | } 193 | } 194 | 195 | func changeGradient(section, variable, title string, defaultVal string, message *string) { 196 | content := readConfig() 197 | current := hyprlang_parser.GetFirst(content, section, variable) 198 | 199 | if current == "" { 200 | current = "None" 201 | } 202 | paragraph.Paragraph("Current '" + title + "' is " + current) 203 | 204 | changeIt, err := confirm.Confirm(confirm.Settings{ 205 | Prompt: "Do you want to change it?", 206 | }) 207 | exitOnError(err) 208 | 209 | if changeIt { 210 | 211 | currentGradient := "" 212 | 213 | addColor := true 214 | var defaultValue [4]int = [4]int{180, 190, 245, 255} 215 | ansi.CursorDown(3) 216 | ansi.CursorUp(2) 217 | paragraph.Paragraph( 218 | "Current new gradient:", 219 | paragraph.Settings{ 220 | MaxCols: 100, 221 | }, 222 | ) 223 | for addColor { 224 | 225 | rgba, err := rgba_picker.RgbaPicker(rgba_picker.Settings{ 226 | Default: defaultValue, 227 | Prompt: "Enter a new color for '" + title + "'" + ansi.BrightBlack + " [arrow/vim keys to move, enter to save]", 228 | MaxCols: 100, 229 | }) 230 | exitOnError(err) 231 | 232 | rgbaStr := rgbaToHex(uint8(rgba[0]), uint8(rgba[1]), uint8(rgba[2]), uint8(rgba[3])) 233 | currentGradient += "rgba(" + rgbaStr + ") " 234 | 235 | ansi.CursorUp(1) 236 | paragraph.Paragraph( 237 | "\rCurrent new gradient: "+currentGradient, 238 | paragraph.Settings{ 239 | MaxCols: 100, 240 | }, 241 | ) 242 | 243 | addColor, err = confirm.Confirm(confirm.Settings{ 244 | Prompt: "Add another color to the gradient?", 245 | }) 246 | exitOnError(err) 247 | 248 | } 249 | 250 | number, err := number_picker.NumberPicker(number_picker.Settings{ 251 | Default: 0, 252 | Prompt: "Enter the angle (in degrees):", 253 | Minimum: float64(0), 254 | Maximum: float64(360), 255 | MaxCols: 100, 256 | }) 257 | exitOnError(err) 258 | 259 | currentGradient += fmt.Sprintf("%ddeg", int(number)) 260 | content = hyprlang_parser.EditFirst(content, section, variable, currentGradient) 261 | 262 | writeConfig(content) 263 | 264 | *message = "SUCCESS:" + title + " changed!" 265 | } 266 | } 267 | 268 | func changeBool(section, variable, title string, defaultVal bool, message *string) { 269 | content := readConfig() 270 | current := hyprlang_parser.GetFirst(content, section, variable) 271 | 272 | if current == "" { 273 | current = "None" 274 | } 275 | 276 | paragraph.Paragraph("Current '" + title + "' is " + current) 277 | 278 | changeIt, err := confirm.Confirm(confirm.Settings{ 279 | Prompt: "Do you want to change it?", 280 | }) 281 | exitOnError(err) 282 | 283 | if changeIt { 284 | var defaultValue bool 285 | if current == "None" { 286 | defaultValue = defaultVal 287 | } else { 288 | defaultValue, err = strconv.ParseBool(current) 289 | exitOnError(err) 290 | } 291 | 292 | result, err := confirm.Confirm(confirm.Settings{ 293 | DefaultToFalse: !defaultValue, 294 | Prompt: "Enter new value for '" + title + "'" + ansi.BrightBlack + " [arrow/vim keys to move, enter to save]", 295 | MaxCols: 100, 296 | Affirmative: "True", 297 | Negative: "False", 298 | }) 299 | exitOnError(err) 300 | 301 | changeto := strconv.FormatBool(result) 302 | 303 | content = hyprlang_parser.EditFirst(content, section, variable, changeto) 304 | 305 | writeConfig(content) 306 | 307 | *message = "SUCCESS:" + title + " changed!" 308 | } 309 | } 310 | 311 | func changeString(section, variable, title, defaultVal string, message *string) { 312 | content := readConfig() 313 | current := hyprlang_parser.GetFirst(content, section, variable) 314 | 315 | if current == "" { 316 | current = "None" 317 | } 318 | 319 | paragraph.Paragraph("Current '" + title + "' is " + current) 320 | 321 | changeIt, err := confirm.Confirm(confirm.Settings{ 322 | Prompt: "Do you want to change it?", 323 | }) 324 | exitOnError(err) 325 | 326 | if changeIt { 327 | changeto, err := input.Input(input.Settings{ 328 | Prompt: "Enter new value for '" + title + "':", 329 | Default: defaultVal, 330 | }) 331 | exitOnError(err) 332 | 333 | content = hyprlang_parser.EditFirst(content, section, variable, changeto) 334 | 335 | writeConfig(content) 336 | 337 | *message = "SUCCESS:" + title + " changed!" 338 | } 339 | } 340 | 341 | func changeList(section, variable, title string, options []string, message *string) { 342 | content := readConfig() 343 | current := hyprlang_parser.GetFirst(content, section, variable) 344 | 345 | if current == "" { 346 | current = "None" 347 | } 348 | 349 | paragraph.Paragraph("Current '" + title + "' is " + current) 350 | 351 | changeIt, err := confirm.Confirm(confirm.Settings{ 352 | Prompt: "Do you want to change it?", 353 | }) 354 | exitOnError(err) 355 | 356 | if changeIt { 357 | 358 | result, err := selection_filter.SelectionFilter(selection_filter.Settings{ 359 | Prompt: "Select new value for '" + title + "':", 360 | Options: options, 361 | MaxRows: 15, 362 | MaxCols: 100, 363 | }) 364 | exitOnError(err) 365 | 366 | content = hyprlang_parser.EditFirst(content, section, variable, options[result]) 367 | 368 | writeConfig(content) 369 | 370 | *message = "SUCCESS:" + title + " changed!" 371 | } 372 | } 373 | -------------------------------------------------------------------------------- /utils/utils.go: -------------------------------------------------------------------------------- 1 | package hyprsettings_utils 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "strings" 7 | ) 8 | 9 | func cutString(s string, length int) string { 10 | if length > len(s)-1 { 11 | return s 12 | } else { 13 | return s[:length] + ".." 14 | } 15 | } 16 | 17 | func repeat(s string, count int) string { 18 | var result string 19 | for i := 0; i < count; i++ { 20 | result += s 21 | } 22 | return result 23 | } 24 | 25 | func splitPrompt(prompt string, maxCols int) []string { 26 | var result []string 27 | 28 | words := strings.Fields(prompt) 29 | 30 | var currentLine string 31 | for _, word := range words { 32 | if len(currentLine)+len(word)+1 <= maxCols { 33 | if currentLine != "" { 34 | currentLine += " " 35 | } 36 | currentLine += word 37 | } else { 38 | result = append(result, currentLine) 39 | currentLine = word 40 | } 41 | } 42 | 43 | if currentLine != "" { 44 | result = append(result, currentLine) 45 | } 46 | 47 | return result 48 | } 49 | 50 | func parseOnError(err error, message *string) { 51 | if err != nil { 52 | if err.Error() == "SIGINT" { 53 | Cleanup() 54 | os.Exit(0) 55 | } else { 56 | *message = "ERROR:" + err.Error() 57 | } 58 | } 59 | } 60 | 61 | func exitOnError(err error) { 62 | if err != nil { 63 | Cleanup() 64 | if err.Error() == "SIGINT" { 65 | os.Exit(0) 66 | } else { 67 | fmt.Println("Error:", err.Error()) 68 | os.Exit(1) 69 | } 70 | } 71 | } 72 | 73 | func rgbaToHex(r, g, b, a uint8) string { 74 | hex := fmt.Sprintf("%02x%02x%02x%02x", r, g, b, a) 75 | return hex 76 | } 77 | 78 | func hexToRGBA(hex string) [4]int { 79 | var r, g, b, a uint8 80 | var err error 81 | if len(hex) != 8 { 82 | _, err = fmt.Sscanf(hex, "%02x%02x%02x%02x", &r, &g, &b) 83 | } else { 84 | _, err = fmt.Sscanf(hex, "%02x%02x%02x%02x", &r, &g, &b, &a) 85 | } 86 | if err != nil { 87 | return [4]int{0, 0, 0, 0} 88 | } 89 | return [4]int{int(r), int(g), int(b), int(a)} 90 | } 91 | -------------------------------------------------------------------------------- /xwayland/xwayland.go: -------------------------------------------------------------------------------- 1 | package xwayland 2 | 3 | import hyprsettings_utils "github.com/anotherhadi/hyprsettings/utils" 4 | 5 | func Xwayland() hyprsettings_utils.Page { 6 | 7 | return hyprsettings_utils.Page{ 8 | Title: "XWayland", 9 | Description: "Change XWayland settings", 10 | Child: []hyprsettings_utils.Page{ 11 | 12 | { 13 | Title: "Use nearest neighbor", 14 | Description: "uses the nearest neigbor filtering for xwayland apps, making them pixelated rather than blurry", 15 | PageType: "bool", 16 | Setting: hyprsettings_utils.Setting{ 17 | Section: "xwayland/", 18 | Variable: "use_nearest_neighbor", 19 | BoolSetting: hyprsettings_utils.BoolSetting{ 20 | DefaultVal: true, 21 | }, 22 | }, 23 | }, 24 | 25 | { 26 | Title: "Force zero scaling", 27 | Description: "forces a scale of 1 on xwayland windows on scaled displays.", 28 | PageType: "bool", 29 | Setting: hyprsettings_utils.Setting{ 30 | Section: "xwayland/", 31 | Variable: "force_zero_scaling", 32 | BoolSetting: hyprsettings_utils.BoolSetting{ 33 | DefaultVal: false, 34 | }, 35 | }, 36 | }, 37 | }, 38 | } 39 | } 40 | --------------------------------------------------------------------------------