From 47a9be50bde5f6304d6715f9a009b3a93d97174f Mon Sep 17 00:00:00 2001 From: Sunderland93 Date: Sat, 25 Nov 2023 18:21:15 +0400 Subject: [PATCH] Add initial clipboard widget --- etc/skel/.config/qtile/config.py | 49 ++++++++++++++++++---------- usr/share/qtile/scripts/clipboard.sh | 6 ++++ 2 files changed, 37 insertions(+), 18 deletions(-) create mode 100755 usr/share/qtile/scripts/clipboard.sh diff --git a/etc/skel/.config/qtile/config.py b/etc/skel/.config/qtile/config.py index 111b514..ea8332c 100644 --- a/etc/skel/.config/qtile/config.py +++ b/etc/skel/.config/qtile/config.py @@ -164,7 +164,7 @@ screens = [ widget.StatusNotifier( decorations=[ BorderDecoration( - colour = colors[5], + colour = colors[1], border_width = [0, 0, 2, 0], ) ], @@ -173,10 +173,10 @@ screens = [ widget.Mpris2( playing_text = "", stop_pause_text = "", - foreground = colors[6], + foreground = colors[2], decorations=[ BorderDecoration( - colour = colors[6], + colour = colors[2], border_width = [0, 0, 2, 0], ) ], @@ -189,21 +189,34 @@ screens = [ font = "Noto Sans", fontsize = "14", fmt = '⌨ {}', - foreground = colors[7], + foreground = colors[3], decorations=[ BorderDecoration( - colour = colors[7], + colour = colors[3], border_width = [0, 0, 2, 0], ) ], ), widget.Spacer(length = 8), - widget.CPU( - format = ' {load_percent:.1f}%', - foreground = colors[8], + # Custom clipboard manager widget, based on Cliphist + widget.TextBox( + text="", + foreground = colors[4], decorations=[ BorderDecoration( - colour = colors[8], + colour = colors[4], + border_width = [0, 0, 2, 0], + ) + ], + mouse_callbacks={"Button1": lambda: qtile.cmd_spawn("/usr/share/qtile/scripts/clipboard.sh --list")}, + ), + widget.Spacer(length = 8), + widget.CPU( + format = ' {load_percent:.1f}%', + foreground = colors[5], + decorations=[ + BorderDecoration( + colour = colors[5], border_width = [0, 0, 2, 0], ) ], @@ -213,10 +226,10 @@ screens = [ widget.Memory( format = " {MemUsed:.1f}/{MemTotal:.1f} GiB", measure_mem='G', - foreground = colors[9], + foreground = colors[6], decorations=[ BorderDecoration( - colour = colors[9], + colour = colors[6], border_width = [0, 0, 2, 0], ) ], @@ -226,10 +239,10 @@ screens = [ widget.Net( prefix="M", format=' {down:.0f}{down_suffix} ↓↑ {up:.0f}{up_suffix}', - foreground = colors[10], + foreground = colors[7], decorations=[ BorderDecoration( - colour = colors[10], + colour = colors[7], border_width = [0, 0, 2, 0], ) ], @@ -237,11 +250,11 @@ screens = [ ), widget.Spacer(length = 8), widget.Volume( - foreground = colors[11], + foreground = colors[8], fmt = '🔉 {}', decorations=[ BorderDecoration( - colour = colors[11], + colour = colors[8], border_width = [0, 0, 2, 0], ) ], @@ -250,10 +263,10 @@ screens = [ widget.Spacer(length = 8), widget.Clock( format="%d %b %H:%M", - foreground = colors[12], + foreground = colors[9], decorations=[ BorderDecoration( - colour = colors[12], + colour = colors[9], border_width = [0, 0, 2, 0], ) ], @@ -265,7 +278,7 @@ screens = [ margin = 6, decorations=[ BorderDecoration( - colour = colors[13], + colour = colors[10], border_width = [0, 0, 2, 0], ) ], diff --git a/usr/share/qtile/scripts/clipboard.sh b/usr/share/qtile/scripts/clipboard.sh new file mode 100755 index 0000000..219900d --- /dev/null +++ b/usr/share/qtile/scripts/clipboard.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +case "$1" in + --list) cliphist list | rofi -dmenu -p "Select item to copy:" -lines 10 -width 35 | cliphist decode | wl-copy;; + --del) cliphist list | rofi -dmenu -p "Select item to delete:" -lines 10 -width 35 | cliphist delete;; +esac