diff --git a/config/.config/rofi/images/flor01.png b/config/.config/rofi/images/flor01.png new file mode 100644 index 0000000..6dfd601 Binary files /dev/null and b/config/.config/rofi/images/flor01.png differ diff --git a/config/.config/rofi/launcher/launcher.rasi b/config/.config/rofi/launcher/launcher.rasi new file mode 100644 index 0000000..0342797 --- /dev/null +++ b/config/.config/rofi/launcher/launcher.rasi @@ -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; +} diff --git a/config/.config/rofi/launcher/launcher.sh b/config/.config/rofi/launcher/launcher.sh new file mode 100755 index 0000000..4830549 --- /dev/null +++ b/config/.config/rofi/launcher/launcher.sh @@ -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 diff --git a/config/.config/rofi/powermenu/powermenu.rasi b/config/.config/rofi/powermenu/powermenu.rasi new file mode 100644 index 0000000..5293525 --- /dev/null +++ b/config/.config/rofi/powermenu/powermenu.rasi @@ -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); +} diff --git a/config/.config/rofi/powermenu/powermenu.sh b/config/.config/rofi/powermenu/powermenu.sh new file mode 100755 index 0000000..3c894d2 --- /dev/null +++ b/config/.config/rofi/powermenu/powermenu.sh @@ -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 diff --git a/modules/app/alacritty.nix b/modules/app/alacritty.nix index 2a29476..2fa4f43 100644 --- a/modules/app/alacritty.nix +++ b/modules/app/alacritty.nix @@ -2,6 +2,7 @@ let cfg = config.samfelag.modules.app.alacritty; + i3Cfg = config.samfelag.modules.desktop.i3; in { options.samfelag.modules.app.alacritty = { @@ -9,10 +10,16 @@ in }; config = lib.mkIf cfg.enable { fonts.fontconfig.enable = true; + hm.home.packages = with pkgs; [ alacritty (nerdfonts.override { fonts = [ "Iosevka" ]; }) ]; + 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"; + }; }; } diff --git a/modules/desktop/desktop.nix b/modules/desktop/desktop.nix index 2f49713..f5d4c47 100644 --- a/modules/desktop/desktop.nix +++ b/modules/desktop/desktop.nix @@ -61,14 +61,16 @@ in desktop.i3 = { enable = true; 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 = [ { 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; } ]; + + extraKeybindings = { + "${cfg.i3.mod}+space" = "exec $HOME/.config/rofi/launcher/launcher.sh"; + "${cfg.i3.mod}+End" = "exec $HOME/.config/rofi/powermenu/powermenu.sh"; + }; }; }; diff --git a/modules/desktop/i3.nix b/modules/desktop/i3.nix index 0d04e60..e700a4a 100644 --- a/modules/desktop/i3.nix +++ b/modules/desktop/i3.nix @@ -3,9 +3,6 @@ let cfg = config.samfelag.modules.desktop.i3; mod = "Mod4"; - - system_mode = "System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown"; - in { options.samfelag.modules.desktop.i3 = with lib; { @@ -15,10 +12,6 @@ in { 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) {}; extraStartup = my.mkOpt (types.listOf types.attrs) [ ]; @@ -110,18 +103,6 @@ in { "Return" = "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 = { @@ -171,7 +152,6 @@ in { # - Modes ------------------------------ "${mod}+r" = "mode \"resize\""; - "${mod}+End" = "mode \"${system_mode}\""; # - Media ------------------------------ @@ -211,9 +191,6 @@ in { "${mod}+Shift+8" = "move container to workspace 8; workspace 8"; "${mod}+Shift+9" = "move container to workspace 9; workspace 9"; "${mod}+Shift+0" = "move container to workspace 10; workspace 10"; - - "${mod}+Return" = "exec ${cfg.terminal}"; - "${mod}+space" = "exec ${cfg.launcher}"; } // cfg.extraKeybindings; }; }; diff --git a/modules/desktop/rofi.nix b/modules/desktop/rofi.nix index 08402bc..0463894 100644 --- a/modules/desktop/rofi.nix +++ b/modules/desktop/rofi.nix @@ -11,5 +11,7 @@ in environment.systemPackages = with pkgs; [ rofi ]; + + hm.xdg.configFile."rofi".source = ../../config/.config/rofi; }; } diff --git a/modules/editors/emacs.nix b/modules/editors/emacs.nix index 10bf5fd..113649c 100644 --- a/modules/editors/emacs.nix +++ b/modules/editors/emacs.nix @@ -4,8 +4,10 @@ with lib; let cfg = config.samfelag.modules.editors.emacs; i3Cfg = config.samfelag.modules.desktop.i3; - emacsWithPackages = with pkgs; ((emacsPackagesFor emacsNativeComp).emacsWithPackages - (epkgs: [epkgs.vterm])); + emacsPackages = epkgs: [ + epkgs.vterm + ]; + emacsWithPackages = with pkgs; ((emacsPackagesFor emacsNativeComp).emacsWithPackages emacsPackages); in { options.samfelag.modules.editors.emacs = { enable = mkEnableOption "emacs"; @@ -14,25 +16,6 @@ in { config = mkIf cfg.enable { 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; [ ## Emacs itself binutils @@ -97,7 +80,10 @@ in { 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 = { installDoomEmacs = ''