Skip to content

Commit 5648fc7

Browse files
committed
pkgs: change rofi power-menu
1 parent 098185d commit 5648fc7

File tree

7 files changed

+172
-291
lines changed

7 files changed

+172
-291
lines changed

‎modules/home/default.nix‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
./p10k/p10k.nix
2828
./packages # other packages
2929
./retroarch.nix
30-
./rofi.nix # launcher
30+
./rofi/rofi.nix # launcher
3131
./scripts/scripts.nix # personal scripts
3232
./ssh.nix # ssh config
3333
./superfile/superfile.nix # terminal file manager

‎modules/home/rofi.nix‎ renamed to ‎modules/home/rofi/config.rasi‎

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,4 @@
1-
{ pkgs, ... }:
2-
{
3-
home.packages = with pkgs; [ rofi ];
4-
5-
xdg.configFile."rofi/theme.rasi".text = ''
6-
* {
7-
bg-col: #1D2021;
8-
bg-col-light: #282828;
9-
border-col: #A89984;
10-
selected-col: #3C3836;
11-
green: #98971A;
12-
fg-col: #FBF1C7;
13-
fg-col2: #EBDBB2;
14-
grey: #BDAE93;
15-
highlight: @green;
16-
}
17-
'';
18-
19-
xdg.configFile."rofi/config.rasi".text = ''
20-
configuration{
1+
configuration{
212
modi: "run,drun,window";
223
lines: 5;
234
cycle: false;
@@ -125,6 +106,4 @@
125106
button selected {
126107
background-color: @bg-col;
127108
text-color: @green;
128-
}
129-
'';
130-
}
109+
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
@theme "theme"
2+
3+
configuration {
4+
show-icons: false;
5+
font: "Maple Mono Bold 24";
6+
}
7+
8+
window {
9+
/* properties for window widget */
10+
width: 500px;
11+
location: center;
12+
anchor: center;
13+
14+
margin: 0px;
15+
padding: 0px;
16+
17+
border: 2px solid;
18+
border-radius: 0px;
19+
border-color: @border-col;
20+
21+
background-color: @bg-col;
22+
}
23+
24+
mainbox {
25+
enabled: true;
26+
27+
border: 0px solid;
28+
border-radius: 0px;
29+
border-color: @selected-col;
30+
31+
background-color: inherit;
32+
33+
children: [ "listview" ];
34+
}
35+
36+
listview {
37+
enabled: true;
38+
39+
lines: 1;
40+
columns: 5;
41+
42+
cycle: true;
43+
dynamic: true;
44+
scrollbar: false;
45+
layout: vertical;
46+
reverse: false;
47+
fixed-height: true;
48+
fixed-columns: true;
49+
50+
spacing: 0px;
51+
52+
border: inherit;
53+
border-radius: inherit;
54+
border-color: inherit;
55+
56+
text-color: @fg-col;
57+
background-color: transparent;
58+
}
59+
60+
element {
61+
enabled: true;
62+
63+
spacing: 0px;
64+
padding: 28px 0px;
65+
66+
border: inherit;
67+
border-radius: inherit;
68+
border-color: inherit;
69+
70+
background-color: inherit;
71+
text-color: @fg-col;
72+
cursor: pointer;
73+
}
74+
75+
element-text {
76+
vertical-align: 0.5;
77+
horizontal-align: 0.5;
78+
79+
font: inherit;
80+
text-color: inherit;
81+
82+
background-color: transparent;
83+
cursor: inherit;
84+
}
85+
86+
element selected.normal {
87+
background-color: @selected-col;
88+
}

‎modules/home/rofi/rofi.nix‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{ pkgs, ... }:
2+
{
3+
home.packages = with pkgs; [ rofi ];
4+
5+
xdg.configFile."rofi/theme.rasi".source = ./theme.rasi;
6+
xdg.configFile."rofi/config.rasi".source = ./config.rasi;
7+
8+
xdg.configFile."rofi/powermenu-theme.rasi".source = ./powermenu-theme.rasi;
9+
}

‎modules/home/rofi/theme.rasi‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
* {
2+
bg-col: #1D2021;
3+
bg-col-light: #282828;
4+
border-col: #A89984;
5+
selected-col: #3C3836;
6+
green: #98971A;
7+
fg-col: #FBF1C7;
8+
fg-col2: #EBDBB2;
9+
grey: #BDAE93;
10+
highlight: @green;
11+
}
Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,62 @@
1-
#!/usr/bin/env bash
1+
#! /usr/bin/env bash
22

3-
rofi -show p -modi p:'rofi-power-menu' -theme-str 'window {width: 10em; height: 15em;} listview {lines: 5;}'
3+
shutdown='󰐥'
4+
reboot='󰜉'
5+
lock='󰌾'
6+
suspend='󰤄'
7+
8+
yes=''
9+
no=''
10+
11+
theme="$HOME/.config/rofi/powermenu-theme.rasi"
12+
13+
rofi_cmd() {
14+
rofi -dmenu -theme ${theme}
15+
}
16+
17+
run_rofi() {
18+
echo -e "$shutdown\n$reboot\n$lock\n$suspend\n$no" | rofi_cmd
19+
}
20+
21+
confirm_cmd() {
22+
rofi -theme-str 'window {width: 200px;}' \
23+
-theme-str 'listview { columns: 2; }' \
24+
-dmenu -theme ${theme}
25+
}
26+
27+
rofi_confirm() {
28+
echo -e "$yes\n$no" | confirm_cmd
29+
}
30+
31+
run_cmd() {
32+
selected="$(rofi_confirm)"
33+
if [[ "$selected" == "$yes" ]]; then
34+
if [[ $1 == '--shutdown' ]]; then
35+
systemctl poweroff
36+
elif [[ $1 == '--reboot' ]]; then
37+
systemctl reboot
38+
elif [[ $1 == '--suspend' ]]; then
39+
systemctl suspend
40+
fi
41+
else
42+
exit 0
43+
fi
44+
}
45+
46+
chosen="$(run_rofi)"
47+
case ${chosen} in
48+
$shutdown)
49+
run_cmd --shutdown
50+
;;
51+
$reboot)
52+
run_cmd --reboot
53+
;;
54+
$lock)
55+
sleep 0.1
56+
swaylock
57+
;;
58+
$suspend)
59+
sleep 0.1
60+
run_cmd --suspend
61+
;;
62+
esac

0 commit comments

Comments
 (0)