init
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
/**
|
||||
* @author Dominik Kressler
|
||||
* @package rofi-archer
|
||||
* @version 1.0.0
|
||||
**/
|
||||
|
||||
* {
|
||||
background: {@theme_bg_color};
|
||||
background-alt: {@theme_unfocused_fg_color}80;
|
||||
|
||||
|
||||
|
||||
foreground: {@theme_text_color};
|
||||
selected: #4c566a;
|
||||
border: {@borders};
|
||||
active: #98C37988;
|
||||
urgent: var(error-color);
|
||||
|
||||
|
||||
|
||||
/*https://catppuccin.ryanccn.dev/palette*/
|
||||
rosewater: #f5e0dc;
|
||||
flamingo: #f2cdcd;
|
||||
pink: #f5c2e7;
|
||||
mauve: #cba6f7;
|
||||
red: #f38ba8;
|
||||
maroon: #eba0ac;
|
||||
peach: #fab387;
|
||||
yellow: #f9e2af;
|
||||
green: #a6e3a1;
|
||||
teal: #94e2d5;
|
||||
sky: #89dceb;
|
||||
sapphire: #74c7ec;
|
||||
blue: #89b4fa;
|
||||
lavender: #b4befe;
|
||||
|
||||
text: {@theme_text_color};
|
||||
subtext1: {@theme_text_color}80;
|
||||
subtext0: #a6adc8;
|
||||
|
||||
overlay0: #6c7086;
|
||||
overlay1: #7f849c;
|
||||
overlay2: #9399b2;
|
||||
|
||||
surface0: #313244;
|
||||
surface1: #45475a;
|
||||
surface2: #585b70;
|
||||
|
||||
base: #1e1e2e;
|
||||
mantle: #181825;
|
||||
crust: #11111b;
|
||||
|
||||
|
||||
|
||||
/* GTK THEME VARS*/
|
||||
theme-fg-color: {@theme_fg_color};
|
||||
theme-text-color: {@theme_text_color};
|
||||
theme-bg-color: {@theme_bg_color};
|
||||
theme-base-color: {@theme_base_color};
|
||||
|
||||
theme-bg-color-shade-1: {@theme_bg_color}EF;
|
||||
theme-bg-color-shade-2: {@theme_bg_color}D8;
|
||||
theme-bg-color-shade-3: {@theme_bg_color}C9;
|
||||
|
||||
theme-selected-bg-color: {@theme_selected_bg_color};
|
||||
theme-selected-fg-color: {@theme_selected_fg_color};
|
||||
|
||||
theme-unfocused-fg-color: {@theme_unfocused_fg_color};
|
||||
theme-unfocused-text-color: {@theme_unfocused_text_color};
|
||||
theme-unfocused-bg-color: {@theme_unfocused_bg_color};
|
||||
theme-unfocused-base-color: {@theme_unfocused_base_color};
|
||||
theme-unfocused-selected-bg-color: {@theme_unfocused_selected_bg_color};
|
||||
theme-unfocused-selected-fg-color: {@theme_unfocused_selected_fg_color};
|
||||
unfocused-insensitive-color: {@unfocused_insensitive_color};
|
||||
|
||||
borders: {@theme_selected_bg_color}30;
|
||||
unfocused-borders: {@unfocused_borders};
|
||||
|
||||
warning-color: {@warning_color};
|
||||
error-color: {@error_color};
|
||||
success-color: {@success_color};
|
||||
}
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/bash
|
||||
# choose pulseaudio sink via rofi or dmenu
|
||||
# changes default sink and moves all streams to that sink
|
||||
#https://gist.github.com/Nervengift/844a597104631c36513c?permalink_comment_id=1826282
|
||||
|
||||
sink=$(ponymix -t sink list|awk '/^sink/ {s=$1" "$2;getline;gsub(/^ +/,"",$0);print s" "$0}'|rofi -dmenu -theme '~/.config/rofi/volume/volume.rasi' -mesg ' Sink Switcher' -p 'pulseaudio sink:' -location 6 -width 100|grep -Po '[0-9]+(?=:)') &&
|
||||
|
||||
|
||||
ponymix set-default -d $sink &&
|
||||
for input in $(ponymix list -t sink-input|grep -Po '[0-9]+(?=:)');do
|
||||
echo "$input -> $sink"
|
||||
ponymix -t sink-input -d $input move $sink
|
||||
done
|
||||
@@ -0,0 +1,295 @@
|
||||
/**
|
||||
*
|
||||
* Author : Aditya Shakya (adi1090x)
|
||||
* Github : @adi1090x
|
||||
*
|
||||
* Rofi Theme File
|
||||
* Rofi Version: 1.7.3
|
||||
**/
|
||||
|
||||
/*****----- Configuration -----*****/
|
||||
configuration {
|
||||
modi: "";
|
||||
show-icons: false;
|
||||
drun-display-format: "{name}";
|
||||
window-format: "{w} · {c} · {t}";
|
||||
}
|
||||
|
||||
/*****----- Global Properties -----*****/
|
||||
@import "../colors.rasi"
|
||||
@import "../fonts.rasi"
|
||||
|
||||
* {
|
||||
border-colour: var(border);
|
||||
handle-colour: var(selected);
|
||||
background-colour: var(background);
|
||||
foreground-colour: var(foreground);
|
||||
alternate-background: var(background-alt);
|
||||
normal-background: var(background);
|
||||
normal-foreground: var(foreground);
|
||||
urgent-background: var(urgent);
|
||||
urgent-foreground: var(background);
|
||||
active-background: var(active);
|
||||
active-foreground: var(background);
|
||||
selected-normal-background: var(selected);
|
||||
selected-normal-foreground: var(background);
|
||||
selected-urgent-background: var(active);
|
||||
selected-urgent-foreground: var(background);
|
||||
selected-active-background: var(urgent);
|
||||
selected-active-foreground: var(background);
|
||||
alternate-normal-background: var(background);
|
||||
alternate-normal-foreground: var(foreground);
|
||||
alternate-urgent-background: var(urgent);
|
||||
alternate-urgent-foreground: var(background);
|
||||
alternate-active-background: var(active);
|
||||
alternate-active-foreground: var(background);
|
||||
}
|
||||
|
||||
/*****----- Main Window -----*****/
|
||||
window {
|
||||
/* properties for window widget */
|
||||
transparency: "real";
|
||||
location: center;
|
||||
anchor: center;
|
||||
fullscreen: false;
|
||||
width: 600px;
|
||||
x-offset: 0px;
|
||||
y-offset: 0px;
|
||||
|
||||
/* properties for all widgets */
|
||||
enabled: true;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 1px solid;
|
||||
border-radius: 10px;
|
||||
border-color: @border-colour;
|
||||
cursor: "default";
|
||||
/* Backgroud Colors */
|
||||
background-color: @background-colour;
|
||||
/* Backgroud Image */
|
||||
//background-image: url("/path/to/image.png", none);
|
||||
/* Simple Linear Gradient */
|
||||
//background-image: linear-gradient(red, orange, pink, purple);
|
||||
/* Directional Linear Gradient */
|
||||
//background-image: linear-gradient(to bottom, pink, yellow, magenta);
|
||||
/* Angle Linear Gradient */
|
||||
//background-image: linear-gradient(45, cyan, purple, indigo);
|
||||
}
|
||||
|
||||
/*****----- Main Box -----*****/
|
||||
mainbox {
|
||||
enabled: true;
|
||||
spacing: 10px;
|
||||
margin: 0px;
|
||||
padding: 30px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px 0px 0px 0px;
|
||||
border-color: @border-colour;
|
||||
background-color: transparent;
|
||||
children: [ "message", "listview", "inputbar" ];
|
||||
}
|
||||
|
||||
/*****----- Inputbar -----*****/
|
||||
inputbar {
|
||||
enabled: false;
|
||||
spacing: 10px;
|
||||
margin: 0;
|
||||
padding: 20px 0px 0;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @border-colour;
|
||||
background-color: transparent;
|
||||
text-color: @foreground-colour;
|
||||
children: [ "textbox-prompt-colon", "entry", "mode-switcher" ];
|
||||
}
|
||||
|
||||
prompt {
|
||||
enabled: true;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
textbox-prompt-colon {
|
||||
enabled: true;
|
||||
padding: 5px 0px 0px 15px;
|
||||
expand: false;
|
||||
font: "MonarchOS 14";
|
||||
str: "";
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
entry {
|
||||
enabled: true;
|
||||
padding: 5px 0px;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
cursor: text;
|
||||
placeholder: "...";
|
||||
placeholder-color: inherit;
|
||||
}
|
||||
num-filtered-rows {
|
||||
enabled: true;
|
||||
expand: false;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
textbox-num-sep {
|
||||
enabled: true;
|
||||
expand: false;
|
||||
str: "/";
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
num-rows {
|
||||
enabled: true;
|
||||
expand: false;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
case-indicator {
|
||||
enabled: true;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
|
||||
/*****----- 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: 5px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @border-colour;
|
||||
background-color: transparent;
|
||||
text-color: @foreground-colour;
|
||||
cursor: "default";
|
||||
}
|
||||
scrollbar {
|
||||
handle-width: 5px;
|
||||
handle-color: @handle-colour;
|
||||
border-radius: 10px;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
/*****----- Elements -----*****/
|
||||
element {
|
||||
enabled: true;
|
||||
spacing: 10px;
|
||||
margin: 0px;
|
||||
padding: 5px 10px;
|
||||
border: 0px solid;
|
||||
border-radius: 10px;
|
||||
border-color: @border-colour;
|
||||
background-color: transparent;
|
||||
text-color: @foreground-colour;
|
||||
cursor: pointer;
|
||||
}
|
||||
element normal.normal {
|
||||
background-color: transparent;
|
||||
text-color: var(normal-foreground);
|
||||
}
|
||||
element normal.urgent {
|
||||
background-color: var(urgent-background);
|
||||
text-color: var(urgent-foreground);
|
||||
}
|
||||
element normal.active {
|
||||
background-color: var(normal-foreground);
|
||||
text-color: var(normal-background);
|
||||
}
|
||||
element selected.normal {
|
||||
background-color: var(selected-normal-background);
|
||||
text-color: var(normal-foreground);
|
||||
}
|
||||
element selected.urgent {
|
||||
background-color: var(selected-urgent-background);
|
||||
text-color: var(normal-background);
|
||||
}
|
||||
element selected.active {
|
||||
background-color: var(selected-active-background);
|
||||
text-color: var(normal-background);
|
||||
}
|
||||
|
||||
element-icon {
|
||||
background-color: transparent;
|
||||
text-color: inherit;
|
||||
size: 24px;
|
||||
cursor: inherit;
|
||||
}
|
||||
element-text {
|
||||
background-color: transparent;
|
||||
text-color: inherit;
|
||||
highlight: inherit;
|
||||
cursor: inherit;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.0;
|
||||
}
|
||||
|
||||
/*****----- Mode Switcher -----*****/
|
||||
mode-switcher{
|
||||
enabled: true;
|
||||
spacing: 10px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @border-colour;
|
||||
background-color: transparent;
|
||||
text-color: @foreground-colour;
|
||||
}
|
||||
button {
|
||||
padding: 7px 15px 7px 10px;
|
||||
border: 0px solid;
|
||||
border-radius: 100%;
|
||||
border-color: @border-colour;
|
||||
background-color: @alternate-background;
|
||||
text-color: inherit;
|
||||
cursor: pointer;
|
||||
}
|
||||
button selected {
|
||||
background-color: var(selected-normal-background);
|
||||
text-color: var(selected-normal-foreground);
|
||||
}
|
||||
|
||||
/*****----- Message -----*****/
|
||||
message {
|
||||
enabled: true;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px 0px 0px 0px;
|
||||
border-color: @border-colour;
|
||||
background-color: transparent;
|
||||
text-color: @foreground-colour;
|
||||
}
|
||||
textbox {
|
||||
padding: 8px 10px;
|
||||
border: 0px solid;
|
||||
border-radius: 10px;
|
||||
border-color: @border-colour;
|
||||
background-color: @alternate-background;
|
||||
text-color: @foreground-colour;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.0;
|
||||
highlight: none;
|
||||
placeholder-color: @foreground-colour;
|
||||
blink: true;
|
||||
markup: true;
|
||||
}
|
||||
error-message {
|
||||
padding: 10px;
|
||||
border: 2px solid;
|
||||
border-radius: 10px;
|
||||
border-color: @border-colour;
|
||||
background-color: @background-colour;
|
||||
text-color: @foreground-colour;
|
||||
}
|
||||
Executable
+317
@@ -0,0 +1,317 @@
|
||||
#!/usr/bin/env bash
|
||||
# __ _ _ _ _ _ _
|
||||
# _ __ ___ / _(_) | |__ | |_ _ ___| |_ ___ ___ | |_| |__
|
||||
# | '__/ _ \| |_| |_____| '_ \| | | | |/ _ \ __/ _ \ / _ \| __| '_ \
|
||||
# | | | (_) | _| |_____| |_) | | |_| | __/ || (_) | (_) | |_| | | |
|
||||
# |_| \___/|_| |_| |_.__/|_|\__,_|\___|\__\___/ \___/ \__|_| |_|
|
||||
#
|
||||
# Author: Nick Clyde (clydedroid)
|
||||
#
|
||||
# A script that generates a rofi menu that uses bluetoothctl to
|
||||
# connect to bluetooth devices and display status info.
|
||||
#
|
||||
# Inspired by networkmanager-dmenu (https://github.com/firecat53/networkmanager-dmenu)
|
||||
# Thanks to x70b1 (https://github.com/polybar/polybar-scripts/tree/master/polybar-scripts/system-bluetooth-bluetoothctl)
|
||||
#
|
||||
# Depends on:
|
||||
# Arch repositories: rofi, bluez-utils (contains bluetoothctl)
|
||||
|
||||
# Constants
|
||||
divider="---------"
|
||||
goback="Back"
|
||||
|
||||
# Checks if bluetooth controller is powered on
|
||||
power_on() {
|
||||
if bluetoothctl show | grep -q "Powered: yes"; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggles power state
|
||||
toggle_power() {
|
||||
if power_on; then
|
||||
bluetoothctl power off
|
||||
show_menu
|
||||
else
|
||||
if rfkill list bluetooth | grep -q 'blocked: yes'; then
|
||||
rfkill unblock bluetooth && sleep 3
|
||||
fi
|
||||
bluetoothctl power on
|
||||
show_menu
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks if controller is scanning for new devices
|
||||
scan_on() {
|
||||
if bluetoothctl show | grep -q "Discovering: yes"; then
|
||||
echo "Scan: on"
|
||||
return 0
|
||||
else
|
||||
echo "Scan: off"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggles scanning state
|
||||
toggle_scan() {
|
||||
if scan_on; then
|
||||
kill $(pgrep -f "bluetoothctl scan on")
|
||||
bluetoothctl scan off
|
||||
show_menu
|
||||
else
|
||||
bluetoothctl scan on &
|
||||
echo "Scanning..."
|
||||
sleep 5
|
||||
show_menu
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks if controller is able to pair to devices
|
||||
pairable_on() {
|
||||
if bluetoothctl show | grep -q "Pairable: yes"; then
|
||||
echo "Pairable: on"
|
||||
return 0
|
||||
else
|
||||
echo "Pairable: off"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggles pairable state
|
||||
toggle_pairable() {
|
||||
if pairable_on; then
|
||||
bluetoothctl pairable off
|
||||
show_menu
|
||||
else
|
||||
bluetoothctl pairable on
|
||||
show_menu
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks if controller is discoverable by other devices
|
||||
discoverable_on() {
|
||||
if bluetoothctl show | grep -q "Discoverable: yes"; then
|
||||
echo "Discoverable: on"
|
||||
return 0
|
||||
else
|
||||
echo "Discoverable: off"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggles discoverable state
|
||||
toggle_discoverable() {
|
||||
if discoverable_on; then
|
||||
bluetoothctl discoverable off
|
||||
show_menu
|
||||
else
|
||||
bluetoothctl discoverable on
|
||||
show_menu
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks if a device is connected
|
||||
device_connected() {
|
||||
device_info=$(bluetoothctl info "$1")
|
||||
if echo "$device_info" | grep -q "Connected: yes"; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggles device connection
|
||||
toggle_connection() {
|
||||
if device_connected "$1"; then
|
||||
bluetoothctl disconnect "$1"
|
||||
device_menu "$device"
|
||||
else
|
||||
bluetoothctl connect "$1"
|
||||
device_menu "$device"
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks if a device is paired
|
||||
device_paired() {
|
||||
device_info=$(bluetoothctl info "$1")
|
||||
if echo "$device_info" | grep -q "Paired: yes"; then
|
||||
echo "Paired: yes"
|
||||
return 0
|
||||
else
|
||||
echo "Paired: no"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggles device paired state
|
||||
toggle_paired() {
|
||||
if device_paired "$1"; then
|
||||
bluetoothctl remove "$1"
|
||||
device_menu "$device"
|
||||
else
|
||||
bluetoothctl pair "$1"
|
||||
device_menu "$device"
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks if a device is trusted
|
||||
device_trusted() {
|
||||
device_info=$(bluetoothctl info "$1")
|
||||
if echo "$device_info" | grep -q "Trusted: yes"; then
|
||||
echo "Trusted: yes"
|
||||
return 0
|
||||
else
|
||||
echo "Trusted: no"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Toggles device connection
|
||||
toggle_trust() {
|
||||
if device_trusted "$1"; then
|
||||
bluetoothctl untrust "$1"
|
||||
device_menu "$device"
|
||||
else
|
||||
bluetoothctl trust "$1"
|
||||
device_menu "$device"
|
||||
fi
|
||||
}
|
||||
|
||||
# Prints a short string with the current bluetooth status
|
||||
# Useful for status bars like polybar, etc.
|
||||
print_status() {
|
||||
if power_on; then
|
||||
printf ''
|
||||
|
||||
paired_devices_cmd="devices Paired"
|
||||
# Check if an outdated version of bluetoothctl is used to preserve backwards compatibility
|
||||
if (( $(echo "$(bluetoothctl version | cut -d ' ' -f 2) < 5.65" | bc -l) )); then
|
||||
paired_devices_cmd="paired-devices"
|
||||
fi
|
||||
|
||||
mapfile -t paired_devices < <(bluetoothctl $paired_devices_cmd | grep Device | cut -d ' ' -f 2)
|
||||
counter=0
|
||||
|
||||
for device in "${paired_devices[@]}"; do
|
||||
if device_connected "$device"; then
|
||||
device_alias=$(bluetoothctl info "$device" | grep "Alias" | cut -d ' ' -f 2-)
|
||||
|
||||
if [ $counter -gt 0 ]; then
|
||||
printf ", %s" "$device_alias"
|
||||
else
|
||||
printf " %s" "$device_alias"
|
||||
fi
|
||||
|
||||
((counter++))
|
||||
fi
|
||||
done
|
||||
printf "\n"
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
# A submenu for a specific device that allows connecting, pairing, and trusting
|
||||
device_menu() {
|
||||
device=$1
|
||||
|
||||
# Get device name and mac address
|
||||
device_name=$(echo "$device" | cut -d ' ' -f 3-)
|
||||
mac=$(echo "$device" | cut -d ' ' -f 2)
|
||||
|
||||
# Build options
|
||||
if device_connected "$mac"; then
|
||||
connected="Connected: yes"
|
||||
else
|
||||
connected="Connected: no"
|
||||
fi
|
||||
paired=$(device_paired "$mac")
|
||||
trusted=$(device_trusted "$mac")
|
||||
options="$connected\n$paired\n$trusted\n$divider\n$goback\nExit"
|
||||
|
||||
# Open rofi menu, read chosen option
|
||||
chosen="$(echo -e "$options" | $rofi_command "$device_name")"
|
||||
|
||||
# Match chosen option to command
|
||||
case "$chosen" in
|
||||
"" | "$divider")
|
||||
echo "No option chosen."
|
||||
;;
|
||||
"$connected")
|
||||
toggle_connection "$mac"
|
||||
;;
|
||||
"$paired")
|
||||
toggle_paired "$mac"
|
||||
;;
|
||||
"$trusted")
|
||||
toggle_trust "$mac"
|
||||
;;
|
||||
"$goback")
|
||||
show_menu
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Opens a rofi menu with current bluetooth status and options to connect
|
||||
show_menu() {
|
||||
# Get menu options
|
||||
if power_on; then
|
||||
power="Power: on"
|
||||
|
||||
# Human-readable names of devices, one per line
|
||||
# If scan is off, will only list paired devices
|
||||
devices=$(bluetoothctl devices | grep Device | cut -d ' ' -f 3-)
|
||||
|
||||
# Get controller flags
|
||||
scan=$(scan_on)
|
||||
pairable=$(pairable_on)
|
||||
discoverable=$(discoverable_on)
|
||||
|
||||
# Options passed to rofi
|
||||
options="$devices\n$divider\n$power\n$scan\n$pairable\n$discoverable\nExit"
|
||||
else
|
||||
power="Power: off"
|
||||
options="$power\nExit"
|
||||
fi
|
||||
|
||||
# Open rofi menu, read chosen option
|
||||
chosen="$(echo -e "$options" | $rofi_command "Bluetooth")"
|
||||
|
||||
# Match chosen option to command
|
||||
case "$chosen" in
|
||||
"" | "$divider")
|
||||
echo "No option chosen."
|
||||
;;
|
||||
"$power")
|
||||
toggle_power
|
||||
;;
|
||||
"$scan")
|
||||
toggle_scan
|
||||
;;
|
||||
"$discoverable")
|
||||
toggle_discoverable
|
||||
;;
|
||||
"$pairable")
|
||||
toggle_pairable
|
||||
;;
|
||||
*)
|
||||
device=$(bluetoothctl devices | grep "$chosen")
|
||||
# Open a submenu if a device is selected
|
||||
if [[ $device ]]; then device_menu "$device"; fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Rofi command to pipe into, can add any options here
|
||||
rofi_command="rofi -dmenu $* -p -theme $HOME/.config/rofi/bluetooth/bluetooth.rasi -mesg -Bluetooth-Control"
|
||||
|
||||
case "$1" in
|
||||
--status)
|
||||
print_status
|
||||
;;
|
||||
*)
|
||||
show_menu
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,157 @@
|
||||
* {
|
||||
on: #98B3C8;
|
||||
off: #CC9498;
|
||||
}
|
||||
|
||||
/*****----- Global Properties -----*****/
|
||||
@import "../colors.rasi"
|
||||
@import "../fonts.rasi"
|
||||
|
||||
configuration {
|
||||
show-icons: false;
|
||||
icon-theme: "Papirus";
|
||||
display-drun: ":";
|
||||
drun-display-format: "{name}";
|
||||
threads: 0;
|
||||
scroll-method: 0;
|
||||
disable-history: false;
|
||||
fullscreen: false;
|
||||
hide-scrollbar: true;
|
||||
sidebar-mode: false;
|
||||
}
|
||||
|
||||
window {
|
||||
transparency: "real";
|
||||
background-color: @background;
|
||||
text-color: @foreground;
|
||||
border: 0px;
|
||||
border-radius: 0px;
|
||||
border-color: @selected;
|
||||
width: 384px;
|
||||
location: center;
|
||||
anchor: center;
|
||||
x-offset: 0;
|
||||
y-offset: 0;
|
||||
}
|
||||
|
||||
prompt {
|
||||
enabled: true;
|
||||
padding: 4px 4px 6px 6px;
|
||||
background-color: @background;
|
||||
text-color: @foreground;
|
||||
}
|
||||
|
||||
textbox-prompt-colon {
|
||||
expand: false;
|
||||
str: "";
|
||||
background-color: @background;
|
||||
text-color: @urgent;
|
||||
padding: 5px 0px 0px 4px;
|
||||
}
|
||||
|
||||
inputbar {
|
||||
children: [ textbox-prompt-colon, prompt ];
|
||||
background-color: @background;
|
||||
text-color: @foreground;
|
||||
expand: false;
|
||||
border: 0px 0px 1px 0px;
|
||||
border-radius: 0px;
|
||||
border-color: @selected;
|
||||
margin: 0px 0px 0px 0px;
|
||||
padding: 0px 0px 0px 0px;
|
||||
position: center;
|
||||
}
|
||||
|
||||
|
||||
entry {
|
||||
background-color: @background;
|
||||
text-color: @foreground;
|
||||
placeholder-color: @foreground;
|
||||
expand: true;
|
||||
horizontal-align: 0;
|
||||
placeholder: "Search";
|
||||
blink: true;
|
||||
padding: 4px 0px 0px 0px;
|
||||
}
|
||||
|
||||
case-indicator {
|
||||
background-color: @background;
|
||||
text-color: @foreground;
|
||||
spacing: 0;
|
||||
}
|
||||
|
||||
|
||||
listview {
|
||||
background-color: @background;
|
||||
columns: 9;
|
||||
lines: 7;
|
||||
spacing: 5px;
|
||||
cycle: true;
|
||||
dynamic: true;
|
||||
layout: vertical;
|
||||
}
|
||||
|
||||
mainbox {
|
||||
background-color: @background;
|
||||
children: [ inputbar, listview ];
|
||||
spacing: 5px;
|
||||
padding: 5px 5px 5px 5px;
|
||||
}
|
||||
|
||||
element {
|
||||
background-color: @background;
|
||||
text-color: @foreground;
|
||||
orientation: horizontal;
|
||||
border: 0px;
|
||||
border-radius: 0px;
|
||||
border-color: @selected;
|
||||
padding: 5px 5px 5px 5px;
|
||||
}
|
||||
|
||||
element-icon {
|
||||
size: 24px;
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
element-text {
|
||||
|
||||
expand: true;
|
||||
horizontal-align: 0;
|
||||
vertical-align: 0;
|
||||
margin: 2px 0px 2px 2px;
|
||||
}
|
||||
|
||||
element selected {
|
||||
background-color: @selected;
|
||||
text-color: @background;
|
||||
border: 0px;
|
||||
border-radius: 0px;
|
||||
border-color: @selected;
|
||||
}
|
||||
|
||||
element.active,
|
||||
element.selected.urgent {
|
||||
background-color: @background-alt;
|
||||
text-color: @background;
|
||||
border-color: @background-alt;
|
||||
}
|
||||
|
||||
element.selected.urgent {
|
||||
border-color: @urgent;
|
||||
}
|
||||
|
||||
element.urgent,
|
||||
element.selected.active {
|
||||
background-color: @background;
|
||||
text-color: @foreground;
|
||||
border-color: @background;
|
||||
}
|
||||
|
||||
element.selected.active {
|
||||
border-color: @selected;
|
||||
}
|
||||
|
||||
element-text, element-icon {
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
Executable
+95
@@ -0,0 +1,95 @@
|
||||
#!/usr/bin/env bash
|
||||
DIR=$(dirname $PWD)
|
||||
|
||||
current_day=$(date +"%e")
|
||||
current_month=$(date +"%m")
|
||||
current_year=$(date +"%Y")
|
||||
|
||||
month=$(date +"%-m")
|
||||
year=$(date +"%Y")
|
||||
previous_month="◀"
|
||||
next_month="▶"
|
||||
last_selected_option=""
|
||||
|
||||
format_calendar () {
|
||||
echo "$1" \
|
||||
| sed -E 's/([[:alpha:]])__/\1\n/g' \
|
||||
| sed -E 's/___([[:digit:]])/.\n\1/g' \
|
||||
| sed -e 's/___/\n./g' \
|
||||
| sed -e 's/__/\n/g' \
|
||||
| sed -e 's/_/\n/g'
|
||||
}
|
||||
|
||||
print_month() {
|
||||
calendar="$(cal -v -- $1 $2 | tail -n +2 | sed -e 's/ /_/g')"
|
||||
echo "$(format_calendar "$calendar")"
|
||||
}
|
||||
|
||||
find_day_index() {
|
||||
index=0
|
||||
while IFS=' ' read -ra arr; do
|
||||
for i in "${arr[@]}"; do
|
||||
if [[ "$i" == "$2" ]]; then
|
||||
echo "$index"
|
||||
break
|
||||
fi
|
||||
((index++))
|
||||
done
|
||||
done <<< "$1"
|
||||
}
|
||||
|
||||
calendar_menu() {
|
||||
calendar_header=$(cal -v -- $month $year | head -n 1)
|
||||
|
||||
month_page="$(print_month $month $year)"
|
||||
calendar_body="\n\n\n$previous_month\n\n\n\n$month_page\n\n\n\n$next_month\n\n\n"
|
||||
|
||||
previous_month_index="3"
|
||||
next_month_index="59"
|
||||
calendar_body_column="7"
|
||||
urgent="-u $previous_month_index,$next_month_index"
|
||||
active=""
|
||||
selected_row=""
|
||||
|
||||
if [[ "$(echo $current_month | bc) $current_year" == "$(echo $month | bc) $year" ]]; then
|
||||
current_day_index=$(($(find_day_index "$month_page" $current_day) + $calendar_body_column))
|
||||
active="-a $current_day_index"
|
||||
selected_row="-selected-row $current_day_index"
|
||||
fi
|
||||
|
||||
if [[ $last_selected_option == $previous_month ]]; then
|
||||
selected_row="-selected-row $previous_month_index"
|
||||
fi
|
||||
|
||||
if [[ $last_selected_option == $next_month ]]; then
|
||||
selected_row="-selected-row $next_month_index"
|
||||
fi
|
||||
|
||||
echo -e "$calendar_body" | rofi -dmenu \
|
||||
-theme $HOME/.config/rofi/calendar/rofi-calendar.rasi \
|
||||
-p "$calendar_header" $urgent $active $selected_row
|
||||
}
|
||||
|
||||
while [[ true ]]; do
|
||||
selected=$(calendar_menu)
|
||||
last_selected_option="$selected"
|
||||
case $selected in
|
||||
$previous_month)
|
||||
((month--))
|
||||
if [[ $month -lt 1 ]]; then
|
||||
month=12
|
||||
((year--))
|
||||
fi
|
||||
;;
|
||||
$next_month)
|
||||
((month++))
|
||||
if [[ $month -gt 12 ]]; then
|
||||
month=1
|
||||
((year++))
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
@@ -0,0 +1,82 @@
|
||||
/**
|
||||
* @author Dominik Kressler
|
||||
* @package rofi-archer
|
||||
* @version 1.0.0
|
||||
**/
|
||||
|
||||
* {
|
||||
background: #1e1e2e;
|
||||
background-alt: #ffffff80;
|
||||
|
||||
|
||||
|
||||
foreground: #ffffff;
|
||||
selected: #4c566a;
|
||||
border: #ffffff;
|
||||
active: #98C37988;
|
||||
urgent: var(error-color);
|
||||
|
||||
|
||||
|
||||
/*https://catppuccin.ryanccn.dev/palette*/
|
||||
rosewater: #f5e0dc;
|
||||
flamingo: #f2cdcd;
|
||||
pink: #f5c2e7;
|
||||
mauve: #cba6f7;
|
||||
red: #f38ba8;
|
||||
maroon: #eba0ac;
|
||||
peach: #fab387;
|
||||
yellow: #f9e2af;
|
||||
green: #a6e3a1;
|
||||
teal: #94e2d5;
|
||||
sky: #89dceb;
|
||||
sapphire: #74c7ec;
|
||||
blue: #89b4fa;
|
||||
lavender: #b4befe;
|
||||
|
||||
text: #ffffff;
|
||||
subtext1: #ffffff80;
|
||||
subtext0: #a6adc8;
|
||||
|
||||
overlay0: #6c7086;
|
||||
overlay1: #7f849c;
|
||||
overlay2: #9399b2;
|
||||
|
||||
surface0: #313244;
|
||||
surface1: #45475a;
|
||||
surface2: #585b70;
|
||||
|
||||
base: #1e1e2e;
|
||||
mantle: #181825;
|
||||
crust: #11111b;
|
||||
|
||||
|
||||
|
||||
/* GTK THEME VARS*/
|
||||
theme-fg-color: #ffffff;
|
||||
theme-text-color: #ffffff;
|
||||
theme-bg-color: #1e1e2e;
|
||||
theme-base-color: #1e1e2e;
|
||||
|
||||
theme-bg-color-shade-1: #1e1e2eEF;
|
||||
theme-bg-color-shade-2: #1e1e2eD8;
|
||||
theme-bg-color-shade-3: #1e1e2eC9;
|
||||
|
||||
theme-selected-bg-color: #b4befe;
|
||||
theme-selected-fg-color: #000000;
|
||||
|
||||
theme-unfocused-fg-color: #ffffff;
|
||||
theme-unfocused-text-color: #ffffff;
|
||||
theme-unfocused-bg-color: #1e1e2e;
|
||||
theme-unfocused-base-color: #1e1e2e;
|
||||
theme-unfocused-selected-bg-color: #b4befe;
|
||||
theme-unfocused-selected-fg-color: #000000;
|
||||
unfocused-insensitive-color: #ffffff;
|
||||
|
||||
borders: #b4befe30;
|
||||
unfocused-borders: #ffffff;
|
||||
|
||||
warning-color: #fbc02d;
|
||||
error-color: #f44336;
|
||||
success-color: #66bb6a;
|
||||
}
|
||||
@@ -0,0 +1,301 @@
|
||||
/**
|
||||
*
|
||||
* Author : Aditya Shakya (adi1090x)
|
||||
* Github : @adi1090x
|
||||
*
|
||||
* Rofi Theme File
|
||||
* Rofi Version: 1.7.3
|
||||
**/
|
||||
|
||||
/*****----- Configuration -----*****/
|
||||
configuration {
|
||||
modi: "drun,run,filebrowser,window";
|
||||
show-icons: true;
|
||||
display-drun: "";
|
||||
display-run: "";
|
||||
display-filebrowser: "";
|
||||
display-window: "";
|
||||
display-combi: "練";
|
||||
drun-display-format: "{name}";
|
||||
window-format: "{w} · {c} · {t}";
|
||||
matching: "fuzzy";
|
||||
sidebar-mode: true;
|
||||
threads: 0;
|
||||
scroll-method: 0;
|
||||
}
|
||||
|
||||
/*****----- Global Properties -----*****/
|
||||
@import "colors.rasi"
|
||||
|
||||
|
||||
* {
|
||||
border-colour: var(borders);
|
||||
handle-colour: var(selected);
|
||||
foreground-colour: var(foreground);
|
||||
alternate-background: var(background-alt);
|
||||
normal-background: var(background);
|
||||
normal-foreground: var(foreground);
|
||||
urgent-background: var(urgent);
|
||||
urgent-foreground: var(background);
|
||||
active-background: var(active);
|
||||
active-foreground: var(background);
|
||||
selected-normal-background: var(selected);
|
||||
selected-normal-foreground: var(background);
|
||||
selected-urgent-background: var(active);
|
||||
selected-urgent-foreground: var(background);
|
||||
selected-active-background: var(urgent);
|
||||
selected-active-foreground: var(background);
|
||||
alternate-normal-background: var(background);
|
||||
alternate-normal-foreground: var(foreground);
|
||||
alternate-urgent-background: var(urgent);
|
||||
alternate-urgent-foreground: var(background);
|
||||
alternate-active-background: var(active);
|
||||
alternate-active-foreground: var(background);
|
||||
|
||||
font: "Hack Nerd Font 10";
|
||||
border-radius: 10px;
|
||||
frame-border: 2px solid;
|
||||
}
|
||||
|
||||
|
||||
/*****----- Main Window -----*****/
|
||||
window {
|
||||
/* properties for window widget */
|
||||
transparency: "real";
|
||||
location: center;
|
||||
anchor: center;
|
||||
fullscreen: false;
|
||||
width: 600px;
|
||||
x-offset: 0px;
|
||||
y-offset: 60px;
|
||||
|
||||
|
||||
/* properties for all widgets */
|
||||
enabled: true;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
|
||||
border-radius: var(border-radius);
|
||||
border: var(frame-border);
|
||||
border-color: var(borders);
|
||||
cursor: "default";
|
||||
|
||||
background-color: @theme-bg-color;
|
||||
|
||||
}
|
||||
|
||||
/*****----- Main Box -----*****/
|
||||
mainbox {
|
||||
enabled: true;
|
||||
spacing: 10px;
|
||||
margin: 0px;
|
||||
padding: 30px;
|
||||
background-color: transparent;
|
||||
children: [ "message", "listview", "inputbar" ];
|
||||
}
|
||||
|
||||
/*****----- Inputbar -----*****/
|
||||
inputbar {
|
||||
enabled: true;
|
||||
spacing: 10px;
|
||||
margin: 0;
|
||||
padding: 20px 0px 0;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @borders;
|
||||
background-color: transparent;
|
||||
text-color: var(theme-text-color);
|
||||
children: [ "textbox-prompt-colon", "entry", "mode-switcher" ];
|
||||
}
|
||||
|
||||
prompt {
|
||||
enabled: true;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
textbox-prompt-colon {
|
||||
enabled: true;
|
||||
padding: 5px 3px 0px 0;
|
||||
expand: false;
|
||||
//font: "MonarchOS 14";
|
||||
//str: "";
|
||||
str: "";
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
entry {
|
||||
enabled: true;
|
||||
padding: 5px 0px;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
cursor: text;
|
||||
placeholder: "...";
|
||||
placeholder-color: inherit;
|
||||
}
|
||||
num-filtered-rows {
|
||||
enabled: true;
|
||||
expand: false;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
textbox-num-sep {
|
||||
enabled: true;
|
||||
expand: false;
|
||||
str: "/";
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
num-rows {
|
||||
enabled: true;
|
||||
expand: false;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
case-indicator {
|
||||
enabled: true;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
|
||||
/*****----- 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: 5px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @borders;
|
||||
background-color: transparent;
|
||||
text-color: var(theme-text-color);
|
||||
cursor: "default";
|
||||
}
|
||||
scrollbar {
|
||||
handle-width: 5px;
|
||||
handle-color: @handle-colour;
|
||||
border-radius: 10px;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
/*****----- Elements -----*****/
|
||||
element {
|
||||
enabled: true;
|
||||
spacing: 10px;
|
||||
margin: 0px;
|
||||
padding: 5px 10px;
|
||||
border: 0px solid;
|
||||
border-radius: 10px;
|
||||
border-color: @borders;
|
||||
background-color: transparent;
|
||||
text-color: var(theme-text-color);
|
||||
cursor: pointer;
|
||||
}
|
||||
element normal.normal {
|
||||
background-color: transparent;
|
||||
text-color: var(normal-foreground);
|
||||
}
|
||||
element normal.urgent {
|
||||
background-color: var(urgent-background);
|
||||
text-color: var(urgent-foreground);
|
||||
}
|
||||
element normal.active {
|
||||
background-color: var(normal-foreground);
|
||||
text-color: var(normal-background);
|
||||
}
|
||||
element selected.normal {
|
||||
background-color: var(theme-selected-bg-color);
|
||||
text-color: var(theme-selected-fg-color);
|
||||
}
|
||||
element selected.urgent {
|
||||
background-color: var(theme-selected-bg-color);
|
||||
text-color: var(normal-background);
|
||||
}
|
||||
element selected.active {
|
||||
background-color: var(error-color);
|
||||
text-color: var(normal-background);
|
||||
}
|
||||
|
||||
element-icon {
|
||||
background-color: transparent;
|
||||
text-color: inherit;
|
||||
size: 24px;
|
||||
cursor: inherit;
|
||||
}
|
||||
element-text {
|
||||
background-color: transparent;
|
||||
text-color: inherit;
|
||||
highlight: inherit;
|
||||
cursor: inherit;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.0;
|
||||
}
|
||||
|
||||
/*****----- Mode Switcher -----*****/
|
||||
mode-switcher{
|
||||
enabled: true;
|
||||
spacing: 10px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @borders;
|
||||
background-color: transparent;
|
||||
text-color: var(theme-text-color);
|
||||
}
|
||||
button {
|
||||
padding: 7px 15px 7px 10px;
|
||||
border: 0px solid;
|
||||
border-radius: 100%;
|
||||
border-color: @borders;
|
||||
background-color: @alternate-background;
|
||||
text-color: inherit;
|
||||
cursor: pointer;
|
||||
}
|
||||
button selected {
|
||||
background-color: var(selected-normal-background);
|
||||
text-color: var(selected-normal-foreground);
|
||||
}
|
||||
|
||||
/*****----- Message -----*****/
|
||||
message {
|
||||
enabled: true;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px 0px 0px 0px;
|
||||
border-color: @borders;
|
||||
background-color: transparent;
|
||||
text-color: var(theme-text-color);
|
||||
}
|
||||
textbox {
|
||||
padding: 8px 10px;
|
||||
border: 0px solid;
|
||||
border-radius: 10px;
|
||||
border-color: @borders;
|
||||
background-color: @alternate-background;
|
||||
text-color: var(theme-text-color);
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.0;
|
||||
highlight: none;
|
||||
placeholder-color: var(theme-text-color);
|
||||
blink: true;
|
||||
markup: true;
|
||||
}
|
||||
error-message {
|
||||
padding: 10px;
|
||||
border: 2px solid;
|
||||
border-radius: 10px;
|
||||
border-color: @borders;
|
||||
background-color: @background;
|
||||
text-color: var(theme-text-color);
|
||||
}
|
||||
@@ -0,0 +1,290 @@
|
||||
/**
|
||||
*
|
||||
* Author : Aditya Shakya (adi1090x)
|
||||
* Github : @adi1090x
|
||||
*
|
||||
* Rofi Theme File
|
||||
* Rofi Version: 1.7.3
|
||||
**/
|
||||
|
||||
/*****----- Configuration -----*****/
|
||||
configuration {
|
||||
modi: "drun,run,filebrowser,window";
|
||||
show-icons: true;
|
||||
drun-display-format: "{name}";
|
||||
}
|
||||
|
||||
/*****----- Global Properties -----*****/
|
||||
@import "../config.rasi"
|
||||
@import "../colors.rasi"
|
||||
|
||||
* {
|
||||
border-colour: var(border);
|
||||
handle-colour: var(selected);
|
||||
background-colour: var(background);
|
||||
foreground-colour: var(foreground);
|
||||
alternate-background: var(background-alt);
|
||||
normal-background: var(background);
|
||||
normal-foreground: var(foreground);
|
||||
urgent-background: var(urgent);
|
||||
urgent-foreground: var(background);
|
||||
active-background: var(active);
|
||||
active-foreground: var(background);
|
||||
selected-normal-background: var(selected);
|
||||
selected-normal-foreground: var(background);
|
||||
selected-urgent-background: var(active);
|
||||
selected-urgent-foreground: var(background);
|
||||
selected-active-background: var(urgent);
|
||||
selected-active-foreground: var(background);
|
||||
alternate-normal-background: var(background);
|
||||
alternate-normal-foreground: var(foreground);
|
||||
alternate-urgent-background: var(urgent);
|
||||
alternate-urgent-foreground: var(background);
|
||||
alternate-active-background: var(active);
|
||||
alternate-active-foreground: var(background);
|
||||
}
|
||||
|
||||
/*****----- Main Window -----*****/
|
||||
window {
|
||||
/* properties for window widget */
|
||||
transparency: "real";
|
||||
location: center;
|
||||
anchor: center;
|
||||
fullscreen: false;
|
||||
width: 600px;
|
||||
x-offset: 0px;
|
||||
y-offset: 0px;
|
||||
|
||||
/* properties for all widgets */
|
||||
enabled: true;
|
||||
|
||||
cursor: "default";
|
||||
/* Backgroud Colors */
|
||||
background-color: @background-colour;
|
||||
/* Backgroud Image */
|
||||
//background-image: url("/path/to/image.png", none);
|
||||
/* Simple Linear Gradient */
|
||||
//background-image: linear-gradient(red, orange, pink, purple);
|
||||
/* Directional Linear Gradient */
|
||||
//background-image: linear-gradient(to bottom, pink, yellow, magenta);
|
||||
/* Angle Linear Gradient */
|
||||
//background-image: linear-gradient(45, cyan, purple, indigo);
|
||||
}
|
||||
|
||||
/*****----- Main Box -----*****/
|
||||
mainbox {
|
||||
enabled: true;
|
||||
spacing: 10px;
|
||||
margin: 0px;
|
||||
padding: 30px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px 0px 0px 0px;
|
||||
border-color: @border-colour;
|
||||
background-color: transparent;
|
||||
children: [ "message", "listview", "inputbar" ];
|
||||
}
|
||||
|
||||
/*****----- Inputbar -----*****/
|
||||
inputbar {
|
||||
enabled: true;
|
||||
spacing: 10px;
|
||||
margin: 0;
|
||||
padding: 20px 0px 0;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @border-colour;
|
||||
background-color: transparent;
|
||||
text-color: @foreground-colour;
|
||||
children: [ "textbox-prompt-colon", "entry", "mode-switcher" ];
|
||||
}
|
||||
|
||||
prompt {
|
||||
enabled: true;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
textbox-prompt-colon {
|
||||
enabled: true;
|
||||
padding: 5px 0px 0px 15px;
|
||||
expand: false;
|
||||
font: "MonarchOS 14";
|
||||
str: "";
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
entry {
|
||||
enabled: true;
|
||||
padding: 5px 0px;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
cursor: text;
|
||||
placeholder: "...";
|
||||
placeholder-color: inherit;
|
||||
}
|
||||
num-filtered-rows {
|
||||
enabled: true;
|
||||
expand: false;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
textbox-num-sep {
|
||||
enabled: true;
|
||||
expand: false;
|
||||
str: "/";
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
num-rows {
|
||||
enabled: true;
|
||||
expand: false;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
case-indicator {
|
||||
enabled: true;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
|
||||
/*****----- 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: 5px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @border-colour;
|
||||
background-color: transparent;
|
||||
text-color: @foreground-colour;
|
||||
cursor: "default";
|
||||
}
|
||||
scrollbar {
|
||||
handle-width: 5px;
|
||||
handle-color: @handle-colour;
|
||||
border-radius: 10px;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
/*****----- Elements -----*****/
|
||||
element {
|
||||
enabled: true;
|
||||
spacing: 0;
|
||||
margin: 0px;
|
||||
padding: 5px 10px;
|
||||
border: 0px solid;
|
||||
border-radius: 10px;
|
||||
border-color: @border-colour;
|
||||
background-color: transparent;
|
||||
text-color: @foreground-colour;
|
||||
cursor: pointer;
|
||||
}
|
||||
element normal.normal {
|
||||
background-color: transparent;
|
||||
text-color: var(normal-foreground);
|
||||
}
|
||||
element normal.urgent {
|
||||
background-color: var(urgent-background);
|
||||
text-color: var(urgent-foreground);
|
||||
}
|
||||
element normal.active {
|
||||
background-color: var(normal-foreground);
|
||||
text-color: var(normal-background);
|
||||
}
|
||||
element selected.normal {
|
||||
background-color: var(selected-normal-background);
|
||||
text-color: var(normal-foreground);
|
||||
}
|
||||
element selected.urgent {
|
||||
background-color: var(selected-urgent-background);
|
||||
text-color: var(normal-background);
|
||||
}
|
||||
element selected.active {
|
||||
background-color: var(selected-active-background);
|
||||
text-color: var(normal-background);
|
||||
}
|
||||
|
||||
element-icon {
|
||||
background-color: transparent;
|
||||
text-color: inherit;
|
||||
size: 0;
|
||||
cursor: inherit;
|
||||
}
|
||||
element-text {
|
||||
background-color: transparent;
|
||||
text-color: inherit;
|
||||
highlight: inherit;
|
||||
cursor: inherit;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.0;
|
||||
}
|
||||
|
||||
/*****----- Mode Switcher -----*****/
|
||||
mode-switcher{
|
||||
enabled: true;
|
||||
spacing: 10px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @border-colour;
|
||||
background-color: transparent;
|
||||
text-color: @foreground-colour;
|
||||
}
|
||||
button {
|
||||
padding: 7px 15px 7px 10px;
|
||||
border: 0px solid;
|
||||
border-radius: 100%;
|
||||
border-color: @border-colour;
|
||||
background-color: @alternate-background;
|
||||
text-color: inherit;
|
||||
cursor: pointer;
|
||||
}
|
||||
button selected {
|
||||
background-color: var(selected-normal-background);
|
||||
text-color: var(selected-normal-foreground);
|
||||
}
|
||||
|
||||
/*****----- Message -----*****/
|
||||
message {
|
||||
enabled: true;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px 0px 0px 0px;
|
||||
border-color: @border-colour;
|
||||
background-color: transparent;
|
||||
text-color: @foreground-colour;
|
||||
}
|
||||
textbox {
|
||||
padding: 8px 10px;
|
||||
border: 0px solid;
|
||||
border-radius: 10px;
|
||||
border-color: @border-colour;
|
||||
background-color: @alternate-background;
|
||||
text-color: @foreground-colour;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.0;
|
||||
highlight: none;
|
||||
placeholder-color: @foreground-colour;
|
||||
blink: true;
|
||||
markup: true;
|
||||
}
|
||||
error-message {
|
||||
padding: 10px;
|
||||
border: 2px solid;
|
||||
border-radius: 10px;
|
||||
border-color: @border-colour;
|
||||
background-color: @background-colour;
|
||||
text-color: @foreground-colour;
|
||||
}
|
||||
Executable
+81
@@ -0,0 +1,81 @@
|
||||
#!/usr/bin/env bash
|
||||
# author: unknown
|
||||
# sentby: MoreChannelNoise (https://www.youtube.com/user/MoreChannelNoise)
|
||||
# editby: gotbletu (https://www.youtube.com/user/gotbletu)
|
||||
|
||||
# demo: https://www.youtube.com/watch?v=kxJClZIXSnM
|
||||
# info: this is a script to launch other rofi scripts,
|
||||
# saves us the trouble of binding multiple hotkeys for each script,
|
||||
# when we can just use one hotkey for everything.
|
||||
|
||||
declare -A LABELS
|
||||
declare -A COMMANDS
|
||||
|
||||
###
|
||||
# List of defined 'bangs'
|
||||
|
||||
COMMANDS[""]="pkexec auto-cpufreq --force=performance"
|
||||
LABELS[""]="Performance"
|
||||
|
||||
COMMANDS[""]='pkexec auto-cpufreq --force=powersave'
|
||||
LABELS[""]="Powersave"
|
||||
|
||||
COMMANDS[""]='pkexec auto-cpufreq --force=reset'
|
||||
LABELS[""]="Reset"
|
||||
|
||||
|
||||
################################################################################
|
||||
# do not edit below
|
||||
################################################################################
|
||||
##
|
||||
# Generate menu
|
||||
##
|
||||
function print_menu()
|
||||
{
|
||||
for key in ${!LABELS[@]}
|
||||
do
|
||||
# echo "$key ${LABELS}"
|
||||
echo "$key ${LABELS[$key]}"
|
||||
# my top version just shows the first field in labels row, not two words side by side
|
||||
done
|
||||
}
|
||||
##
|
||||
# Show rofi.
|
||||
##
|
||||
function start()
|
||||
{
|
||||
# print_menu | rofi -dmenu -p "?=>"
|
||||
print_menu | sort | rofi -theme ~/.config/rofi/cpugov/rofi-cpugov.rasi -show "CPU Mode" -dmenu -mesg " CPU Mode" -i -p "rofi-bangs: "
|
||||
}
|
||||
|
||||
|
||||
# Run it
|
||||
value="$(start)"
|
||||
|
||||
# Split input.
|
||||
# grab upto first space.
|
||||
choice=${value%%\ *}
|
||||
# graph remainder, minus space.
|
||||
input=${value:$((${#choice}+1))}
|
||||
|
||||
##
|
||||
# Cancelled? bail out
|
||||
##
|
||||
if test -z ${choice}
|
||||
then
|
||||
exit
|
||||
fi
|
||||
|
||||
# check if choice exists
|
||||
if test ${COMMANDS[$choice]+isset}
|
||||
then
|
||||
# Execute the choice
|
||||
#eval echo "Executing: ${COMMANDS[$choice]}"
|
||||
eval ${COMMANDS[$choice]}
|
||||
|
||||
dunstify --replace 553 -i "/usr/share/icons/zafiro-dark/devices/48/cpu.svg" "CPU Mode" "Set to $choice ${LABELS[$choice]}"
|
||||
else
|
||||
eval $choice | rofi
|
||||
# prefer my above so I can use this same script to also launch apps like geany or leafpad etc (DK)
|
||||
# echo "Unknown command: ${choice}" | rofi -dmenu -p "error"
|
||||
fi
|
||||
@@ -0,0 +1,280 @@
|
||||
/**
|
||||
*
|
||||
* Author : Aditya Shakya (adi1090x)
|
||||
* Github : @adi1090x
|
||||
*
|
||||
* Rofi Theme File
|
||||
* Rofi Version: 1.7.3
|
||||
**/
|
||||
|
||||
@import "../config.rasi"
|
||||
@import "../colors.rasi"
|
||||
/*****----- Configuration -----*****/
|
||||
configuration {
|
||||
|
||||
show-icons: true;
|
||||
display-emoji: "";
|
||||
}
|
||||
|
||||
/*****----- Global Properties -----*****/
|
||||
|
||||
* {
|
||||
border-colour: var(border);
|
||||
handle-colour: var(selected);
|
||||
background-colour: var(background);
|
||||
foreground-colour: var(foreground);
|
||||
alternate-background: var(background-alt);
|
||||
normal-background: var(background);
|
||||
normal-foreground: var(foreground);
|
||||
urgent-background: var(urgent);
|
||||
urgent-foreground: var(background);
|
||||
active-background: var(active);
|
||||
active-foreground: var(background);
|
||||
selected-normal-background: var(selected);
|
||||
selected-normal-foreground: var(background);
|
||||
selected-urgent-background: var(active);
|
||||
selected-urgent-foreground: var(background);
|
||||
selected-active-background: var(urgent);
|
||||
selected-active-foreground: var(background);
|
||||
alternate-normal-background: var(background);
|
||||
alternate-normal-foreground: var(foreground);
|
||||
alternate-urgent-background: var(urgent);
|
||||
alternate-urgent-foreground: var(background);
|
||||
alternate-active-background: var(active);
|
||||
alternate-active-foreground: var(background);
|
||||
}
|
||||
|
||||
/*****----- Main Window -----*****/
|
||||
window {
|
||||
/* properties for window widget */
|
||||
transparency: "real";
|
||||
location: center;
|
||||
anchor: center;
|
||||
fullscreen: false;
|
||||
width: 600px;
|
||||
x-offset: 0px;
|
||||
y-offset: 0px;
|
||||
|
||||
/* properties for all widgets */
|
||||
enabled: true;
|
||||
|
||||
}
|
||||
|
||||
/*****----- Main Box -----*****/
|
||||
mainbox {
|
||||
enabled: true;
|
||||
spacing: 10px;
|
||||
margin: 0px;
|
||||
padding: 30px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px 0px 0px 0px;
|
||||
border-color: @border-colour;
|
||||
background-color: transparent;
|
||||
children: [ "message", "listview", "inputbar" ];
|
||||
}
|
||||
|
||||
/*****----- Inputbar -----*****/
|
||||
inputbar {
|
||||
enabled: true;
|
||||
spacing: 10px;
|
||||
margin: 0;
|
||||
padding: 20px 0px 0;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @border-colour;
|
||||
background-color: transparent;
|
||||
text-color: @foreground-colour;
|
||||
children: [ "textbox-prompt-colon", "entry" ];
|
||||
}
|
||||
|
||||
prompt {
|
||||
enabled: true;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
textbox-prompt-colon {
|
||||
enabled: true;
|
||||
padding: 5px 0px 0px 15px;
|
||||
expand: false;
|
||||
font: "MonarchOS 14";
|
||||
str: "";
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
entry {
|
||||
enabled: true;
|
||||
padding: 5px 0px;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
cursor: text;
|
||||
placeholder: "...";
|
||||
placeholder-color: inherit;
|
||||
}
|
||||
num-filtered-rows {
|
||||
enabled: true;
|
||||
expand: false;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
textbox-num-sep {
|
||||
enabled: true;
|
||||
expand: false;
|
||||
str: "/";
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
num-rows {
|
||||
enabled: true;
|
||||
expand: false;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
case-indicator {
|
||||
enabled: true;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
|
||||
/*****----- Listview -----*****/
|
||||
listview {
|
||||
enabled: true;
|
||||
columns: 4;
|
||||
lines: 8;
|
||||
cycle: true;
|
||||
dynamic: true;
|
||||
scrollbar: true;
|
||||
layout: vertical;
|
||||
reverse: false;
|
||||
fixed-height: true;
|
||||
fixed-columns: true;
|
||||
|
||||
spacing: 5px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
|
||||
background-color: transparent;
|
||||
text-color: @subtext1;
|
||||
cursor: "default";
|
||||
}
|
||||
scrollbar {
|
||||
handle-width: 5px;
|
||||
handle-color: @handle-colour;
|
||||
border-radius: 10px;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
/*****----- Elements -----*****/
|
||||
element {
|
||||
enabled: true;
|
||||
spacing: 0px;
|
||||
margin: 0px;
|
||||
padding: 5px;
|
||||
border: 0px solid;
|
||||
border-radius: 10px;
|
||||
border-color: @border-colour;
|
||||
background-color: transparent;
|
||||
text-color: @text;
|
||||
cursor: pointer;
|
||||
|
||||
}
|
||||
element normal.normal {
|
||||
background-color: transparent;
|
||||
text-color: var(normal-foreground);
|
||||
}
|
||||
element normal.urgent {
|
||||
background-color: var(urgent-background);
|
||||
text-color: var(urgent-foreground);
|
||||
}
|
||||
element normal.active {
|
||||
background-color: var(normal-foreground);
|
||||
text-color: var(normal-background);
|
||||
}
|
||||
element selected.normal {
|
||||
background-color: var(selected-normal-background);
|
||||
text-color: var(normal-foreground);
|
||||
}
|
||||
element selected.urgent {
|
||||
background-color: var(selected-urgent-background);
|
||||
text-color: var(normal-background);
|
||||
}
|
||||
element selected.active {
|
||||
background-color: var(selected-active-background);
|
||||
text-color: var(normal-background);
|
||||
}
|
||||
|
||||
element-icon {
|
||||
background-color: transparent;
|
||||
text-color: inherit;
|
||||
size: 0;
|
||||
cursor: inherit;
|
||||
}
|
||||
element-text {
|
||||
background-color: transparent;
|
||||
text-color: inherit;
|
||||
highlight: inherit;
|
||||
cursor: inherit;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.0;
|
||||
}
|
||||
|
||||
/*****----- Mode Switcher -----*****/
|
||||
mode-switcher{
|
||||
enabled: true;
|
||||
spacing: 10px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @border-colour;
|
||||
background-color: transparent;
|
||||
text-color: @foreground-colour;
|
||||
}
|
||||
button {
|
||||
padding: 7px 15px 7px 10px;
|
||||
border: 0px solid;
|
||||
border-radius: 100%;
|
||||
border-color: @border-colour;
|
||||
background-color: @alternate-background;
|
||||
text-color: inherit;
|
||||
cursor: pointer;
|
||||
}
|
||||
button selected {
|
||||
background-color: var(selected-normal-background);
|
||||
text-color: var(selected-normal-foreground);
|
||||
}
|
||||
|
||||
/*****----- Message -----*****/
|
||||
message {
|
||||
enabled: true;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px 0px 0px 0px;
|
||||
border-color: @border-colour;
|
||||
background-color: transparent;
|
||||
text-color: @foreground-colour;
|
||||
}
|
||||
textbox {
|
||||
padding: 8px 10px;
|
||||
border: 0px solid;
|
||||
border-radius: 10px;
|
||||
border-color: @border-colour;
|
||||
background-color: @alternate-background;
|
||||
text-color: @foreground-colour;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.0;
|
||||
highlight: none;
|
||||
placeholder-color: @foreground-colour;
|
||||
blink: true;
|
||||
markup: true;
|
||||
}
|
||||
error-message {
|
||||
padding: 10px;
|
||||
border: 2px solid;
|
||||
border-radius: 10px;
|
||||
border-color: @border-colour;
|
||||
background-color: @background-colour;
|
||||
text-color: @foreground-colour;
|
||||
}
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
FILE="$HOME/.config/rofi/emojis/emojis.txt"
|
||||
|
||||
if [ "$@" ]
|
||||
then
|
||||
smiley=$(echo $@ | cut -d' ' -f1)
|
||||
echo -n "$smiley" | xsel -bi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
cat $FILE
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,61 @@
|
||||
#! /usr/bin/env python3
|
||||
|
||||
# https://github.com/Git-Fal7/gtk-rofi/
|
||||
# Taken from MATE-HUD github.com/ubuntu-mate/mate-hud
|
||||
# Used for rofi css
|
||||
|
||||
# Usage
|
||||
# ./file_gtk_style.py [input file] > [output file]
|
||||
|
||||
# examples
|
||||
# background-color: {@theme_bg_color}
|
||||
|
||||
# see the array below for list of style context to use
|
||||
|
||||
import sys
|
||||
|
||||
if len(sys.argv)<2:
|
||||
sys.exit(1)
|
||||
|
||||
import gi
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gio, GLib, Gtk
|
||||
|
||||
#Converts from rgba <GTK R, G, B> to hex #RRGGBB
|
||||
def rgba_to_hex(color):
|
||||
return "#{0:02x}{1:02x}{2:02x}".format( int(color.red * 255), int(color.green * 255), int(color.blue * 255))
|
||||
|
||||
window = Gtk.Window()
|
||||
style_context = window.get_style_context()
|
||||
|
||||
#List of style contexts
|
||||
lists = [
|
||||
#Foreground
|
||||
'theme_fg_color', 'theme_selected_fg_color', 'theme_fg_color',
|
||||
'warning_fg_color', 'info_fg_color',
|
||||
#Background
|
||||
'theme_bg_color', 'theme_selected_bg_color', 'error_bg_color',
|
||||
'warning_bg_color', 'info_bg_color',
|
||||
#Others
|
||||
'theme_unfocused_fg_color', 'theme_text_color',
|
||||
'theme_unfocused_text_color',
|
||||
'theme_base_color',
|
||||
'theme_unfocused_fg_color',
|
||||
'theme_unfocused_text_color',
|
||||
'theme_unfocused_bg_color',
|
||||
'theme_unfocused_base_color',
|
||||
'theme_unfocused_selected_bg_color',
|
||||
'theme_unfocused_selected_fg_color',
|
||||
'unfocused_insensitive_color',
|
||||
'borders',
|
||||
'unfocused_borders',
|
||||
'warning_color',
|
||||
'error_color',
|
||||
'success_color'
|
||||
]
|
||||
|
||||
with open(sys.argv[1]) as f:
|
||||
file=f.read()
|
||||
for style in lists:
|
||||
file=file.replace("{@" + style + "}", rgba_to_hex(style_context.lookup_color(style)[1]))
|
||||
print(file)
|
||||
@@ -0,0 +1 @@
|
||||
GTK_THEME=Catppuccin-Mocha-Standard-Lavender-Dark
|
||||
@@ -0,0 +1,291 @@
|
||||
/**
|
||||
*
|
||||
* Author : Aditya Shakya (adi1090x)
|
||||
* Github : @adi1090x
|
||||
*
|
||||
* Rofi Theme File
|
||||
* Rofi Version: 1.7.3
|
||||
**/
|
||||
|
||||
/*****----- Configuration -----*****/
|
||||
configuration {
|
||||
modi: "drun,run,filebrowser,window";
|
||||
show-icons: true;
|
||||
drun-display-format: "{name}";
|
||||
}
|
||||
|
||||
/*****----- Global Properties -----*****/
|
||||
@import "../config.rasi"
|
||||
@import "../colors.rasi"
|
||||
@import "../fonts.rasi"
|
||||
|
||||
* {
|
||||
border-colour: var(border);
|
||||
handle-colour: var(selected);
|
||||
background-colour: var(background);
|
||||
foreground-colour: var(foreground);
|
||||
alternate-background: var(background-alt);
|
||||
normal-background: var(background);
|
||||
normal-foreground: var(foreground);
|
||||
urgent-background: var(urgent);
|
||||
urgent-foreground: var(background);
|
||||
active-background: var(active);
|
||||
active-foreground: var(background);
|
||||
selected-normal-background: var(selected);
|
||||
selected-normal-foreground: var(background);
|
||||
selected-urgent-background: var(active);
|
||||
selected-urgent-foreground: var(background);
|
||||
selected-active-background: var(urgent);
|
||||
selected-active-foreground: var(background);
|
||||
alternate-normal-background: var(background);
|
||||
alternate-normal-foreground: var(foreground);
|
||||
alternate-urgent-background: var(urgent);
|
||||
alternate-urgent-foreground: var(background);
|
||||
alternate-active-background: var(active);
|
||||
alternate-active-foreground: var(background);
|
||||
}
|
||||
|
||||
/*****----- Main Window -----*****/
|
||||
window {
|
||||
/* properties for window widget */
|
||||
transparency: "real";
|
||||
location: center;
|
||||
anchor: center;
|
||||
fullscreen: false;
|
||||
width: 600px;
|
||||
x-offset: 0px;
|
||||
y-offset: 0px;
|
||||
|
||||
/* properties for all widgets */
|
||||
enabled: true;
|
||||
|
||||
cursor: "default";
|
||||
/* Backgroud Colors */
|
||||
background-color: @background-colour;
|
||||
/* Backgroud Image */
|
||||
//background-image: url("/path/to/image.png", none);
|
||||
/* Simple Linear Gradient */
|
||||
//background-image: linear-gradient(red, orange, pink, purple);
|
||||
/* Directional Linear Gradient */
|
||||
//background-image: linear-gradient(to bottom, pink, yellow, magenta);
|
||||
/* Angle Linear Gradient */
|
||||
//background-image: linear-gradient(45, cyan, purple, indigo);
|
||||
}
|
||||
|
||||
/*****----- Main Box -----*****/
|
||||
mainbox {
|
||||
enabled: true;
|
||||
spacing: 10px;
|
||||
margin: 0px;
|
||||
padding: 30px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px 0px 0px 0px;
|
||||
border-color: @border-colour;
|
||||
background-color: transparent;
|
||||
children: [ "message", "listview", "inputbar" ];
|
||||
}
|
||||
|
||||
/*****----- Inputbar -----*****/
|
||||
inputbar {
|
||||
enabled: true;
|
||||
spacing: 10px;
|
||||
margin: 0;
|
||||
padding: 20px 0px 0;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @border-colour;
|
||||
background-color: transparent;
|
||||
text-color: @foreground-colour;
|
||||
children: [ "textbox-prompt-colon", "entry", "mode-switcher" ];
|
||||
}
|
||||
|
||||
prompt {
|
||||
enabled: true;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
textbox-prompt-colon {
|
||||
enabled: true;
|
||||
padding: 5px 0px 0px 15px;
|
||||
expand: false;
|
||||
font: "MonarchOS 14";
|
||||
str: "";
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
entry {
|
||||
enabled: true;
|
||||
padding: 5px 0px;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
cursor: text;
|
||||
placeholder: "...";
|
||||
placeholder-color: inherit;
|
||||
}
|
||||
num-filtered-rows {
|
||||
enabled: true;
|
||||
expand: false;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
textbox-num-sep {
|
||||
enabled: true;
|
||||
expand: false;
|
||||
str: "/";
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
num-rows {
|
||||
enabled: true;
|
||||
expand: false;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
case-indicator {
|
||||
enabled: true;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
|
||||
/*****----- Listview -----*****/
|
||||
listview {
|
||||
enabled: true;
|
||||
columns: 2;
|
||||
lines: 8;
|
||||
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: @border-colour;
|
||||
background-color: transparent;
|
||||
text-color: @foreground-colour;
|
||||
cursor: "default";
|
||||
}
|
||||
scrollbar {
|
||||
handle-width: 5px;
|
||||
handle-color: @handle-colour;
|
||||
border-radius: 10px;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
/*****----- Elements -----*****/
|
||||
element {
|
||||
enabled: true;
|
||||
spacing: 0;
|
||||
margin: 0px;
|
||||
padding: 5px 10px;
|
||||
border: 0px solid;
|
||||
border-radius: 10px;
|
||||
border-color: @border-colour;
|
||||
background-color: transparent;
|
||||
text-color: @foreground-colour;
|
||||
cursor: pointer;
|
||||
}
|
||||
element normal.normal {
|
||||
background-color: transparent;
|
||||
text-color: var(normal-foreground);
|
||||
}
|
||||
element normal.urgent {
|
||||
background-color: var(urgent-background);
|
||||
text-color: var(urgent-foreground);
|
||||
}
|
||||
element normal.active {
|
||||
background-color: var(normal-foreground);
|
||||
text-color: var(normal-background);
|
||||
}
|
||||
element selected.normal {
|
||||
background-color: var(selected-normal-background);
|
||||
text-color: var(normal-foreground);
|
||||
}
|
||||
element selected.urgent {
|
||||
background-color: var(selected-urgent-background);
|
||||
text-color: var(normal-background);
|
||||
}
|
||||
element selected.active {
|
||||
background-color: var(selected-active-background);
|
||||
text-color: var(normal-background);
|
||||
}
|
||||
|
||||
element-icon {
|
||||
background-color: transparent;
|
||||
text-color: inherit;
|
||||
size: 0;
|
||||
cursor: inherit;
|
||||
}
|
||||
element-text {
|
||||
background-color: transparent;
|
||||
text-color: inherit;
|
||||
highlight: inherit;
|
||||
cursor: inherit;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.0;
|
||||
}
|
||||
|
||||
/*****----- Mode Switcher -----*****/
|
||||
mode-switcher{
|
||||
enabled: true;
|
||||
spacing: 10px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @border-colour;
|
||||
background-color: transparent;
|
||||
text-color: @foreground-colour;
|
||||
}
|
||||
button {
|
||||
padding: 7px 15px 7px 10px;
|
||||
border: 0px solid;
|
||||
border-radius: 100%;
|
||||
border-color: @border-colour;
|
||||
background-color: @alternate-background;
|
||||
text-color: inherit;
|
||||
cursor: pointer;
|
||||
}
|
||||
button selected {
|
||||
background-color: var(selected-normal-background);
|
||||
text-color: var(selected-normal-foreground);
|
||||
}
|
||||
|
||||
/*****----- Message -----*****/
|
||||
message {
|
||||
enabled: true;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px 0px 0px 0px;
|
||||
border-color: @border-colour;
|
||||
background-color: transparent;
|
||||
text-color: @foreground-colour;
|
||||
}
|
||||
textbox {
|
||||
padding: 8px 10px;
|
||||
border: 0px solid;
|
||||
border-radius: 10px;
|
||||
border-color: @border-colour;
|
||||
background-color: @alternate-background;
|
||||
text-color: @foreground-colour;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.0;
|
||||
highlight: none;
|
||||
placeholder-color: @foreground-colour;
|
||||
blink: true;
|
||||
markup: true;
|
||||
}
|
||||
error-message {
|
||||
padding: 10px;
|
||||
border: 2px solid;
|
||||
border-radius: 10px;
|
||||
border-color: @border-colour;
|
||||
background-color: @background-colour;
|
||||
text-color: @foreground-colour;
|
||||
}
|
||||
Executable
+151
@@ -0,0 +1,151 @@
|
||||
#!/usr/bin/env bash
|
||||
# author: unknown
|
||||
# sentby: MoreChannelNoise (https://www.youtube.com/user/MoreChannelNoise)
|
||||
# editby: gotbletu (https://www.youtube.com/user/gotbletu)
|
||||
|
||||
# demo: https://www.youtube.com/watch?v=kxJClZIXSnM
|
||||
# info: this is a script to launch other rofi scripts,
|
||||
# saves us the trouble of binding multiple hotkeys for each script,
|
||||
# when we can just use one hotkey for everything.
|
||||
|
||||
declare -A LABELS
|
||||
declare -A COMMANDS
|
||||
|
||||
###
|
||||
# List of defined 'bangs'
|
||||
|
||||
# launch programs
|
||||
# COMMANDS["apps"]="rofi -combi-modi window,drun -show combi"
|
||||
# LABELS["apps"]=""
|
||||
|
||||
# open bookmarks
|
||||
# COMMANDS["bookmarks"]="~/.scripts/rofi-scripts-collection/rofi-surfraw-bookmarks.sh"
|
||||
# LABELS["bookmarks"]=""
|
||||
|
||||
# search local files
|
||||
COMMANDS[""]="~/.config/rofi/locate/rofi-locate.sh"
|
||||
LABELS[""]="Locate"
|
||||
|
||||
# open custom web searches
|
||||
# COMMANDS["websearch"]="~/.scripts/rofi-scripts-collection/rofi-surfraw-websearch.sh"
|
||||
# LABELS["websearch"]=""
|
||||
|
||||
# show clipboard history
|
||||
# source: https://bitbucket.org/pandozer/rofi-clipboard-manager/overview
|
||||
# COMMANDS["clipboard"]='rofi -modi "clipboard:~/.bin/rofi-clipboard-manager/mclip.py menu" -show clipboard && ~/.bin/rofi-clipboard-manager/mclip.py paste'
|
||||
# LABELS["clipboard"]=""
|
||||
|
||||
# references --------------------------
|
||||
# COMMANDS[";sr2"]="chromium 'wikipedia.org/search-redirect.php?search=\" \${input}\""
|
||||
# LABELS[";sr2"]=""
|
||||
|
||||
# COMMANDS[";piratebay"]="chromium --disk-cache-dir=/tmp/cache http://thepiratebay.org/search/\" \${input}\""
|
||||
# LABELS[";piratebay"]=""
|
||||
|
||||
# COMMANDS[".bin"]="spacefm -r '/home/dka/bin'"
|
||||
# LABELS[".bin"]=".bin"
|
||||
|
||||
# COMMANDS["#screenshot"]='/home/dka/bin/screenshot-scripts/myscreenshot.sh'
|
||||
# LABELS["#screenshot"]="screenshot"
|
||||
|
||||
# greenclip clipboard history
|
||||
# source: https://github.com/erebe/greenclip
|
||||
COMMANDS[""]='rofi -modi "clipboard:greenclip print" -show Clipboard'
|
||||
LABELS[""]="Clipboard"
|
||||
|
||||
COMMANDS[""]='~/.config/rofi/nm-vpn/nm-vpn.sh'
|
||||
LABELS[""]='VPN Connection Manager'
|
||||
|
||||
COMMANDS[""]='~/.config/rofi/volume/volume.sh'
|
||||
LABELS[""]='Sound Manager'
|
||||
|
||||
COMMANDS[""]='~/.config/rofi/shortcuts/shortcuts.sh'
|
||||
LABELS[""]='Hotkey List'
|
||||
|
||||
COMMANDS[""]='wlogout'
|
||||
LABELS[""]='Session Menu'
|
||||
|
||||
COMMANDS[""]='wdisplays'
|
||||
LABELS[""]='Display Setup'
|
||||
|
||||
COMMANDS[""]='nwg-look'
|
||||
LABELS[""]='Appearance Settings'
|
||||
|
||||
COMMANDS[""]='noisetorch'
|
||||
LABELS[""]='Audio Noise Reduction'
|
||||
|
||||
COMMANDS[""]='/home/dom/.local/share/headset-charge-indicator/headset-charge-indicator.py &'
|
||||
LABELS[""]='Headset Control'
|
||||
|
||||
COMMANDS[""]='~/.config/rofi/bluetooth/bluetooth.sh'
|
||||
LABELS[""]='Bluetooth Control'
|
||||
|
||||
COMMANDS[""]='nm-applet --indicator &'
|
||||
LABELS[""]='Networker Manager'
|
||||
|
||||
COMMANDS[""]='hyprpicker -f hex -a'
|
||||
LABELS[""]='Color Picker'
|
||||
|
||||
COMMANDS[""]='font-manager'
|
||||
LABELS[""]='Font Manager'
|
||||
|
||||
COMMANDS[""]='gufw'
|
||||
LABELS[""]='Firewall Settings'
|
||||
|
||||
COMMANDS[""]='stacer'
|
||||
LABELS[" "]='System Maintenance'
|
||||
|
||||
|
||||
################################################################################
|
||||
# do not edit below
|
||||
################################################################################
|
||||
##
|
||||
# Generate menu
|
||||
##
|
||||
function print_menu()
|
||||
{
|
||||
for key in ${!LABELS[@]}
|
||||
do
|
||||
# echo "$key ${LABELS}"
|
||||
echo "$key ${LABELS[$key]}"
|
||||
# my top version just shows the first field in labels row, not two words side by side
|
||||
done
|
||||
}
|
||||
##
|
||||
# Show rofi.
|
||||
##
|
||||
function start()
|
||||
{
|
||||
# print_menu | rofi -dmenu -p "?=>"
|
||||
print_menu | sort | rofi -show "Tools" -dmenu -mesg " Tools" -i -p "rofi-bangs: "
|
||||
}
|
||||
|
||||
|
||||
# Run it
|
||||
value="$(start)"
|
||||
|
||||
# Split input.
|
||||
# grab upto first space.
|
||||
choice=${value%%\ *}
|
||||
# graph remainder, minus space.
|
||||
input=${value:$((${#choice}+1))}
|
||||
|
||||
##
|
||||
# Cancelled? bail out
|
||||
##
|
||||
if test -z ${choice}
|
||||
then
|
||||
exit
|
||||
fi
|
||||
|
||||
# check if choice exists
|
||||
if test ${COMMANDS[$choice]+isset}
|
||||
then
|
||||
# Execute the choice
|
||||
eval echo "Executing: ${COMMANDS[$choice]}"
|
||||
eval ${COMMANDS[$choice]}
|
||||
else
|
||||
eval $choice | rofi
|
||||
# prefer my above so I can use this same script to also launch apps like geany or leafpad etc (DK)
|
||||
# echo "Unknown command: ${choice}" | rofi -dmenu -p "error"
|
||||
fi
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
|
||||
#https://github.com/luiscrjunior/rofi-json
|
||||
|
||||
user_file="$(eval echo ${1})"
|
||||
|
||||
if [[ "$user_file" = /* ]]
|
||||
then
|
||||
config_file="$user_file"
|
||||
else
|
||||
cwd=$(dirname $0)
|
||||
config_file="${cwd}/${user_file}"
|
||||
fi
|
||||
|
||||
json=$(cat ${config_file})
|
||||
|
||||
if [ $# -eq 1 ]; then
|
||||
echo $json | jq -cr '.[] | "\(.name)|\(.command)|\(.icon)"' |
|
||||
while IFS="|" read -r name command icon
|
||||
do
|
||||
if [[ $name == "null" ]]; then
|
||||
continue
|
||||
fi
|
||||
if [[ $icon == "null" ]]; then
|
||||
icon="system-run"
|
||||
fi
|
||||
echo -en "${name}\0icon\x1f${icon}\n"
|
||||
done
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $# -eq 2 ]; then
|
||||
|
||||
selected=$2
|
||||
task=$(echo $json | jq ".[] | select(.name == \"$selected\")")
|
||||
|
||||
if [[ $task == "" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
command=$(echo $task | jq -j ".command")
|
||||
|
||||
if [[ $command == "null" ]]; then
|
||||
command=$(echo $task | jq -j ".name")
|
||||
fi
|
||||
|
||||
coproc bash -c "$command"
|
||||
exit
|
||||
|
||||
fi
|
||||
@@ -0,0 +1,6 @@
|
||||
@import "../config.rasi"
|
||||
@import "../colors.rasi"
|
||||
|
||||
window {
|
||||
width: 400px;
|
||||
}
|
||||
Executable
+40
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SETTINGS=$HOME/.config/rofi/gtk-theme.ini
|
||||
|
||||
#Gets the current gtk using gsettings and removes the quotes
|
||||
CURRENT_GTK_THEME=$(gsettings get org.gnome.desktop.interface gtk-theme)
|
||||
CURRENT_GTK_THEME="${CURRENT_GTK_THEME#?}"
|
||||
CURRENT_GTK_THEME="${CURRENT_GTK_THEME%?}"
|
||||
|
||||
#Gets the gtk theme that is in the settings.ini file
|
||||
SETTINGS_GTK_THEME=$(grep "GTK_THEME" "${SETTINGS}" | cut -b 11-)
|
||||
|
||||
#create new colors.rasi from template
|
||||
if [ "${SETTINGS_GTK_THEME}" != "${CURRENT_GTK_THEME}" ]; then
|
||||
sed -i "s:GTK_THEME=${SETTINGS_GTK_THEME}:GTK_THEME=${CURRENT_GTK_THEME}:g" "${SETTINGS}"
|
||||
|
||||
python3 $HOME/.config/rofi/file_gtk_style.py "${HOME}"/.config/rofi/_template/colors.rasi > "${HOME}"/.config/rofi/colors.rasi
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
window)
|
||||
showmode="window"
|
||||
;;
|
||||
files)
|
||||
showmode="filebrowser"
|
||||
;;
|
||||
run)
|
||||
showmode="run"
|
||||
;;
|
||||
*)
|
||||
showmode="drun"
|
||||
;;
|
||||
esac
|
||||
|
||||
## Run
|
||||
rofi \
|
||||
-show $showmode \
|
||||
-theme ~/.config/rofi/launcher/launcher.rasi
|
||||
-normal-window
|
||||
-matching fuzzy
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
# _ _ _ _
|
||||
# __ _ ___ | |_| |__ | | ___| |_ _ _
|
||||
# / _` |/ _ \| __| '_ \| |/ _ \ __| | | |
|
||||
#| (_| | (_) | |_| |_) | | __/ |_| |_| |
|
||||
# \__, |\___/ \__|_.__/|_|\___|\__|\__,_|
|
||||
# |___/
|
||||
# https://www.youtube.com/user/gotbletu
|
||||
# https://twitter.com/gotbletu
|
||||
# https://plus.google.com/+gotbletu
|
||||
# https://github.com/gotbletu
|
||||
# gotbletu@gmail.com
|
||||
|
||||
# info: rofi-locate is a script to search local files and folders on your computer using the locate command and the updatedb database
|
||||
# requirements: rofi mlocate
|
||||
# playlist: rofi https://www.youtube.com/playlist?list=PLqv94xWU9zZ0LVP1SEFQsLEYjZC_SUB3m
|
||||
|
||||
xdg-open "$(locate home media | rofi -threads 0 -width 100 -dmenu -i -p "locate:")"
|
||||
|
||||
@@ -0,0 +1,224 @@
|
||||
@import "../config.rasi"
|
||||
|
||||
configuration {
|
||||
modi: "";
|
||||
show-icons: false;
|
||||
drun-display-format: "{name}";
|
||||
window-format: "{w} · {c} · {t}";
|
||||
}
|
||||
|
||||
mainbox {
|
||||
enabled: true;
|
||||
spacing: 10px;
|
||||
margin: 0px;
|
||||
padding: 30px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px 0px 0px 0px;
|
||||
border-color: @border;
|
||||
background-color: transparent;
|
||||
children: [ "message", "listview", "inputbar" ];
|
||||
}
|
||||
|
||||
inputbar {
|
||||
enabled: true;
|
||||
spacing: 10px;
|
||||
margin: 0;
|
||||
padding: 20px 0px 0;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @border;
|
||||
background-color: transparent;
|
||||
text-color: @foreground;
|
||||
children: [ "textbox-prompt-colon", "entry", "mode-switcher" ];
|
||||
}
|
||||
|
||||
prompt {
|
||||
enabled: true;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
textbox-prompt-colon {
|
||||
enabled: true;
|
||||
padding: 5px 0px 0px 15px;
|
||||
expand: false;
|
||||
font: "MonarchOS 14";
|
||||
str: "";
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
entry {
|
||||
enabled: true;
|
||||
padding: 5px 0px;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
cursor: text;
|
||||
placeholder: "...";
|
||||
placeholder-color: inherit;
|
||||
}
|
||||
num-filtered-rows {
|
||||
enabled: true;
|
||||
expand: false;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
textbox-num-sep {
|
||||
enabled: true;
|
||||
expand: false;
|
||||
str: "/";
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
num-rows {
|
||||
enabled: true;
|
||||
expand: false;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
case-indicator {
|
||||
enabled: true;
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
}
|
||||
|
||||
/*****----- Listview -----*****/
|
||||
listview {
|
||||
enabled: true;
|
||||
columns: 1;
|
||||
lines: 2;
|
||||
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: @border;
|
||||
background-color: transparent;
|
||||
text-color: @foreground;
|
||||
cursor: "default";
|
||||
}
|
||||
scrollbar {
|
||||
handle-width: 5px;
|
||||
handle-color: @handle-colour;
|
||||
border-radius: 10px;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
/*****----- Elements -----*****/
|
||||
element {
|
||||
enabled: true;
|
||||
spacing: 10px;
|
||||
margin: 0px;
|
||||
padding: 5px 10px;
|
||||
border: 0px solid;
|
||||
border-radius: 10px;
|
||||
border-color: @border;
|
||||
background-color: transparent;
|
||||
text-color: @foreground;
|
||||
cursor: pointer;
|
||||
}
|
||||
element normal.normal {
|
||||
background-color: transparent;
|
||||
text-color: var(normal-foreground);
|
||||
}
|
||||
element normal.urgent {
|
||||
background-color: var(urgent-background);
|
||||
text-color: var(urgent-foreground);
|
||||
}
|
||||
element normal.active {
|
||||
background-color: var(normal-foreground);
|
||||
text-color: var(normal-background);
|
||||
}
|
||||
element selected.normal {
|
||||
background-color: var(selected-normal-background);
|
||||
text-color: var(normal-foreground);
|
||||
}
|
||||
element selected.urgent {
|
||||
background-color: var(selected-urgent-background);
|
||||
text-color: var(normal-background);
|
||||
}
|
||||
element selected.active {
|
||||
background-color: var(selected-active-background);
|
||||
text-color: var(normal-background);
|
||||
}
|
||||
|
||||
element-icon {
|
||||
background-color: transparent;
|
||||
text-color: inherit;
|
||||
size: 24px;
|
||||
cursor: inherit;
|
||||
}
|
||||
element-text {
|
||||
background-color: transparent;
|
||||
text-color: inherit;
|
||||
highlight: inherit;
|
||||
cursor: inherit;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.0;
|
||||
}
|
||||
|
||||
/*****----- Mode Switcher -----*****/
|
||||
mode-switcher{
|
||||
enabled: true;
|
||||
spacing: 10px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @border;
|
||||
background-color: transparent;
|
||||
text-color: @foreground;
|
||||
}
|
||||
button {
|
||||
padding: 7px 15px 7px 10px;
|
||||
border: 0px solid;
|
||||
border-radius: 100%;
|
||||
border-color: @border;
|
||||
background-color: @alternate-background;
|
||||
text-color: inherit;
|
||||
cursor: pointer;
|
||||
}
|
||||
button selected {
|
||||
background-color: var(selected-normal-background);
|
||||
text-color: var(selected-normal-foreground);
|
||||
}
|
||||
|
||||
/*****----- Message -----*****/
|
||||
message {
|
||||
enabled: true;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px 0px 0px 0px;
|
||||
border-color: @border;
|
||||
background-color: transparent;
|
||||
text-color: @foreground;
|
||||
}
|
||||
textbox {
|
||||
padding: 8px 10px;
|
||||
border: 0px solid;
|
||||
border-radius: 10px;
|
||||
border-color: @border;
|
||||
background-color: @alternate-background;
|
||||
text-color: @foreground;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.0;
|
||||
highlight: none;
|
||||
placeholder-color: @foreground;
|
||||
blink: true;
|
||||
markup: true;
|
||||
}
|
||||
error-message {
|
||||
padding: 10px;
|
||||
border: 2px solid;
|
||||
border-radius: 10px;
|
||||
border-color: @border;
|
||||
background-color: @background;
|
||||
text-color: @foreground;
|
||||
}
|
||||
Executable
+99
@@ -0,0 +1,99 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (C) 2021 Damien Cassou
|
||||
|
||||
# Author: Damien Cassou <damien@cassou.me>
|
||||
# Url: https://gitlab.com/DamienCassou/rofi-vpn
|
||||
# Version: 0.2.0
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# Commentary:
|
||||
|
||||
# This program uses rofi and nmcli to let the user enable/disable VPN
|
||||
# connections.
|
||||
|
||||
# Code:
|
||||
|
||||
# What to show in front of an active VPN connection:
|
||||
ACTIVE_PREFIX=" "
|
||||
|
||||
# What to show in front of an inactive VPN connection:
|
||||
INACTIVE_PREFIX=" "
|
||||
|
||||
# Display on standard output all VPN connections, one per line. An
|
||||
# active VPN connection is prefixed with `ACTIVE_PREFIX` and an inactive
|
||||
# one is prefixed with `INACTIVE_PREFIX`.
|
||||
function list_vpn_connections() {
|
||||
nmcli --get-values ACTIVE,NAME,TYPE connection show \
|
||||
| grep ':vpn$' \
|
||||
| sed \
|
||||
-e "s/^no:/${INACTIVE_PREFIX}/" \
|
||||
-e "s/^yes:/${ACTIVE_PREFIX}/" \
|
||||
-e 's/:vpn$//'
|
||||
}
|
||||
|
||||
# Take a line as displayed by `list_vpn_connections()` as argument and
|
||||
# use nmcli to toggle the corresponding connection.
|
||||
function toggle_vpn_connection() {
|
||||
local result="$1"
|
||||
local connection
|
||||
|
||||
connection=$(extract_connection_name_from_result "${result}")
|
||||
|
||||
if [[ $result = ${ACTIVE_PREFIX}* ]]; then
|
||||
feedback=$(nmcli connection down "$connection")
|
||||
dunstify "VPN Status '$connection'" "$feedback" --replace=553
|
||||
else
|
||||
kitty --class "kitty-vpn" --title "VPN Connection" nmcli connection --ask up "$connection"
|
||||
#feedback=$(nmcli connection up "$connection")
|
||||
dunstify "VPN Status '$connection'" "" --replace=553
|
||||
fi
|
||||
}
|
||||
|
||||
# Take a line as displayed by `list_vpn_connections()` as argument and
|
||||
# remove `ACTIVE_PREFIX` or `INACTIVE_PREFIX` to only display the
|
||||
# connection name.
|
||||
function extract_connection_name_from_result() {
|
||||
local result="$1"
|
||||
|
||||
# I don't know how to use plain bash to remove the prefix so I'm
|
||||
# using sed:
|
||||
# shellcheck disable=SC2001
|
||||
sed -e 's/^.* \([^ ]\+\)$/\1/' <<< "$result"
|
||||
}
|
||||
|
||||
# Execute the `rofi` command. The first argument of the function is
|
||||
# used as lines to select from.
|
||||
function start_rofi() {
|
||||
local content="$1"
|
||||
echo -e "$content" | rofi -dmenu -theme $HOME/.config/rofi/nm-vpn/nm-vpn.rasi -mesg " VPN Connection Manager" -icon ""
|
||||
}
|
||||
|
||||
# List the VPN connections and let the user toggle one using rofi.
|
||||
function main() {
|
||||
local connections
|
||||
local result
|
||||
|
||||
connections=$(list_vpn_connections)
|
||||
result=$(start_rofi "$connections")
|
||||
|
||||
if [ -n "$result" ]; then
|
||||
toggle_vpn_connection "$result"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
main
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
####
|
||||
## https://github.com/ericmurphyxyz/rofi-wifi-menu
|
||||
####
|
||||
|
||||
notify-send "Getting list of available Wi-Fi networks..."
|
||||
# Get a list of available wifi connections and morph it into a nice-looking list
|
||||
wifi_list=$(nmcli --fields "SECURITY,SSID" device wifi list | sed 1d | sed 's/ */ /g' | sed -E "s/WPA*.?\S/ /g" | sed "s/^--/ /g" | sed "s/ //g" | sed "/--/d")
|
||||
|
||||
connected=$(nmcli -fields WIFI g)
|
||||
if [[ "$connected" =~ "enabled" ]]; then
|
||||
toggle="睊 Disable Wi-Fi"
|
||||
elif [[ "$connected" =~ "disabled" ]]; then
|
||||
toggle="直 Enable Wi-Fi"
|
||||
fi
|
||||
|
||||
# Use rofi to select wifi network
|
||||
chosen_network=$(echo -e "$toggle\n$wifi_list" | uniq -u | rofi -drun -i -selected-row 1 -p "Wi-Fi SSID: " )
|
||||
# Get name of connection
|
||||
chosen_id=$(echo "${chosen_network:3}" | xargs)
|
||||
|
||||
if [ "$chosen_network" = "" ]; then
|
||||
exit
|
||||
elif [ "$chosen_network" = "直 Enable Wi-Fi" ]; then
|
||||
nmcli radio wifi on
|
||||
elif [ "$chosen_network" = "睊 Disable Wi-Fi" ]; then
|
||||
nmcli radio wifi off
|
||||
else
|
||||
# Message to show when connection is activated successfully
|
||||
success_message="You are now connected to the Wi-Fi network \"$chosen_id\"."
|
||||
# Get saved connections
|
||||
saved_connections=$(nmcli -g NAME connection)
|
||||
if [[ $(echo "$saved_connections" | grep -w "$chosen_id") = "$chosen_id" ]]; then
|
||||
nmcli connection up id "$chosen_id" | grep "successfully" && notify-send "Connection Established" "$success_message"
|
||||
else
|
||||
if [[ "$chosen_network" =~ "" ]]; then
|
||||
wifi_password=$(rofi -dmenu -p "Password: " )
|
||||
fi
|
||||
nmcli device wifi connect "$chosen_id" password "$wifi_password" | grep "successfully" && notify-send "Connection Established" "$success_message"
|
||||
fi
|
||||
fi
|
||||
@@ -0,0 +1,76 @@
|
||||
@import "config.rasi"
|
||||
@import "colors.rasi"
|
||||
|
||||
configuration {
|
||||
show-icons: false;
|
||||
}
|
||||
|
||||
window {
|
||||
|
||||
width:200px;
|
||||
}
|
||||
|
||||
mainbox {
|
||||
children: [ "message", "listview"];
|
||||
}
|
||||
|
||||
/*****----- Message -----*****/
|
||||
message {
|
||||
enabled: true;
|
||||
margin: 0px;
|
||||
padding: 8px;
|
||||
border: 0px solid;
|
||||
border-radius: 100%;
|
||||
background-color: transparent;
|
||||
text-color: var(theme-text-color);
|
||||
}
|
||||
textbox {
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
|
||||
placeholder-color: var(theme-text-color);
|
||||
|
||||
font: "Hack Nerd Font Bold 12";
|
||||
}
|
||||
error-message {
|
||||
padding: 12px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
background-color: var(theme-bg-color);
|
||||
text-color: var(theme-text-color);
|
||||
}
|
||||
|
||||
listview {
|
||||
columns: 2;
|
||||
lines: 1;
|
||||
layout:vertical;
|
||||
}
|
||||
|
||||
|
||||
element {
|
||||
enabled: true;
|
||||
spacing: 0px;
|
||||
margin: 0px;
|
||||
|
||||
border: 0px solid;
|
||||
border-radius: 100%;
|
||||
background-color: transparent;
|
||||
|
||||
cursor: "pointer";
|
||||
}
|
||||
element-text {
|
||||
background-color: transparent;
|
||||
text-color: var(theme-text-color);
|
||||
cursor: inherit;
|
||||
horizontal-align: 0.5;
|
||||
vertical-align:0;
|
||||
font: "Hack Nerd Font 18";
|
||||
|
||||
}
|
||||
element selected.normal {
|
||||
background-color: var(theme-selected-bg-color);
|
||||
text-color: var(theme-selected-fg-color);
|
||||
}
|
||||
element-text selected.normal {
|
||||
text-color: var(mantle);
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
configuration {
|
||||
show-icons: false;
|
||||
}
|
||||
|
||||
@import "../colors.rasi"
|
||||
|
||||
|
||||
window {
|
||||
transparency: "real";
|
||||
location: center;
|
||||
anchor: center;
|
||||
fullscreen: false;
|
||||
x-offset: 0px;
|
||||
y-offset: 60px;
|
||||
width: 635px;
|
||||
|
||||
border: 2px solid;
|
||||
border-radius: 10px;
|
||||
border-color: var(borders);
|
||||
|
||||
cursor: "default";
|
||||
background-color: var(theme-bg-color);
|
||||
}
|
||||
|
||||
mainbox {
|
||||
enabled: true;
|
||||
spacing: 15px;
|
||||
margin: 0px;
|
||||
padding: 30px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: var(borders);
|
||||
background-color: transparent;
|
||||
children: ["inputbar", "listview" ];
|
||||
}
|
||||
|
||||
|
||||
inputbar {
|
||||
enabled: true;
|
||||
spacing: 15px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
background-color: transparent;
|
||||
text-color: var(theme-text-color);
|
||||
children: ["textbox-prompt-colon", "prompt"];
|
||||
}
|
||||
|
||||
|
||||
textbox-prompt-colon {
|
||||
enabled: true;
|
||||
expand: false;
|
||||
font: "MonarchOS 10";
|
||||
str: "";
|
||||
padding: 12px 16px;
|
||||
border-radius: 100%;
|
||||
background-color: var(theme-selected-bg-color);
|
||||
text-color: @theme-selected-fg-color;
|
||||
|
||||
}
|
||||
prompt {
|
||||
enabled: true;
|
||||
padding: 12px;
|
||||
border-radius: 100%;
|
||||
background-color: var(theme-text-color);
|
||||
text-color: var(theme-bg-color);
|
||||
}
|
||||
|
||||
dummy {
|
||||
background-color: inherit;
|
||||
}
|
||||
|
||||
|
||||
listview {
|
||||
enabled: true;
|
||||
columns: 2;
|
||||
lines: 5;
|
||||
cycle: true;
|
||||
dynamic: false;
|
||||
scrollbar: false;
|
||||
layout: horizontal;
|
||||
reverse: false;
|
||||
fixed-height: true;
|
||||
fixed-columns: true;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.5;
|
||||
spacing: 15px;
|
||||
background-color: transparent;
|
||||
text-color: var(theme-text-color);
|
||||
cursor: "default";
|
||||
}
|
||||
|
||||
element {
|
||||
enabled: true;
|
||||
spacing: 0px;
|
||||
margin: 0px;
|
||||
|
||||
border: 0px solid;
|
||||
border-radius: 100%;
|
||||
|
||||
background-color: transparent;
|
||||
|
||||
cursor: "pointer";
|
||||
}
|
||||
element-text {
|
||||
font: "Hack Nerd Font 28";
|
||||
background-color: transparent;
|
||||
text-color: var(text);
|
||||
cursor: inherit;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.5;
|
||||
padding: 10px 40px;
|
||||
horizontal-align: 0;
|
||||
}
|
||||
element selected.normal {
|
||||
background-color: var(theme-selected-bg-color);
|
||||
}
|
||||
element-text selected.normal {
|
||||
text-color: var(theme-bg-color);
|
||||
}
|
||||
Executable
+101
@@ -0,0 +1,101 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya (adi1090x)
|
||||
## Github : @adi1090x
|
||||
#
|
||||
## Rofi : Power Menu
|
||||
#
|
||||
|
||||
# CMDs
|
||||
uptime="`uptime -p | sed -e 's/up //g'`"
|
||||
host=`hostname`
|
||||
|
||||
# Options
|
||||
shutdown=''
|
||||
reboot=''
|
||||
lock=''
|
||||
suspend=''
|
||||
logout=''
|
||||
yes=''
|
||||
no=''
|
||||
|
||||
# Rofi CMD
|
||||
rofi_cmd() {
|
||||
rofi -dmenu \
|
||||
-p "$host uptime: $uptime" \
|
||||
-mesg "$host uptime: $uptime" \
|
||||
-theme ~/.config/rofi/powermenu/powermenu.rasi
|
||||
}
|
||||
|
||||
# Confirmation CMD
|
||||
confirm_cmd() {
|
||||
rofi -dmenu \
|
||||
-p 'Confirmation' \
|
||||
-mesg 'Confirm '${chosen} \
|
||||
-theme ~/.config/rofi/powermenu/confirm.rasi
|
||||
}
|
||||
|
||||
# Ask for confirmation
|
||||
confirm_exit() {
|
||||
echo -e "$yes\n$no" | confirm_cmd ${chosen}
|
||||
}
|
||||
|
||||
# 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
|
||||
elif [[ $1 == '--reboot' ]]; then
|
||||
systemctl reboot
|
||||
elif [[ $1 == '--suspend' ]]; then
|
||||
mpc -q pause
|
||||
amixer set Master mute
|
||||
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
|
||||
elif [[ "$DESKTOP_SESSION" == 'hyprland' ]]; then
|
||||
hyprctl dispatch exit
|
||||
fi
|
||||
fi
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
# Actions
|
||||
chosen="$(run_rofi)"
|
||||
case ${chosen} in
|
||||
$shutdown)
|
||||
run_cmd --shutdown
|
||||
;;
|
||||
$reboot)
|
||||
run_cmd --reboot
|
||||
;;
|
||||
$lock)
|
||||
if [[ "$DESKTOP_SESSION" == 'bspwm' ]]; then
|
||||
betterlockscreen -l
|
||||
elif [[ "$DESKTOP_SESSION" == 'hyprland' ]]; then
|
||||
killall rofi
|
||||
swaylock
|
||||
fi
|
||||
;;
|
||||
$suspend)
|
||||
run_cmd --suspend
|
||||
;;
|
||||
$logout)
|
||||
run_cmd --logout
|
||||
;;
|
||||
esac
|
||||
Executable
+307
@@ -0,0 +1,307 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Rofi clipboard manager
|
||||
Usage:
|
||||
roficlip.py --daemon [-q | --quiet]
|
||||
roficlip.py --show [--persistent | --actions] [-q | --quiet] [<item>]
|
||||
roficlip.py --add [-q | --quiet ]
|
||||
roficlip.py --remove [-q | --quiet]
|
||||
roficlip.py --edit
|
||||
roficlip.py (-h | --help)
|
||||
roficlip.py (-v | --version)
|
||||
|
||||
Arguments:
|
||||
<item> Selected item to be used with rofi
|
||||
|
||||
Commands:
|
||||
--daemon Run clipboard manager daemon.
|
||||
--show Show clipboard history.
|
||||
--persistent Select to show persistent history.
|
||||
--actions Select to show actions defined in config.
|
||||
--add Add current clipboard to persistent storage.
|
||||
--remove Remove current clipboard from persistent storage.
|
||||
--edit Edit persistent storage with text editor.
|
||||
-q, --quiet Do not notify, even if notification enabled in config.
|
||||
-h, --help Show this screen.
|
||||
-v, --version Show version.
|
||||
|
||||
"""
|
||||
import errno
|
||||
import os
|
||||
import sys
|
||||
import stat
|
||||
import struct
|
||||
from subprocess import Popen, DEVNULL
|
||||
from tempfile import NamedTemporaryFile
|
||||
|
||||
try:
|
||||
import gi
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, Gdk, GLib
|
||||
except ImportError:
|
||||
raise
|
||||
|
||||
import yaml
|
||||
from docopt import docopt
|
||||
from xdg import BaseDirectory
|
||||
|
||||
try:
|
||||
import notify2
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
|
||||
class ClipboardManager():
|
||||
def __init__(self):
|
||||
# Init databases and fifo
|
||||
name = 'roficlip'
|
||||
self.ring_db = '{0}/{1}'.format(BaseDirectory.save_data_path(name), 'ring.db')
|
||||
self.persist_db = '{0}/{1}'.format(BaseDirectory.save_data_path(name), 'persistent.db')
|
||||
self.fifo_path = '{0}/{1}.fifo'.format(BaseDirectory.get_runtime_dir(strict=False), name)
|
||||
self.config_path = '{0}/settings'.format(BaseDirectory.save_config_path(name))
|
||||
if not os.path.isfile(self.ring_db):
|
||||
open(self.ring_db, "a+").close()
|
||||
if not os.path.isfile(self.persist_db):
|
||||
open(self.persist_db, "a+").close()
|
||||
if (
|
||||
not os.path.exists(self.fifo_path) or
|
||||
not stat.S_ISFIFO(os.stat(self.fifo_path).st_mode)
|
||||
):
|
||||
os.mkfifo(self.fifo_path)
|
||||
self.fifo = os.open(self.fifo_path, os.O_RDONLY | os.O_NONBLOCK)
|
||||
|
||||
# Init clipboard and read databases
|
||||
self.cb = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
|
||||
self.ring = self.read(self.ring_db)
|
||||
self.persist = self.read(self.persist_db)
|
||||
|
||||
# Load settings
|
||||
self.load_config()
|
||||
|
||||
# Init notifications
|
||||
if self.cfg['notify'] and 'notify2' in sys.modules:
|
||||
self.notify = notify2
|
||||
self.notify.init(name)
|
||||
else:
|
||||
self.cfg['notify'] = False
|
||||
|
||||
def daemon(self):
|
||||
"""
|
||||
Clipboard Manager daemon.
|
||||
"""
|
||||
GLib.timeout_add(300, self.cb_watcher)
|
||||
GLib.timeout_add(300, self.fifo_watcher)
|
||||
Gtk.main()
|
||||
|
||||
def cb_watcher(self):
|
||||
"""
|
||||
Callback function.
|
||||
Watch clipboard and write changes to ring database.
|
||||
Must return "True" for continuous operation.
|
||||
"""
|
||||
clip = self.cb.wait_for_text()
|
||||
if self.sync_items(clip, self.ring):
|
||||
self.ring = self.ring[0:self.cfg['ring_size']]
|
||||
self.write(self.ring_db, self.ring)
|
||||
return True
|
||||
|
||||
def fifo_watcher(self):
|
||||
"""
|
||||
Callback function.
|
||||
Copy contents from fifo to clipboard.
|
||||
Must return "True" for continuous operation.
|
||||
"""
|
||||
try:
|
||||
fifo_in = os.read(self.fifo, 65536)
|
||||
except OSError as err:
|
||||
if err.errno == errno.EAGAIN or err.errno == errno.EWOULDBLOCK:
|
||||
fifo_in = None
|
||||
else:
|
||||
raise
|
||||
if fifo_in:
|
||||
self.cb.set_text(fifo_in.decode('utf-8'), -1)
|
||||
self.notify_send('Copied to the clipboard.')
|
||||
return True
|
||||
|
||||
def sync_items(self, clip, items):
|
||||
"""
|
||||
Sync clipboard contents with specified items dict when needed.
|
||||
Return "True" if dict modified, otherwise "False".
|
||||
"""
|
||||
if clip and (not items or clip != items[0]):
|
||||
if clip in items:
|
||||
items.remove(clip)
|
||||
items.insert(0, clip)
|
||||
return True
|
||||
return False
|
||||
|
||||
def copy_item(self, clip):
|
||||
"""
|
||||
Writes to fifo item that should be copied to clipboard.
|
||||
"""
|
||||
if clip:
|
||||
with open(self.fifo_path, "w") as file:
|
||||
file.write(clip)
|
||||
file.close()
|
||||
|
||||
def show_items(self, items):
|
||||
"""
|
||||
Format and show contents of specified items dict (for rofi).
|
||||
"""
|
||||
for clip in items:
|
||||
clip = clip.replace('\n', self.cfg['newline_char'])
|
||||
|
||||
# Move text after last \# to beginning of string
|
||||
if args['--persistent'] and self.cfg['show_comments_first'] and '#' in clip:
|
||||
# Save index of last \#
|
||||
idx = clip.rfind('#')
|
||||
# Format string
|
||||
clip = '{} ➜ {}'.format(clip[idx+1:], clip[:idx])
|
||||
preview = clip[0:self.cfg['preview_width']]
|
||||
print(preview)
|
||||
|
||||
def persistent_add(self):
|
||||
"""
|
||||
Add current clipboard to persistent storage.
|
||||
"""
|
||||
clip = self.cb.wait_for_text()
|
||||
if self.sync_items(clip, self.persist):
|
||||
self.write(self.persist_db, self.persist)
|
||||
self.notify_send('Added to persistent.')
|
||||
|
||||
def persistent_remove(self):
|
||||
"""
|
||||
Remove current clipboard from persistent storage.
|
||||
"""
|
||||
clip = self.cb.wait_for_text()
|
||||
if clip and clip in self.persist:
|
||||
self.persist.remove(clip)
|
||||
self.write(self.persist_db, self.persist)
|
||||
self.notify_send('Removed from persistent.')
|
||||
|
||||
def persistent_edit(self):
|
||||
"""
|
||||
Edit persistent storage with text editor.
|
||||
New line char will be used as separator.
|
||||
"""
|
||||
editor = os.getenv('EDITOR')
|
||||
if self.persist and editor:
|
||||
try:
|
||||
tmp = NamedTemporaryFile(mode='w+')
|
||||
for clip in self.persist:
|
||||
clip = '{}\n'.format(clip.replace('\n', self.cfg['newline_char']))
|
||||
tmp.write(clip)
|
||||
tmp.flush()
|
||||
except IOError as e:
|
||||
print("I/O error({0}): {1}".format(e.errno, e.strerror))
|
||||
else:
|
||||
proc = Popen([editor, tmp.name], stdout=DEVNULL, stderr=DEVNULL)
|
||||
ret = proc.wait()
|
||||
if ret == 0:
|
||||
tmp.seek(0, 0)
|
||||
clips = tmp.read().splitlines()
|
||||
if clips:
|
||||
self.persist = []
|
||||
for clip in clips:
|
||||
clip = clip.replace('\n', '')
|
||||
clip = clip.replace(self.cfg['newline_char'], '\n')
|
||||
self.persist.append(clip)
|
||||
self.write(self.persist_db, self.persist)
|
||||
finally:
|
||||
tmp.close()
|
||||
|
||||
def do_action(self, action):
|
||||
"""
|
||||
Run selected action on clipboard contents.
|
||||
"""
|
||||
if action:
|
||||
clip = self.cb.wait_for_text()
|
||||
params = self.actions[action].split(' ')
|
||||
while '%s' in params:
|
||||
params[params.index('%s')] = clip
|
||||
Popen(params, stdout=DEVNULL, stderr=DEVNULL)
|
||||
self.notify_send("Action: {}".format(action))
|
||||
|
||||
def notify_send(self, text):
|
||||
"""
|
||||
Show desktop notification.
|
||||
"""
|
||||
if self.cfg['notify']:
|
||||
n = self.notify.Notification("Roficlip", text)
|
||||
n.timeout = self.cfg['notify_timeout'] * 1000
|
||||
n.show()
|
||||
|
||||
def read(self, fd):
|
||||
"""
|
||||
Helper function. Binary reader.
|
||||
"""
|
||||
result = []
|
||||
with open(fd, "rb") as file:
|
||||
bytes_read = file.read(4)
|
||||
while bytes_read:
|
||||
chunksize = struct.unpack('>i', bytes_read)[0]
|
||||
bytes_read = file.read(chunksize)
|
||||
result.append(bytes_read.decode('utf-8'))
|
||||
bytes_read = file.read(4)
|
||||
return result
|
||||
|
||||
def write(self, fd, items):
|
||||
"""
|
||||
Helper function. Binary writer.
|
||||
"""
|
||||
with open(fd, 'wb') as file:
|
||||
for item in items:
|
||||
item = item.encode('utf-8')
|
||||
file.write(struct.pack('>i', len(item)))
|
||||
file.write(item)
|
||||
|
||||
def load_config(self):
|
||||
"""
|
||||
Read config if exists, and/or provide defaults.
|
||||
"""
|
||||
# default settings
|
||||
settings = {
|
||||
'settings': {
|
||||
'ring_size': 20,
|
||||
'preview_width': 100,
|
||||
'newline_char': '¬',
|
||||
'notify': True,
|
||||
'notify_timeout': 1,
|
||||
'show_comments_first': False,
|
||||
},
|
||||
'actions': {}
|
||||
}
|
||||
if os.path.isfile(self.config_path):
|
||||
with open(self.config_path, "r") as file:
|
||||
config = yaml.safe_load(file)
|
||||
for key in {'settings', 'actions'}:
|
||||
if key in config:
|
||||
settings[key].update(config[key])
|
||||
self.cfg = settings['settings']
|
||||
self.actions = settings['actions']
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
cm = ClipboardManager()
|
||||
args = docopt(__doc__, version='0.4')
|
||||
if args['--quiet']:
|
||||
cm.cfg['notify'] = False
|
||||
if args['--daemon']:
|
||||
cm.daemon()
|
||||
elif (args['--show'] and not args['--actions']):
|
||||
if args['<item>']:
|
||||
cm.copy_item(args['<item>'])
|
||||
else:
|
||||
cm.show_items(cm.persist if args['--persistent'] else cm.ring)
|
||||
elif (args['--show'] and args['--actions']):
|
||||
if args['<item>']:
|
||||
cm.do_action(args['<item>'])
|
||||
else:
|
||||
cm.show_items(cm.actions)
|
||||
elif args['--add']:
|
||||
cm.persistent_add()
|
||||
elif args['--remove']:
|
||||
cm.persistent_remove()
|
||||
elif args['--edit']:
|
||||
cm.persistent_edit()
|
||||
exit(0)
|
||||
@@ -0,0 +1,9 @@
|
||||
@import "../config.rasi"
|
||||
@import "../colors.rasi"
|
||||
|
||||
configuration {
|
||||
show-icons: false;
|
||||
modi: "drun";
|
||||
window-format: "{w} · {c} · {t}";
|
||||
}
|
||||
|
||||
Executable
+77
@@ -0,0 +1,77 @@
|
||||
#!/bin/bash
|
||||
|
||||
# https://github.com/Gustash/hyprland-interactive-screenshot
|
||||
# `list_geometry` returns the geometry of the focused of visible windows. You can also get they title
|
||||
# by setting a second argument to `with_description`. The geometry and the title are seperated by `\t`.
|
||||
#
|
||||
# Arguments:
|
||||
# $1: `focused` or `visible`
|
||||
# $2: `with_description` or nothing
|
||||
#
|
||||
# Output examples:
|
||||
# - with the `with_description` option:
|
||||
# 12,43 100x200\tTermite
|
||||
# - without the `with_description` option:
|
||||
# 12,43 100x200
|
||||
function list_geometry () {
|
||||
[ "$2" = with_description ] && local append="\(.title)\t" || local append=
|
||||
if [ "$1" = focused ]; then
|
||||
hyprctl -j activewindow | jq -r '"'$append'\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"'
|
||||
else
|
||||
hyprctl -j clients | jq -r '.[] | select(.workspace.id | contains('$(hyprctl -j monitors | jq -r 'map(.activeWorkspace.id) | join(",")')')) | "'$append'\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"'
|
||||
fi
|
||||
}
|
||||
|
||||
WINDOWS=`list_geometry visible with_description`
|
||||
FOCUSED=`list_geometry focused`
|
||||
|
||||
CHOICE=`rofi -dmenu -theme ~/.config/rofi/screenshot/screenshot.rasi -p 'Screenshot' << EOF
|
||||
fullscreen
|
||||
region
|
||||
focused
|
||||
$WINDOWS
|
||||
EOF`
|
||||
|
||||
SAVEDIR=${HYPRLAND_INTERACTIVE_SCREENSHOT_SAVEDIR}
|
||||
[ -z "$SAVEDIR" ] && SAVEDIR=${SWAY_INTERACTIVE_SCREENSHOT_SAVEDIR:=~}
|
||||
mkdir -p -- "$SAVEDIR"
|
||||
FILENAME="$SAVEDIR/$(date +'%Y-%m-%d-%H%M%S_screenshot.png')"
|
||||
EXPENDED_FILENAME="${FILENAME/#\~/$HOME}"
|
||||
|
||||
case $CHOICE in
|
||||
fullscreen)
|
||||
grim "$EXPENDED_FILENAME"
|
||||
;;
|
||||
region)
|
||||
grim -g "$(slurp)" "$EXPENDED_FILENAME"
|
||||
;;
|
||||
focused)
|
||||
grim -g "$FOCUSED" "$EXPENDED_FILENAME"
|
||||
;;
|
||||
'')
|
||||
notify-send "Screenshot" "Cancelled"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
GEOMETRY="`echo \"$CHOICE\" | cut -d$'\t' -f1`"
|
||||
grim -g "$GEOMETRY" "$EXPENDED_FILENAME"
|
||||
esac
|
||||
|
||||
# If swappy is installed, prompt the user to edit the captured screenshot
|
||||
if command -v swappy $>/dev/null
|
||||
then
|
||||
EDIT_CHOICE=`echo -e "\n" | rofi -dmenu -theme ~/.config/rofi/powermenu/confirm.rasi -p 'Edit' -mesg 'Edit?'`
|
||||
|
||||
case $EDIT_CHOICE in
|
||||
)
|
||||
swappy -f "$EXPENDED_FILENAME" -o "$EXPENDED_FILENAME"
|
||||
;;
|
||||
)
|
||||
;;
|
||||
'')
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
wl-copy < "$EXPENDED_FILENAME"
|
||||
notify-send "Screenshot" "File saved as <i>'$FILENAME'</i> and copied to the clipboard." -i "$EXPENDED_FILENAME"
|
||||
@@ -0,0 +1,49 @@
|
||||
configuration {
|
||||
modi: "drun";
|
||||
show-icons: false;
|
||||
drun-display-format: "{name}";
|
||||
}
|
||||
|
||||
@import "../config.rasi"
|
||||
@import "../colors.rasi"
|
||||
|
||||
|
||||
window {
|
||||
enabled: true;
|
||||
cursor: "default";
|
||||
}
|
||||
|
||||
|
||||
mainbox {
|
||||
children: [ "message", "listview", "inputbar" ];
|
||||
}
|
||||
|
||||
|
||||
inputbar {
|
||||
enabled: true;
|
||||
|
||||
children: [ "textbox-prompt-colon", "entry", "mode-switcher" ];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
listview {
|
||||
enabled: true;
|
||||
columns: 2;
|
||||
lines: 8;
|
||||
cycle: true;
|
||||
dynamic: true;
|
||||
scrollbar: false;
|
||||
layout: vertical;
|
||||
reverse: false;
|
||||
fixed-height: true;
|
||||
fixed-columns: true;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
element-icon {
|
||||
size: 0px;
|
||||
}
|
||||
+151
@@ -0,0 +1,151 @@
|
||||
#!/usr/bin/env bash
|
||||
# author: unknown
|
||||
# sentby: MoreChannelNoise (https://www.youtube.com/user/MoreChannelNoise)
|
||||
# editby: gotbletu (https://www.youtube.com/user/gotbletu)
|
||||
|
||||
# demo: https://www.youtube.com/watch?v=kxJClZIXSnM
|
||||
# info: this is a script to launch other rofi scripts,
|
||||
# saves us the trouble of binding multiple hotkeys for each script,
|
||||
# when we can just use one hotkey for everything.
|
||||
|
||||
declare -A LABELS
|
||||
declare -A COMMANDS
|
||||
|
||||
###
|
||||
# List of defined 'bangs'
|
||||
|
||||
# launch programs
|
||||
# COMMANDS["apps"]="rofi -combi-modi window,drun -show combi"
|
||||
# LABELS["apps"]=""
|
||||
|
||||
# open bookmarks
|
||||
# COMMANDS["bookmarks"]="~/.scripts/rofi-scripts-collection/rofi-surfraw-bookmarks.sh"
|
||||
# LABELS["bookmarks"]=""
|
||||
|
||||
# search local files
|
||||
COMMANDS[""]="~/.config/rofi/locate/rofi-locate.sh"
|
||||
LABELS[""]="Locate"
|
||||
|
||||
# open custom web searches
|
||||
# COMMANDS["websearch"]="~/.scripts/rofi-scripts-collection/rofi-surfraw-websearch.sh"
|
||||
# LABELS["websearch"]=""
|
||||
|
||||
# show clipboard history
|
||||
# source: https://bitbucket.org/pandozer/rofi-clipboard-manager/overview
|
||||
# COMMANDS["clipboard"]='rofi -modi "clipboard:~/.bin/rofi-clipboard-manager/mclip.py menu" -show clipboard && ~/.bin/rofi-clipboard-manager/mclip.py paste'
|
||||
# LABELS["clipboard"]=""
|
||||
|
||||
# references --------------------------
|
||||
# COMMANDS[";sr2"]="chromium 'wikipedia.org/search-redirect.php?search=\" \${input}\""
|
||||
# LABELS[";sr2"]=""
|
||||
|
||||
# COMMANDS[";piratebay"]="chromium --disk-cache-dir=/tmp/cache http://thepiratebay.org/search/\" \${input}\""
|
||||
# LABELS[";piratebay"]=""
|
||||
|
||||
# COMMANDS[".bin"]="spacefm -r '/home/dka/bin'"
|
||||
# LABELS[".bin"]=".bin"
|
||||
|
||||
# COMMANDS["#screenshot"]='/home/dka/bin/screenshot-scripts/myscreenshot.sh'
|
||||
# LABELS["#screenshot"]="screenshot"
|
||||
|
||||
# greenclip clipboard history
|
||||
# source: https://github.com/erebe/greenclip
|
||||
COMMANDS[""]='cliphist list | rofi -dmenu | cliphist decode | wl-copy'
|
||||
LABELS[""]="Clipboard"
|
||||
|
||||
COMMANDS[""]='~/.config/rofi/nm-vpn/nm-vpn.sh'
|
||||
LABELS[""]='VPN Connection Manager'
|
||||
|
||||
COMMANDS[""]='~/.config/rofi/volume/volume.sh'
|
||||
LABELS[""]='Sound Manager'
|
||||
|
||||
COMMANDS[""]='~/.config/rofi/shortcuts/shortcuts.sh'
|
||||
LABELS[""]='Hotkey List'
|
||||
|
||||
COMMANDS[""]='wlogout'
|
||||
LABELS[""]='Session Menu'
|
||||
|
||||
COMMANDS[""]='wdisplays'
|
||||
LABELS[""]='Display Setup'
|
||||
|
||||
COMMANDS[""]='nwg-look'
|
||||
LABELS[""]='Appearance Settings'
|
||||
|
||||
COMMANDS[""]='noisetorch'
|
||||
LABELS[""]='Audio Noise Reduction'
|
||||
|
||||
COMMANDS[""]='/home/dom/.local/share/headset-charge-indicator/headset-charge-indicator.py &'
|
||||
LABELS[""]='Headset Control'
|
||||
|
||||
COMMANDS[""]='~/.config/rofi/bluetooth/bluetooth.sh'
|
||||
LABELS[""]='Bluetooth Control'
|
||||
|
||||
COMMANDS[""]='nm-applet --indicator &'
|
||||
LABELS[""]='Networker Manager'
|
||||
|
||||
COMMANDS[""]='hyprpicker -f hex -a'
|
||||
LABELS[""]='Color Picker'
|
||||
|
||||
COMMANDS[""]='font-manager'
|
||||
LABELS[""]='Font Manager'
|
||||
|
||||
COMMANDS[""]='gufw'
|
||||
LABELS[""]='Firewall Settings'
|
||||
|
||||
COMMANDS[""]='stacer'
|
||||
LABELS[""]='System Maintenance'
|
||||
|
||||
|
||||
################################################################################
|
||||
# do not edit below
|
||||
################################################################################
|
||||
##
|
||||
# Generate menu
|
||||
##
|
||||
function print_menu()
|
||||
{
|
||||
for key in ${!LABELS[@]}
|
||||
do
|
||||
# echo "$key ${LABELS}"
|
||||
echo "$key ${LABELS[$key]}"
|
||||
# my top version just shows the first field in labels row, not two words side by side
|
||||
done
|
||||
}
|
||||
##
|
||||
# Show rofi.
|
||||
##
|
||||
function start()
|
||||
{
|
||||
# print_menu | rofi -dmenu -p "?=>"
|
||||
print_menu | sort | rofi -theme $HOME/.config/rofi/settings-menu/settings-menu.rasi -show "Settings x Tools" -dmenu -mesg " Settings x Tools" -i -p "rofi-bangs: "
|
||||
}
|
||||
|
||||
|
||||
# Run it
|
||||
value="$(start)"
|
||||
|
||||
# Split input.
|
||||
# grab upto first space.
|
||||
choice=${value%%\ *}
|
||||
# graph remainder, minus space.
|
||||
input=${value:$((${#choice}+1))}
|
||||
|
||||
##
|
||||
# Cancelled? bail out
|
||||
##
|
||||
if test -z ${choice}
|
||||
then
|
||||
exit
|
||||
fi
|
||||
|
||||
# check if choice exists
|
||||
if test ${COMMANDS[$choice]+isset}
|
||||
then
|
||||
# Execute the choice
|
||||
eval echo "Executing: ${COMMANDS[$choice]}"
|
||||
eval ${COMMANDS[$choice]}
|
||||
else
|
||||
eval $choice | rofi
|
||||
# prefer my above so I can use this same script to also launch apps like geany or leafpad etc (DK)
|
||||
# echo "Unknown command: ${choice}" | rofi -dmenu -p "error"
|
||||
fi
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
config_file=~/.config/hypr/hl-keybindings.conf
|
||||
keybinds=$(grep -oP '(?<=bind = ).*' $config_file)
|
||||
keybinds=$(echo "$keybinds" | sed 's/,\([^,]*\)$/ = \1/' | sed 's/, exec//g' | sed 's/^,//g')
|
||||
rofi -dmenu -p "Keybinds" <<< "$keybinds"
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
mapfile -t allLines < $HOME/.config/sxhkd/sxhkdrc
|
||||
jsonstr="["
|
||||
for ((i = 0; i < ${#allLines[@]}; ++i)); do
|
||||
if [[ ${allLines[$i]} =~ ^#.* ]]; then
|
||||
shortcut="${allLines[$i]:1}: ${allLines[$(( $i + 1 ))]}"
|
||||
if (( $i > 0 )); then
|
||||
jsonstr+=","
|
||||
fi
|
||||
jsonstr+="{"
|
||||
jsonstr+=\""name"\"":"
|
||||
jsonstr+=\""${shortcut}"\"
|
||||
jsonstr+=","\""command"\"":""\""\"
|
||||
jsonstr+="}"
|
||||
fi
|
||||
done
|
||||
jsonstr+="]"
|
||||
echo $jsonstr > /tmp/sxhkdrc.json
|
||||
rofi -modi " Hotkeys":"~/.config/rofi/helper/rofi-json.sh /tmp/sxhkdrc.json" -show " Hotkeys" -theme $HOME/.config/rofi/config.rasi
|
||||
@@ -0,0 +1 @@
|
||||
[{"name":"Window Switcher: alt + Tab","command":""},{"name":"System Monitor: ctrl + alt + Delete","command":""},{"name":" File Explorer: super + e","command":""},{"name":"Screenshot Tool: Print","command":""},{"name":"Kill GUI: super + k","command":""},{"name":"Screen Brightness +: XF86MonBrightnessUp","command":""},{"name":"Screen Brightness -: XF86MonBrightnessDown","command":""},{"name":"Song Prev, Next : XF86Audio{Prev,Next}","command":""},{"name":"Sond Play / Pause: XF86AudioPlay","command":""},{"name":" terminal emulator: super + Return","command":""},{"name":" program launcher: super + space","command":""},{"name":" Show this Shortcut List: super + s","command":""},{"name":" make sxhkd reload its configuration files:: super + Escape","command":""},{"name":": # bspwm hotkeys","command":""},{"name":" bspwm hotkeys: #","command":""},{"name":": ","command":""},{"name":" quit/restart bspwm: super + alt + {q,r}","command":""},{"name":" close and kill: super + {_,shift + }q","command":""},{"name":" alternate between the tiled and monocle layout: super + m","command":""},{"name":" send the newest marked node to the newest preselected node: super + y","command":""},{"name":" swap the current node and the biggest window: super + g","command":""},{"name":": # preselect","command":""},{"name":" preselect: #","command":""},{"name":": ","command":""},{"name":" preselect the direction: super + ctrl + {h,j,k,l}","command":""},{"name":" preselect the ratio: super + ctrl + {1-9}","command":""},{"name":" cancel the preselection for the focused node: super + ctrl + space","command":""},{"name":" cancel the preselection for the focused desktop: #super + ctrl + shift + space","command":""},{"name":"super + ctrl + shift + space: # bspc query -N -d | xargs -I id -n 1 bspc node id -p cancel","command":""},{"name":" bspc query -N -d | xargs -I id -n 1 bspc node id -p cancel: ","command":""},{"name":": # state/flags","command":""},{"name":" state/flags: #","command":""},{"name":": ","command":""},{"name":" set the window state: super + {t,shift + t,s,f}","command":""},{"name":" set the node flags: super + ctrl + {m,x,y,z}","command":""},{"name":": # focus/swap","command":""},{"name":" focus/swap: #","command":""},{"name":": ","command":""},{"name":" focus the node in the given direction: super + {_,shift + }{h,j,k,l}","command":""},{"name":" focus the node for the given path jump: super + {p,b,comma,period}","command":""},{"name":" focus the next/previous window in the current desktop: super + {_,shift + }c","command":""},{"name":" focus the next/previous desktop in the current monitor: super + {8,9}","command":""},{"name":" focus the last node/desktop: super + {grave,Tab}","command":""},{"name":" focus the older or newer node in the focus history: super + {o,i}","command":""},{"name":" focus or send to the given desktop: super + {_,shift + }{1-9,0}","command":""},{"name":": # move/resize","command":""},{"name":" move/resize: #","command":""},{"name":": ","command":""},{"name":" expand a window by moving one of its side outward: super + alt + {h,j,k,l}","command":""},{"name":" contract a window by moving one of its side inward: super + alt + shift + {h,j,k,l}","command":""},{"name":" move a floating window: #super + {Left,Down,Up,Right}","command":""},{"name":"super + {Left,Down,Up,Right}: # bspc node -v {-20 0,0 20,0 -20,20 0}","command":""},{"name":" bspc node -v {-20 0,0 20,0 -20,20 0}: ","command":""},{"name":" Move window by direction in same workspace: super + {Left,Down,Up,Right}","command":""}]
|
||||
@@ -0,0 +1,176 @@
|
||||
/**
|
||||
*
|
||||
* Author : Aditya Shakya (adi1090x)
|
||||
* Github : @adi1090x
|
||||
*
|
||||
* Rofi Theme File
|
||||
* Rofi Version: 1.7.3
|
||||
* ---
|
||||
*
|
||||
* @Modification Dominik Kressler
|
||||
* @package rofi-archer
|
||||
* @version 1.0.0
|
||||
**/
|
||||
|
||||
/*****----- Configuration -----*****/
|
||||
configuration {
|
||||
show-icons: false;
|
||||
}
|
||||
|
||||
/*****----- Global Properties -----*****/
|
||||
@import "../colors.rasi"
|
||||
@import "../fonts.rasi"
|
||||
|
||||
/*
|
||||
USE_BUTTONS=YES
|
||||
*/
|
||||
|
||||
/*****----- 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: 0px solid;
|
||||
border-radius: 10px;
|
||||
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: [ "inputbar", "listview" ];
|
||||
}
|
||||
|
||||
/*****----- Inputbar -----*****/
|
||||
inputbar {
|
||||
enabled: true;
|
||||
spacing: 15px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 0px;
|
||||
border-radius: 0px;
|
||||
border-color: @selected;
|
||||
background-color: transparent;
|
||||
text-color: @foreground;
|
||||
children: [ "textbox-prompt-colon", "prompt"];
|
||||
}
|
||||
|
||||
dummy {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
textbox-prompt-colon {
|
||||
enabled: true;
|
||||
expand: false;
|
||||
str: "";
|
||||
padding: 12px 20px 12px 16px;
|
||||
border-radius: 100%;
|
||||
background-color: @urgent;
|
||||
text-color: @background;
|
||||
}
|
||||
prompt {
|
||||
enabled: true;
|
||||
padding: 12px;
|
||||
border-radius: 100%;
|
||||
background-color: @active;
|
||||
text-color: @background;
|
||||
}
|
||||
|
||||
/*****----- Message -----*****/
|
||||
message {
|
||||
enabled: true;
|
||||
margin: 0px;
|
||||
padding: 12px;
|
||||
border: 0px solid;
|
||||
border-radius: 100%;
|
||||
border-color: @selected;
|
||||
background-color: transparent;
|
||||
text-color: @foreground;
|
||||
font-weight: bold;
|
||||
}
|
||||
textbox {
|
||||
background-color: inherit;
|
||||
text-color: inherit;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.5;
|
||||
placeholder-color: @foreground;
|
||||
blink: true;
|
||||
markup: true;
|
||||
}
|
||||
error-message {
|
||||
padding: 12px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @selected;
|
||||
background-color: @background;
|
||||
text-color: @foreground;
|
||||
}
|
||||
|
||||
/*****----- Listview -----*****/
|
||||
listview {
|
||||
enabled: true;
|
||||
columns: 5;
|
||||
lines: 1;
|
||||
cycle: true;
|
||||
dynamic: true;
|
||||
scrollbar: false;
|
||||
layout: vertical;
|
||||
reverse: false;
|
||||
fixed-height: true;
|
||||
fixed-columns: true;
|
||||
|
||||
spacing: 15px;
|
||||
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: 40px 10px;
|
||||
border: 0px solid;
|
||||
border-radius: 100%;
|
||||
border-color: @selected;
|
||||
background-color: @selected;
|
||||
text-color: var(background-alt);
|
||||
cursor: pointer;
|
||||
}
|
||||
element-text {
|
||||
font: "JetBrainsMono Nerd Font bold 32";
|
||||
background-color: transparent;
|
||||
text-color: inherit;
|
||||
cursor: inherit;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.5;
|
||||
}
|
||||
element selected.normal {
|
||||
background-color: var(background-alt);
|
||||
text-color: @foreground;
|
||||
}
|
||||
@@ -0,0 +1,224 @@
|
||||
/**
|
||||
*
|
||||
* Author : Aditya Shakya (adi1090x)
|
||||
* Github : @adi1090x
|
||||
*
|
||||
* Rofi Theme File
|
||||
* Rofi Version: 1.7.3
|
||||
**/
|
||||
|
||||
/*****----- Configuration -----*****/
|
||||
configuration {
|
||||
modi: "";
|
||||
show-icons: false;
|
||||
}
|
||||
|
||||
/*****----- Global Properties -----*****/
|
||||
@import "../config.rasi"
|
||||
@import "../colors.rasi"
|
||||
|
||||
* {
|
||||
border-colour: var(border);
|
||||
handle-colour: var(selected);
|
||||
background-colour: var(background);
|
||||
foreground-colour: var(foreground);
|
||||
alternate-background: var(background-alt);
|
||||
normal-background: var(background);
|
||||
normal-foreground: var(foreground);
|
||||
urgent-background: var(urgent);
|
||||
urgent-foreground: var(background);
|
||||
active-background: var(active);
|
||||
active-foreground: var(background);
|
||||
selected-normal-background: var(selected);
|
||||
selected-normal-foreground: var(background);
|
||||
selected-urgent-background: var(active);
|
||||
selected-urgent-foreground: var(background);
|
||||
selected-active-background: var(urgent);
|
||||
selected-active-foreground: var(background);
|
||||
alternate-normal-background: var(background);
|
||||
alternate-normal-foreground: var(foreground);
|
||||
alternate-urgent-background: var(urgent);
|
||||
alternate-urgent-foreground: var(background);
|
||||
alternate-active-background: var(active);
|
||||
alternate-active-foreground: var(background);
|
||||
}
|
||||
|
||||
/*****----- Main Window -----*****/
|
||||
window {
|
||||
/* properties for window widget */
|
||||
transparency: "real";
|
||||
location: center;
|
||||
anchor: center;
|
||||
fullscreen: false;
|
||||
width: 600px;
|
||||
x-offset: 0px;
|
||||
y-offset: 0px;
|
||||
border-radius: 10px;
|
||||
/* properties for all widgets */
|
||||
enabled: true;
|
||||
|
||||
cursor: "default";
|
||||
background-color: @background-colour;
|
||||
}
|
||||
|
||||
/*****----- Main Box -----*****/
|
||||
mainbox {
|
||||
enabled: true;
|
||||
spacing: 10px;
|
||||
margin: 0px;
|
||||
padding: 30px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px 0px 0px 0px;
|
||||
border-color: @border-colour;
|
||||
background-color: transparent;
|
||||
children: [ "message", "listview", "inputbar" ];
|
||||
}
|
||||
|
||||
/*****----- Inputbar -----*****/
|
||||
inputbar {
|
||||
enabled: false;
|
||||
}
|
||||
|
||||
/*****----- Listview -----*****/
|
||||
listview {
|
||||
enabled: true;
|
||||
columns: 6;
|
||||
lines: 8;
|
||||
cycle: true;
|
||||
dynamic: true;
|
||||
scrollbar: false;
|
||||
layout: vertical;
|
||||
reverse: false;
|
||||
fixed-height: false;
|
||||
fixed-columns: false;
|
||||
|
||||
spacing: 5px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @border-colour;
|
||||
background-color: transparent;
|
||||
text-color: @foreground-colour;
|
||||
cursor: "default";
|
||||
align: center;
|
||||
}
|
||||
scrollbar {
|
||||
handle-width: 5px;
|
||||
handle-color: @handle-colour;
|
||||
border-radius: 10px;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
/*****----- Elements -----*****/
|
||||
element {
|
||||
enabled: true;
|
||||
spacing: 10px;
|
||||
margin: 0px;
|
||||
padding: 5px 10px;
|
||||
border: 0px solid;
|
||||
border-radius: 10px;
|
||||
border-color: @border-colour;
|
||||
background-color: transparent;
|
||||
text-color: @foreground-colour;
|
||||
cursor: pointer;
|
||||
}
|
||||
element normal.normal {
|
||||
background-color: transparent;
|
||||
text-color: var(normal-foreground);
|
||||
}
|
||||
element normal.urgent {
|
||||
background-color: var(normal-background);
|
||||
text-color: var(normal-foreground);
|
||||
}
|
||||
element normal.active {
|
||||
background-color: var(normal-foreground);
|
||||
text-color: var(normal-background);
|
||||
}
|
||||
element selected.normal {
|
||||
background-color: var(selected-normal-background);
|
||||
text-color: var(normal-foreground);
|
||||
}
|
||||
element selected.urgent {
|
||||
background-color: var(selected-normal-background);
|
||||
text-color: var(normal-background);
|
||||
}
|
||||
element selected.active {
|
||||
background-color: var(selected-normal-background);
|
||||
text-color: var(normal-foreground);
|
||||
}
|
||||
|
||||
element-icon {
|
||||
background-color: transparent;
|
||||
text-color: inherit;
|
||||
size: 24px;
|
||||
cursor: inherit;
|
||||
}
|
||||
element-text {
|
||||
background-color: transparent;
|
||||
text-color: inherit;
|
||||
highlight: inherit;
|
||||
cursor: inherit;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.0;
|
||||
}
|
||||
|
||||
/*****----- Mode Switcher -----*****/
|
||||
mode-switcher{
|
||||
enabled: true;
|
||||
spacing: 10px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px;
|
||||
border-color: @border-colour;
|
||||
background-color: transparent;
|
||||
text-color: @foreground-colour;
|
||||
}
|
||||
button {
|
||||
padding: 7px 15px 7px 10px;
|
||||
border: 0px solid;
|
||||
border-radius: 100%;
|
||||
border-color: @border-colour;
|
||||
background-color: @alternate-background;
|
||||
text-color: inherit;
|
||||
cursor: pointer;
|
||||
}
|
||||
button selected {
|
||||
background-color: var(selected-normal-background);
|
||||
text-color: var(selected-normal-foreground);
|
||||
}
|
||||
|
||||
/*****----- Message -----*****/
|
||||
message {
|
||||
enabled: true;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
border: 0px solid;
|
||||
border-radius: 0px 0px 0px 0px;
|
||||
border-color: @border-colour;
|
||||
background-color: transparent;
|
||||
text-color: @foreground-colour;
|
||||
}
|
||||
textbox {
|
||||
padding: 8px 10px;
|
||||
border: 0px solid;
|
||||
border-radius: 10px;
|
||||
border-color: @border-colour;
|
||||
background-color: @alternate-background;
|
||||
text-color: @foreground-colour;
|
||||
vertical-align: 0.5;
|
||||
horizontal-align: 0.0;
|
||||
highlight: none;
|
||||
placeholder-color: @foreground-colour;
|
||||
blink: true;
|
||||
markup: true;
|
||||
}
|
||||
error-message {
|
||||
padding: 10px;
|
||||
border: 2px solid;
|
||||
border-radius: 10px;
|
||||
border-color: @border-colour;
|
||||
background-color: @background-colour;
|
||||
text-color: @foreground-colour;
|
||||
}
|
||||
Executable
+122
@@ -0,0 +1,122 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Author : Aditya Shakya (adi1090x)
|
||||
## Github : @adi1090x
|
||||
#
|
||||
## Applets : Volume
|
||||
|
||||
theme="~/.config/rofi/volume/volume.rasi"
|
||||
|
||||
# Volume Info
|
||||
mixer="`amixer info Master | grep 'Mixer name' | cut -d':' -f2 | tr -d \',' '`"
|
||||
speaker="`amixer get Master | tail -n1 | awk -F ' ' '{print $5}' | tr -d '[]'`"
|
||||
mic="`amixer get Capture | tail -n1 | awk -F ' ' '{print $5}' | tr -d '[]'`"
|
||||
|
||||
active=""
|
||||
urgent=""
|
||||
|
||||
# Speaker Info
|
||||
amixer get Master | grep '\[on\]' &>/dev/null
|
||||
if [[ "$?" == 0 ]]; then
|
||||
active="-a 1"
|
||||
stext='Mute Speaker'
|
||||
sicon=''
|
||||
else
|
||||
urgent="-u 1"
|
||||
stext='Unmute Speaker'
|
||||
sicon=''
|
||||
fi
|
||||
|
||||
# Microphone Info
|
||||
amixer get Capture | grep '\[on\]' &>/dev/null
|
||||
if [[ "$?" == 0 ]]; then
|
||||
[ -n "$active" ] && active+=",3" || active="-a 3"
|
||||
mtext='Mute Mic'
|
||||
micon=''
|
||||
else
|
||||
[ -n "$urgent" ] && urgent+=",3" || urgent="-u 3"
|
||||
mtext='Unmute Mic'
|
||||
micon=''
|
||||
fi
|
||||
|
||||
currentsink=$(ponymix defaults|awk '/^sink/ {s=$1" "$2;getline;gsub(/^ +/,"",$0);print s" "$0}' | cut -d':' -f2)
|
||||
currentsource=$(ponymix defaults|awk '/^source/ {s=$1" "$2;getline;gsub(/^ +/,"",$0);print s" "$0}' | cut -d':' -f2)
|
||||
|
||||
|
||||
# Theme Elements
|
||||
prompt="Speaker: $sicon Mic: $micon "
|
||||
mesg="$mixer Speaker: $speaker Mic: $mic"
|
||||
|
||||
list_col='6'
|
||||
list_row='3'
|
||||
win_width='670px'
|
||||
|
||||
# Options
|
||||
option_1="$micon $mtext ›$currentsource"
|
||||
option_2="$sicon $stext ›$currentsink"
|
||||
option_3=" Sink Switcher"
|
||||
option_4=""
|
||||
option_5=" Mixer"
|
||||
option_6=" Noise Torch"
|
||||
|
||||
|
||||
# Rofi CMD
|
||||
#-theme-str "listview {columns: $list_col; lines: $list_row;}" \
|
||||
rofi_cmd() {
|
||||
rofi -theme-str "window {width: $win_width;}" \
|
||||
-theme-str 'textbox-prompt-colon {str: "";}' \
|
||||
-dmenu \
|
||||
-p "$prompt" \
|
||||
-mesg "$mesg" \
|
||||
${active} ${urgent} \
|
||||
-markup-rows \
|
||||
-theme ${theme}
|
||||
}
|
||||
|
||||
# Pass variables to rofi dmenu
|
||||
run_rofi() {
|
||||
echo -e "$option_1\n$option_2\n$option_3\n$option_4\n$option_5\n$option_6" | rofi_cmd
|
||||
}
|
||||
|
||||
# Execute Command
|
||||
run_cmd() {
|
||||
if [[ "$1" == '--opt3' ]]; then
|
||||
#amixer -Mq set Master,0 5%+ unmute
|
||||
$HOME/.config/rofi/audio/rofi-sink-switcher.sh
|
||||
elif [[ "$1" == '--opt2' ]]; then
|
||||
amixer set Master toggle
|
||||
elif [[ "$1" == '--opt4' ]]; then
|
||||
amixer -Mq set Master,0 5%- unmute
|
||||
|
||||
elif [[ "$1" == '--opt1' ]]; then
|
||||
amixer set Capture toggle
|
||||
elif [[ "$1" == '--opt5' ]]; then
|
||||
pavucontrol
|
||||
elif [[ "$1" == '--opt6' ]]; then
|
||||
noisetorch
|
||||
fi
|
||||
}
|
||||
|
||||
# Actions
|
||||
chosen="$(run_rofi)"
|
||||
case ${chosen} in
|
||||
$option_1)
|
||||
run_cmd --opt1
|
||||
;;
|
||||
$option_2)
|
||||
run_cmd --opt2
|
||||
;;
|
||||
$option_3)
|
||||
run_cmd --opt3
|
||||
;;
|
||||
$option_4)
|
||||
run_cmd --opt4
|
||||
;;
|
||||
$option_5)
|
||||
run_cmd --opt5
|
||||
;;
|
||||
$option_6)
|
||||
run_cmd --opt6
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user