This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

configs: remove dead modules

-1586
-238
configs/git.nix
··· 1 - { 2 - self, 3 - config, 4 - lib, 5 - pkgs, 6 - ... 7 - }: 8 - 9 - let 10 - git = self.inputs.stockholm.lib.git; 11 - out = { 12 - imports = [ 13 - self.inputs.stockholm.nixosModules.git 14 - ]; 15 - services.nginx.enable = true; 16 - krebs.git = { 17 - enable = true; 18 - cgit = { 19 - settings = { 20 - root-title = "public repositories at ${config.krebs.build.host.name}"; 21 - root-desc = "keep calm and engage"; 22 - }; 23 - }; 24 - repos = repos; 25 - rules = rules; 26 - }; 27 - 28 - krebs.iptables.tables.filter.INPUT.rules = [ 29 - { 30 - predicate = "-i retiolum -p tcp --dport 80"; 31 - target = "ACCEPT"; 32 - } 33 - ]; 34 - 35 - system.activationScripts.spool-chmod = '' 36 - ${pkgs.coreutils}/bin/chmod +x /var/spool 37 - ''; 38 - }; 39 - 40 - cgit-clear-cache = pkgs.cgit-clear-cache.override { 41 - inherit (config.krebs.git.cgit.settings) cache-root; 42 - }; 43 - 44 - repos = public-repos // lib.optionalAttrs config.krebs.build.host.secure restricted-repos; 45 - 46 - rules = lib.concatMap make-rules (lib.attrValues repos); 47 - 48 - public-repos = lib.mapAttrs make-public-repo { 49 - Reaktor = { 50 - cgit.desc = "Reaktor IRC bot"; 51 - cgit.section = "software"; 52 - }; 53 - buildbot-classic = { 54 - cgit.desc = "fork of buildbot"; 55 - cgit.section = "software"; 56 - }; 57 - cholerab = { 58 - cgit.desc = "krebs thesauron & enterprise-patterns"; 59 - cgit.section = "documentation"; 60 - }; 61 - disko = { 62 - cgit.desc = "take a description of your disk layout and produce a format script"; 63 - cgit.section = "software"; 64 - }; 65 - go = { 66 - cgit.desc = "url shortener"; 67 - cgit.section = "software"; 68 - }; 69 - grib2json-bin = { 70 - cgit.desc = "build jar of grib2json"; 71 - cgit.section = "deployment"; 72 - }; 73 - krebspage = { 74 - cgit.desc = "homepage of krebs"; 75 - cgit.section = "configuration"; 76 - }; 77 - krops = { 78 - cgit.desc = "krebs deployment"; 79 - cgit.section = "software"; 80 - }; 81 - news = { 82 - cgit.desc = "take a rss feed and a timeout and print it to stdout"; 83 - cgit.section = "software"; 84 - }; 85 - newsbot-js = { 86 - cgit.desc = "print rss feeds to irc channels"; 87 - cgit.section = "software"; 88 - }; 89 - nix-user-chroot = { 90 - cgit.desc = "Fork of nix-user-chroot by lethalman"; 91 - cgit.section = "software"; 92 - }; 93 - nix-writers = { 94 - cgit.desc = "high level writers for nix"; 95 - cgit.section = "software"; 96 - }; 97 - nixos-generators = { 98 - cgit.desc = "custom image builders"; 99 - cgit.section = "software"; 100 - }; 101 - nixpkgs = { 102 - cgit.desc = "nixpkgs fork"; 103 - cgit.section = "configuration"; 104 - }; 105 - populate = { 106 - cgit.section = "software"; 107 - }; 108 - reaktor2 = { 109 - cgit.desc = "irc bot"; 110 - cgit.section = "software"; 111 - }; 112 - stockholm = { 113 - cgit.desc = "take all the computers hostage, they'll love you!"; 114 - cgit.section = "configuration"; 115 - }; 116 - stockholm-issues = { 117 - cgit.desc = "stockholm issues"; 118 - cgit.section = "issues"; 119 - }; 120 - the_playlist = { 121 - cgit.desc = "Good Music collection + tools"; 122 - cgit.section = "art"; 123 - }; 124 - workadventure-nix = { 125 - cgit.desc = "Nix packaging for workadventure"; 126 - cgit.section = "deployment"; 127 - }; 128 - xmonad-stockholm = { 129 - cgit.desc = "krebs xmonad modules"; 130 - cgit.section = "configuration"; 131 - }; 132 - }; 133 - 134 - restricted-repos = lib.mapAttrs make-restricted-repo { 135 - brain = { 136 - collaborators = with config.krebs.users; [ 137 - tv 138 - makefu 139 - ]; 140 - announce = true; 141 - }; 142 - }; 143 - 144 - make-public-repo = 145 - name: 146 - { 147 - cgit ? { }, 148 - collaborators ? [ ], 149 - ... 150 - }: 151 - { 152 - inherit cgit collaborators name; 153 - public = true; 154 - hooks = { 155 - post-receive = '' 156 - ${pkgs.git-hooks.irc-announce { 157 - # TODO make nick = config.krebs.build.host.name the default 158 - nick = config.krebs.build.host.name; 159 - channel = "#xxx"; 160 - # TODO define refs in some kind of option per repo 161 - server = "irc.r"; 162 - verbose = config.krebs.build.host.name == "orange"; 163 - }} 164 - ${cgit-clear-cache}/bin/cgit-clear-cache 165 - ''; 166 - }; 167 - }; 168 - 169 - make-restricted-repo = 170 - name: 171 - { 172 - admins ? [ ], 173 - collaborators ? [ ], 174 - announce ? true, 175 - hooks ? { }, 176 - ... 177 - }: 178 - { 179 - inherit admins collaborators name; 180 - public = false; 181 - hooks = { 182 - post-receive = '' 183 - ${lib.optionalString announce ( 184 - pkgs.git-hooks.irc-announce { 185 - # TODO make nick = config.krebs.build.host.name the default 186 - nick = config.krebs.build.host.name; 187 - channel = "#xxx"; 188 - # TODO define refs in some kind of option per repo 189 - refs = [ 190 - "refs/heads/master" 191 - "refs/heads/staging*" 192 - ]; 193 - server = "irc.r"; 194 - verbose = false; 195 - } 196 - )} 197 - ${cgit-clear-cache}/bin/cgit-clear-cache 198 - ''; 199 - } 200 - // hooks; 201 - }; 202 - 203 - make-rules = 204 - with git // config.krebs.users; 205 - repo: 206 - lib.singleton { 207 - user = [ lass ]; 208 - repo = [ repo ]; 209 - perm = push "refs/*" [ 210 - non-fast-forward 211 - create 212 - delete 213 - merge 214 - ]; 215 - } 216 - ++ lib.optional (lib.length (repo.admins or [ ]) > 0) { 217 - user = repo.admins; 218 - repo = [ repo ]; 219 - perm = push "refs/*" [ 220 - non-fast-forward 221 - create 222 - delete 223 - merge 224 - ]; 225 - } 226 - ++ lib.optional (lib.length (repo.collaborators or [ ]) > 0) { 227 - user = repo.collaborators; 228 - repo = [ repo ]; 229 - perm = fetch; 230 - } 231 - ++ lib.optional repo.public { 232 - user = lib.attrValues config.krebs.users; 233 - repo = [ repo ]; 234 - perm = fetch; 235 - }; 236 - 237 - in 238 - out
-459
configs/desktops/lib/gamescope_libinput.patch
··· 1 - From 8518bc9b6ce13b0beffde1e59dae347e25adec84 Mon Sep 17 00:00:00 2001 2 - From: honjow <honjow311@gmail.com> 3 - Date: Tue, 25 Jun 2024 21:52:11 +0800 4 - Subject: [PATCH 1/3] feat: Support libinput pointer settings. 5 - 6 - --- 7 - src/main.cpp | 43 +++++++++++++++++++++++++++++++++++++++++++ 8 - src/main.hpp | 12 ++++++++++++ 9 - src/wlserver.cpp | 44 ++++++++++++++++++++++++++++++++++++++++++++ 10 - 3 files changed, 99 insertions(+) 11 - 12 - diff --git a/src/main.cpp b/src/main.cpp 13 - index e8ebd66a30..37dfb8ebcb 100644 14 - --- a/src/main.cpp 15 - +++ b/src/main.cpp 16 - @@ -145,6 +145,12 @@ const struct option *gamescope_options = (struct option[]){ 17 - // Steam Deck options 18 - { "mura-map", required_argument, nullptr, 0 }, 19 - 20 - + // Pointer options 21 - + { "tap-to-click", no_argument, nullptr, 0 }, 22 - + { "tap-to-drag", no_argument, nullptr, 0 }, 23 - + { "drag-lock", no_argument, nullptr, 0 }, 24 - + { "natural-scrolling", required_argument, nullptr, 0 }, 25 - + 26 - {} // keep last 27 - }; 28 - 29 - @@ -256,6 +262,16 @@ const char usage[] = 30 - "Steam Deck options:\n" 31 - " --mura-map Set the mura compensation map to use for the display. Takes in a path to the mura map.\n" 32 - "\n" 33 - + "Libinput Pointer options:\n" 34 - + " --tap-to-click enable tap-to-click feature for pointer devices\n" 35 - + " --tap-and-drag enable tap-and-drag feature for pointer devices\n" 36 - + " --drag-lock enable drag-lock feature for pointer devices\n" 37 - + " --natural-scrolling enable natural scrolling for ...\n" 38 - + " none => No pointer device\n" 39 - + " touchpad => Only for touchpad\n" 40 - + " mouse => Only for mouse\n" 41 - + " all => All pointer device\n" 42 - + "\n" 43 - "Keyboard shortcuts:\n" 44 - " Super + F toggle fullscreen\n" 45 - " Super + N toggle nearest neighbour filtering\n" 46 - @@ -305,6 +321,11 @@ float g_flMaxWindowScale = FLT_MAX; 47 - uint32_t g_preferVendorID = 0; 48 - uint32_t g_preferDeviceID = 0; 49 - 50 - +bool g_tapToClick = false; 51 - +bool g_tapAndDrag = false; 52 - +bool g_dragLock = false; 53 - +SelectedPointerType g_naturalScrolling = SelectedPointerType::NONE; 54 - + 55 - pthread_t g_mainThread; 56 - 57 - static void steamCompMgrThreadRun(int argc, char **argv); 58 - @@ -438,6 +459,20 @@ static gamescope::ConCommand cc_shutdown( "shutdown", "Cleanly shutdown gamescop 59 - console_log.infof( "Shutting down..." ); 60 - ShutdownGamescope(); 61 - }); 62 - +static SelectedPointerType parse_selected_pointer_type(const char* str) 63 - +{ 64 - + if (!str || !*str) 65 - + return SelectedPointerType::NONE; 66 - + 67 - + if (!strcmp(str, "all")) 68 - + return SelectedPointerType::ALL; 69 - + else if (!strcmp(str, "touchpad")) 70 - + return SelectedPointerType::TOUCHPAD; 71 - + else if (!strcmp(str, "mouse")) 72 - + return SelectedPointerType::MOUSE; 73 - + else 74 - + return SelectedPointerType::NONE; 75 - +} 76 - 77 - static void handle_signal( int sig ) 78 - { 79 - @@ -754,6 +789,14 @@ int main(int argc, char **argv) 80 - g_nCursorScaleHeight = atoi(optarg); 81 - } else if (strcmp(opt_name, "mangoapp") == 0) { 82 - g_bLaunchMangoapp = true; 83 - + } else if (strcmp(opt_name, "tap-to-click") == 0) { 84 - + g_tapToClick = true; 85 - + } else if (strcmp(opt_name, "tap-and-drag") == 0) { 86 - + g_tapAndDrag = true; 87 - + } else if (strcmp(opt_name, "drag-lock") == 0) { 88 - + g_dragLock = true; 89 - + } else if (strcmp(opt_name, "natural-scrolling") == 0) { 90 - + g_naturalScrolling = parse_selected_pointer_type( optarg ); 91 - } 92 - break; 93 - case '?': 94 - diff --git a/src/main.hpp b/src/main.hpp 95 - index 8cfe62915f..c8948f7bdc 100644 96 - --- a/src/main.hpp 97 - +++ b/src/main.hpp 98 - @@ -66,3 +66,15 @@ extern int g_nXWaylandCount; 99 - extern uint32_t g_preferVendorID; 100 - extern uint32_t g_preferDeviceID; 101 - 102 - +enum class SelectedPointerType : uint32_t 103 - +{ 104 - + NONE, 105 - + TOUCHPAD, 106 - + MOUSE, 107 - + ALL, 108 - +}; 109 - + 110 - +extern bool g_tapToClick; 111 - +extern bool g_tapAndDrag; 112 - +extern bool g_dragLock; 113 - +extern SelectedPointerType g_naturalScrolling; 114 - diff --git a/src/wlserver.cpp b/src/wlserver.cpp 115 - index ee6891d103..95b250ec4a 100644 116 - --- a/src/wlserver.cpp 117 - +++ b/src/wlserver.cpp 118 - @@ -484,6 +484,48 @@ static void wlserver_handle_touch_motion(struct wl_listener *listener, void *dat 119 - wlserver_touchmotion( event->x, event->y, event->touch_id, event->time_msec ); 120 - } 121 - 122 - +static void wlserver_set_libinput_pointer(struct wlr_input_device *device) 123 - +{ 124 - +#ifdef WLR_BACKEND_LIBINPUT_H 125 - + if (device->type != WLR_INPUT_DEVICE_POINTER || !wlr_input_device_is_libinput(device)) 126 - + return; 127 - + 128 - + struct libinput_device* libinput_device = wlr_libinput_get_device_handle(device); 129 - + 130 - + if (g_tapToClick) 131 - + libinput_device_config_tap_set_enabled(libinput_device, LIBINPUT_CONFIG_TAP_ENABLED); 132 - + else 133 - + libinput_device_config_tap_set_enabled(libinput_device, LIBINPUT_CONFIG_TAP_DISABLED); 134 - + 135 - + if (g_tapAndDrag) 136 - + libinput_device_config_tap_set_drag_enabled(libinput_device, LIBINPUT_CONFIG_DRAG_ENABLED); 137 - + else 138 - + libinput_device_config_tap_set_drag_enabled(libinput_device, LIBINPUT_CONFIG_DRAG_DISABLED); 139 - + 140 - + if (g_dragLock) 141 - + libinput_device_config_tap_set_drag_lock_enabled(libinput_device, LIBINPUT_CONFIG_DRAG_LOCK_ENABLED); 142 - + else 143 - + libinput_device_config_tap_set_drag_lock_enabled(libinput_device, LIBINPUT_CONFIG_DRAG_LOCK_DISABLED); 144 - + 145 - + if (libinput_device_config_scroll_has_natural_scroll(libinput_device) != 0) 146 - + switch (g_naturalScrolling) 147 - + { 148 - + case SelectedPointerType::TOUCHPAD: 149 - + if (libinput_device_config_tap_get_finger_count(libinput_device) != 0) 150 - + libinput_device_config_scroll_set_natural_scroll_enabled(libinput_device, true); 151 - + break; 152 - + case SelectedPointerType::MOUSE: 153 - + if (libinput_device_config_tap_get_finger_count(libinput_device) == 0) 154 - + libinput_device_config_scroll_set_natural_scroll_enabled(libinput_device, true); 155 - + break; 156 - + case SelectedPointerType::ALL: 157 - + libinput_device_config_scroll_set_natural_scroll_enabled(libinput_device, true); 158 - + case SelectedPointerType::NONE: 159 - + break; 160 - + } 161 - +#endif 162 - +} 163 - + 164 - static void wlserver_new_input(struct wl_listener *listener, void *data) 165 - { 166 - struct wlr_input_device *device = (struct wlr_input_device *) data; 167 - @@ -534,6 +576,8 @@ static void wlserver_new_input(struct wl_listener *listener, void *data) 168 - wl_signal_add( &pointer->wlr->events.axis, &pointer->axis); 169 - pointer->frame.notify = wlserver_handle_pointer_frame; 170 - wl_signal_add( &pointer->wlr->events.frame, &pointer->frame); 171 - + 172 - + wlserver_set_libinput_pointer(device); 173 - } 174 - break; 175 - case WLR_INPUT_DEVICE_TOUCH: 176 - 177 - From 8f3bd1747ec3f72e8f5598e4de6a962ec44eecf4 Mon Sep 17 00:00:00 2001 178 - From: Chenx Dust <chenx_dust@outlook.com> 179 - Date: Fri, 5 Jul 2024 14:30:07 +0000 180 - Subject: [PATCH 2/3] feat: Add more options for libinput pointer device 181 - 182 - --- 183 - src/main.cpp | 53 +++++++++++++++++++++++++--- 184 - src/main.hpp | 14 ++++++++ 185 - src/wlserver.cpp | 90 ++++++++++++++++++++++++++++++++++++++++++------ 186 - 3 files changed, 142 insertions(+), 15 deletions(-) 187 - 188 - diff --git a/src/main.cpp b/src/main.cpp 189 - index 37dfb8ebcb..5eda5e8133 100644 190 - --- a/src/main.cpp 191 - +++ b/src/main.cpp 192 - @@ -145,11 +145,17 @@ const struct option *gamescope_options = (struct option[]){ 193 - // Steam Deck options 194 - { "mura-map", required_argument, nullptr, 0 }, 195 - 196 - - // Pointer options 197 - + // Libinput options 198 - { "tap-to-click", no_argument, nullptr, 0 }, 199 - { "tap-to-drag", no_argument, nullptr, 0 }, 200 - { "drag-lock", no_argument, nullptr, 0 }, 201 - + { "middle-emulation", no_argument, nullptr, 0 }, 202 - + { "disable-while-typing", no_argument, nullptr, 0 }, 203 - + { "disable-while-trackpointing", no_argument, nullptr, 0 }, 204 - + { "left-handed", no_argument, nullptr, 0 }, 205 - { "natural-scrolling", required_argument, nullptr, 0 }, 206 - + { "pointer-accel-profile", required_argument, nullptr, 0 }, 207 - + { "pointer-accel-speed", required_argument, nullptr, 0 }, 208 - 209 - {} // keep last 210 - }; 211 - @@ -266,11 +272,19 @@ const char usage[] = 212 - " --tap-to-click enable tap-to-click feature for pointer devices\n" 213 - " --tap-and-drag enable tap-and-drag feature for pointer devices\n" 214 - " --drag-lock enable drag-lock feature for pointer devices\n" 215 - + " --middle-emulation enable middle button emulation for pointer devices\n" 216 - + " --left-handed enable left handed mode for pointer devices\n" 217 - + " --disable-while-typing disable pointer devices while typing\n" 218 - + " --disable-while-trackpointing disable pointer devices while trackpointing\n" 219 - " --natural-scrolling enable natural scrolling for ...\n" 220 - - " none => No pointer device\n" 221 - - " touchpad => Only for touchpad\n" 222 - - " mouse => Only for mouse\n" 223 - + " none => No pointer device (default)\n" 224 - + " touchpad => Only touchpad\n" 225 - + " mouse => Only mouse\n" 226 - " all => All pointer device\n" 227 - + " --pointer-accel-profile set acceleration profile for pointer devices to ...\n" 228 - + " adaptive => takes the current speed of the device into account when deciding on acceleration (default)\n" 229 - + " flat => simply a constant factor applied to all device deltas, regardless of the speed of motion\n" 230 - + " --pointer-accel-speed set acceleration speed for pointer devices within [-1, 1] (default 0)\n" 231 - "\n" 232 - "Keyboard shortcuts:\n" 233 - " Super + F toggle fullscreen\n" 234 - @@ -324,7 +338,13 @@ uint32_t g_preferDeviceID = 0; 235 - bool g_tapToClick = false; 236 - bool g_tapAndDrag = false; 237 - bool g_dragLock = false; 238 - +bool g_middleEmu = false; 239 - +bool g_leftHanded = false; 240 - +bool g_dwt = false; 241 - +bool g_dwtp = false; 242 - SelectedPointerType g_naturalScrolling = SelectedPointerType::NONE; 243 - +PointerAccelProfileType g_accelProfile = PointerAccelProfileType::ADAPTIVE; 244 - +double g_accelSpeed = false; 245 - 246 - pthread_t g_mainThread; 247 - 248 - @@ -474,6 +494,19 @@ static SelectedPointerType parse_selected_pointer_type(const char* str) 249 - return SelectedPointerType::NONE; 250 - } 251 - 252 - +static PointerAccelProfileType parse_pointer_accel_profile(const char* str) 253 - +{ 254 - + if (!str || !*str) 255 - + return PointerAccelProfileType::ADAPTIVE; 256 - + 257 - + if (!strcmp(str, "adaptive")) 258 - + return PointerAccelProfileType::ADAPTIVE; 259 - + else if (!strcmp(str, "flat")) 260 - + return PointerAccelProfileType::FLAT; 261 - + else 262 - + return PointerAccelProfileType::ADAPTIVE; 263 - +} 264 - + 265 - static void handle_signal( int sig ) 266 - { 267 - switch ( sig ) { 268 - @@ -795,8 +828,20 @@ int main(int argc, char **argv) 269 - g_tapAndDrag = true; 270 - } else if (strcmp(opt_name, "drag-lock") == 0) { 271 - g_dragLock = true; 272 - + } else if (strcmp(opt_name, "middle-emulation") == 0) { 273 - + g_middleEmu = true; 274 - + } else if (strcmp(opt_name, "left-handed") == 0) { 275 - + g_leftHanded = true; 276 - + } else if (strcmp(opt_name, "disable-while-typing") == 0) { 277 - + g_dwt = true; 278 - + } else if (strcmp(opt_name, "disable-while-trackpointing") == 0) { 279 - + g_dwtp = true; 280 - } else if (strcmp(opt_name, "natural-scrolling") == 0) { 281 - g_naturalScrolling = parse_selected_pointer_type( optarg ); 282 - + } else if (strcmp(opt_name, "pointer-accel-profile") == 0) { 283 - + g_accelProfile = parse_pointer_accel_profile( optarg ); 284 - + } else if (strcmp(opt_name, "pointer-accel-speed") == 0) { 285 - + g_accelSpeed = atof( optarg ); 286 - } 287 - break; 288 - case '?': 289 - diff --git a/src/main.hpp b/src/main.hpp 290 - index c8948f7bdc..58eed11701 100644 291 - --- a/src/main.hpp 292 - +++ b/src/main.hpp 293 - @@ -74,7 +74,21 @@ enum class SelectedPointerType : uint32_t 294 - ALL, 295 - }; 296 - 297 - +enum class PointerAccelProfileType : uint32_t 298 - +{ 299 - + NONE, 300 - + FLAT, 301 - + ADAPTIVE, 302 - + CUSTOM, 303 - +}; 304 - + 305 - extern bool g_tapToClick; 306 - extern bool g_tapAndDrag; 307 - extern bool g_dragLock; 308 - +extern bool g_middleEmu; 309 - +extern bool g_leftHanded; 310 - +extern bool g_dwt; 311 - +extern bool g_dwtp; 312 - extern SelectedPointerType g_naturalScrolling; 313 - +extern PointerAccelProfileType g_accelProfile; 314 - +extern double g_accelSpeed; 315 - diff --git a/src/wlserver.cpp b/src/wlserver.cpp 316 - index 95b250ec4a..7d7778f6ee 100644 317 - --- a/src/wlserver.cpp 318 - +++ b/src/wlserver.cpp 319 - @@ -486,28 +486,76 @@ static void wlserver_handle_touch_motion(struct wl_listener *listener, void *dat 320 - 321 - static void wlserver_set_libinput_pointer(struct wlr_input_device *device) 322 - { 323 - -#ifdef WLR_BACKEND_LIBINPUT_H 324 - +#ifdef HAVE_DRM 325 - if (device->type != WLR_INPUT_DEVICE_POINTER || !wlr_input_device_is_libinput(device)) 326 - return; 327 - 328 - struct libinput_device* libinput_device = wlr_libinput_get_device_handle(device); 329 - 330 - - if (g_tapToClick) 331 - + if (g_tapToClick) { 332 - libinput_device_config_tap_set_enabled(libinput_device, LIBINPUT_CONFIG_TAP_ENABLED); 333 - - else 334 - + } else { 335 - libinput_device_config_tap_set_enabled(libinput_device, LIBINPUT_CONFIG_TAP_DISABLED); 336 - - 337 - - if (g_tapAndDrag) 338 - + } 339 - + if (g_tapAndDrag) { 340 - libinput_device_config_tap_set_drag_enabled(libinput_device, LIBINPUT_CONFIG_DRAG_ENABLED); 341 - - else 342 - + } else { 343 - libinput_device_config_tap_set_drag_enabled(libinput_device, LIBINPUT_CONFIG_DRAG_DISABLED); 344 - - 345 - - if (g_dragLock) 346 - + } 347 - + if (g_dragLock) { 348 - libinput_device_config_tap_set_drag_lock_enabled(libinput_device, LIBINPUT_CONFIG_DRAG_LOCK_ENABLED); 349 - - else 350 - + } else { 351 - libinput_device_config_tap_set_drag_lock_enabled(libinput_device, LIBINPUT_CONFIG_DRAG_LOCK_DISABLED); 352 - - 353 - - if (libinput_device_config_scroll_has_natural_scroll(libinput_device) != 0) 354 - + } 355 - + if (libinput_device_config_middle_emulation_is_available(libinput_device)) { 356 - + if (g_middleEmu) { 357 - + libinput_device_config_middle_emulation_set_enabled(libinput_device, LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); 358 - + } else { 359 - + libinput_device_config_middle_emulation_set_enabled(libinput_device, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); 360 - + } 361 - + } else { 362 - + if (device->name) { 363 - + printf("Libinput pointer \"%s\": Middle button emulation not supported", device->name); 364 - + } else { 365 - + printf("Unnamed libinput pointer: Middle button emulation not supported"); 366 - + } 367 - + } 368 - + if (libinput_device_config_left_handed_is_available(libinput_device)) { 369 - + libinput_device_config_left_handed_set(libinput_device, g_leftHanded); 370 - + } else { 371 - + if (device->name) { 372 - + printf("Libinput pointer \"%s\": Left handed mode not supported", device->name); 373 - + } else { 374 - + printf("Unnamed libinput pointer: Left handed mode not supported"); 375 - + } 376 - + } 377 - + if (libinput_device_config_dwt_is_available(libinput_device)) { 378 - + if (g_dwt) { 379 - + libinput_device_config_dwt_set_enabled(libinput_device, LIBINPUT_CONFIG_DWT_ENABLED); 380 - + } else { 381 - + libinput_device_config_dwt_set_enabled(libinput_device, LIBINPUT_CONFIG_DWT_DISABLED); 382 - + } 383 - + } else { 384 - + if (device->name) { 385 - + printf("Libinput pointer \"%s\": Disable while typing not supported", device->name); 386 - + } else { 387 - + printf("Unnamed libinput pointer: Disable while typing not supported"); 388 - + } 389 - + } 390 - + if (libinput_device_config_dwtp_is_available(libinput_device)) { 391 - + if (g_dwtp) { 392 - + libinput_device_config_dwtp_set_enabled(libinput_device, LIBINPUT_CONFIG_DWTP_ENABLED); 393 - + } else { 394 - + libinput_device_config_dwtp_set_enabled(libinput_device, LIBINPUT_CONFIG_DWTP_DISABLED); 395 - + } 396 - + } else { 397 - + if (device->name) { 398 - + printf("Libinput pointer \"%s\": Disable while track pointing not supported", device->name); 399 - + } else { 400 - + printf("Unnamed libinput pointer: Disable while track pointing not supported"); 401 - + } 402 - + } 403 - + if (libinput_device_config_scroll_has_natural_scroll(libinput_device) != 0) { 404 - switch (g_naturalScrolling) 405 - { 406 - case SelectedPointerType::TOUCHPAD: 407 - @@ -520,9 +568,29 @@ static void wlserver_set_libinput_pointer(struct wlr_input_device *device) 408 - break; 409 - case SelectedPointerType::ALL: 410 - libinput_device_config_scroll_set_natural_scroll_enabled(libinput_device, true); 411 - + break; 412 - case SelectedPointerType::NONE: 413 - break; 414 - } 415 - + } 416 - + if (libinput_device_config_accel_is_available(libinput_device)) { 417 - + switch (g_accelProfile) { 418 - + case PointerAccelProfileType::FLAT: 419 - + libinput_device_config_accel_set_profile(libinput_device, LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT); 420 - + break; 421 - + case PointerAccelProfileType::ADAPTIVE: 422 - + default: 423 - + libinput_device_config_accel_set_profile(libinput_device, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE); 424 - + break; 425 - + } 426 - + libinput_device_config_accel_set_speed(libinput_device, g_accelSpeed); 427 - + } else { 428 - + if (device->name) { 429 - + printf("Libinput pointer \"%s\": Accelation not supported", device->name); 430 - + } else { 431 - + printf("Unnamed libinput pointer: Accelation not supported"); 432 - + } 433 - + } 434 - #endif 435 - } 436 - 437 - 438 - From f69e6bcb2d1c49911f9e9aaf1a6f8e0f182eb29c Mon Sep 17 00:00:00 2001 439 - From: Chenx Dust <chenx_dust@outlook.com> 440 - Date: Thu, 17 Oct 2024 04:41:02 +0000 441 - Subject: [PATCH 3/3] fix: Fix typo of "tap and drag" option in `main.cpp` 442 - 443 - --- 444 - src/main.cpp | 2 +- 445 - 1 file changed, 1 insertion(+), 1 deletion(-) 446 - 447 - diff --git a/src/main.cpp b/src/main.cpp 448 - index 5eda5e8133..05f8d26517 100644 449 - --- a/src/main.cpp 450 - +++ b/src/main.cpp 451 - @@ -147,7 +147,7 @@ const struct option *gamescope_options = (struct option[]){ 452 - 453 - // Libinput options 454 - { "tap-to-click", no_argument, nullptr, 0 }, 455 - - { "tap-to-drag", no_argument, nullptr, 0 }, 456 - + { "tap-and-drag", no_argument, nullptr, 0 }, 457 - { "drag-lock", no_argument, nullptr, 0 }, 458 - { "middle-emulation", no_argument, nullptr, 0 }, 459 - { "disable-while-typing", no_argument, nullptr, 0 },
-6
configs/desktops/lib/wayland.nix
··· 89 89 programs.wshowkeys.enable = true; 90 90 91 91 environment.systemPackages = with pkgs; [ 92 - # (gamescope.overrideAttrs (old: { 93 - # patches = old.patches ++ [ 94 - # ./gamescope_libinput.patch 95 - # ]; 96 - # 97 - # })) 98 92 swaylock-effects # lockscreen 99 93 pavucontrol 100 94 swayidle
-730
configs/desktops/sway/eww.nix
··· 1 - { 2 - pkgs, 3 - lib, 4 - config, 5 - self, 6 - ... 7 - }: 8 - let 9 - 10 - # Reference to goto-workspace (defined in default.nix, available at /run/current-system/sw/bin/) 11 - gotoWorkspace = "/run/current-system/sw/bin/goto-workspace"; 12 - 13 - # eww configuration 14 - ewwYuck = pkgs.writeText "eww.yuck" '' 15 - ; Magic variables (built-in, no polling needed) 16 - ; EWW_TIME provides current time 17 - ; EWW_CPU provides {cores: [...], avg: X} 18 - ; EWW_RAM provides {used_mem_perc: X, available_mem: Y, total_mem: Z, ...} 19 - 20 - ; Custom variables with polling 21 - (defpoll cpu-freq :interval "2s" :initial 0 "${lib.getExe cpuFreqScript}") 22 - (defpoll cpu-load :interval "2s" :initial "0.00" "cut -d' ' -f1 /proc/loadavg") 23 - (defpoll temperature :interval "2s" :initial '{"temp": 0, "fan": 0}' "${lib.getExe tempScript}") 24 - (defpoll power :interval "2s" :initial '{"watts": 0, "charging": false}' "${lib.getExe powerScript}") 25 - (defpoll power-profile :interval "2s" :initial '{"name": "unknown", "tdp": 0}' "${lib.getExe powerProfileStatusScript}") 26 - (defpoll battery :interval "10s" :initial '{"capacity": "100", "icon": "󰁹", "watts": "0", "time_remaining": "--", "status": "Full"}' "${lib.getExe batteryScript}") 27 - (defpoll volume :interval "1s" :initial '{"level": "0", "icon": "󰕿"}' "${lib.getExe volumeScript}") 28 - (defpoll network :interval "5s" :initial "󰖪 ..." "${lib.getExe networkScript}") 29 - (defpoll brightness :interval "1s" :initial 100 "${lib.getExe brightnessScript}") 30 - (defpoll idle-inhibited :interval "0.5s" :initial "false" "${lib.getExe idleStatusScript}") 31 - (deflisten workspaces :initial '[]' "${lib.getExe workspacesScript}") 32 - 33 - ; Tooltip state 34 - (defvar hover-tooltip "") 35 - 36 - ; Generic hover-tooltip wrapper: shows tooltip on hover via in-bar overlay 37 - ; Use an explicit eww command here instead of the EWW_CMD shell variable, 38 - ; because yuck also treats dollar-brace interpolation as a dynamic string. 39 - (defwidget hover-tip [text] 40 - (eventbox :onhover {text != "" ? "${lib.getExe pkgs.eww} --config \"$EWW_CONFIG\" update hover-tooltip=${"'"}''${text}${"'"}" : ""} 41 - :onhoverlost "${lib.getExe pkgs.eww} --config \"$EWW_CONFIG\" update hover-tooltip=${"'"}${"'"}" 42 - (children))) 43 - 44 - ; Widget definitions 45 - (defwidget bar [] 46 - (overlay 47 - (centerbox :orientation "h" 48 - (left) 49 - (center) 50 - (right)) 51 - (revealer :reveal {hover-tooltip != ""} :transition "slidedown" :duration "150ms" :valign "end" :halign "end" 52 - (box :class "hover-tooltip" 53 - (label :text hover-tooltip))))) 54 - 55 - (defwidget left [] 56 - (box :class "left" :orientation "h" :space-evenly false :halign "start" 57 - (workspaces-widget))) 58 - 59 - (defwidget center [] 60 - (box :class "center" :orientation "h" :space-evenly false :halign "center" 61 - (label :text {formattime(EWW_TIME, "%H:%M")}))) 62 - 63 - (defwidget right [] 64 - (box :class "right" :orientation "h" :space-evenly false :halign "end" :spacing 8 65 - (network-widget) 66 - (volume-widget) 67 - (graph-widget :value {EWW_CPU.avg} :icon "󰍛" :class "cpu" :unit "%" :tooltip "Load: ''${cpu-load} | ''${cpu-freq} MHz") 68 - (graph-widget :value {EWW_RAM.used_mem_perc} :icon "󰘚" :class "memory" :unit "%") 69 - (graph-widget :value {temperature.temp} :icon "󰔏" :class "temp" :unit "°" :tooltip "Fan: ''${temperature.fan} RPM") 70 - (power-graph-widget) 71 - (brightness-widget) 72 - (battery-widget) 73 - (idle-inhibitor) 74 - (label :class "date" :text {formattime(EWW_TIME, "%Y-%m-%d")}) 75 - (systray :class "systray" :icon-size 18 :spacing 4))) 76 - 77 - (defwidget workspaces-widget [] 78 - (box :class "workspaces" :orientation "h" :space-evenly false :spacing 0 79 - (for ws in workspaces 80 - (button :class {ws.urgent ? "workspace urgent" : (ws.focused ? "workspace focused" : "workspace")} 81 - :onclick "${gotoWorkspace} ''${ws.name}" 82 - {ws.name})))) 83 - 84 - (defwidget graph-widget [value icon class unit ?tooltip] 85 - (hover-tip :text {tooltip ?: ""} 86 - (box :class "graph-module ''${class}" :orientation "h" :space-evenly false :spacing 4 87 - (graph :class "graph" 88 - :value value 89 - :thickness 3 90 - :time-range "60s" 91 - :min 0 92 - :max 100 93 - :dynamic true 94 - :line-style "round" 95 - :width 75) 96 - (label :text "''${round(value, 0)}''${unit} ''${icon}")))) 97 - 98 - (defwidget battery-widget [] 99 - (hover-tip :text "''${battery.watts}W | ''${battery.time_remaining} ''${battery.status == 'Charging' ? 'to full' : 'remaining'}" 100 - (box :class "battery" :orientation "h" :space-evenly false 101 - (label :text "''${battery.capacity}% ''${battery.icon}")))) 102 - 103 - (defwidget power-graph-widget [] 104 - (hover-tip :text "TDP: ''${power-profile.tdp}W (''${power-profile.name}) | ''${battery.time_remaining} ''${battery.status == 'Charging' ? 'to full' : 'remaining'}" 105 - (eventbox :onclick "${lib.getExe powerProfileCycleScript}" 106 - (box :class {power.charging ? "graph-module power charging" : "graph-module power"} :orientation "h" :space-evenly false :spacing 4 107 - (graph :class "graph" 108 - :value {power.watts} 109 - :thickness 3 110 - :time-range "60s" 111 - :min 0 112 - :max 45 113 - :dynamic false 114 - :line-style "round" 115 - :width 75) 116 - (label :text "''${round(power.watts, 1)}W ''${power.charging ? '󰂄' : '󰁹'}"))))) 117 - 118 - (defwidget volume-widget [] 119 - (eventbox :onscroll "${lib.getExe volumeAdjustScript} {}" 120 - :onclick "${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle" 121 - (box :class "volume" :orientation "h" :space-evenly false 122 - (label :text "''${volume.level}% ''${volume.icon}")))) 123 - 124 - (defwidget network-widget [] 125 - (box :class "network" :orientation "h" :space-evenly false 126 - (label :text "''${network}"))) 127 - 128 - (defwidget brightness-widget [] 129 - (button :class "brightness" :onclick "/run/current-system/sw/bin/switch-theme toggle" 130 - (label :text "''${brightness}% 󰃟"))) 131 - 132 - (defwidget idle-inhibitor [] 133 - (button :class {idle-inhibited == "true" ? "idle-inhibitor active" : "idle-inhibitor"} 134 - :onclick "${lib.getExe idleToggleScript}" 135 - {idle-inhibited == "true" ? "󰅶" : "󰾪"})) 136 - 137 - ; Window definition - screen name passed as argument 138 - (defwindow bar [screen] 139 - :monitor screen 140 - :geometry (geometry :x "0%" 141 - :y "0%" 142 - :width "100%" 143 - :height "36px" 144 - :anchor "top center") 145 - :stacking "fg" 146 - :exclusive true 147 - :focusable false 148 - (bar)) 149 - 150 - 151 - ''; 152 - 153 - ewwScss = pkgs.writeText "eww.scss" '' 154 - * { 155 - all: unset; 156 - font-family: "Iosevka Nerd Font", monospace; 157 - font-size: 14px; 158 - } 159 - 160 - window { 161 - background-color: #1a1b26; 162 - color: #c0caf5; 163 - } 164 - 165 - .left, .center, .right { 166 - margin: 4px 8px; 167 - } 168 - 169 - .workspaces { 170 - button { 171 - padding: 0 4px; 172 - margin: 0 1px; 173 - border-radius: 2px; 174 - min-width: 24px; 175 - background-color: #24283b; 176 - &.focused { 177 - background-color: #7aa2f7; 178 - color: #1a1b26; 179 - } 180 - &.urgent { 181 - background-color: #f7768e; 182 - color: #1a1b26; 183 - } 184 - &:hover { 185 - background-color: #414868; 186 - } 187 - } 188 - } 189 - 190 - .graph-module { 191 - padding: 0 8px; 192 - margin: 0 2px; 193 - border-radius: 4px; 194 - &.cpu { 195 - background-color: #9ece6a; 196 - color: #1a1b26; 197 - } 198 - &.memory { 199 - background-color: #7dcfff; 200 - color: #1a1b26; 201 - } 202 - &.temp { 203 - background-color: #ff9e64; 204 - color: #1a1b26; 205 - } 206 - &.power { 207 - background-color: #f7768e; 208 - color: #1a1b26; 209 - &.charging { 210 - background-color: #9ece6a; 211 - } 212 - } 213 - } 214 - 215 - .graph { 216 - min-height: 20px; 217 - } 218 - 219 - .battery, .volume, .network, .date, .brightness { 220 - padding: 0 8px; 221 - margin: 0 2px; 222 - border-radius: 4px; 223 - background-color: #24283b; 224 - } 225 - 226 - .idle-inhibitor { 227 - padding: 0 8px; 228 - margin: 0 2px; 229 - border-radius: 4px; 230 - background-color: #24283b; 231 - &.active { 232 - background-color: #bb9af7; 233 - color: #1a1b26; 234 - } 235 - &:hover { 236 - background-color: #414868; 237 - } 238 - } 239 - 240 - .systray { 241 - padding: 0 8px; 242 - margin: 0 2px; 243 - } 244 - 245 - .hover-tooltip { 246 - background-color: #24283b; 247 - color: #c0caf5; 248 - border-bottom: 1px solid #414868; 249 - padding: 2px 12px; 250 - } 251 - ''; 252 - 253 - cpuFreqScript = pkgs.writeShellApplication { 254 - name = "eww-cpu-freq"; 255 - runtimeInputs = [ ]; 256 - text = '' 257 - # Get average CPU frequency in MHz 258 - freq=0 259 - count=0 260 - for f in /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq; do 261 - if [ -f "$f" ]; then 262 - val=$(cat "$f") 263 - freq=$((freq + val)) 264 - count=$((count + 1)) 265 - fi 266 - done 267 - if [ "$count" -gt 0 ]; then 268 - freq=$((freq / count / 1000)) 269 - fi 270 - echo "$freq" 271 - ''; 272 - }; 273 - 274 - tempScript = pkgs.writeShellApplication { 275 - name = "eww-temp"; 276 - runtimeInputs = [ pkgs.jq ]; 277 - text = '' 278 - temp_raw=$(cat /sys/class/thermal/thermal_zone0/temp 2>/dev/null || echo 0) 279 - temp=$((temp_raw / 1000)) 280 - 281 - # Find gpdfan hwmon for fan speed 282 - fan=0 283 - for hwmon in /sys/class/hwmon/hwmon*; do 284 - if [ "$(cat "$hwmon/name" 2>/dev/null)" = "gpdfan" ]; then 285 - fan=$(cat "$hwmon/fan1_input" 2>/dev/null || echo 0) 286 - break 287 - fi 288 - done 289 - 290 - jq -n --argjson temp "$temp" --argjson fan "$fan" '{temp: $temp, fan: $fan}' 291 - ''; 292 - }; 293 - 294 - powerScript = pkgs.writeShellApplication { 295 - name = "eww-power"; 296 - runtimeInputs = [ 297 - pkgs.jq 298 - pkgs.bc 299 - ]; 300 - text = '' 301 - # Use RAPL for actual system power consumption (works on Intel and AMD Zen) 302 - # Falls back to battery power_now if RAPL unavailable 303 - 304 - state_file="/tmp/eww-power-state" 305 - rapl_path="/sys/class/powercap/intel-rapl:0/energy_uj" 306 - 307 - # Check charging status 308 - charging="false" 309 - for p in /sys/class/power_supply/BAT* /sys/class/power_supply/BATT*; do 310 - if [ -f "$p/status" ]; then 311 - status=$(cat "$p/status" 2>/dev/null || echo "Unknown") 312 - if [ "$status" = "Charging" ]; then 313 - charging="true" 314 - fi 315 - break 316 - fi 317 - done 318 - 319 - # Try RAPL first (gives actual system power regardless of charging state) 320 - if [ -r "$rapl_path" ]; then 321 - current_energy=$(cat "$rapl_path") 322 - current_time=$(date +%s%N) 323 - 324 - if [ -f "$state_file" ]; then 325 - read -r prev_energy prev_time < "$state_file" 326 - 327 - # Calculate power from energy difference 328 - energy_diff=$((current_energy - prev_energy)) 329 - time_diff=$((current_time - prev_time)) 330 - 331 - # Handle counter wrap-around 332 - if [ "$energy_diff" -lt 0 ]; then 333 - max_energy=$(cat /sys/class/powercap/intel-rapl:0/max_energy_range_uj 2>/dev/null || echo 0) 334 - energy_diff=$((energy_diff + max_energy)) 335 - fi 336 - 337 - if [ "$time_diff" -gt 0 ]; then 338 - # energy_diff is in microjoules, time_diff is in nanoseconds 339 - # watts = microjoules / (nanoseconds / 1e9) / 1e6 = microjoules * 1000 / nanoseconds 340 - watts=$(echo "scale=1; $energy_diff * 1000 / $time_diff" | bc) 341 - else 342 - watts="0" 343 - fi 344 - else 345 - watts="0" 346 - fi 347 - 348 - # Save current state 349 - echo "$current_energy $current_time" > "$state_file" 350 - 351 - jq -n --argjson watts "$watts" --argjson charging "$charging" '{watts: $watts, charging: $charging}' 352 - exit 0 353 - fi 354 - 355 - # Fallback: use battery power_now (only accurate when discharging) 356 - bat_path="" 357 - for p in /sys/class/power_supply/BAT* /sys/class/power_supply/BATT*; do 358 - if [ -f "$p/power_now" ]; then 359 - bat_path="$p" 360 - break 361 - fi 362 - done 363 - 364 - if [ -z "$bat_path" ]; then 365 - echo '{"watts": 0, "charging": false}' 366 - exit 0 367 - fi 368 - 369 - power_now=$(cat "$bat_path/power_now" 2>/dev/null || echo 0) 370 - watts=$(echo "scale=1; $power_now / 1000000" | bc) 371 - 372 - jq -n --argjson watts "$watts" --argjson charging "$charging" '{watts: $watts, charging: $charging}' 373 - ''; 374 - }; 375 - 376 - batteryScript = pkgs.writeShellApplication { 377 - name = "eww-battery"; 378 - runtimeInputs = [ 379 - pkgs.jq 380 - pkgs.bc 381 - ]; 382 - text = '' 383 - # Find battery device dynamically 384 - bat_path="" 385 - for p in /sys/class/power_supply/BAT* /sys/class/power_supply/BATT*; do 386 - if [ -f "$p/capacity" ]; then 387 - bat_path="$p" 388 - break 389 - fi 390 - done 391 - 392 - if [ -z "$bat_path" ]; then 393 - echo '{"capacity": "N/A", "icon": "󰂃", "watts": "0", "time_remaining": "N/A"}' 394 - exit 0 395 - fi 396 - 397 - capacity=$(cat "$bat_path/capacity" 2>/dev/null || echo 100) 398 - status=$(cat "$bat_path/status" 2>/dev/null || echo "Full") 399 - power_now=$(cat "$bat_path/power_now" 2>/dev/null || echo 0) 400 - energy_now=$(cat "$bat_path/energy_now" 2>/dev/null || echo 0) 401 - energy_full=$(cat "$bat_path/energy_full" 2>/dev/null || echo 0) 402 - 403 - # Convert microwatts to watts 404 - watts=$(echo "scale=1; $power_now / 1000000" | bc) 405 - 406 - # Calculate time remaining 407 - if [ "$power_now" -gt 0 ]; then 408 - if [ "$status" = "Charging" ]; then 409 - # Time to full 410 - remaining_energy=$((energy_full - energy_now)) 411 - hours=$(echo "scale=2; $remaining_energy / $power_now" | bc) 412 - else 413 - # Time to empty 414 - hours=$(echo "scale=2; $energy_now / $power_now" | bc) 415 - fi 416 - # Convert to hours:minutes 417 - # Note: bc outputs ".76" for values < 1, so cut returns empty string 418 - h=$(echo "$hours" | cut -d. -f1) 419 - h=''${h:-0} # Default to 0 if empty (i.e., less than 1 hour) 420 - m=$(echo "scale=0; ($hours - $h) * 60 / 1" | bc) 421 - time_remaining="''${h}h ''${m}m" 422 - else 423 - time_remaining="--" 424 - fi 425 - 426 - if [ "$status" = "Charging" ]; then 427 - icon="󰂄" 428 - elif [ "$status" = "Full" ]; then 429 - icon="󰁹" 430 - elif [ "$capacity" -gt 80 ]; then 431 - icon="󰂂" 432 - elif [ "$capacity" -gt 60 ]; then 433 - icon="󰂀" 434 - elif [ "$capacity" -gt 40 ]; then 435 - icon="󰁾" 436 - elif [ "$capacity" -gt 20 ]; then 437 - icon="󰁼" 438 - else 439 - icon="󰁺" 440 - fi 441 - jq -n --arg cap "$capacity" --arg icon "$icon" --arg watts "$watts" --arg time "$time_remaining" --arg status "$status" \ 442 - '{capacity: $cap, icon: $icon, watts: $watts, time_remaining: $time, status: $status}' 443 - ''; 444 - }; 445 - 446 - volumeScript = pkgs.writeShellApplication { 447 - name = "eww-volume"; 448 - runtimeInputs = [ 449 - pkgs.pulseaudio 450 - pkgs.jq 451 - pkgs.gnugrep 452 - ]; 453 - text = '' 454 - vol=$(pactl get-sink-volume @DEFAULT_SINK@ | grep -oP '\d+%' | head -1 | tr -d '%') 455 - muted=$(pactl get-sink-mute @DEFAULT_SINK@ | grep -oP '(yes|no)') 456 - if [ "$muted" = "yes" ]; then 457 - icon="󰖁" 458 - elif [ "$vol" -gt 50 ]; then 459 - icon="󰕾" 460 - elif [ "$vol" -gt 0 ]; then 461 - icon="󰖀" 462 - else 463 - icon="󰕿" 464 - fi 465 - jq -n --arg level "$vol" --arg icon "$icon" '{level: $level, icon: $icon}' 466 - ''; 467 - }; 468 - 469 - volumeAdjustScript = pkgs.writeShellApplication { 470 - name = "eww-volume-adjust"; 471 - runtimeInputs = [ pkgs.pulseaudio ]; 472 - text = '' 473 - direction="$1" 474 - if [ "$direction" = "up" ]; then 475 - pactl set-sink-volume @DEFAULT_SINK@ +5% 476 - else 477 - pactl set-sink-volume @DEFAULT_SINK@ -5% 478 - fi 479 - ''; 480 - }; 481 - 482 - networkScript = pkgs.writeShellApplication { 483 - name = "eww-network"; 484 - runtimeInputs = [ pkgs.networkmanager ]; 485 - text = '' 486 - connection=$(nmcli -t -f NAME,TYPE,DEVICE connection show --active 2>/dev/null | head -1) 487 - if [ -z "$connection" ]; then 488 - echo "󰖪 Disconnected" 489 - else 490 - name=$(echo "$connection" | cut -d: -f1) 491 - type=$(echo "$connection" | cut -d: -f2) 492 - if [ "$type" = "802-11-wireless" ]; then 493 - echo "󰖩 $name" 494 - else 495 - echo "󰈀 $name" 496 - fi 497 - fi 498 - ''; 499 - }; 500 - 501 - workspacesScript = pkgs.writeShellApplication { 502 - name = "sway-workspaces"; 503 - runtimeInputs = [ 504 - pkgs.sway 505 - pkgs.jq 506 - ]; 507 - text = '' 508 - # Output initial state 509 - swaymsg -t get_workspaces | jq -c '[.[] | {name: .name, focused: .focused, urgent: .urgent}]' 510 - 511 - # Subscribe to workspace events and output updated state 512 - swaymsg -t subscribe -m '["workspace"]' | while read -r _; do 513 - swaymsg -t get_workspaces | jq -c '[.[] | {name: .name, focused: .focused, urgent: .urgent}]' 514 - done 515 - ''; 516 - }; 517 - 518 - brightnessScript = pkgs.writeShellApplication { 519 - name = "eww-brightness"; 520 - runtimeInputs = [ pkgs.brightnessctl ]; 521 - text = '' 522 - brightnessctl -m | cut -d, -f4 | tr -d '%' 523 - ''; 524 - }; 525 - 526 - idleToggleScript = pkgs.writeShellApplication { 527 - name = "eww-idle-toggle"; 528 - runtimeInputs = [ pkgs.systemd ]; 529 - text = '' 530 - if systemctl --user is-active --quiet sway-idle-inhibit.service; then 531 - systemctl --user stop sway-idle-inhibit.service 532 - else 533 - systemctl --user start sway-idle-inhibit.service 534 - fi 535 - ''; 536 - }; 537 - 538 - idleStatusScript = pkgs.writeShellApplication { 539 - name = "eww-idle-status"; 540 - runtimeInputs = [ pkgs.systemd ]; 541 - text = '' 542 - if systemctl --user is-active --quiet sway-idle-inhibit.service; then 543 - echo "true" 544 - else 545 - echo "false" 546 - fi 547 - ''; 548 - }; 549 - 550 - # Power profile state file (written by power-profile tool, read by eww) 551 - powerProfileStateFile = "/tmp/power-profile-state"; 552 - 553 - powerProfileStatusScript = pkgs.writeShellApplication { 554 - name = "eww-power-profile-status"; 555 - runtimeInputs = [ pkgs.jq ]; 556 - text = '' 557 - state_file="${powerProfileStateFile}" 558 - if [ -f "$state_file" ]; then 559 - read -r name tdp < "$state_file" 560 - else 561 - name="unknown" 562 - tdp="?" 563 - fi 564 - jq -n --arg name "$name" --arg tdp "$tdp" '{name: $name, tdp: $tdp}' 565 - ''; 566 - }; 567 - 568 - powerProfileCycleScript = pkgs.writeShellApplication { 569 - name = "eww-power-profile-cycle"; 570 - runtimeInputs = [ pkgs.libnotify ]; 571 - text = '' 572 - state_file="${powerProfileStateFile}" 573 - 574 - # Profile names (must match power-profile tool) 575 - profiles=("low" "normal" "high") 576 - 577 - # Read current profile from state file 578 - current="unknown" 579 - if [ -f "$state_file" ]; then 580 - read -r current _ < "$state_file" 581 - fi 582 - 583 - # Find next profile (cycle through) 584 - next_idx=0 585 - for i in "''${!profiles[@]}"; do 586 - if [ "''${profiles[$i]}" = "$current" ]; then 587 - next_idx=$(( (i + 1) % ''${#profiles[@]} )) 588 - break 589 - fi 590 - done 591 - 592 - next="''${profiles[$next_idx]}" 593 - 594 - # Use the power-profile tool (uses sudo internally, writes state file) 595 - if /run/current-system/sw/bin/power-profile "$next" >/dev/null 2>&1; then 596 - notify-send -t 2000 "Power Profile" "Set to $next" 597 - else 598 - notify-send -t 2000 "Power Profile" "Failed to set profile" 599 - fi 600 - ''; 601 - }; 602 - 603 - ewwConfigDir = pkgs.runCommand "eww-config" { } '' 604 - mkdir -p $out 605 - cp ${ewwYuck} $out/eww.yuck 606 - cp ${ewwScss} $out/eww.scss 607 - ''; 608 - 609 - in 610 - { 611 - # ryzenadj and power-profile for power profile control 612 - environment.systemPackages = [ 613 - pkgs.ryzenadj 614 - self.packages.${pkgs.system}.power-profile 615 - ]; 616 - 617 - # Allow user to run ryzenadj without password (for power profile switching) 618 - security.sudo.extraRules = [ 619 - { 620 - users = [ config.users.users.mainUser.name ]; 621 - commands = [ 622 - { 623 - command = "/run/current-system/sw/bin/ryzenadj"; 624 - options = [ "NOPASSWD" ]; 625 - } 626 - ]; 627 - } 628 - ]; 629 - 630 - # Make RAPL energy counters readable for power monitoring 631 - # Works on both Intel and AMD Zen CPUs (via intel_rapl_msr module) 632 - services.udev.extraRules = '' 633 - SUBSYSTEM=="powercap", ACTION=="add", RUN+="${pkgs.coreutils}/bin/chmod a+r /sys/class/powercap/%k/energy_uj" 634 - ''; 635 - 636 - # eww daemon 637 - systemd.user.services.eww = { 638 - description = "ElKowars Wacky Widgets daemon"; 639 - partOf = [ "sway-session.target" ]; 640 - wantedBy = [ "sway-session.target" ]; 641 - path = [ 642 - pkgs.bash 643 - pkgs.sway 644 - ]; 645 - environment.EWW_CONFIG = "${ewwConfigDir}"; 646 - serviceConfig = { 647 - Type = "simple"; 648 - ExecStart = "${lib.getExe pkgs.eww} daemon --config ${ewwConfigDir} --no-daemonize"; 649 - ExecStop = "${lib.getExe pkgs.eww} --config ${ewwConfigDir} kill"; 650 - Restart = "on-failure"; 651 - RestartSec = 1; 652 - }; 653 - }; 654 - 655 - # Idle inhibit service - toggled by eww button 656 - systemd.user.services.sway-idle-inhibit = { 657 - description = "Inhibit idle/sleep"; 658 - serviceConfig = { 659 - Type = "simple"; 660 - ExecStart = "${pkgs.systemd}/bin/systemd-inhibit --what=idle:sleep --who=eww --why='User requested' --mode=block sleep infinity"; 661 - }; 662 - }; 663 - 664 - # eww bar per output - template unit using output name (e.g. eww-bar@eDP-1.service) 665 - systemd.user.services."eww-bar@" = { 666 - description = "Eww bar on output %i"; 667 - partOf = [ "sway-session.target" ]; 668 - after = [ "eww.service" ]; 669 - requires = [ "eww.service" ]; 670 - serviceConfig = { 671 - Type = "oneshot"; 672 - RemainAfterExit = true; 673 - ExecStart = "${pkgs.eww}/bin/eww --config ${ewwConfigDir} open bar --id bar-%i --arg screen=%i"; 674 - ExecStop = "${pkgs.eww}/bin/eww --config ${ewwConfigDir} close bar-%i"; 675 - }; 676 - }; 677 - 678 - # Watches for output changes and starts/stops eww-bar@ instances 679 - systemd.user.services.eww-output-watcher = { 680 - description = "Watch for output changes and manage eww bars"; 681 - partOf = [ "sway-session.target" ]; 682 - wantedBy = [ "sway-session.target" ]; 683 - after = [ "eww.service" ]; 684 - requires = [ "eww.service" ]; 685 - serviceConfig = { 686 - Type = "simple"; 687 - ExecStart = lib.getExe ( 688 - pkgs.writeShellApplication { 689 - name = "eww-output-watcher"; 690 - runtimeInputs = [ 691 - pkgs.sway 692 - pkgs.jq 693 - pkgs.systemd 694 - pkgs.gawk 695 - pkgs.gnused 696 - pkgs.gnugrep 697 - ]; 698 - text = '' 699 - update_bars() { 700 - # Get current outputs 701 - outputs=$(swaymsg -t get_outputs | jq -r '.[].name') 702 - 703 - # Start bars for connected outputs 704 - for output in $outputs; do 705 - systemctl --user start "eww-bar@$output.service" || true 706 - done 707 - 708 - # Stop bars for disconnected outputs 709 - running=$(systemctl --user list-units --type=service --state=running --plain --no-legend 'eww-bar@*' | awk '{print $1}' | sed 's/eww-bar@\(.*\)\.service/\1/') 710 - for output in $running; do 711 - if ! echo "$outputs" | grep -qx "$output"; then 712 - systemctl --user stop "eww-bar@$output.service" || true 713 - fi 714 - done 715 - } 716 - 717 - update_bars 718 - swaymsg -t subscribe -m '["output"]' | while read -r _; do 719 - sleep 0.5 720 - update_bars 721 - done 722 - ''; 723 - } 724 - ); 725 - Restart = "on-failure"; 726 - RestartSec = 1; 727 - }; 728 - }; 729 - 730 - }
-6
configs/services/coms/default.nix
··· 1 - { 2 - imports = [ 3 - ./jitsi.nix 4 - ./murmur.nix 5 - ]; 6 - }
-31
configs/services/coms/murmur.nix
··· 1 - { ... }: 2 - { 3 - security.acme.acceptTerms = true; 4 - 5 - services.murmur = { 6 - enable = true; 7 - # allowHtml = false; 8 - bandwidth = 10000000; 9 - registerName = "lassul.us"; 10 - autobanTime = 30; 11 - sslCert = "/var/lib/acme/lassul.us/cert.pem"; 12 - sslKey = "/var/lib/acme/lassul.us/key.pem"; 13 - extraConfig = '' 14 - opusthreshold=0 15 - # rememberchannelduration=10000 16 - ''; 17 - }; 18 - networking.firewall.allowedTCPPorts = [ 64738 ]; 19 - networking.firewall.allowedUDPPorts = [ 64738 ]; 20 - 21 - services.nginx.virtualHosts."lassul.us" = { 22 - enableACME = true; 23 - }; 24 - security.acme.certs."lassul.us" = { 25 - group = "lasscert"; 26 - }; 27 - users.groups.lasscert.members = [ 28 - "nginx" 29 - "murmur" 30 - ]; 31 - }
-29
configs/services/git/default.nix
··· 1 - { config, pkgs, ... }: 2 - { 3 - imports = [ 4 - ../../git.nix 5 - ]; 6 - services.nginx.virtualHosts."cgit.lassul.us" = { 7 - enableACME = true; 8 - addSSL = true; 9 - locations = config.services.nginx.virtualHosts.cgit.locations; 10 - extraConfig = '' 11 - client_max_body_size 300M; 12 - client_body_timeout 2024; 13 - client_header_timeout 2024; 14 - 15 - fastcgi_buffers 16 512k; 16 - fastcgi_buffer_size 512k; 17 - fastcgi_read_timeout 500; 18 - fastcgi_send_timeout 500; 19 - ''; 20 - }; 21 - systemd.tmpfiles.settings."cgit"."/tmp/cgit".d = { 22 - mode = "0755"; 23 - user = "git"; 24 - group = "git"; 25 - }; 26 - krebs.git.cgit.fcgiwrap.group.name = "git"; 27 - krebs.git.cgit.fcgiwrap.user.name = "git"; 28 - krebs.git.cgit.fcgiwrap.user.home = toString pkgs.emptyDirectory; 29 - }
-23
configs/services/git/proxy.nix
··· 1 - { ... }: 2 - { 3 - services.nginx.virtualHosts."cgit.lassul.us" = { 4 - forceSSL = true; 5 - enableACME = true; 6 - acmeFallbackHost = "orange.r"; 7 - locations."/" = { 8 - proxyPass = "http://orange.r"; 9 - proxyWebsockets = true; 10 - recommendedProxySettings = true; 11 - }; 12 - extraConfig = '' 13 - client_max_body_size 300M; 14 - client_body_timeout 2024; 15 - client_header_timeout 2024; 16 - 17 - fastcgi_buffers 16 512k; 18 - fastcgi_buffer_size 512k; 19 - fastcgi_read_timeout 500; 20 - fastcgi_send_timeout 500; 21 - ''; 22 - }; 23 - }
-25
configs/services/nixcache/default.nix
··· 1 - { config, pkgs, ... }: 2 - { 3 - nixpkgs.config.packageOverrides = p: { 4 - nix-serve = p.haskellPackages.nix-serve-ng; 5 - }; 6 - 7 - services.nix-serve = { 8 - enable = true; 9 - port = 5005; 10 - secretKeyFile = "${config.krebs.secret.directory}/nix-serve.key"; 11 - }; 12 - 13 - clan.core.vars.generators.nix-serve = { 14 - files."nix-serve.key" = { }; 15 - files."nix-serve.pub".secret = false; 16 - runtimeInputs = with pkgs; [ 17 - coreutils 18 - nix 19 - ]; 20 - script = '' 21 - exit 1 # Manual migration required from facts to vars 22 - nix-store --generate-binary-cache-key cache.${config.networking.hostName} "$out"/nix-serve.key "$out"/nix-serve.pub 23 - ''; 24 - }; 25 - }
-39
configs/services/site/default.nix
··· 1 - { config, pkgs, ... }: 2 - { 3 - security.acme = { 4 - certs."lassul.us" = { 5 - group = "lasscert"; 6 - }; 7 - }; 8 - 9 - users.groups.lasscert.members = [ 10 - "nginx" 11 - ]; 12 - 13 - services.nginx.virtualHosts."lassul.us" = { 14 - addSSL = true; 15 - enableACME = true; 16 - default = true; 17 - locations."/".extraConfig = '' 18 - root /srv/http/lassul.us; 19 - ''; 20 - locations."= /hosts".extraConfig = '' 21 - alias ${pkgs.krebs-hosts_combined}; 22 - ''; 23 - locations."= /retiolum.hosts".extraConfig = '' 24 - alias ${pkgs.krebs-hosts-retiolum}; 25 - ''; 26 - locations."= /wireguard-key".extraConfig = '' 27 - alias ${pkgs.writeText "neoprism.wg" config.krebs.hosts.neoprism.nets.wiregrill.wireguard.pubkey}; 28 - ''; 29 - locations."= /ssh.pub".extraConfig = '' 30 - alias ${pkgs.writeText "pub" config.krebs.users.lass-yubikey.pubkey}; 31 - ''; 32 - locations."= /gpg.pub".extraConfig = '' 33 - alias ${pkgs.writeText "pub" config.krebs.users.lass-yubikey.pgp.pubkeys.default}; 34 - ''; 35 - locations."= /ip".extraConfig = '' 36 - return 200 '$remote_addr'; 37 - ''; 38 - }; 39 - }