From d388d2192ac5a55353e0f7ee4cbb4f23bed24514 Mon Sep 17 00:00:00 2001 From: marc Date: Sun, 1 Jun 2025 22:57:57 +0200 Subject: [PATCH] Added cliphist and changed starship config --- config/rofi/menus/cliphist/cliphist.rasi | 147 +++++++++++++++++++++++ config/rofi/menus/cliphist/cliphist.sh | 12 ++ modules/desktop/grapheio.nix | 2 + modules/desktop/tools/cliphist.nix | 36 ++++++ modules/shell/starship.nix | 10 +- 5 files changed, 202 insertions(+), 5 deletions(-) create mode 100755 config/rofi/menus/cliphist/cliphist.rasi create mode 100755 config/rofi/menus/cliphist/cliphist.sh create mode 100644 modules/desktop/tools/cliphist.nix diff --git a/config/rofi/menus/cliphist/cliphist.rasi b/config/rofi/menus/cliphist/cliphist.rasi new file mode 100755 index 0000000..0d578b5 --- /dev/null +++ b/config/rofi/menus/cliphist/cliphist.rasi @@ -0,0 +1,147 @@ +/** + * + * Author : Marc Sastre, based on Aditya Shakya (adi1090x, Github : @adi1090x) + * + **/ + +@import "~/.config/rofi/theme.rasi" + +/*****----- Configuration -----*****/ +configuration { + show-icons: false; +} + +/*****----- Main Window -----*****/ +window { + /* properties for window widget */ + transparency: "real"; + location: center; + anchor: center; + fullscreen: false; + width: 800px; + x-offset: 0px; + y-offset: 0px; + + /* properties for all widgets */ + enabled: true; + margin: 0px; + padding: 0px; + border: 2px solid; + border-radius: 15px; + border-color: @background-alt; + 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: [ "inputbar", "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; +} + +/*****----- 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; +} + +/*****----- 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); +} +element active { + background-color: var(active); + text-color: var(background); +} +element selected.active { + background-color: var(selected); + text-color: var(background); +} diff --git a/config/rofi/menus/cliphist/cliphist.sh b/config/rofi/menus/cliphist/cliphist.sh new file mode 100755 index 0000000..4294b13 --- /dev/null +++ b/config/rofi/menus/cliphist/cliphist.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +# For debugging/development purposes +# PREFIX=projects/samfelag/config/ + +# Rofi command to pipe into, can add any options here +dir="$HOME/$PREFIX.config/rofi/menus/cliphist/" +theme='cliphist' + +rofi_command="rofi -dmenu -i -theme ${dir}/${theme}.rasi" + +cliphist list | $rofi_command | cliphist decode | wl-copy diff --git a/modules/desktop/grapheio.nix b/modules/desktop/grapheio.nix index c1786de..6a5e6fb 100644 --- a/modules/desktop/grapheio.nix +++ b/modules/desktop/grapheio.nix @@ -113,6 +113,8 @@ in rofi.enable = true; # Notification center swaync.enable = true; + # Clipboard manager (history) + cliphist.enable = true; }; }; diff --git a/modules/desktop/tools/cliphist.nix b/modules/desktop/tools/cliphist.nix new file mode 100644 index 0000000..64b56c3 --- /dev/null +++ b/modules/desktop/tools/cliphist.nix @@ -0,0 +1,36 @@ +{ config, lib, pkgs, inputs, ... }: + +with lib; +let + cfg = config.samfelag.modules.desktop.tools.cliphist; + hyprCfg = config.samfelag.modules.desktop.wm.hyprland; + rofiCfg = config.samfelag.modules.desktop.tools.rofi; +in +{ + options.samfelag.modules.desktop.tools.cliphist = { + enable = mkEnableOption "Clipboard history"; + }; + + config = mkIf cfg.enable { + + # - Clipboard manager ------------------------ + hm.services.cliphist = { + enable = true; + extraOptions = [ + "-max-dedupe-search" + "10" + "-max-items" + "500" + ]; + }; + + # - Hyprland keybindings --------------------- + hm.wayland.windowManager.hyprland.settings = lib.mkIf (hyprCfg.enable && rofiCfg.enable) { + bind = [ + # Clipboard manager + "${hyprCfg.mod}, v, exec, $HOME/.config/rofi/menus/cliphist/cliphist.sh" + ]; + }; + + }; +} diff --git a/modules/shell/starship.nix b/modules/shell/starship.nix index 3d59413..1260d41 100644 --- a/modules/shell/starship.nix +++ b/modules/shell/starship.nix @@ -13,12 +13,12 @@ in settings = { add_newline = false; - # character = { - # success_symbol = "[➜](bold green)"; - # error_symbol = "[➜](bold red)"; - # }; + # Prompt on the right + right_format = "$time"; + time.disabled = false; - # package.disabled = true; + # Status: Show error code of failed commands + status.disabled = false; }; }; };