Fluxbox Notes

Fluxbox相关笔记

Posted by Ryan Yim on 2023-11-12
Estimated Reading Time 13 Minutes
Words 2.4k In Total
Viewed Times

当你的Linux设备配置太低时,你会选择使用桌面环境吗?GNOME、KDE是占用资源相对高的DE(Desktop Enviroment - 桌面环境),Xfce等则相对较少,如果还有更少的呢?WM(Window Manager - 窗口管理器)?Openbox?Fluxbox?这里,咱们就讲一讲Fluxbox。因为目前我在单位分配到的电脑是一台2010年AMD CPU、RAM只有4G的电脑(或许对一些人来说已经算不错了),我不能让系统本身占用太多资源。

参考:

官网

Debian About

Wiki:

Fluxbox安装

无界面系统安装

Debian命令行从0开始搭建Fluxbox请参见Why-LInux

GNOME桌面环境安装

直接sudo apt install fluxbox即可。然后注销,在GDM登陆界面Session选择Fluxbox即可。

Fluxbox配置文件

配置文件结构

配置文件可以从https://github.com/rmshadows/rm_scripts获取

1
2
3
4
5
6
7
8
9
10
11
12
13
$ ls ~/.fluxbox
apps
fbrun_history
init
keys
lastwallpaper
menu
overlay
slitlist
startup
styles/
windowmenu
workspace

键盘快捷键

~/.fluxbox/keys文件

按键:modifier+keys+operations

下列是部份说明

modifier:

  • Mod1=Alt

  • Mod4=OS, a.k.a. Win-key

  • Control=control key

  • Shift=shift key

keys:

  • a-zA-Z0-9=字母、数字大小写不敏感

  • Escape=the escape key

  • Right|Left|Up|Down=Arrow-keys beyond the Home/End keys

  • Tab=tabulator key

  • Delete=delete key

operations:

  • Workspace N = 转到工作区N

  • PrevWindow|NextWindow = 循环切换工作区

  • Exec|ExecCommand = 运行命令

  • FullScreen = 全屏当前窗口

  • ToggleDecor = toggle window decorations

  • Maximize[Horizontal|Vertical] = 最大化窗口

  • NextTab|PrevTab = 切换窗口

  • MoveTo x y = 移动窗口,(0,0)在上左。move the current window to coordinates (x,y) (where (0,0) is the upper left corner)

  • ArrangeWindows = automatically arrange windows on current desktop

  • RootMenu = 在鼠标位置打开主菜单。popup the rootmenu on the cursor’s position

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
! fluxbox-update_configs added '(workspace=[current])' to (Next|Prev)(Window|Group)
! check lines marked by 'FBCV13' if they are correctly updated
!mouse actions added by fluxbox-update_configs
OnTitlebar Mouse1 :MacroCmd {Focus} {Raise} {ActivateTab}
!mouse actions added by fluxbox-update_configs
OnTitlebar Move1 :StartMoving
OnLeftGrip Move1 :StartResizing bottomleft
OnRightGrip Move1 :StartResizing bottomright
OnWindowBorder Move1 :StartMoving

! fluxbox-update_configs added '(workspace=[current])' to (Next|Prev)(Window|Group)
! check lines marked by 'FBCV13' if they are correctly updated
!mouse actions added by fluxbox-update_configs
OnTitlebar Mouse1 :MacroCmd {Focus} {Raise} {ActivateTab}
!mouse actions added by fluxbox-update_configs
OnTitlebar Move1 :StartMoving
OnLeftGrip Move1 :StartResizing bottomleft
OnRightGrip Move1 :StartResizing bottomright
OnWindowBorder Move1 :StartMoving

!mouse actions added by fluxbox-update_configs
# 鼠标标题栏中键 移动
OnTitlebar Mouse2 :StartTabbing

!mouse actions added by fluxbox-update_configs
# 鼠标标题栏双击收起
OnTitlebar Double Mouse1 :Shade
# 鼠标标题栏右击
OnTitlebar Mouse3 :WindowMenu

!mouse actions added by fluxbox-update_configs
OnWindow Mod1 Mouse1 :MacroCmd {Raise} {Focus} {StartMoving}
OnWindow Mod1 Mouse3 :MacroCmd {Raise} {Focus} {StartResizing BottomRight}

!mouse actions added by fluxbox-update_configs
OnDesktop Mouse1 :hideMenus
OnDesktop Mouse2 :workspaceMenu
OnDesktop Mouse3 :rootMenu

# Alt + Tab 切换窗口
Mod1 Tab :NextWindow (workspace=[current]) (workspace=[current]) !! FBCV13 !! !! FBCV13 !!
Mod1 Shift Tab :PrevWindow (workspace=[current]) (workspace=[current]) !! FBCV13 !! !! FBCV13 !!

