Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
UserConfig
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jiří Kalvoda
UserConfig
Commits
818a86ca
Commit
818a86ca
authored
4 years ago
by
Jiří Kalvoda
Browse files
Options
Downloads
Patches
Plain Diff
I3 Add status.
parent
f11a1a44
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
i3/config
+10
-2
10 additions, 2 deletions
i3/config
i3/i3status.conf
+52
-0
52 additions, 0 deletions
i3/i3status.conf
i3/init.sh
+2
-0
2 additions, 0 deletions
i3/init.sh
i3/status.cpp
+100
-0
100 additions, 0 deletions
i3/status.cpp
with
164 additions
and
2 deletions
i3/config
+
10
−
2
View file @
818a86ca
...
@@ -204,7 +204,7 @@ bindsym $mod+r mode "resize"
...
@@ -204,7 +204,7 @@ bindsym $mod+r mode "resize"
# Start i3bar to display a workspace bar (plus the system information i3status
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
# finds out, if available)
bar {
bar {
status_command "~/.config/i3/status.out"
status_command "~/.config/i3/status.out
2>~/.status.log
"
}
}
exec --no-startup-id synclient HorizEdgeScroll=1 VertEdgeScroll=1 VertScrollDelta=-111
exec --no-startup-id synclient HorizEdgeScroll=1 VertEdgeScroll=1 VertScrollDelta=-111
...
@@ -333,6 +333,8 @@ mode "System modifikator"
...
@@ -333,6 +333,8 @@ mode "System modifikator"
bindsym bracketright exec "notify-send \\"$(lsblk)\\""
bindsym bracketright exec "notify-send \\"$(lsblk)\\""
bindsym Shift+bracketright mode "default"; exec "gksudo -g gparted"
bindsym Shift+bracketright mode "default"; exec "gksudo -g gparted"
bindsym Ctrl+bracketright mode "default"; exec "gksudo -g gnome-disks"
bindsym Ctrl+bracketright mode "default"; exec "gksudo -g gnome-disks"
bindcode 94 exec --no-startup-id "osdd-run & sleep 0.1;osdc --color=red RESTART"
}
}
bindcode 121 exec "echo $(( 1 - $(cat ~/.config/micloop/mute) )) > ~/.config/micloop/mute;pacmd set-sink-input-mute $(cat ~/.config/micloop/id) $(cat ~/.config/micloop/mute) ; notify-send 'loopmic mute' $(cat ~/.config/micloop/mute) -h string:x-canonical-private-synchronous:anything"
bindcode 121 exec "echo $(( 1 - $(cat ~/.config/micloop/mute) )) > ~/.config/micloop/mute;pacmd set-sink-input-mute $(cat ~/.config/micloop/id) $(cat ~/.config/micloop/mute) ; notify-send 'loopmic mute' $(cat ~/.config/micloop/mute) -h string:x-canonical-private-synchronous:anything"
...
@@ -377,4 +379,10 @@ bindsym $mod+Shift+o exec --no-startup-id killall -3 mate-session; exec --no-sta
...
@@ -377,4 +379,10 @@ bindsym $mod+Shift+o exec --no-startup-id killall -3 mate-session; exec --no-sta
exec "setxkbmap us,cz -variant ,ucw -option grp:caps_switch"
exec "setxkbmap us,cz -variant ,ucw -option grp:caps_switch"
exec "osdd-run"
exec "osd-run"
bindcode 94 exec "osdc --duration=1 \\"\\""
bindcode Shift+94 exec "osdc --skip=1 --log=0 --duration=1 \\"\\""
bindcode Ctrl+94 exec "osd-clock"
bindcode Ctrl+Shift+94 exec "terminal -e bash -i -c \\"cat ~/.osdd_log;read\\""
bindcode $mod+94 exec "terminal"
This diff is collapsed.
Click to expand it.
i3/i3status.conf
0 → 100644
+
52
−
0
View file @
818a86ca
# i3status configuration file.
# see "man i3status" for documentation.
# It is important that this file is edited as UTF-8.
# The following line should contain a sharp s:
# ß
# If the above line is not correctly displayed, fix your editor first!
general
{
output_format
=
"i3bar"
colors
=
true
interval
=
1
}
order
+=
"wireless _first_"
order
+=
"ethernet _first_"
order
+=
"battery all"
order
+=
"load"
order
+=
"memory"
order
+=
"tztime local"
wireless
_
first_
{
format_up
=
"W: (%quality at %essid) %ip"
format_down
=
"W: down"
}
ethernet
_
first_
{
format_up
=
"E: %ip (%speed)"
format_down
=
"E: down"
}
battery
all
{
format
=
"%status %percentage %remaining"
}
disk
"/"
{
format
=
"%avail"
}
load
{
format
=
"%1min L"
}
memory
{
format
=
"%used X %available"
threshold_degraded
=
"1G"
format_degraded
=
"MEMORY < %available"
}
tztime
local
{
format
=
"%Y-%m-%d %H:%M:%S"
}
This diff is collapsed.
Click to expand it.
i3/init.sh
+
2
−
0
View file @
818a86ca
...
@@ -5,7 +5,9 @@ mkdir -p ~/.config/i3
...
@@ -5,7 +5,9 @@ mkdir -p ~/.config/i3
ln
-sr
config ~/.config/i3/config
ln
-sr
config ~/.config/i3/config
ln
-sr
toggle-border ~/.config/i3/i3-toggle-border
ln
-sr
toggle-border ~/.config/i3/i3-toggle-border
ln
-sr
kill
~/.config/i3/i3-kill
ln
-sr
kill
~/.config/i3/i3-kill
ln
-sr
i3status.conf ~/.config/i3/
chmod
o+x ~/.config/i3/i3-
*
chmod
o+x ~/.config/i3/i3-
*
g++ status.cpp
-o
~/.config/i3/status.out
if
[
"
$1
"
==
"mint"
]
;
if
[
"
$1
"
==
"mint"
]
;
then
then
...
...
This diff is collapsed.
Click to expand it.
i3/status.cpp
0 → 100644
+
100
−
0
View file @
818a86ca
#include
<bits/stdc++.h>
#include
<unistd.h>
using
namespace
std
;
#ifdef DEB
#define D if(1)
#else
#define D if(0)
#endif
#define fo(a,b) for(int a=0;a<(b);++a)
using
ll
=
long
long
;
const
int
LEN
=
5000
;
ll
t
;
#define TIME_P "%lld%s"
#define TIME(a) ((a)<180?a:(a)/60<180?a/60:a/60/60),((a)<180?"s":(a)/60<180?"min":"h")
#define ERR(a,b) {sprintf(out,"{\"name\":\"error\",\"color\":\"#FF0000\",\"full_text\":\"%s\"}" b,a);return;}
void
loadOsdd
(
char
*
out
)
{
*
out
=
0
;
static
char
color
[
LEN
],
line
[
LEN
];
FILE
*
f
=
fopen
(
".osdd_last"
,
"r"
);
if
(
!
f
)
ERR
(
"Open f"
,
","
);
ll
ti
;
fscanf
(
f
,
"%lld"
,
&
ti
);
ti
=
t
-
ti
;
for
(
int
i
=
0
;
fscanf
(
f
,
" %s%[^
\n
]"
,
color
,
line
)
==
2
;
i
++
)
{
if
(
line
[
1
])
{
out
+=
sprintf
(
out
,
"{
\"
name
\"
:
\"
osdd%d
\"
,
\"
color
\"
:
\"
#%s
\"
,
\"
full_text
\"
:
\"
"
,
i
,
color
);
if
(
!
i
)
out
+=
sprintf
(
out
,
"["
TIME_P
"] "
,
TIME
(
ti
));
out
+=
sprintf
(
out
,
"%s
\"
},"
,
line
+
1
);
}
}
fclose
(
f
);
}
void
loadMail
(
char
*
out
)
{
out
[
0
]
=
0
;
FILE
*
f
=
fopen
(
".cm"
,
"r"
);
if
(
!
f
)
ERR
(
"Open f"
,);
ll
lastUpTime
=
0
;
int
newMails
=
0
;
if
(
fscanf
(
f
,
"%lld%d"
,
&
lastUpTime
,
&
newMails
)
!=
2
)
return
;
ll
delay
=
t
-
lastUpTime
;
if
(
-
5
<
delay
&&
delay
>
30
)
if
(
newMails
)
sprintf
(
out
,
"{
\"
name
\"
:
\"
mail
\"
,
\"
color
\"
:
\"
#%s
\"
,
\"
full_text
\"
:
\"
NO CONNECTION "
TIME_P
" [%d]
\"
}"
,
t
%
2
?
"FF0000"
:
"3333FF"
,
TIME
(
delay
),
newMails
);
else
sprintf
(
out
,
"{
\"
name
\"
:
\"
mail
\"
,
\"
color
\"
:
\"
#FF0000
\"
,
\"
full_text
\"
:
\"
NO CONNECTION "
TIME_P
"
\"
}"
,
TIME
(
delay
));
else
if
(
newMails
)
sprintf
(
out
,
"{
\"
name
\"
:
\"
mail
\"
,
\"
color
\"
:
\"
#%s
\"
,
\"
full_text
\"
:
\"
[%d NEW]
\"
}"
,
t
%
2
?
"FF7000"
:
"3333FF"
,
newMails
);
else
sprintf
(
out
,
"{
\"
name
\"
:
\"
mail
\"
,
\"
color
\"
:
\"
#00FF00
\"
,
\"
full_text
\"
:
\"
OK
\"
}"
);
fclose
(
f
);
}
char
i3status_aloc
[
LEN
];
char
mail
[
LEN
];
char
osdd
[
LEN
];
int
main
()
{
assert
(
chdir
(
getenv
(
"HOME"
))
==
0
);
FILE
*
f
=
popen
(
"i3status -c ~/.config/i3/i3status.conf"
,
"r"
);
char
*
i3status
;
while
(
fgets
(
i3status
=
i3status_aloc
,
LEN
-
2
,
f
))
{
{
ll
lastt
=
t
;
t
=
time
(
0
);
if
(
t
==
lastt
)
t
++
;
}
if
(
!
memcmp
(
i3status
,
"{
\"
ver"
,
sizeof
(
"{
\"
ver"
)
-
1
)
||!
strcmp
(
i3status
,
"[
\n
"
)
||!
strcmp
(
i3status
,
"]
\n
"
))
{
printf
(
"%s"
,
i3status
);
fprintf
(
stderr
,
"%s"
,
i3status
);
}
else
{
if
(
i3status
[
0
]
==
','
)
{
putc
(
*
i3status
,
stderr
);
putchar
(
i3status
++
[
0
]);}
if
(
i3status
[
0
]
==
'['
)
{
putc
(
*
i3status
,
stderr
);
putchar
(
i3status
++
[
0
]);}
loadMail
(
mail
);
loadOsdd
(
osdd
);
printf
(
"%s%s,%s"
,
osdd
,
mail
,
i3status
);
fprintf
(
stderr
,
"%s%s,%s"
,
osdd
,
mail
,
i3status
);
}
fflush
(
stdout
);
fflush
(
stderr
);
}
return
0
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment