feat(binto): move to new logitech mouse

This commit is contained in:
matt1432 2024-05-01 10:21:28 -04:00
parent 2caeb6f438
commit 585d764720
11 changed files with 20 additions and 193 deletions

View file

@ -11,7 +11,6 @@ in {
../../modules/kmscon.nix
../../modules/printer.nix
../../modules/ratbag-mice.nix
../../modules/razer.nix
../../modules/sshd.nix
../../modules/tailscale.nix

Binary file not shown.

BIN
flake.nix

Binary file not shown.

View file

@ -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;
}
}

View file

@ -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(),
],
}),

View file

@ -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],
});
};

View file

@ -176,7 +176,6 @@ export const Notification = ({
const BlockedApps = [
'Spotify',
'OpenRazer',
];
if (BlockedApps.find((app) => app === notif.app_name)) {

View file

@ -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=";

View file

@ -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: {

View file

@ -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"
];
})
];
}

View file

@ -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"];
};
};
}