# Alt + 1-6 切换工作区
Mod1 1 :Workspace 1
Mod1 2 :Workspace 2
Mod1 3 :Workspace 3
Mod1 4 :Workspace 4
Mod1 5 :Workspace 5
Mod1 6 :Workspace 6

# Alt + Esc最大化窗口
# Mod1 Escape :MaximizeWindow

# 打开主菜单
Mod1 F1 :RootMenu
# Mod1 Shift m :RootMenu

# change to a specific workspace
#Mod1 1 :ExecCommand wmctrl -s 0
#Mod1 2 :ExecCommand wmctrl -s 1
#Mod1 3 :ExecCommand wmctrl -s 2
#Mod1 4 :ExecCommand wmctrl -s 3
#Mod1 5 :ExecCommand wmctrl -s 4
#Mod1 6 :ExecCommand wmctrl -s 5

##### 自定义的快捷键 - Customized
### 这里是Alt键(打开终端)
Mod1 q :ExecCommand gnome-terminal
# Mod1 q :ExecCommand xfce4-terminal
# 系统资源监视
# Mod1 Shift w :ExecCommand htop
Mod1 Shift w :ExecCommand gnome-system-monitor
# 文件管理
# Mod1 Shift e :ExecCommand thunar
Mod1 Shift e :ExecCommand nautilus
# 打开浏览器
Mod1 Shift r :ExecCommand firefox
# 打开虚拟机
# Mod1 Shift t :ExecCommand virtualbox
# 杀死应用:
Mod1 Shift k :Kill
# 窗口全屏、关闭窗口
Mod1 Shift f :Fullscreen
Mod1 F4 :Close
# 窗口装饰条
Mod1 F2 :ToggleDecor
# 取消打印 Cancel Print
Mod1 Shift l :ExecCommand gnome-terminal -- "~/.fluxbox/scripts/custom/Cancel_All_Print_Task.sh"

# 重启fluxbox(Alt + Win + r)
Mod1 Mod4 r :Restart
# 退出fluxbox
Mod1 Mod4 Escape :Exit

### 这里是Super(开始键)键
# 显示桌面
Mod4 d :ShowDesktop

# 窗口管理
# Alt + 上/下 最大化、最小化窗口
Mod1 Up :MaximizeWindow
Mod1 Down :MinimizeWindow
# 收起、放下窗口
Mod1 Left :ShadeOn
Mod1 Right :ShadeOff
# Alt + H/V 水平、垂直最大化
Mod1 h :MaximizeHorizontal
Mod1 v :MaximizeVertical

# 窗口位置
# Win + 上下左右 窗口半屏上下左右
# Example of macro commands
# Position and resize windows to half of the screen in various positions
Mod4 Up :MacroCmd {ResizeTo 100% 50%} {MoveTo 00 00 Up}
Mod4 Left :MacroCmd {ResizeTo 50% 100%} {MoveTo 00 00 Left}
Mod4 Right :MacroCmd {ResizeTo 50% 100%} {MoveTo 00 00 Right}
Mod4 Down :MacroCmd {ResizeTo 100% 50%} {MoveTo 00 00 Bottom}
# 窗口1/4
# Win + qwas
# As before but only use a quarter of the screen
# 左上
Mod4 q :MacroCmd {ResizeTo 50% 50%} {MoveTo 00% 00% Up}
# 右上
Mod4 w :MacroCmd {ResizeTo 50% 50%} {MoveTo 50% 00% Up}
# 右下
Mod4 a :MacroCmd {ResizeTo 50% 50%} {MoveTo 00% 50% Up}
# 左下
Mod4 s :MacroCmd {ResizeTo 50% 50%} {MoveTo 50% 50% Up}
# 窗口排列方式
# Example of the simple tiling features
Mod4 1 :ArrangeWindows
Mod4 2 :ArrangeWindowsVertical
Mod4 3 :ArrangeWindowsHorizontal
Mod4 4 :ArrangeWindowsHorizontal (Name=[current])
Mod4 5 :ArrangeWindowsVertical (Name=[current])


# 锁屏 Win + L
# Xfce4锁屏:
# Mod4 l :ExecCommand dm-tool lock
Mod4 l :ExecCommand i3lock
Mod4 a :ExecCommand xfce4-appfinder

# 亮度调整(brightnessctl set +10%)
Control Mod4 Left :ExecCommand brightnessctl set 5%-
Control Mod4 Right :ExecCommand brightnessctl set +5%

# prtsc截屏,请安装scrot截屏
Print :ExecCommand ksnip

gnome-terminal -- "v_linux_x64 --lite"无效的情况下,改为:

