feat: polybar and rofi

This commit is contained in:
Elias Renman
2024-02-02 15:22:58 +01:00
parent 8d5b668ac4
commit d6cde2b388
17 changed files with 820 additions and 64 deletions

104
rofi/powermenu/powermenu.sh Normal file
View File

@@ -0,0 +1,104 @@
#!/usr/bin/env bash
## Author : Aditya Shakya (adi1090x)
## Github : @adi1090x
#
## Rofi : Power Menu
#
## Available Styles
#
## style-1 style-2 style-3 style-4 style-5
# Current Theme
dir="$HOME/.config/rofi/powermenu"
theme='style-3'
# CMDs
host=$(hostname)
# Options
shutdown='󰐥'
reboot='󰜉'
lock='󰌾'
suspend=''
logout='󰍃'
yes='󰄬'
no='󰜺'
# Rofi CMD
rofi_cmd() {
rofi -dmenu \
-p "Uptime: $(awk '{print int($1/60)}' /proc/uptime) min" \
-theme ${dir}/${theme}.rasi
# -mesg "Uptime: $uptime" \
}
# Confirmation CMD
confirm_cmd() {
rofi -dmenu \
-p 'Confirmation' \
-mesg 'Are you Sure?' \
-theme ${dir}/shared/confirm.rasi
}
# Ask for confirmation
confirm_exit() {
echo -e "$yes\n$no" | confirm_cmd
}
# Pass variables to rofi dmenu
run_rofi() {
echo -e "$lock\n$suspend\n$logout\n$reboot\n$shutdown" | rofi_cmd
}
# Execute Command
run_cmd() {
selected="$(confirm_exit)"
if [[ "$selected" == "$yes" ]]; then
if [[ $1 == '--shutdown' ]]; then
systemctl poweroff
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
fi
fi
else
exit 0
fi
}
# Actions
chosen="$(run_rofi)"
case ${chosen} in
$shutdown)
run_cmd --shutdown
;;
$reboot)
run_cmd --reboot
;;
$lock)
if [[ -x '/usr/bin/betterlockscreen' ]]; then
betterlockscreen -l
elif [[ -x '/usr/bin/i3lock' ]]; then
i3lock
fi
;;
$suspend)
run_cmd --suspend
;;
$logout)
run_cmd --logout
;;
esac

View File

@@ -0,0 +1,27 @@
/**
*
* Author : Aditya Shakya (adi1090x)
* Github : @adi1090x
*
* Colors
*
* Available Colors Schemes
*
* adapta catppuccin everforest navy paper
* arc cyberpunk gruvbox nord solarized
* black dracula lovelace onedark yousai
*
**/
/* Import color-scheme from `colors` directory */
* {
background: #15161EFF;
background-alt: #1A1B26FF;
foreground: #C0CAF5FF;
selected: #33467CFF;
active: #414868FF;
urgent: #F7768EFF;
}

View File

@@ -0,0 +1,93 @@
/**
*
* Author : Aditya Shakya (adi1090x)
* Github : @adi1090x
*
* Rofi Theme File
* Rofi Version: 1.7.3
**/
/*****----- Configuration -----*****/
configuration {
show-icons: false;
}
/*****----- Global Properties -----*****/
@import "colors.rasi"
@import "fonts.rasi"
/*****----- Main Window -----*****/
window {
location: center;
anchor: center;
fullscreen: false;
width: 500px;
border-radius: 20px;
cursor: "default";
background-color: @background;
}
/*****----- Main Box -----*****/
mainbox {
spacing: 30px;
padding: 30px;
background-color: transparent;
children: [ "message", "listview" ];
}
/*****----- Message -----*****/
message {
margin: 0px;
padding: 20px;
border-radius: 20px;
background-color: @background-alt;
text-color: @foreground;
}
textbox {
background-color: inherit;
text-color: inherit;
vertical-align: 0.5;
horizontal-align: 0.5;
placeholder-color: @foreground;
blink: true;
markup: true;
}
/*****----- Listview -----*****/
listview {
columns: 2;
lines: 1;
cycle: true;
dynamic: true;
scrollbar: false;
layout: vertical;
reverse: false;
fixed-height: true;
fixed-columns: true;
spacing: 30px;
background-color: transparent;
text-color: @foreground;
cursor: "default";
}
/*****----- Elements -----*****/
element {
padding: 60px 10px;
border-radius: 20px;
background-color: @background-alt;
text-color: @foreground;
cursor: pointer;
}
element-text {
font: "feather 48";
background-color: transparent;
text-color: inherit;
cursor: inherit;
vertical-align: 0.5;
horizontal-align: 0.5;
}
element selected.normal {
background-color: var(selected);
text-color: var(background);
}

