Ricing rofi

This commit is contained in:
marc
2022-11-21 15:02:20 +01:00
parent ae6a2fafa3
commit 8617646685
10 changed files with 460 additions and 48 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

View File

@@ -0,0 +1,206 @@
/**
*
* Author : Marc Sastre, based on Aditya Shakya (adi1090x, Github : @adi1090x)
*
**/
/*****----- Configuration -----*****/
configuration {
modi: "drun,run,filebrowser,window";
show-icons: true;
display-drun: "APPS";
display-run: "RUN";
display-filebrowser: "FILES";
display-window: "WINDOW";
drun-display-format: "{name}";
window-format: "{w} · {c} · {t}";
}
/*****----- Global Properties -----*****/
* {
font: "Iosevka Nerd Font 10";
background: #2B6CB6;
background-alt: #498AD4;
foreground: #FFFFFF;
selected: #173B63;
active: #999999;
urgent: #808080;
}
/*****----- Main Window -----*****/
window {
/* properties for window widget */
transparency: "real";
location: center;
anchor: center;
fullscreen: false;
width: 1000px;
x-offset: 0px;
y-offset: 0px;
/* properties for all widgets */
enabled: true;
border-radius: 15px;
cursor: "default";
background-color: @background;
}
/*****----- Main Box -----*****/
mainbox {
enabled: true;
spacing: 0px;
background-color: transparent;
orientation: horizontal;
children: [ "imagebox", "listbox" ];
}
imagebox {
padding: 20px;
background-color: transparent;
background-image: url("~/.config/rofi/images/flor01.png", width);
orientation: vertical;
children: [ "inputbar", "dummy", "mode-switcher" ];
}
listbox {
spacing: 20px;
padding: 20px;
background-color: transparent;
orientation: vertical;
children: [ "message", "listview" ];
}
dummy {
background-color: transparent;
}
/*****----- Inputbar -----*****/
inputbar {
enabled: true;
spacing: 10px;
padding: 15px;
border-radius: 10px;
background-color: @background-alt;
text-color: @foreground;
children: [ "textbox-prompt-colon", "entry" ];
}
textbox-prompt-colon {
enabled: true;
expand: false;
str: "";
background-color: inherit;
text-color: inherit;
}
entry {
enabled: true;
background-color: inherit;
text-color: inherit;
cursor: text;
placeholder: "Search";
placeholder-color: inherit;
}
/*****----- Mode Switcher -----*****/
mode-switcher{
enabled: true;
spacing: 20px;
background-color: transparent;
text-color: @foreground;
}
button {
padding: 15px;
border-radius: 10px;
background-color: @background-alt;
text-color: inherit;
cursor: pointer;
}
button selected {
background-color: @selected;
text-color: @foreground;
}
/*****----- Listview -----*****/
listview {
enabled: true;
columns: 1;
lines: 8;
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: 15px;
padding: 8px;
border-radius: 10px;
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: 15px;
border-radius: 10px;
background-color: @background-alt;
text-color: @foreground;
vertical-align: 0.5;
horizontal-align: 0.0;
}
error-message {
padding: 15px;
border-radius: 20px;
background-color: @background;
text-color: @foreground;
}

View File

@@ -0,0 +1,10 @@
#!/usr/bin/env sh
## Author : Marc Sastre, based on Aditya Shakya (adi1090x, Github : @adi1090x)
## Rofi : Launcher
# Current Theme
dir="$HOME/.config/rofi/launcher/"
theme='launcher'
rofi -show drun -theme ${dir}/${theme}.rasi

View File

