libinput gestures and rofi menu

This commit is contained in:
Janis 2025-07-20 14:31:30 +02:00
parent 4ec3859a0e
commit 37355dfaa4
4 changed files with 258 additions and 2 deletions

View file

@ -5,5 +5,7 @@
./waybar.nix ./waybar.nix
./alacritty.nix ./alacritty.nix
./zsh.nix ./zsh.nix
./libinput.nix
./rofi.nix
]; ];
} }

13
config/apps/libinput.nix Normal file
View file

@ -0,0 +1,13 @@
{pkgs, config, ...}: {
home.packages = with pkgs; [
libinput
libinput-gestures
];
xdg.configFile."libinput-gestures.conf".text = ''
gesture swipe left 4 swaymsg workspace next
gesture swipe right 4 swaymsg workspace next
gesture swipe down 4 swaylock-wrapper
gesture pinch in 4 rofi -combi-modi window,drun,run,ssh,combi -show combi -show-icons
'';
}

239
config/apps/rofi.nix Normal file
View file

@ -0,0 +1,239 @@
{pkgs, config, ...}: let
theme = import ../data/theme.nix { inherit config; };
in {
xdg.dataFile."rofi/themes/launcher.rasi".text = ''
/**
*
* Author : Aditya Shakya (adi1090x)
* Github : @adi1090x
*
* Rofi Theme File
* Rofi Version: 1.7.3
**/
/*****----- Configuration -----*****/
configuration {
modi: "drun,run,filebrowser,window";
show-icons: false;
display-drun: "";
display-run: "";
display-filebrowser: "";
display-window: "";
drun-display-format: "{name}";
window-format: "{w} · {c} · {t}";
}
/*****----- Global Properties -----*****/
* {
font: "JetBrains Mono Nerd Font 10";
background: #101010;
background-alt: #252525;
foreground: #FFFFFF;
selected: #505050;
active: #909090;
urgent: #707070;
}
/*****----- Main Window -----*****/
window {
/* properties for window widget */
transparency: "real";
location: center;
anchor: center;
fullscreen: false;
width: 400px;
x-offset: 0px;
y-offset: 0px;
/* properties for all widgets */
enabled: true;
border-radius: 20px;
cursor: "default";
background-color: @background;
}
/*****----- Main Box -----*****/
mainbox {
enabled: true;
spacing: 0px;
background-color: transparent;
orientation: vertical;
children: [ "inputbar", "listbox" ];
}
listbox {
spacing: 20px;
padding: 20px;
background-color: transparent;
orientation: vertical;
children: [ "message", "listview", "mode-switcher" ];
}
/*****----- Inputbar -----*****/
inputbar {
enabled: true;
spacing: 10px;
padding: 100px 40px;
background-color: transparent;
background-image: url("~/.config/rofi/images/g.png", width);
text-color: @foreground;
orientation: horizontal;
children: [ "textbox-prompt-colon", "entry" ];
}
textbox-prompt-colon {
enabled: true;
expand: false;
str: "";
padding: 12px 15px;
border-radius: 100%;
background-color: @background-alt;
text-color: inherit;
}
entry {
enabled: true;
expand: true;
padding: 12px 16px;
border-radius: 100%;
background-color: @background-alt;
text-color: inherit;
cursor: text;
placeholder: "Search";
placeholder-color: inherit;
}
/*****----- Mode Switcher -----*****/
mode-switcher{
enabled: true;
spacing: 10px;
background-color: transparent;
text-color: @foreground;
}
button {
padding: 12px;
border-radius: 100%;
background-color: @background-alt;
text-color: inherit;
cursor: pointer;
}
button selected {
background-color: @selected;
text-color: @foreground;
}
/*****----- Listview -----*****/
listview {
enabled: true;
columns: 1;
lines: 5;
cycle: true;
dynamic: true;
scrollbar: false;
layout: vertical;
reverse: false;
fixed-height: true;
fixed-columns: true;
spacing: 10px;
background-color: transparent;
text-color: @foreground;
cursor: "default";
}
/*****----- Elements -----*****/
element {
enabled: true;
spacing: 10px;
padding: 12px;
border-radius: 100%;
background-color: transparent;
text-color: @foreground;
cursor: pointer;
}
element normal.normal {
background-color: inherit;
text-color: inherit;
}
element normal.urgent {
background-color: @urgent;
text-color: @foreground;
}
element normal.active {
background-color: @active;
text-color: @foreground;
}
element selected.normal {
background-color: @selected;
text-color: @foreground;
}
element selected.urgent {
background-color: @urgent;
text-color: @foreground;
}
element selected.active {
background-color: @urgent;
text-color: @foreground;
}
element-icon {
background-color: transparent;
text-color: inherit;
size: 32px;
cursor: inherit;
}
element-text {
background-color: transparent;
text-color: inherit;
cursor: inherit;
vertical-align: 0.5;
horizontal-align: 0.0;
}
/*****----- Message -----*****/
message {
background-color: transparent;
}
textbox {
padding: 12px;
border-radius: 100%;
background-color: @background-alt;
text-color: @foreground;
vertical-align: 0.5;
horizontal-align: 0.0;
}
error-message {
padding: 15px;
border-radius: 0px;
background-color: @background;
text-color: @foreground;
}
'';
xdg.configFile."rofi/launcher.rasi".text = ''
configuration {
modi: "drun,run,ssh,filebrowser,window";
terminal: "${pkgs.alacritty}/bin/alacritty";
show-icons: true;
display-drun: "";
display-run: "";
display-ssh: "";
drun-display-format: "{name}";
run-display-format: "{name}";
ssh-display-format: "{name}";
combi-display-format: "{mode} {name}";
combi-modi: "window,drun,run,filebrowser";
kb-mode-previous: "Control+h";
kb-mode-next: "Control+l";
kb-mode-complete: "";
kb-remove-char-back: "BackSpace,Shift+BackSpace";
}
'';
programs.rofi = {
enable = true;
package = pkgs.rofi-wayland;
terminal = "{pkgs.alacritty}/bin/alacritty";
theme = "launcher.rasi";
};
}

View file

@ -1,4 +1,4 @@
{pkgs, lib, ...}: {pkgs, lib, config, ...}:
let let
base = import ./../options.nix; base = import ./../options.nix;
@ -8,6 +8,8 @@ let
up = "k"; up = "k";
down = "j"; down = "j";
launcher = "${pkgs.rofi}/bin/rofi -config ${config.xdg.configHome}/rofi/launcher.rasi -theme ${config.xdg.dataHome}/rofi/themes/launcher.rasi -show drun -show-icons";
in { in {
wayland = { wayland = {
windowManager = { windowManager = {
@ -71,7 +73,7 @@ in {
"${mod}+Shift+Return" = "exec ${alacritty}/bin/alacritty"; "${mod}+Shift+Return" = "exec ${alacritty}/bin/alacritty";
"${mod}+q" = "kill"; "${mod}+q" = "kill";
"${mod}+p" = "exec ${pkgs.rofi}/bin/rofi -combi-modes window,drun,run -modes combi,ssh -show combi -show-icons"; "${mod}+p" = "exec ${launcher}";
"${mod}+Shift+e" = "exec ${pkgs.emacs}/bin/emacsclient -c -a ''"; "${mod}+Shift+e" = "exec ${pkgs.emacs}/bin/emacsclient -c -a ''";
"${mod}+Shift+b" = "exec ${pkgs.firefox}/bin/firefox"; "${mod}+Shift+b" = "exec ${pkgs.firefox}/bin/firefox";
"${mod}+Shift+c" = "reload"; "${mod}+Shift+c" = "reload";