View File

@@ -0,0 +1,12 @@
/**
*
* Author : Aditya Shakya (adi1090x)
* Github : @adi1090x
*
* Fonts
*
**/
* {
font: "JetBrains Mono Nerd Font 12";
}

136
rofi/powermenu/style-3.rasi Normal file
View File

@@ -0,0 +1,136 @@
/**
*
* Author : Aditya Shakya (adi1090x)
* Github : @adi1090x
*
* Rofi Theme File
* Rofi Version: 1.7.3
**/
/*****----- Configuration -----*****/
configuration {
show-icons: false;
}
/*****----- Global Properties -----*****/
@import "shared/colors.rasi"
@import "shared/fonts.rasi"
/*****----- Global Properties -----*****/
* {
/* Resolution : 1920x1080 */
mainbox-spacing: 100px;
mainbox-margin: 150px 400px;
message-margin: 0px 350px;
message-padding: 15px;
message-border-radius: 15px;
listview-spacing: 50px;
element-padding: 35px 40px;
element-border-radius: 20px;
prompt-font: "Jetbrains Mono Nerd Font Bold 72";
textbox-font: "Jetbrains Nerd Font 14";
element-text-font: "Jetbrains Mono 64";
background-window: black/30%;
background-normal: white/5%;
background-selected: var(selected);
foreground-normal: white;
foreground-selected: white;
}
/*****----- Main Window -----*****/
window {
transparency: "real";
location: center;
anchor: center;
fullscreen: true;
cursor: "default";
background-color: var(background-window);
}
/*****----- Main Box -----*****/
mainbox {
enabled: true;
spacing: var(mainbox-spacing);
margin: var(mainbox-margin);
background-color: transparent;
children: [ "dummy", "inputbar", "listview", "message", "dummy" ];
}
/*****----- Inputbar -----*****/
inputbar {
enabled: true;
background-color: transparent;
children: [ "dummy", "prompt", "dummy"];
}
dummy {
background-color: transparent;
}
prompt {
enabled: true;
font: var(prompt-font);
background-color: transparent;
text-color: var(foreground-normal);
}
/*****----- Message -----*****/
message {
enabled: true;
margin: var(message-margin);
padding: var(message-padding);
border-radius: var(message-border-radius);
background-color: var(background-normal);
text-color: var(foreground-normal);
}
textbox {
font: var(textbox-font);
background-color: transparent;
text-color: inherit;
vertical-align: 0.5;
horizontal-align: 0.5;
}
/*****----- Listview -----*****/
listview {
enabled: true;
expand: false;
columns: 5;
lines: 1;
cycle: true;
dynamic: true;
scrollbar: false;
layout: vertical;
reverse: false;
fixed-height: true;
fixed-columns: true;
spacing: var(listview-spacing);
background-color: transparent;
cursor: "default";
}
/*****----- Elements -----*****/
element {
enabled: true;
padding: var(element-padding);
border-radius: var(element-border-radius);
background-color: var(background-normal);
text-color: var(foreground-normal);
cursor: pointer;
}
element-text {
font: var(element-text-font);
background-color: transparent;
text-color: inherit;
cursor: inherit;
vertical-align: 0.5;
horizontal-align: 0.5;
}
element selected.normal {
background-color: var(background-selected);
text-color: var(foreground-selected);
}