gnome-terminal -- bash -c "v_linux_x64 --lite; exec bash"

格式:

gnome-terminal -- bash -c "【你要运行的命令】; exec bash"

Fluxbox调整亮度

brightnessctl

sudo apt install brightnessctl

brightnessctl set 50

brightnessctl set +10%

brightnessctl set 10%-

xrandr

如果brightnessctl亮度调节无效(/sys/class/backlight没有文件),请使用xrandr调节(适用ARM机器)

首先使用xrandr --verbose查看信息,可以看到Brightness: 0.57HDMI-A-0

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 16384 x 16384
HDMI-A-0 connected primary 1920x1080+0+0 (0x54) normal (normal left inverted right x axis y axis) 530mm x 290mm
Identifier: 0x51
Timestamp: 86442
Subpixel: horizontal rgb
Gamma: 1.0:1.0:1.0
Brightness: 0.57
Clones:
CRTC: 0
CRTCs: 0 1
Transform: 1.000000 0.000000 0.000000
0.000000 1.000000 0.000000
0.000000 0.000000 1.000000
filter:
EDID:
00ffffffffffff000cb4802301000000
0b1f010380351d783a2d36a75438ae26
0d4f54210800a9c0b3009500818081c0
810081404540023a801871382d40582c
450012222100001e000000fc00583234
30315746410a20202020000000fd0030
3c0f9613000a202020202020000000ff
003030303030303030303030303101ee
020326f148901f051404130312230907
078301000067030c001000382d681a00
000101303ced023a801871382d40582c
4500a05a0000001e0000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
00000000000000000000000000000057
TearFree: on
supported: off, on, auto
dither: off
supported: off, on
audio: auto
supported: off, on, auto
scaling mode: None
supported: None, Full, Center, Full aspect
underscan vborder: 0
range: (0, 128)
underscan hborder: 0
range: (0, 128)
underscan: off
supported: off, on, auto
coherent: 1
range: (0, 1)
link-status: Good
supported: Good, Bad
CONNECTOR_ID: 41
supported: 41
non-desktop: 0
range: (0, 1)
1920x1080 (0x54) 148.500MHz +HSync +VSync *current +preferred
h: width 1920 start 2008 end 2052 total 2200 skew 0 clock 67.50KHz
v: height 1080 start 1084 end 1089 total 1125 clock 60.00Hz
1920x1080 (0x55) 148.500MHz +HSync +VSync
h: width 1920 start 2448 end 2492 total 2640 skew 0 clock 56.25KHz
v: height 1080 start 1084 end 1089 total 1125 clock 50.00Hz
1920x1080 (0x56) 148.352MHz +HSync +VSync
h: width 1920 start 2008 end 2052 total 2200 skew 0 clock 67.43KHz
v: height 1080 start 1084 end 1089 total 1125 clock 59.94Hz
1920x1080i (0x57) 74.250MHz +HSync +VSync Interlace
h: width 1920 start 2008 end 2052 total 2200 skew 0 clock 33.75KHz
v: height 1080 start 1084 end 1094 total 1125 clock 60.00Hz
1920x1080i (0x58) 74.250MHz +HSync +VSync Interlace
h: width 1920 start 2448 end 2492 total 2640 skew 0 clock 28.12KHz
v: height 1080 start 1084 end 1094 total 1125 clock 50.00Hz
1920x1080i (0x59) 74.176MHz +HSync +VSync Interlace
h: width 1920 start 2008 end 2052 total 2200 skew 0 clock 33.72KHz
v: height 1080 start 1084 end 1094 total 1125 clock 59.94Hz
1680x1050 (0x5a) 119.000MHz +HSync -VSync
h: width 1680 start 1728 end 1760 total 1840 skew 0 clock 64.67KHz
v: height 1050 start 1053 end 1059 total 1080 clock 59.88Hz
1600x900 (0x5b) 108.000MHz +HSync +VSync
h: width 1600 start 1624 end 1704 total 1800 skew 0 clock 60.00KHz
v: height 900 start 901 end 904 total 1000 clock 60.00Hz
1280x1024 (0x5c) 108.000MHz +HSync +VSync
h: width 1280 start 1328 end 1440 total 1688 skew 0 clock 63.98KHz
v: height 1024 start 1025 end 1028 total 1066 clock 60.02Hz
1440x900 (0x5d) 88.750MHz +HSync -VSync
h: width 1440 start 1488 end 1520 total 1600 skew 0 clock 55.47KHz
v: height 900 start 903 end 909 total 926 clock 59.90Hz
1280x960 (0x5e) 108.000MHz +HSync +VSync
h: width 1280 start 1376 end 1488 total 1800 skew 0 clock 60.00KHz
v: height 960 start 961 end 964 total 1000 clock 60.00Hz
1280x800 (0x5f) 71.000MHz +HSync -VSync
h: width 1280 start 1328 end 1360 total 1440 skew 0 clock 49.31KHz
v: height 800 start 803 end 809 total 823 clock 59.91Hz
1280x720 (0x60) 74.250MHz +HSync +VSync
h: width 1280 start 1390 end 1430 total 1650 skew 0 clock 45.00KHz
v: height 720 start 725 end 730 total 750 clock 60.00Hz
1280x720 (0x61) 74.250MHz +HSync +VSync
h: width 1280 start 1720 end 1760 total 1980 skew 0 clock 37.50KHz
v: height 720 start 725 end 730 total 750 clock 50.00Hz
1280x720 (0x62) 74.176MHz +HSync +VSync
h: width 1280 start 1390 end 1430 total 1650 skew 0 clock 44.96KHz
v: height 720 start 725 end 730 total 750 clock 59.94Hz
1024x768 (0x63) 65.000MHz -HSync -VSync
h: width 1024 start 1048 end 1184 total 1344 skew 0 clock 48.36KHz
v: height 768 start 771 end 777 total 806 clock 60.00Hz
800x600 (0x64) 40.000MHz +HSync +VSync
h: width 800 start 840 end 968 total 1056 skew 0 clock 37.88KHz
v: height 600 start 601 end 605 total 628 clock 60.32Hz
720x576 (0x65) 27.000MHz -HSync -VSync
h: width 720 start 732 end 796 total 864 skew 0 clock 31.25KHz
v: height 576 start 581 end 586 total 625 clock 50.00Hz
720x480 (0x66) 27.027MHz -HSync -VSync
h: width 720 start 736 end 798 total 858 skew 0 clock 31.50KHz
v: height 480 start 489 end 495 total 525 clock 60.00Hz
720x480 (0x67) 27.000MHz -HSync -VSync
h: width 720 start 736 end 798 total 858 skew 0 clock 31.47KHz
v: height 480 start 489 end 495 total 525 clock 59.94Hz
640x480 (0x68) 25.200MHz -HSync -VSync
h: width 640 start 656 end 752 total 800 skew 0 clock 31.50KHz
v: height 480 start 490 end 492 total 525 clock 60.00Hz
640x480 (0x69) 25.175MHz -HSync -VSync
h: width 640 start 656 end 752 total 800 skew 0 clock 31.47KHz
v: height 480 start 490 end 492 total 525 clock 59.94Hz
VGA-0 disconnected (normal left inverted right x axis y axis)
Identifier: 0x52
Timestamp: 86442
Subpixel: no subpixels
Clones:
CRTCs: 0 1
Transform: 1.000000 0.000000 0.000000
0.000000 1.000000 0.000000
0.000000 0.000000 1.000000
filter:
TearFree: on
supported: off, on, auto
scaling mode: None
supported: None, Full, Center, Full aspect
load detection: 1
range: (0, 1)
link-status: Good
supported: Good, Bad
CONNECTOR_ID: 43
supported: 43
non-desktop: 0
range: (0, 1)