@@ -0,0 +1,124 @@
/**
*
* Author : Marc Sastre, based on Aditya Shakya (adi1090x, Github : @adi1090x)
*
**/
/*****----- Configuration -----*****/
configuration {
show-icons: false;
}
/*****----- Global Properties -----*****/
* {
font: "Iosevka Nerd Font 10";
background: #F18F01;
background-alt: #FEB548;
foreground: #444444;
selected: #A26201;
active: #FFCAB1;
urgent: #FFCAB1;
}
/*****----- Main Window -----*****/
window {
/* properties for window widget */
transparency: "real";
location: center;
anchor: center;
fullscreen: false;
width: 500px;
x-offset: 0px;
y-offset: 0px;
/* properties for all widgets */
enabled: true;
margin: 0px;
padding: 0px;
border: 0px solid;
border-radius: 20px;
border-color: @selected;
cursor: "default";
background-color: @background;
}
/*****----- Main Box -----*****/
mainbox {
enabled: true;
spacing: 15px;
margin: 0px;
padding: 30px;
border: 0px solid;
border-radius: 0px;
border-color: @selected;
background-color: transparent;
children: [ "listview" ];
}
message {
enabled: true;
margin: 0px;
padding: 10px;
border: 0px solid;
border-radius: 10px;
border-color: @selected;
background-color: @background-alt;
text-color: @foreground;
}
textbox {
background-color: inherit;
text-color: inherit;
vertical-align: 0.5;
horizontal-align: 0.0;
placeholder-color: @foreground;
blink: true;
markup: true;
}
/*****----- 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: 5px;
margin: 0px;
padding: 0px;
border: 0px solid;
border-radius: 0px;
border-color: @selected;
background-color: transparent;
text-color: @foreground;
cursor: "default";
}
/*****----- Elements -----*****/
element {
enabled: true;
spacing: 0px;
margin: 0px;
padding: 12px;
border: 0px solid;
border-radius: 100%;
border-color: @selected;
background-color: transparent;
text-color: @foreground;
cursor: pointer;
}
element-text {
background-color: transparent;
text-color: inherit;
cursor: inherit;
vertical-align: 0.5;
horizontal-align: 0.0;
}
element selected.normal {
background-color: var(selected);
text-color: var(background);
}

View File

@@ -0,0 +1,98 @@
#!/usr/bin/env sh
## Author : Marc Sastre, based on Aditya Shakya (adi1090x, Github : @adi1090x)
## Rofi : Power Menu
# Current Theme
dir="$HOME/.config/rofi/powermenu/"
theme='powermenu'
# CMDs
# Options
shutdown=' Shutdown'
reboot=' Reboot'
lock=' Lock'
suspend=' Suspend'
logout=' Logout'
yes='Yes'
no='No'
# Rofi CMD
rofi_cmd() {
rofi -dmenu \
-theme ${dir}/${theme}.rasi
}
# Confirmation CMD
confirm_cmd() {
rofi -theme-str 'window {location: center; anchor: center; fullscreen: false; width: 250px;}' \
-theme-str 'mainbox {children: [ "message", "listview" ];}' \
-theme-str 'listview {columns: 2; lines: 1;}' \
-theme-str 'element-text {horizontal-align: 0.5;}' \
-theme-str 'textbox {horizontal-align: 0.5;}' \
-dmenu \
-p 'Confirmation' \
-mesg 'Are you Sure?' \
-theme ${dir}/${theme}.rasi
}
# Ask for confirmation
confirm_exit() {
echo -e "$yes\n$no" | confirm_cmd
}
# Pass variables to rofi dmenu
run_rofi() {
echo -e "$lock\n$suspend\n$logout\n$reboot\n$shutdown" | rofi_cmd
}
# Execute Command
run_cmd() {
selected="$(confirm_exit)"
if [[ "$selected" == "$yes" ]]; then
if [[ $1 == '--shutdown' ]]; then
systemctl poweroff -i
elif [[ $1 == '--reboot' ]]; then
systemctl reboot
elif [[ $1 == '--suspend' ]]; then
systemctl suspend
elif [[ $1 == '--logout' ]]; then
if [[ "$DESKTOP_SESSION" == 'openbox' ]]; then
openbox --exit
elif [[ "$DESKTOP_SESSION" == 'bspwm' ]]; then
bspc quit
elif [[ "$DESKTOP_SESSION" == 'i3' ]]; then
i3-msg exit
elif [[ "$DESKTOP_SESSION" == 'plasma' ]]; then
qdbus org.kde.ksmserver /KSMServer logout 0 0 0
fi
fi
else
exit 0
fi
}
# Actions
chosen="$(run_rofi)"
case ${chosen} in
$shutdown)
run_cmd --shutdown
;;
$reboot)
run_cmd --reboot
;;
$lock)
if command -v i3lock-color; then
i3lock-color -c 808F85 && sleep 1
# elif command -v betterlockscreen; then
# betterlockscreen -l
fi
;;
$suspend)
run_cmd --suspend
;;
$logout)
run_cmd --logout
;;
esac

