Skip to content

Commit

Permalink
feat(rofi): add jetbrains plugin (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
zakuciael authored May 11, 2024
1 parent df9ae68 commit 75a7e69
Show file tree
Hide file tree
Showing 13 changed files with 162 additions and 25 deletions.
2 changes: 1 addition & 1 deletion configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
inherit username;
stateVersion = "23.11";
homeDirectory = "/home/${username}";
packages = scripts.shellExports;
packages = scripts.mkShellExports config;
};
};

Expand Down
4 changes: 4 additions & 0 deletions dotfiles/rofi/config.rasi
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ configuration {
steal-focus: false;
/* dpi: -1;*/

/*---------- JetBrains settings ----------*/
jetbrains-custom-aliases: ["rs:RR", "web:WS", "cpp:CL"];
jetbrains-install-dir: "~/.local/share/JetBrains/apps/";

/*---------- Matching setting ----------*/
matching: "normal";
tokenize: true;
Expand Down
2 changes: 1 addition & 1 deletion dotfiles/rofi/launchers/style.rasi
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/*****----- Configuration -----*****/
/* TODO: Add jetbrains plugin */
configuration {
modi: "drun,ssh,filebrowser,window";
modi: "drun,jetbrains,ssh,filebrowser,window";
show-icons: true;
display-drun: "";
display-ssh: "";
Expand Down
95 changes: 95 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
url = "github:bromanko/age-plugin-op";
inputs.nixpkgs.follows = "nixpkgs";
};
rofi-jetbrains = {
url = "github:zakuciael/rofi-jetbrains";
inputs.nixpkgs.follows = "nixpkgs";
};
hyprland.url = "github:hyprwm/Hyprland";
nixd.url = "github:nix-community/nixd";
nil.url = "github:oxalica/nil";
Expand Down Expand Up @@ -74,6 +78,7 @@
alejandra = flakeInputs.alejandra.packages.${system};
hyprland-contrib = flakeInputs.hyprland-contrib.packages.${system};
hyprpaper = flakeInputs.hyprpaper.packages.${system};
rofi-jetbrains = flakeInputs.rofi-jetbrains.packages.${system};
age-plugin-op =
flakeInputs.age-plugin-op.packages.${system}
// {
Expand Down
2 changes: 1 addition & 1 deletion lib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
defs = import ./defs.nix {inherit lib;};

dotfiles = mapper.mapDirToAttrs ./../dotfiles;
scripts = import ./scripts.nix {inherit lib pkgs unstable inputs dotfiles;};
scripts = import ./scripts.nix {inherit lib pkgs unstable inputs username dotfiles;};
in {
inherit utils mapper defs;

Expand Down
2 changes: 1 addition & 1 deletion lib/overlays.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ with lib.my; let
(builtins.map (config: attrByPath [attr] null config) overlays)
);
in {
pkgs = (getOverlaysFromAttr "pkgs") ++ privatePkgsOverlays;
pkgs = privatePkgsOverlays ++ (getOverlaysFromAttr "pkgs");
unstable = getOverlaysFromAttr "unstable";
}
20 changes: 11 additions & 9 deletions lib/scripts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,25 @@
pkgs,
unstable,
inputs,
username,
dotfiles,
...
}:
with lib;
with lib.my; let
scripts =
mkScripts = config:
builtins.map
(file: import file {inherit lib pkgs unstable inputs dotfiles;})
(file: import file {inherit config lib pkgs unstable inputs username dotfiles;})
(utils.recursiveReadDir ./../scripts {suffixes = ["nix"];});
in {
shellExports =
mkShellExports = config:
builtins.map
(getAttr "package")
(builtins.filter (script: attrByPath ["export"] false script) scripts);
packages = builtins.listToAttrs (builtins.map (script: {
name = script.package.name;
value = script.package;
})
scripts);
(builtins.filter (script: attrByPath ["export"] false script) (mkScripts config));
mkScriptPackages = config:
builtins.listToAttrs (builtins.map (script: {
name = script.package.name;
value = script.package;
})
(mkScripts config));
}
13 changes: 8 additions & 5 deletions modules/desktop/apps/rofi.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
{
lib,
pkgs,
inputs,
username,
dotfiles,
...
}:
with lib;
with lib.my; {
}: {
home-manager.users.${username} = {
home.packages = with pkgs; [rofi-wayland];
programs.rofi = {
enable = true;
package = pkgs.rofi-wayland;
plugins = [inputs.rofi-jetbrains.default];
};

xdg.configFile.rofi.source = dotfiles.rofi.source;
};
}
9 changes: 6 additions & 3 deletions modules/desktop/wm/hyprland.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
...
}:
with lib;
with lib.my;
with lib.my; let
scriptPackages = scripts.mkScriptPackages config;
in
desktop.mkDesktopModule {
inherit config;

Expand Down Expand Up @@ -123,8 +125,9 @@ with lib.my;
"$mod, RIGHT, movefocus, r"
"$mod, UP, movefocus, u"
"$mod, DOWN, movefocus, d"
"SHIFT CTRL, space, exec, ${scripts.packages.rofi-launcher}/bin/rofi-launcher drun"
"SHIFT CTRL, Q, exec, ${scripts.packages.rofi-powermenu}/bin/rofi-powermenu"
"SHIFT CTRL, space, exec, ${scriptPackages.rofi-launcher}/bin/rofi-launcher drun"
"SHIFT CTRL, R, exec, ${scriptPackages.rofi-launcher}/bin/rofi-launcher jetbrains"
"SHIFT CTRL, Q, exec, ${scriptPackages.rofi-powermenu}/bin/rofi-powermenu"
];

bindl = with pkgs; [
Expand Down
13 changes: 12 additions & 1 deletion modules/dev/ide.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ with lib.my; let
webstorm
])
);
installedIDEs = builtins.map (name: avaiableIdes.${name}) cfg;
in {
options.modules.dev.ides = mkOption {
description = "A list of JetBrains IDEs names to install";
Expand All @@ -42,7 +43,17 @@ in {

config = mkIf (cfg != []) {
home-manager.users.${username} = {
home.packages = builtins.map (name: avaiableIdes.${name}) cfg;
home = {
packages = installedIDEs;

file = builtins.listToAttrs (builtins.map (ide: {
name = ".local/share/JetBrains/apps/${ide.pname}";
value = {
source = "${ide}/${ide.pname}";
};
})
installedIDEs);
};
};
};
}
9 changes: 7 additions & 2 deletions scripts/rofi/launcher.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
{pkgs, ...}: {
{
config,
pkgs,
username,
...
}: {
package = pkgs.writeShellApplication {
name = "rofi-launcher";
runtimeInputs = with pkgs; [rofi-wayland];
runtimeInputs = [config.home-manager.users.${username}.programs.rofi.finalPackage];
text = ''
rofi -theme "$HOME/.config/rofi/launchers/style.rasi" -show "$1"
'';
Expand Down
11 changes: 10 additions & 1 deletion scripts/rofi/powermenu.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
{
config,
pkgs,
inputs,
username,
...
}: {
package = pkgs.writeShellApplication {
name = "rofi-powermenu";
runtimeInputs = with pkgs; [rofi-wayland toybox mpc-cli alsa-utils bspwm inputs.hyprland];
runtimeInputs = with pkgs; [
config.home-manager.users.${username}.programs.rofi.finalPackage
toybox
mpc-cli
alsa-utils
bspwm
inputs.hyprland
];
text = ''
# CMDs
uptime=$(uptime -p | sed -e 's/up //g')
Expand Down

0 comments on commit 75a7e69

Please sign in to comment.