diff --git a/devices/binto/default.nix b/devices/binto/default.nix index 1c19b5c..e09df39 100644 --- a/devices/binto/default.nix +++ b/devices/binto/default.nix @@ -11,7 +11,6 @@ in { ../../modules/kmscon.nix ../../modules/printer.nix ../../modules/ratbag-mice.nix - ../../modules/razer.nix ../../modules/sshd.nix ../../modules/tailscale.nix diff --git a/flake.lock b/flake.lock index 671ec2a..ef7783d 100644 --- a/flake.lock +++ b/flake.lock @@ -789,6 +789,22 @@ "type": "github" } }, + "libratbag-src": { + "flake": false, + "locked": { + "lastModified": 1709658456, + "narHash": "sha256-9rlnGQ7kcXqX+8mFb0imnzLo0X6Nuca6fcMv+H6ZwEw=", + "owner": "libratbag", + "repo": "libratbag", + "rev": "8444ceb638b19c3fbeb073a5cd29f17c6d34dd07", + "type": "github" + }, + "original": { + "owner": "libratbag", + "repo": "libratbag", + "type": "github" + } + }, "modernx-src": { "flake": false, "locked": { @@ -1566,6 +1582,22 @@ "type": "github" } }, + "piper-src": { + "flake": false, + "locked": { + "lastModified": 1708275645, + "narHash": "sha256-ar1f0d2dzgUCL9F/AI1la26i/4Ab6SgxmeTjiI1J4z0=", + "owner": "libratbag", + "repo": "piper", + "rev": "66c1897540d107e48227ce05c5ac51ea41454feb", + "type": "github" + }, + "original": { + "owner": "libratbag", + "repo": "piper", + "type": "github" + } + }, "plymouth-theme-src": { "flake": false, "locked": { @@ -1670,6 +1702,7 @@ "hyprland": "hyprland", "jellyfin-flake": "jellyfin-flake", "jellyfin-ultrachromic-src": "jellyfin-ultrachromic-src", + "libratbag-src": "libratbag-src", "modernx-src": "modernx-src", "nh": "nh", "nix-eval-jobs": "nix-eval-jobs", @@ -1688,6 +1721,7 @@ "pam-fprint-grosshack-src": "pam-fprint-grosshack-src", "pcsd": "pcsd", "persist-properties-src": "persist-properties-src", + "piper-src": "piper-src", "plymouth-theme-src": "plymouth-theme-src", "pointer-event-src": "pointer-event-src", "pokemon-colorscripts-src": "pokemon-colorscripts-src", diff --git a/flake.nix b/flake.nix index d9126c8..3515463 100644 --- a/flake.nix +++ b/flake.nix @@ -426,6 +426,20 @@ url = "https://repo.dec05eba.com/gpu-screen-recorder"; flake = false; }; + + libratbag-src = { + type = "github"; + owner = "libratbag"; + repo = "libratbag"; + flake = false; + }; + + piper-src = { + type = "github"; + owner = "libratbag"; + repo = "piper"; + flake = false; + }; ## ## MPV scripts diff --git a/modules/ags/config/scss/binto-widgets/bar.scss b/modules/ags/config/scss/binto-widgets/bar.scss index 414b626..b839cf9 100644 --- a/modules/ags/config/scss/binto-widgets/bar.scss +++ b/modules/ags/config/scss/binto-widgets/bar.scss @@ -25,26 +25,3 @@ background-color: $bgfull; } } - -.razer { - padding: 0 5px; - background: $bgfull; - - .low { - color: $red; - } - - .medium { - color: $yellow; - } - - .high { - color: $green; - } - - image { - padding-right: 5px; - font-size: 22px; - color: white; - } -} diff --git a/modules/ags/config/ts/bar/binto.ts b/modules/ags/config/ts/bar/binto.ts index b6e3b7f..ee2817b 100644 --- a/modules/ags/config/ts/bar/binto.ts +++ b/modules/ags/config/ts/bar/binto.ts @@ -7,7 +7,6 @@ import BarRevealer from './fullscreen.ts'; import Clock from './items/clock.ts'; import CurrentWindow from './items/current-window'; import NotifButton from './items/notif-button.ts'; -import RazerStats from './items/razer-stats.ts'; import SysTray from './items/systray.ts'; const PADDING = 20; @@ -29,10 +28,6 @@ export default () => BarRevealer({ Separator(PADDING), SysTray(), - - Separator(PADDING / 2 / 2), - - RazerStats(), ], }), diff --git a/modules/ags/config/ts/bar/items/razer-stats.ts b/modules/ags/config/ts/bar/items/razer-stats.ts deleted file mode 100644 index 267f4ca..0000000 --- a/modules/ags/config/ts/bar/items/razer-stats.ts +++ /dev/null @@ -1,93 +0,0 @@ -import { execAsync, interval } from 'resource:///com/github/Aylur/ags/utils.js'; - -const { Box, Icon, Label } = Widget; - -const RAZER_POLL = 10000; -const LOW_BATT = 20; - -const RazerBat = Variable({ - battery: 0, - charging: false, - sleeping: false, - disconnected: true, -}); - - -const fetchInfo = () => { - execAsync([ - 'bash', - '-c', - "polychromatic-cli -n 'Razer Naga Pro (Wired)' -k" + - ' || ' + - "polychromatic-cli -n 'Razer Naga Pro (Wireless)' -k", - - ]).then((out) => { - const batteryMatches = out.split('\n') - .filter((i) => i.includes('Battery'))[0] - .match(/[0-9]+/); - - let sleeping = false; - let battery = batteryMatches !== null ? - parseInt(batteryMatches[0]) : - 0; - - // Don't set to zero when in sleep mode - if (battery === 0 && RazerBat.value.battery > 10) { - battery = RazerBat.value.battery; - sleeping = true; - } - - // If 'Wireless' isn't in the logs it means the cmd found 'Wired' - const charging = !out.includes('Wireless'); - - RazerBat.value = { - battery, - charging, - sleeping, - disconnected: false, - }; - }).catch(() => { - RazerBat.value.disconnected = true; - }); -}; - -interval(RAZER_POLL, fetchInfo); - -export default () => { - const percentage = Label({ vpack: 'center' }); - - const icon = Icon({ hpack: 'start' }) - .hook(RazerBat, (self) => { - const v = RazerBat.value; - - percentage.visible = !(v.disconnected || v.charging); - percentage.label = `${v.battery}%`; - - self.icon = v.disconnected ? - 'content-loading-symbolic' : - 'mouse-razer-symbolic'; - self.setCss( - v.disconnected || v.charging ? - 'margin-right: -5px;' : - '', - ); - - self.toggleClassName( - 'high', - v.battery > 66, - ); - self.toggleClassName( - 'medium', - v.battery > LOW_BATT && v.battery <= 66, - ); - self.toggleClassName( - 'low', - v.battery <= LOW_BATT, - ); - }); - - return Box({ - class_name: 'razer', - children: [icon, percentage], - }); -}; diff --git a/modules/ags/config/ts/notifications/base.ts b/modules/ags/config/ts/notifications/base.ts index a633947..bf55ed9 100644 --- a/modules/ags/config/ts/notifications/base.ts +++ b/modules/ags/config/ts/notifications/base.ts @@ -176,7 +176,6 @@ export const Notification = ({ const BlockedApps = [ 'Spotify', - 'OpenRazer', ]; if (BlockedApps.find((app) => app === notif.app_name)) { diff --git a/modules/ags/icons.nix b/modules/ags/icons.nix index b885efa..46f8991 100644 --- a/modules/ags/icons.nix +++ b/modules/ags/icons.nix @@ -3,11 +3,6 @@ pkgs, ... }: { - "${agsConfigDir}/config/icons/mouse-razer-symbolic.svg".source = pkgs.fetchurl { - url = "https://raw.githubusercontent.com/bithatch/razer-icon-font/main/src/devices/mouse.svg"; - hash = "sha256-A1+eIp2VEFDyY23GIHKhbnByHXrnVS3QgIJ9sjjtuZw="; - }; - "${agsConfigDir}/config/icons/down-large-symbolic.svg".source = pkgs.fetchurl { url = "https://www.svgrepo.com/download/158537/down-chevron.svg"; hash = "sha256-mOfNjgZh0rt6XosKA2kpLY22lJldSS1XCphgrnvZH1s="; diff --git a/modules/hyprland/inputs.nix b/modules/hyprland/inputs.nix index bda3c5c..d3fc965 100644 --- a/modules/hyprland/inputs.nix +++ b/modules/hyprland/inputs.nix @@ -8,15 +8,7 @@ inherit (osConfig.vars) mainMonitor; miceNames = [ - # Wireless - "razer-razer-naga-pro" - - # Wired (it always changes) - "razer-razer-naga-pro-1" - "razer-naga-pro" - "razer-naga-pro-1" - "razer-naga-pro-2" - "razer-naga-pro-3" + "logitech-g502-x" "logitech-g502-hero-gaming-mouse" ]; nagaConf = name: { diff --git a/modules/ratbag-mice.nix b/modules/ratbag-mice.nix index 3fd9e2b..42996cc 100644 --- a/modules/ratbag-mice.nix +++ b/modules/ratbag-mice.nix @@ -1,28 +1,26 @@ { - config, - lib, + libratbag-src, pkgs, + piper-src, ... -}: let - inherit (config.vars) mainUser; - inherit (lib) mkIf; - cfgHypr = - config - .home-manager - .users - .${mainUser} - .wayland - .windowManager - .hyprland; -in { - services.ratbagd.enable = true; +}: { + services.ratbagd = { + enable = true; - # HOME-MANAGER CONFIG - home-manager.users.${mainUser} = { - home.packages = with pkgs; [piper]; - - wayland.windowManager.hyprland = mkIf (cfgHypr.enable) { - # settings.exec-once = [""]; + package = pkgs.libratbag.overrideAttrs { + version = libratbag-src.shortRev; + src = libratbag-src; }; }; + + environment.systemPackages = with pkgs; [ + (piper.overrideAttrs { + name = "piper-${piper-src.shortRev}"; + src = piper-src; + + mesonFlags = [ + "-Druntime-dependency-checks=false" + ]; + }) + ]; } diff --git a/modules/razer.nix b/modules/razer.nix deleted file mode 100644 index a2cd5ab..0000000 --- a/modules/razer.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: let - inherit (config.vars) mainUser; - inherit (lib) mkIf; - - cfgHypr = - config - .home-manager - .users - .${mainUser} - .wayland - .windowManager - .hyprland; -in { - hardware.openrazer = { - enable = true; - users = [mainUser]; - }; - - environment.systemPackages = with pkgs; [ - openrazer-daemon - polychromatic - ]; - - # HOME-MANAGER CONFIG - home-manager.users.${mainUser} = { - wayland.windowManager.hyprland = mkIf (cfgHypr.enable) { - settings.exec-once = ["polychromatic-tray-applet"]; - }; - }; -}