View File

@@ -2,6 +2,7 @@
let let
cfg = config.samfelag.modules.app.alacritty; cfg = config.samfelag.modules.app.alacritty;
i3Cfg = config.samfelag.modules.desktop.i3;
in in
{ {
options.samfelag.modules.app.alacritty = { options.samfelag.modules.app.alacritty = {
@@ -9,10 +10,16 @@ in
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
fonts.fontconfig.enable = true; fonts.fontconfig.enable = true;
hm.home.packages = with pkgs; [ hm.home.packages = with pkgs; [
alacritty alacritty
(nerdfonts.override { fonts = [ "Iosevka" ]; }) (nerdfonts.override { fonts = [ "Iosevka" ]; })
]; ];
hm.xdg.configFile."alacritty".source = ../../config/.config/alacritty; hm.xdg.configFile."alacritty".source = ../../config/.config/alacritty;
samfelag.modules.desktop.i3.extraKeybindings = lib.mkIf i3Cfg.enable {
"${i3Cfg.mod}+Return" = "exec ${pkgs.alacritty}/bin/alacritty";
};
}; };
} }

View File

@@ -61,14 +61,16 @@ in
desktop.i3 = { desktop.i3 = {
enable = true; enable = true;
laptop = cfg.laptop; laptop = cfg.laptop;
launcher = "${pkgs.rofi}/bin/rofi rofi -show run";
terminal = "${pkgs.alacritty}/bin/alacritty";
locker = "${pkgs.i3lock-blur}/bin/i3lock-color -c 808F85 && sleep 1";
extraStartup = [ extraStartup = [
{ command = "systemctl --user restart polybar"; always = true; notification = false; } { command = "systemctl --user restart polybar"; always = true; notification = false; }
{ command = "feh --bg-center -B \"${cfg.bgColour}\" -z --no-fehbg ${cfg.wallpapers}"; always = true; notification = false; } { command = "feh --bg-center -B \"${cfg.bgColour}\" -z --no-fehbg ${cfg.wallpapers}"; always = true; notification = false; }
]; ];
extraKeybindings = {
"${cfg.i3.mod}+space" = "exec $HOME/.config/rofi/launcher/launcher.sh";
"${cfg.i3.mod}+End" = "exec $HOME/.config/rofi/powermenu/powermenu.sh";
};
}; };
}; };

View File