调节亮度请使用:xrandr --output 【显示名称】 --brightness 【亮度】

如:xrandr --output HDMI-A-0 --brightness 0.8

设置背景图片

防止主题(Style)变更当前桌面可以注释掉~/.fluxbox/overlay中的注释:(unset、none都行)

1
2
3
! The following line will prevent styles from setting the background.
! background: unset
background: unset

~/.fluxbox/lastwallpaper保存的是最后一次使用的背景图

设置桌面背景请使用:fbsetbg

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
OPTIONS
-f file
Set fullscreen wallpaper.

-c file
Set centered wallpaper.

-t file
Set tiled wallpaper.

-a file
Set maximized wallpaper, preserving aspect (if your bgsetter doesn’t support this option fbsetbg falls back to -f).

-u wallpapersetter
Use specified wallpapersetter, use no argument to forget.

-b fbsetrootoptions
Forward the options to fbsetroot(1). These can be used to set a solid, pattern, or gradient background texture.

-r directory
Set random wallpaper from a directory.

-F, -C, -T, -A, -U, -B, -R
Same as the lowercase option but without remembering.

-l
Set previous wallpaper. Or, if the random feature was last used, set another random wallpaper from the same directory.

-i
Display useful information about best wallpapersetter found.

-p
Display some useful tips.

-h
Display a help message.

If you like this blog or find it useful for you, you are welcome to comment on it. You are also welcome to share this blog, so that more people can participate in it. If the images used in the blog infringe your copyright, please contact the author to delete them. Thank you !