@@ -3,9 +3,6 @@
let let
cfg = config.samfelag.modules.desktop.i3; cfg = config.samfelag.modules.desktop.i3;
mod = "Mod4"; mod = "Mod4";
system_mode = "System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown";
in { in {
options.samfelag.modules.desktop.i3 = with lib; { options.samfelag.modules.desktop.i3 = with lib; {
@@ -15,10 +12,6 @@ in {
laptop = mkEnableOption "Enable features for a laptop (trackpad, battery, etc...)"; laptop = mkEnableOption "Enable features for a laptop (trackpad, battery, etc...)";
launcher = mkOption { type = types.str; };
terminal = mkOption { type = types.str; };
locker = mkOption { type = types.str; };
extraKeybindings = my.mkOpt (types.attrsOf types.str) {}; extraKeybindings = my.mkOpt (types.attrsOf types.str) {};
extraStartup = my.mkOpt (types.listOf types.attrs) [ ]; extraStartup = my.mkOpt (types.listOf types.attrs) [ ];
@@ -110,18 +103,6 @@ in {
"Return" = "mode \"default\""; "Return" = "mode \"default\"";
"Escape" = "mode \"default\""; "Escape" = "mode \"default\"";
}; };
"${system_mode}" = {
"l" = "exec --no-startup-id ${cfg.locker}, mode \"default\"";
"e" = "exec --no-startup-id i3-msg exit, mode \"default\"";
"s" = "exec --no-startup-id ${cfg.locker} && systemctl suspend, mode \"default\"";
"h" = "exec --no-startup-id ${cfg.locker} && systemctl hibernate, mode \"default\"";
"r" = "exec --no-startup-id systemctl reboot, mode \"default\"";
"Shift+s" = "exec --no-startup-id systemctl poweroff -i, mode \"default\"";
"Return" = "mode \"default\"";
"Escape" = "mode \"default\"";
};
}; };
keybindings = { keybindings = {
@@ -171,7 +152,6 @@ in {
# - Modes ------------------------------ # - Modes ------------------------------
"${mod}+r" = "mode \"resize\""; "${mod}+r" = "mode \"resize\"";
"${mod}+End" = "mode \"${system_mode}\"";
# - Media ------------------------------ # - Media ------------------------------
@@ -211,9 +191,6 @@ in {
"${mod}+Shift+8" = "move container to workspace 8; workspace 8"; "${mod}+Shift+8" = "move container to workspace 8; workspace 8";
"${mod}+Shift+9" = "move container to workspace 9; workspace 9"; "${mod}+Shift+9" = "move container to workspace 9; workspace 9";
"${mod}+Shift+0" = "move container to workspace 10; workspace 10"; "${mod}+Shift+0" = "move container to workspace 10; workspace 10";
"${mod}+Return" = "exec ${cfg.terminal}";
"${mod}+space" = "exec ${cfg.launcher}";
} // cfg.extraKeybindings; } // cfg.extraKeybindings;
}; };
}; };

View File

@@ -11,5 +11,7 @@ in
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
rofi rofi
]; ];
hm.xdg.configFile."rofi".source = ../../config/.config/rofi;
}; };
} }

View File

@@ -4,8 +4,10 @@ with lib;
let let
cfg = config.samfelag.modules.editors.emacs; cfg = config.samfelag.modules.editors.emacs;
i3Cfg = config.samfelag.modules.desktop.i3; i3Cfg = config.samfelag.modules.desktop.i3;
emacsWithPackages = with pkgs; ((emacsPackagesFor emacsNativeComp).emacsWithPackages emacsPackages = epkgs: [
(epkgs: [epkgs.vterm])); epkgs.vterm
];
emacsWithPackages = with pkgs; ((emacsPackagesFor emacsNativeComp).emacsWithPackages emacsPackages);
in { in {
options.samfelag.modules.editors.emacs = { options.samfelag.modules.editors.emacs = {
enable = mkEnableOption "emacs"; enable = mkEnableOption "emacs";
@@ -14,25 +16,6 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
nixpkgs.overlays = [ inputs.emacs-overlay.overlay ]; nixpkgs.overlays = [ inputs.emacs-overlay.overlay ];
# home.file.doom-emacs = {
# source = ./doom-emacs;
# target = ".config/doom";
# recursive = true;
# # onChange = "doom upgrade";
# };
# home.programs.emacs = {
# enable = true;
# # package = pkgs.emacsPgtkGcc;
# extraPackages = epkgs: [ epkgs.vterm ];
# };
# home.services.emacs = {
# enable = true;
# client.enable = true;
# socketActivation.enable = true;
# };
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
## Emacs itself ## Emacs itself
binutils binutils
@@ -97,7 +80,10 @@ in {
env.PATH = [ "$HOME/.config/emacs/bin" ]; env.PATH = [ "$HOME/.config/emacs/bin" ];
home-manager.users.marc.xdg.configFile."doom".source = ../../config/doom; hm.xdg.configFile."doom" = {
source = ../../config/doom;
recursive = true;
};
system.userActivationScripts = { system.userActivationScripts = {
installDoomEmacs = '' installDoomEmacs = ''