Commit of 2.2.0 Release

This commit is contained in:
linuxer 2021-02-20 18:45:07 +02:00
parent d4d08cc6e6
commit 8f9e579702
Signed by: linuxer.gr
GPG Key ID: CCD2779140DF9E58
18 changed files with 716 additions and 483 deletions

View File

@ -2,12 +2,12 @@ object Form2: TForm2
Left = 2120
Height = 409
Top = 688
Width = 817
Width = 847
BorderIcons = [biSystemMenu]
BorderStyle = bsSingle
Caption = 'About'
ClientHeight = 409
ClientWidth = 817
ClientWidth = 847
Icon.Data = {
BE2500000000010001003030000001002000A825000016000000280000003000
0000600000000100200000000000002400006400000064000000000000000000
@ -7984,7 +7984,7 @@ object Form2: TForm2
Left = 0
Height = 170
Top = 182
Width = 258
Width = 296
Picture.Data = {
0A544A706567496D616765CCF50000FFD8FFE000104A46494600010101004800
480000FFE117FC45786966000049492A000800000006001A0105000100000056
@ -9960,17 +9960,17 @@ object Form2: TForm2
Left = 302
Height = 260
Top = 5
Width = 509
Width = 538
Font.Height = -14
Font.Name = 'Sans'
ItemHeight = 0
ParentFont = False
ScrollWidth = 505
ScrollWidth = 536
TabOrder = 0
TopIndex = -1
end
object Label1: TLabel
Left = 266
Left = 312
Height = 17
Top = 273
Width = 48
@ -9981,7 +9981,7 @@ object Form2: TForm2
ParentFont = False
end
object Label2: TLabel
Left = 266
Left = 312
Height = 17
Top = 305
Width = 48
@ -9995,14 +9995,14 @@ object Form2: TForm2
Left = 0
Height = 36
Top = 366
Width = 817
Width = 840
Caption = 'Close'
OnClick = Button2Click
ParentFont = False
TabOrder = 1
end
object Label3: TLabel
Left = 266
Left = 312
Height = 20
Top = 337
Width = 44
@ -10011,14 +10011,14 @@ object Form2: TForm2
ParentFont = False
end
object Image: TImage
Left = 739
Left = 776
Height = 64
Top = 287
Width = 64
end
object StaticText1: TStaticText
Cursor = crHandPoint
Left = 351
Left = 397
Height = 17
Top = 273
Width = 261
@ -10035,7 +10035,7 @@ object Form2: TForm2
end
object StaticText2: TStaticText
Cursor = crHandPoint
Left = 351
Left = 397
Height = 17
Top = 304
Width = 365
@ -10050,7 +10050,7 @@ object Form2: TForm2
end
object StaticText3: TStaticText
Cursor = crHandPoint
Left = 349
Left = 395
Height = 17
Top = 337
Width = 296
@ -10066,7 +10066,7 @@ object Form2: TForm2
object ImageList: TImageList
Height = 64
Width = 64
Left = 758
Left = 792
Top = 301
Bitmap = {
4C7A0700000040000000400000008CBB00000000000078DACCBC07585EE9792D

View File

@ -398,7 +398,7 @@ install:
<CodeGeneration>
<TargetOS Value="linux"/>
<Optimizations>
<OptimizationLevel Value="3"/>
<OptimizationLevel Value="4"/>
</Optimizations>
</CodeGeneration>
<Linking>

View File

@ -21,6 +21,7 @@
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<EditorIndex Value="3"/>
<TopLine Value="45"/>
<CursorPos X="127" Y="19"/>
<UsageCount Value="279"/>
<Loaded Value="True"/>
@ -47,7 +48,8 @@
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<EditorIndex Value="5"/>
<CursorPos X="127" Y="19"/>
<TopLine Value="55"/>
<CursorPos X="104" Y="107"/>
<UsageCount Value="279"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
@ -74,11 +76,10 @@
<ResourceBaseClass Value="Form"/>
<UnitName Value="Main"/>
<IsVisibleTab Value="True"/>
<TopLine Value="20"/>
<CursorPos Y="47"/>
<TopLine Value="139"/>
<CursorPos X="82" Y="170"/>
<UsageCount Value="279"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit>
<Unit>
<Filename Value="OutputForm.pas"/>
@ -101,6 +102,7 @@
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<EditorIndex Value="9"/>
<TopLine Value="16"/>
<CursorPos X="127" Y="19"/>
<UsageCount Value="279"/>
<Loaded Value="True"/>
@ -114,6 +116,7 @@
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<EditorIndex Value="10"/>
<TopLine Value="3"/>
<CursorPos X="127" Y="19"/>
<UsageCount Value="279"/>
<Loaded Value="True"/>
@ -159,7 +162,7 @@
<FRMtype Value="0"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="2"/>
<CursorPos X="26" Y="31"/>
<CursorPos X="3" Y="19"/>
<UsageCount Value="224"/>
<Loaded Value="True"/>
<DefaultSyntaxHighlighter Value="Bash"/>
@ -168,155 +171,141 @@
<Filename Value="libnotify.pas"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="1"/>
<CursorPos Y="4"/>
<UsageCount Value="35"/>
<TopLine Value="118"/>
<CursorPos X="3" Y="59"/>
<UsageCount Value="191"/>
<Loaded Value="True"/>
</Unit>
<Unit>
<Filename Value="/usr/local/codetyphon/typhon/components/pl_lclextensions/source/include/delphicompat_gtk3.inc"/>
<Filename Value="../../../bin/CameraControl/CameraControl/ReleasesPacks/camera-control-webcam-switch-indicator/main.pas"/>
<FRMtype Value="0"/>
<UnitName Value="Main"/>
<EditorIndex Value="-1"/>
<TopLine Value="13"/>
<CursorPos X="2" Y="41"/>
<UsageCount Value="4"/>
</Unit>
<Unit>
<Filename Value="/usr/local/codetyphon/typhon/lcl/interfaces/gtk3/alllclintfunits.pas"/>
<FRMtype Value="0"/>
<UnitName Value="AllLCLIntfUnits"/>
<EditorIndex Value="-1"/>
<CursorPos X="3" Y="19"/>
<UsageCount Value="4"/>
</Unit>
<Unit>
<Filename Value="/usr/local/codetyphon/typhon/components/pl_LuiControls/source/luicontrols/presentationmanager.pas"/>
<FRMtype Value="0"/>
<UnitName Value="PresentationManager"/>
<EditorIndex Value="-1"/>
<CursorPos Y="6"/>
<UsageCount Value="9"/>
<TopLine Value="1973"/>
<CursorPos X="11" Y="2408"/>
<UsageCount Value="10"/>
</Unit>
</Units>
<JumpHistory HistoryIndex="29">
<Position>
<Filename Value="main.pas"/>
<Caret Line="1762" Column="11" TopLine="1737"/>
<Caret Line="1346" Column="88" TopLine="1295"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="1769" Column="6" TopLine="1743"/>
</Position>
<Position>
<Filename Value="RebootDialog.pas"/>
<Caret Line="12" Column="81" TopLine="8"/>
<Caret Line="1359" Column="63" TopLine="1304"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="2058" Column="39" TopLine="2015"/>
<Caret Line="1538" Column="85" TopLine="1483"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="279" Column="27" TopLine="205"/>
<Caret Line="1539" Column="53" TopLine="1484"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="288" Column="11" TopLine="275"/>
<Caret Line="1573" Column="78" TopLine="1518"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="25" Column="63" TopLine="16"/>
<Caret Line="1574" Column="39" TopLine="1519"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="23" Column="10" TopLine="17"/>
<Caret Line="1634" Column="69" TopLine="1602"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="2236" TopLine="2210"/>
<Caret Line="1662" Column="72" TopLine="1613"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="296" Column="19" TopLine="289"/>
<Caret Line="1078" Column="12" TopLine="1024"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="253" TopLine="212"/>
<Caret Line="2365" Column="25" TopLine="2311"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="227" TopLine="186"/>
<Caret Line="525" TopLine="495"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="219" Column="7" TopLine="184"/>
<Caret Line="1327" Column="45" TopLine="1296"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="205" Column="5" TopLine="187"/>
<Caret Line="1346" Column="88" TopLine="1296"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="362" Column="111" TopLine="317"/>
<Caret Line="1359" Column="63" TopLine="1304"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="360" Column="34" TopLine="333"/>
<Caret Line="1538" Column="85" TopLine="1483"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="52" Column="33" TopLine="17"/>
<Caret Line="1539" Column="53" TopLine="1484"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="49" TopLine="23"/>
<Caret Line="1573" Column="78" TopLine="1518"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="225" TopLine="203"/>
<Caret Line="1574" Column="39" TopLine="1519"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="117" Column="24" TopLine="104"/>
<Caret Line="1634" Column="49" TopLine="1590"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="442" Column="20" TopLine="293"/>
<Caret Line="1649" Column="49" TopLine="1603"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="432" Column="141" TopLine="425"/>
<Caret Line="1665" Column="82" TopLine="1625"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="431" Column="125" TopLine="422"/>
<Caret Line="1634" Column="58" TopLine="1609"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="239" Column="7" TopLine="219"/>
<Caret Line="1662" Column="74" TopLine="1608"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="1868" Column="92" TopLine="1817"/>
<Caret Line="1663" Column="42" TopLine="1608"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="363" Column="114" TopLine="330"/>
</Position>
<Position>
<Filename Value="libnotify.pas"/>
<Caret Line="25" Column="23"/>
<Caret Line="1716" Column="24" TopLine="1707"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="363" Column="114" TopLine="315"/>
<Caret Line="1915" Column="79" TopLine="1860"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="434" Column="15" TopLine="360"/>
<Caret Line="2417" Column="32" TopLine="2405"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="7" Column="14"/>
<Caret Line="47" TopLine="16"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="2417" Column="32" TopLine="2408"/>
</Position>
<Position>
<Filename Value="main.pas"/>
<Caret Line="2431" Column="75" TopLine="2408"/>
</Position>
</JumpHistory>
<RunParams>

BIN
CameraControl.res Normal file

Binary file not shown.

View File

@ -1,7 +1,8 @@
#!/usr/bin/bash
export MYSECRET='sudopasswordtexxt'
package_type=$(command -v pacman || command -v apt || command -v yum)
#export MYSECRET='sudopasswordtext' has been depreciated, it uses polkit instead
gsettings set com.canonical.notify-osd gravity 2
package_type=$(command -v pacman || command -v apt || command -v yum || command -v xbps-fetch)
export $(dbus-launch)
distropack=${package_type:9}
if [[ ${package_type:9} == "apt" ]];
@ -10,6 +11,10 @@ if [[ ${package_type:9} == "apt" ]];
elif [[ ${package_type:9} == "pacman" ]];
then
distro='Arch'
elif [[ ${package_type:5} == "xbps-fetch" ]];
then
distro='Void'
distropack=${package_type:5}
else
distro='RPM'
fi
@ -17,23 +22,16 @@ fi
#echo $distropack
#echo $distro
cd $HOME/FPC\ Projects/CameraControl/build
session_type=$XDG_SESSION_TYPE
#QT_QPA_PLATFORM selection for xcb / wayland
if [[ ${session_type} -eq "x11" ]]; then
QT_QPA_PLATFORM=xcb /opt/CameraControl/cameracontrol.bin -$distro >/dev/null
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY QT_QPA_PLATFORM=xcb QT_STYLE_OVERRIDE=kvantum /opt/CameraControl/cameracontrol.bin -$distro >/dev/null
exit 0
fi
if [[ ${session_type} -eq "wayland" ]]; then
QT_QPA_PLATFORM=wayland /opt/CameraControl/cameracontrol.bin >/dev/null
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY QT_QPA_PLATFORM=xcb QT_STYLE_OVERRIDE=kvantum /opt/CameraControl/cameracontrol.bin -$distro >/dev/null
exit 0
fi
#qt_session=$QT_QPA_PLATFORM
# So use the line below for execution
#QT_QPA_PLATFORM=xcb /opt/CameraControl/cameracontrol.bin -$distro >/dev/null

View File

@ -1,11 +1,13 @@
object Form7: TForm7
Left = 533
Height = 165
Height = 215
Top = 45
Width = 452
BorderStyle = bsToolWindow
ClientHeight = 165
ClientWidth = 452
Width = 589
BorderIcons = [biSystemMenu]
BorderStyle = bsSingle
ClientHeight = 215
ClientWidth = 589
DesignTimePPI = 125
Icon.Data = {
BE2500000000010001003030000001002000A825000016000000280000003000
0000600000000100200000000000002400006400000064000000000000000000
@ -314,44 +316,44 @@ object Form7: TForm7
Position = poScreenCenter
LCLVersion = '7.2'
object Button1: TButton
Left = 328
Height = 36
Top = 128
Width = 122
Left = 427
Height = 47
Top = 167
Width = 159
Caption = 'Ok'
OnClick = Button1Click
ParentFont = False
TabOrder = 0
end
object Image: TImage
Left = 7
Height = 64
Top = 10
Width = 64
Left = 9
Height = 83
Top = 13
Width = 83
end
object Label1: TLabel
Left = 80
Height = 20
Top = 16
Width = 44
Left = 104
Height = 26
Top = 21
Width = 57
Caption = 'Label1'
ParentColor = False
ParentFont = False
end
object Edit1: TEdit
Left = 80
Height = 36
Top = 61
Width = 384
Left = 104
Height = 42
Top = 79
Width = 500
OnEditingDone = Button1Click
ParentFont = False
TabOrder = 1
end
object Button2: TButton
Left = 80
Height = 36
Top = 128
Width = 127
Left = 104
Height = 47
Top = 167
Width = 165
Caption = 'Cancel'
OnClick = Button2Click
ParentFont = False
@ -360,8 +362,8 @@ object Form7: TForm7
object ImageList: TImageList
Height = 64
Width = 64
Left = 24
Top = 24
Left = 31
Top = 31
Bitmap = {
4C7A080000004000000040000000A2C200000000000078DAECBC05749C779AEE
D9333DDD31C44E9CC461C7714C31C7EC989959B2645916333333339558AA1233

View File

@ -1,12 +1,13 @@
object Form3: TForm3
Left = 468
Height = 438
Height = 570
Top = 45
Width = 722
BorderStyle = bsToolWindow
Width = 940
BorderStyle = bsSingle
Caption = 'Events Logged'
ClientHeight = 438
ClientWidth = 722
ClientHeight = 570
ClientWidth = 940
DesignTimePPI = 125
Icon.Data = {
BE2500000000010001003030000001002000A825000016000000280000003000
0000600000000100200000000000002400006400000064000000000000000000
@ -316,9 +317,9 @@ object Form3: TForm3
LCLVersion = '7.2'
object Button1: TButton
Left = 0
Height = 36
Top = 399
Width = 722
Height = 47
Top = 520
Width = 940
Caption = 'Close'
OnClick = Button1Click
ParentFont = False
@ -326,9 +327,9 @@ object Form3: TForm3
end
object StringGrid1: TStringGrid
Left = 1
Height = 384
Top = 10
Width = 720
Height = 500
Top = 13
Width = 938
AutoAdvance = aaDown
Color = clDefault
ColCount = 4
@ -337,14 +338,14 @@ object Form3: TForm3
RowCount = 1
ScrollBars = ssAutoVertical
TabOrder = 1
TitleFont.Height = -13
TitleFont.Height = -17
TitleFont.Name = 'Sans'
TitleImageList = Form1.ImageListStatus
ColWidths = (
36
175
335
163
47
228
436
212
)
Cells = (
4

View File

@ -1,11 +1,13 @@
object Form8: TForm8
Left = 533
Height = 287
Height = 374
Top = 45
Width = 374
BorderStyle = bsToolWindow
ClientHeight = 287
ClientWidth = 374
Width = 487
BorderIcons = [biSystemMenu]
BorderStyle = bsSingle
ClientHeight = 374
ClientWidth = 487
DesignTimePPI = 125
Icon.Data = {
BE2500000000010001003030000001002000A825000016000000280000003000
0000600000000100200000000000002400006400000064000000000000000000
@ -315,25 +317,25 @@ object Form8: TForm8
LCLVersion = '7.2'
object Button1: TButton
Left = 0
Height = 36
Top = 246
Width = 373
Height = 47
Top = 320
Width = 486
Caption = 'Ok'
OnClick = Button1Click
ParentFont = False
TabOrder = 0
end
object Image: TImage
Left = 6
Height = 64
Top = 12
Width = 64
Left = 8
Height = 83
Top = 16
Width = 83
end
object Label1: TLabel
Left = 80
Height = 20
Top = 16
Width = 44
Left = 104
Height = 26
Top = 21
Width = 57
Caption = 'Label1'
Font.Style = [fsBold]
ParentColor = False
@ -342,8 +344,8 @@ object Form8: TForm8
object ImageList: TImageList
Height = 64
Width = 64
Left = 24
Top = 32
Left = 31
Top = 42
Bitmap = {
4C7A0A000000400000004000000052DA00000000000078DAECBC05749C779AEE
D9333DDD31C44E9CC461C7714C31C7EC989959B2645916333333339558AA1233

View File

@ -1,11 +1,13 @@
object Form6: TForm6
Left = 533
Height = 410
Height = 534
Top = 45
Width = 464
BorderStyle = bsToolWindow
ClientHeight = 410
ClientWidth = 464
Width = 604
BorderIcons = [biSystemMenu]
BorderStyle = bsSingle
ClientHeight = 534
ClientWidth = 604
DesignTimePPI = 125
Icon.Data = {
BE2500000000010001003030000001002000A825000016000000280000003000
0000600000000100200000000000002400006400000064000000000000000000
@ -315,36 +317,36 @@ object Form6: TForm6
LCLVersion = '7.2'
object Button1: TButton
Left = 0
Height = 36
Top = 368
Width = 465
Height = 47
Top = 479
Width = 605
Caption = 'Ok'
OnClick = Button1Click
ParentFont = False
TabOrder = 0
end
object ListBox: TListBox
Left = 80
Height = 353
Top = 10
Width = 384
Left = 104
Height = 460
Top = 13
Width = 500
ItemHeight = 0
ParentFont = False
ScrollWidth = 380
ScrollWidth = 498
TabOrder = 1
TopIndex = -1
end
object Image: TImage
Left = 8
Height = 64
Top = 10
Width = 64
Left = 10
Height = 83
Top = 13
Width = 83
end
object ImageList: TImageList
Height = 64
Width = 64
Left = 24
Top = 32
Left = 31
Top = 42
Bitmap = {
4C7A07000000400000004000000009A400000000000078DAECBC05749C779AEE
D9333DDD31C44E9CC461C7714C31C7EC989959B2645916333333339558AA1233

View File

@ -1,20 +1,22 @@
object Form9: TForm9
Left = 584
Height = 205
Height = 267
Top = 48
Width = 218
BorderStyle = bsToolWindow
Width = 284
BorderIcons = [biSystemMenu]
BorderStyle = bsSingle
Caption = 'Camera Control - Killed Pids '
ClientHeight = 205
ClientWidth = 218
ClientHeight = 267
ClientWidth = 284
DesignTimePPI = 125
Font.Style = [fsBold]
Position = poScreenCenter
LCLVersion = '7.2'
object Button1: TButton
Left = 0
Height = 36
Top = 164
Width = 216
Height = 47
Top = 214
Width = 281
Caption = 'Οκ'
Font.Style = [fsBold]
OnClick = Button1Click
@ -23,9 +25,9 @@ object Form9: TForm9
end
object Image1: TImage
Left = 0
Height = 64
Top = 10
Width = 64
Height = 83
Top = 13
Width = 83
Picture.Data = {
07544269746D61708A3F0000424D8A3F0000000000008A0000007C0000004000
00003F0000000100200003000000003F0000130B0000130B0000000000000000
@ -539,39 +541,39 @@ object Form9: TForm9
}
end
object Label1: TLabel
Left = 87
Height = 20
Top = 45
Width = 34
Left = 113
Height = 26
Top = 59
Width = 45
Caption = 'None'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
end
object ScrollBar1: TScrollBar
Left = 204
Height = 148
Top = 10
Left = 266
Height = 193
Top = 13
Width = 13
Kind = sbVertical
PageSize = 0
TabOrder = 1
end
object Label2: TLabel
Left = 67
Height = 20
Top = 10
Width = 93
Left = 87
Height = 26
Top = 13
Width = 122
Caption = 'Pids Numbers'
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
end
object Bevel1: TBevel
Left = 61
Height = 12
Top = 31
Width = 106
Left = 79
Height = 16
Top = 40
Width = 138
Shape = bsBottomLine
Style = bsRaised
end

View File

@ -1,14 +1,18 @@
# `Camera Control for Linux in System Tray (Notification Area)`
- A small utility to switch your webcam on/off, microphone mute/unmute for Linux Desktops ([Qt5](https://gitlab.com/psposito/camera-control-webcam-switch-indicator/issues/5), [Gtk3 maybe in the future](https://gitlab.com/psposito/camera-control-webcam-switch-indicator/issues/4))
- A small utility to switch your webcam on/off, microphone mute/unmute for Linux Desktops ([Qt5](https://gitlab.com/linuxer.gr/camera-control-webcam-switch-indicator/issues/5), [Gtk3 maybe in the future](https://gitlab.com/inuxer.gr/camera-control-webcam-switch-indicator/issues/4))
- This project replaces the ([camera monitor](https://launchpad.net/cameramonitor)), for having the full webcam status on tray and provides for both camera and microphone switch functions aditionally.
- This project replaces the [camera monitor](https://launchpad.net/cameramonitor), for having the full webcam status on tray and provides for both camera and microphone switch functions aditionally.
- In addition, it provides Security Control, by Logs, Popup notifiers and Shield Icon on tray for Malware or Intrusion Detection.
- For all of the above to be succeded, `the sudo password is necessary to be provided on a copy of /opt/CameraControl.sh to your Home folder`, edited as shown here with the correct sudo password at the sudopasswordtext field.
- Polkit integration prevents leakage of sensitive data, as from 2.2.0 release and on
![Screenshot](https://i.imgur.com/iJzG3z3.png)
![Screenshot](https://imgur.com/9qNDcYz.png)
- so the CameraControl.sh, has been modified accordingly
[![Screenshot](https://imgur.com/xea7CYZ.png)
- RPM is not valid yet. I do not have any feedback and testing from such distributions.
@ -98,14 +102,17 @@
(click on the links to open)
- Forced to Reboot if Kernel module V4L2 produces 59 lines by switching the Camera, [from On/Off and from Off/On, when Hacking Events occur](https://gitlab.com/psposito/camera-control-webcam-switch-indicator/-/wikis/Project-History-and-other-Details#found-v4l2-limitations-forcing-for-reboot-when-v4l2-video-on-comes-to-number-60-it-is-mandatory-to-reboot-because-kernel-does-not-generate-more-devices-and-video-capture-is-not-possible)
- Forced to Reboot if Kernel module V4L2 produces 59 lines by switching the Camera, [from On/Off and from Off/On, when Hacking Events occur](https://gitlab.com/inuxer.gr/camera-control-webcam-switch-indicator/-/wikis/Project-History-and-other-Details#found-v4l2-limitations-forcing-for-reboot-when-v4l2-video-on-comes-to-number-60-it-is-mandatory-to-reboot-because-kernel-does-not-generate-more-devices-and-video-capture-is-not-possible)
![Screenshot](https://imgur.com/bUjoU0j.png)
### Video Demos:
- #### The second major release 2.2.0 polkit and notify-osd in action
- #### The Big Release 2.0.2 Demo
- [![Release 2.2.0 Demo](http://img.youtube.com/vi/_Z6MtPDJi9Y/0.jpg)](https://www.youtube.com/watch?v=_Z6MtPDJi9Y)
- #### The first major Release 2.0.2 Demo
- [![Release 2.0.2 Demo](http://img.youtube.com/vi/8b2H3lYPNc8/0.jpg)](http://www.youtube.com/watch?v=8b2H3lYPNc8)
@ -135,7 +142,7 @@
- ##### `qt5gtk2` may be needed for correct popup (baloons) messages
- ##### `gnome-shell-extension-topicons-plus` [AUR](https://aur.archlinux.org/packages/gnome-shell-extension-topicons-plus)
### For All Distributions, add `lsof`, if is not installed at distribution's default installation.
### For All Distributions, add `lsof` and `libnotify`, if are not installed at distribution's default installation.
#### Select the name(s) from the above list, by the name of your Distribution (either major or derived from), respectively.

View File

@ -1,12 +1,14 @@
object Form4: TForm4
Left = 455
Height = 213
Height = 277
Top = 45
Width = 303
BorderStyle = bsToolWindow
Width = 395
BorderIcons = [biSystemMenu]
BorderStyle = bsSingle
Caption = 'Sytem Reboot'
ClientHeight = 213
ClientWidth = 303
ClientHeight = 277
ClientWidth = 395
DesignTimePPI = 125
Icon.Data = {
BE2500000000010001003030000001002000A825000016000000280000003000
0000600000000100200000000000002400006400000064000000000000000000
@ -313,34 +315,32 @@ object Form4: TForm4
767F
}
Position = poScreenCenter
LCLVersion = '7.2'
LCLVersion = '7.3'
object ListBox1: TListBox
Left = 0
Height = 159
Top = 10
Width = 302
Height = 207
Top = 13
Width = 393
Font.Style = [fsBold]
ItemHeight = 0
ParentFont = False
ScrollWidth = 298
TabOrder = 0
TopIndex = -1
end
object Button1: TButton
Left = 36
Height = 36
Top = 174
Width = 74
Left = 47
Height = 47
Top = 227
Width = 96
Caption = 'Reboot'
OnClick = Button1Click
ParentFont = False
TabOrder = 1
end
object Button2: TButton
Left = 184
Height = 36
Top = 174
Width = 74
Left = 240
Height = 47
Top = 227
Width = 96
Caption = 'Cancel'
OnClick = Button2Click
ParentFont = False

View File

@ -104,7 +104,8 @@ begin
CmdString := '';
Password := Form4.Password;
FileDestDir := '/etc/modprobe.d/blacklistuvcvideo.conf';
CmdString := Concat(Concat(Concat('echo ', Password), ' | sudo -S rm -f '), FileDestDir);
//CmdString := Concat(Concat(Concat('echo ', Password), ' | sudo -S rm -f '), FileDestDir);
CmdString := Concat(Concat('sudo rm -f '), FileDestDir);
S := FpSystem(CmdString);
if (S <> 0) then
begin
@ -130,7 +131,8 @@ begin
HomeDir := expandfilename('~/');
FileString := Concat(HomeDir,'.blacklistuvcvideo ');
FileDestDir := '/etc/modprobe.d/blacklistuvcvideo.conf';
CmdString := Concat(Concat(Concat(Concat('echo ', Password), ' | sudo -S cp '), FileString), FileDestDir);
//CmdString := Concat(Concat(Concat(Concat('echo ', Password), ' | sudo -S cp '), FileString), FileDestDir);
CmdString := Concat(Concat(Concat('sudo cp '), FileString), FileDestDir);
S := FpSystem(CmdString);
if (S <> 0) then
begin
@ -190,7 +192,8 @@ begin
begin
Line := Copy(Form4.AudioStringList.Strings[n], 11, Length(Form4.AudioStringList.Strings[n]));
//ShowMessage(Line);
CmdString := Concat(Concat(Concat('echo ', Password), ' | sudo -S modprobe '), Line);
//CmdString := Concat(Concat(Concat('echo ', Password), ' | sudo -S modprobe '), Line);
CmdString := Concat(Concat('sudo modprobe '), Line);
S := FpSystem(CmdString);
Inc(n);
end;
@ -213,7 +216,8 @@ begin
FileDestDir := '';
Password := Form4.Password;
FileDestDir := '/etc/modprobe.d/blacklistaudio.conf';
CmdString := Concat(Concat(Concat('echo ', Password), ' | sudo -S rm -f '), FileDestDir);
//CmdString := Concat(Concat(Concat('echo ', Password), ' | sudo -S rm -f '), FileDestDir);
CmdString := Concat(Concat('sudo rm -f '), FileDestDir);
S := FpSystem(CmdString);
if (S <> 0) then
@ -238,7 +242,8 @@ begin
HomeDir := expandfilename('~/');
FileString := Concat(HomeDir,'.blacklistaudio ');
FileDestDir := '/etc/modprobe.d/blacklistaudio.conf ';
CmdString := Concat(Concat(Concat(Concat('echo ', Password), ' | sudo -S cp '), FileString), FileDestDir);
//CmdString := Concat(Concat(Concat(Concat('echo ', Password), ' | sudo -S cp '), FileString), FileDestDir);
CmdString := Concat(Concat(Concat('sudo cp '), FileString), FileDestDir);
S := FpSystem(CmdString);
if (S <> 0) then
begin

View File

@ -1,12 +1,14 @@
object Form5: TForm5
Left = 533
Height = 294
Height = 383
Top = 45
Width = 365
BorderStyle = bsToolWindow
Width = 475
BorderIcons = [biSystemMenu]
BorderStyle = bsSingle
Caption = 'Reboot or Quit Application'
ClientHeight = 294
ClientWidth = 365
ClientHeight = 383
ClientWidth = 475
DesignTimePPI = 125
Icon.Data = {
BE2500000000010001003030000001002000A825000016000000280000003000
0000600000000100200000000000002400006400000064000000000000000000
@ -315,10 +317,10 @@ object Form5: TForm5
Position = poScreenCenter
LCLVersion = '7.2'
object Button1: TButton
Left = 21
Height = 36
Top = 256
Width = 118
Left = 27
Height = 47
Top = 333
Width = 154
Caption = 'Reboot'
Default = True
OnClick = Button1Click
@ -326,31 +328,31 @@ object Form5: TForm5
TabOrder = 0
end
object Button2: TButton
Left = 200
Height = 36
Top = 256
Width = 118
Left = 260
Height = 47
Top = 333
Width = 154
Caption = 'Quit'
OnClick = Button2Click
ParentFont = False
TabOrder = 1
end
object ListBox1: TListBox
Left = 5
Height = 215
Top = 10
Width = 358
Left = 7
Height = 280
Top = 13
Width = 466
ItemHeight = 0
ParentFont = False
ScrollWidth = 354
ScrollWidth = 464
TabOrder = 2
TopIndex = -1
end
object StaticText1: TStaticText
Left = 57
Height = 17
Top = 231
Width = 243
Left = 74
Height = 22
Top = 301
Width = 316
Caption = 'V4L2 limitations, forcing for Reboot'
Font.Color = clBlue
Font.Style = [fsItalic, fsUnderline]

118
main.frm
View File

@ -1,20 +1,20 @@
object Form1: TForm1
Left = 612
Height = 629
Height = 701
Top = 251
Width = 755
Width = 930
Caption = 'Form1'
ClientHeight = 629
ClientWidth = 755
ClientHeight = 701
ClientWidth = 930
DesignTimePPI = 125
OnCreate = FormCreate
PopupMenu = PopupMenu1
LCLVersion = '7.2'
LCLVersion = '7.3'
object VpClock1: TVpClock
Left = 306
Height = 39
Top = 553
Width = 177
Left = 392
Height = 30
Top = 552
Width = 136
Active = False
ClockMode = cmClock
DigitalOptions.MilitaryTime = True
@ -45,8 +45,8 @@ object Form1: TForm1
object ImageListMic: TImageList
Height = 64
Width = 64
Left = 473
Top = 20
Left = 542
Top = 32
Bitmap = {
4C7A030000004000000040000000875D00000000000078DADC7D075814D7FA3E
4DC01ABBB16BA2C61A5BC4DE22187B8988A0284A1790DECB0E55AA48EFBD4AEF
@ -2912,14 +2912,14 @@ object Form1: TForm1
Hint = 'Camera Menu'
Visible = True
OnClick = TrayIcon1Click
Left = 634
Top = 104
Left = 703
Top = 116
end
object ImageListCam: TImageList
Height = 64
Width = 64
Left = 634
Top = 20
Left = 703
Top = 32
Bitmap = {
4C7A040000004000000040000000984F00000000000078DAED7D075814D7F736
02028A1514517AEFBDF7DE51E9BD1751C0120B764D8C3DB624C6DE7BAFB13710
@ -5880,8 +5880,8 @@ object Form1: TForm1
Hint = 'Microphone Status & Menu'
Visible = True
OnClick = TrayIcon2Click
Left = 473
Top = 104
Left = 542
Top = 116
end
object ProcessUTF8_1: TProcessUTF8
Active = False
@ -5896,11 +5896,11 @@ object Form1: TForm1
WindowTop = 0
WindowWidth = 0
FillAttribute = 0
Left = 20
Left = 96
Top = 547
end
object PopupMenu1: TPopupMenu
Left = 174
Left = 243
Top = 547
object MenuItem1: TMenuItem
Caption = 'Camera'
@ -5959,8 +5959,8 @@ object Form1: TForm1
object ImageListStatus: TImageList
Height = 64
Width = 64
Left = 333
Top = 20
Left = 402
Top = 32
Bitmap = {
4C7A050000004000000040000000BB6A00000000000078DAEC7D05781457F7FE
46D1E2B4D0022D85D296162AD48D16EAEE022DA5A54829EE1A926009114284B8
@ -9535,12 +9535,12 @@ object Form1: TForm1
Hint = 'Events Log Status'
Visible = True
OnClick = TrayIcon3Click
Left = 333
Top = 104
Left = 402
Top = 116
end
object PopupMenu2: TPopupMenu
Left = 333
Top = 174
Left = 402
Top = 186
object MenuItem12: TMenuItem
Caption = 'Show Logs'
Bitmap.Data = {
@ -10271,8 +10271,8 @@ object Form1: TForm1
end
end
object PopupMenu3: TPopupMenu
Left = 473
Top = 174
Left = 542
Top = 186
object MenuItem18: TMenuItem
Caption = '-'
end
@ -11162,8 +11162,8 @@ object Form1: TForm1
end
end
object PopupMenu4: TPopupMenu
Left = 634
Top = 174
Left = 703
Top = 186
object MenuItem14: TMenuItem
Caption = 'Camera'
Bitmap.Data = {
@ -12193,14 +12193,14 @@ object Form1: TForm1
Hint = 'System Actions and Main Menu'
Visible = True
OnClick = TrayIcon4Click
Left = 174
Top = 104
Left = 243
Top = 116
end
object ImageListSystem: TImageList
Height = 64
Width = 64
Left = 174
Top = 20
Left = 243
Top = 32
Bitmap = {
4C7A010000004000000040000000C70C00000000000078DAED9A0B6C95E519C7
DB721BCEDB70C1CCCC6D2E19DBD42C71CBB22C8CCCB96432350885404B5D3142
@ -12641,8 +12641,8 @@ object Form1: TForm1
}
end
object PopupMenu5: TPopupMenu
Left = 174
Top = 174
Left = 243
Top = 186
object MenuItem40: TMenuItem
Caption = 'System Camera'
Bitmap.Data = {
@ -20866,14 +20866,14 @@ object Form1: TForm1
Hint = 'Camera Status'
Visible = True
OnClick = TrayIcon5Click
Left = 27
Top = 104
Left = 96
Top = 116
end
object ImageListCam1: TImageList
Height = 64
Width = 64
Left = 27
Top = 20
Left = 96
Top = 32
Bitmap = {
4C7A030000004000000040000000C15400000000000078DAD59D059895D5F6FF
09958B5DD7BAA220DDDD39C00CCC0C534C7777173330450C357437D229212021
@ -24181,8 +24181,8 @@ object Form1: TForm1
TitleFont.Name = 'Roboto'
TitleFont.Style = [fsBold]
Visible = False
Left = 634
Top = 240
Left = 703
Top = 252
end
object PopupNotifier2: TPopupNotifier
Color = clBlack
@ -24653,8 +24653,8 @@ object Form1: TForm1
TitleFont.Style = [fsBold]
Visible = False
OnClose = PopupNotifier2Close
Left = 634
Top = 293
Left = 703
Top = 320
end
object PopupNotifier3: TPopupNotifier
Color = clBlack
@ -24784,8 +24784,8 @@ object Form1: TForm1
TitleFont.Name = 'Roboto'
TitleFont.Style = [fsBold]
Visible = False
Left = 473
Top = 240
Left = 542
Top = 252
end
object PopupNotifier4: TPopupNotifier
Color = clBlack
@ -24923,8 +24923,8 @@ object Form1: TForm1
TitleFont.Name = 'Roboto'
TitleFont.Style = [fsBold]
Visible = False
Left = 473
Top = 293
Left = 542
Top = 320
end
object PopupNotifier5: TPopupNotifier
Color = clBlack
@ -25391,8 +25391,8 @@ object Form1: TForm1
TitleFont.Name = 'Roboto'
TitleFont.Style = [fsBold]
Visible = False
Left = 27
Top = 240
Left = 96
Top = 252
end
object PopupNotifier6: TPopupNotifier
Color = clBlack
@ -25862,8 +25862,8 @@ object Form1: TForm1
TitleFont.Name = 'Roboto'
TitleFont.Style = [fsBold]
Visible = False
Left = 27
Top = 293
Left = 96
Top = 320
end
object PopupNotifier7: TPopupNotifier
Color = clBlack
@ -26330,8 +26330,8 @@ object Form1: TForm1
TitleFont.Name = 'Roboto'
TitleFont.Style = [fsBold]
Visible = False
Left = 27
Top = 366
Left = 96
Top = 393
end
object PopupNotifier8: TPopupNotifier
Color = clBlack
@ -26689,8 +26689,8 @@ object Form1: TForm1
TitleFont.Name = 'Roboto'
TitleFont.Style = [fsBold]
Visible = False
Left = 333
Top = 240
Left = 402
Top = 252
end
object PopupNotifier9: TPopupNotifier
Color = clBlack
@ -27048,12 +27048,12 @@ object Form1: TForm1
TitleFont.Name = 'Roboto'
TitleFont.Style = [fsBold]
Visible = False
Left = 333
Top = 293
Left = 402
Top = 320
end
object PopupMenu6: TPopupMenu
Left = 27
Top = 174
Left = 96
Top = 186
object MenuItem13: TMenuItem
Caption = 'Kill Capturing (User Mode)'
Bitmap.Data = {

359
main.pas
View File

@ -167,7 +167,7 @@ type
end;
var
ReleaseNo : String = '2.1.0';
ReleaseNo : String = '2.2.0'; // skipped subversions, from 2.1.0, cause of the major change of operation with polkit and notify-osd
Form1 : TForm1;
S : LongInt;
MicSwitchStr : String;
@ -282,57 +282,57 @@ begin
inherited Create();
end;
procedure RunsAsRoot(CommandLine:String);
var
Proc: TProcess;
CharBuffer: array [0..511] of char;
ReadCount: integer;
ExitCode: integer;
SudoPassword: string;
begin
WriteLn('Please enter the sudo password:');
Readln(SudoPassword);
ExitCode := -1; //Start out with failure, let's see later if it works
Proc := TProcess.Create(nil); //Create a new process
try
Proc.Options := [poUsePipes, poStderrToOutPut]; //Use pipes to redirect program stdin,stdout,stderr
Proc.CommandLine := CommandLine; //Run ls /root as root using sudo
// -S causes sudo to read the password from stdin.
Proc.Execute; //start it. sudo will now probably ask for a password
// write the password to stdin of the sudo program:
SudoPassword := SudoPassword + LineEnding;
Proc.Input.Write(SudoPassword[1], Length(SudoPassword));
SudoPassword := '%*'; //short string, hope this will scramble memory a bit; note: using PChars is more fool-proof
SudoPassword := ''; // and make the program a bit safer from snooping?!?
// main loop to read output from stdout and stderr of sudo
while Proc.Running or (Proc.Output.NumBytesAvailable > 0) or
(Proc.Stderr.NumBytesAvailable > 0) do
begin
// read stdout and write to our stdout
while Proc.Output.NumBytesAvailable > 0 do
begin
ReadCount := Min(512, Proc.Output.NumBytesAvailable); //Read up to buffer, not more
Proc.Output.Read(CharBuffer, ReadCount);
Write(StdOut, Copy(CharBuffer, 0, ReadCount));
end;
// read stderr and write to our stderr
while Proc.Stderr.NumBytesAvailable > 0 do
begin
ReadCount := Min(512, Proc.Stderr.NumBytesAvailable); //Read up to buffer, not more
Proc.Stderr.Read(CharBuffer, ReadCount);
Write(StdErr, Copy(CharBuffer, 0, ReadCount));
end;
end;
ExitCode := Proc.ExitStatus;
finally
Proc.Free;
Halt(ExitCode);
end;
end;
//procedure RunsAsRoot(CommandLine:String);
//var
// Proc: TProcess;
// CharBuffer: array [0..511] of char;
// ReadCount: integer;
// ExitCode: integer;
// SudoPassword: string;
//
//begin
// WriteLn('Please enter the sudo password:');
// Readln(SudoPassword);
// ExitCode := -1; //Start out with failure, let's see later if it works
// Proc := TProcess.Create(nil); //Create a new process
// try
// Proc.Options := [poUsePipes, poStderrToOutPut]; //Use pipes to redirect program stdin,stdout,stderr
// Proc.CommandLine := CommandLine; //Run ls /root as root using sudo
// // -S causes sudo to read the password from stdin.
// Proc.Execute; //start it. sudo will now probably ask for a password
//
// // write the password to stdin of the sudo program:
// SudoPassword := SudoPassword + LineEnding;
// Proc.Input.Write(SudoPassword[1], Length(SudoPassword));
// SudoPassword := '%*'; //short string, hope this will scramble memory a bit; note: using PChars is more fool-proof
// SudoPassword := ''; // and make the program a bit safer from snooping?!?
//
// // main loop to read output from stdout and stderr of sudo
// while Proc.Running or (Proc.Output.NumBytesAvailable > 0) or
// (Proc.Stderr.NumBytesAvailable > 0) do
// begin
// // read stdout and write to our stdout
// while Proc.Output.NumBytesAvailable > 0 do
// begin
// ReadCount := Min(512, Proc.Output.NumBytesAvailable); //Read up to buffer, not more
// Proc.Output.Read(CharBuffer, ReadCount);
// Write(StdOut, Copy(CharBuffer, 0, ReadCount));
// end;
// // read stderr and write to our stderr
// while Proc.Stderr.NumBytesAvailable > 0 do
// begin
// ReadCount := Min(512, Proc.Stderr.NumBytesAvailable); //Read up to buffer, not more
// Proc.Stderr.Read(CharBuffer, ReadCount);
// Write(StdErr, Copy(CharBuffer, 0, ReadCount));
// end;
// end;
// ExitCode := Proc.ExitStatus;
//
// finally
// Proc.Free;
// Halt(ExitCode);
// end;
//end;
procedure AdjustBalloonPosition;
var
@ -504,24 +504,24 @@ begin
{$ENDIF}
end;
procedure GetDistrName; // This will be altered after testing on different distros, so to eliminate the $distro on CameraControl.sh
var
AStringList : TStringList;
AProcess : TProcess;
begin
AProcess := TProcess.Create(nil);
AProcess.Executable := '/bin/sh';
AProcess.Parameters.Add('-c');
AProcess.Parameters.Add('cat /etc/lsb-release | grep DISTRIB_ID=');
AProcess.Options := AProcess.Options + [poWaitOnExit, poUsePipes];
AProcess.Execute;
AStringList := TStringList.Create;
AStringList.LoadFromStream(AProcess.Output);
DistrNameStr := Copy(AStringList.Strings[AstringList.Count-1], 12, Length(AStringList.Strings[AstringList.Count-1]));
AStringList.Free;
AProcess.Free;
end;
//procedure GetDistrName; // This will be altered after testing on different distros, so to eliminate the $distro on CameraControl.sh
//var
// AStringList : TStringList;
// AProcess : TProcess;
//begin
// AProcess := TProcess.Create(nil);
// AProcess.Executable := '/bin/sh';
// AProcess.Parameters.Add('-c');
// AProcess.Parameters.Add('cat /etc/lsb-release | grep DISTRIB_ID=');
// AProcess.Options := AProcess.Options + [poWaitOnExit, poUsePipes];
// AProcess.Execute;
// AStringList := TStringList.Create;
// AStringList.LoadFromStream(AProcess.Output);
// DistrNameStr := Copy(AStringList.Strings[AstringList.Count-1], 12, Length(AStringList.Strings[AstringList.Count-1]));
//
// AStringList.Free;
// AProcess.Free;
//end;
procedure GetMicCaptureStatus;
var
@ -623,7 +623,8 @@ begin
j := 0;
while j <= AStringList.Count - 1 do
begin
S := FpSystem(Concat('echo ', Password2, ' | sudo -S kill -KILL ' , AStringList.Strings[j]));
//S := FpSystem(Concat('echo ', Password2, ' | sudo -S kill -KILL ' , AStringList.Strings[j]));
S := FpSystem(Concat('sudo kill -KILL ' , AStringList.Strings[j]));
Inc(j);
end;
@ -656,10 +657,10 @@ begin
CaptureAppName := '';
//StrLength := 0;
if (Length(Password2) > 0) and (HasPassword = true) then // Full test command is: lsof /dev | grep video && ls /dev/ | grep v4l
Str2 := Concat('echo ', Password2, ' | sudo -S sh -c "lsof /dev | grep video"')
else
Str2 := Concat('lsof /dev/ ' , '|' , ' grep video');
//if (Length(Password2) > 0) and (HasPassword = true) then // Full test command is: lsof /dev | grep video && ls /dev/ | grep v4l
// Str2 := Concat('echo ', Password2, ' | sudo -S sh -c "lsof /dev | grep video"')
//else
Str2 := Concat('sudo lsof /dev/ ' , '|' , ' grep video');
Str := Str2;
AStringList := TStringList.Create;
@ -927,51 +928,51 @@ begin
end;
procedure GetCapturePassword;
begin
if (HasPassword = false) and (WantsPassword = true) then
begin
PasswordInputQuery;
if InputForm.Form7.CancelOk = false then
begin
S := FpSystem(Concat('echo ', Password2, ' | sudo -S sh -c "ls /root"'));
if S <> 0 then
begin
WantsPassword := false;
Form1.MenuItem38.Visible := true;
HasPassword := false;
Password2 := '';
NoCapturePassword;
end
else
begin
if (HasPassword = false) and (Length(Password2) > 0) then
Password := Password2;
WantsPassword := false;
Form1.MenuItem38.Visible := false;
HasPassword := true;
MessageForm.Form8.Caption := 'Camera Control for Linux';
MessageForm.Form8.Button1.Caption := 'Ok';
MessageForm.Form8.Label1.Caption := 'Password is Correct' + LineEnding +
' ' + LineEnding +
'Now Kill Capturing (Sudo) is available' + LineEnding +
'on the Camera Indicator Menu' + LineEnding +
' ' + LineEnding +
'Got correct password from User' + LineEnding +
'Input';
MessageForm.Form8.ImageList.GetBitmap(7, MessageForm.Form8.Image.Picture.Bitmap);
MessageForm.Form8.ShowModal;
//ShowMessage( 'Password is Correct' + sLineBreak +
// 'Now Kill Capturing (Sudo) is available' + sLineBreak +
// 'on the Camera Indicator Menu');
end;
end
else
NoCapturePassword;
end;
end;
//procedure GetCapturePassword;
//begin
// if (HasPassword = false) and (WantsPassword = true) then
// begin
// PasswordInputQuery;
// if InputForm.Form7.CancelOk = false then
// begin
// S := FpSystem(Concat('echo ', Password2, ' | sudo -S sh -c "ls /root"'));
// if S <> 0 then
// begin
// WantsPassword := false;
// Form1.MenuItem38.Visible := true;
// HasPassword := false;
// Password2 := '';
// NoCapturePassword;
// end
// else
// begin
// if (HasPassword = false) and (Length(Password2) > 0) then
// Password := Password2;
// WantsPassword := false;
// Form1.MenuItem38.Visible := false;
// HasPassword := true;
//
// MessageForm.Form8.Caption := 'Camera Control for Linux';
// MessageForm.Form8.Button1.Caption := 'Ok';
// MessageForm.Form8.Label1.Caption := 'Password is Correct' + LineEnding +
// ' ' + LineEnding +
// 'Now Kill Capturing (Sudo) is available' + LineEnding +
// 'on the Camera Indicator Menu' + LineEnding +
// ' ' + LineEnding +
// 'Got correct password from User' + LineEnding +
// 'Input';
// MessageForm.Form8.ImageList.GetBitmap(7, MessageForm.Form8.Image.Picture.Bitmap);
// MessageForm.Form8.ShowModal;
//
// //ShowMessage( 'Password is Correct' + sLineBreak +
// // 'Now Kill Capturing (Sudo) is available' + sLineBreak +
// // 'on the Camera Indicator Menu');
// end;
// end
// else
// NoCapturePassword;
// end;
//end;
procedure TForm1.FormCreate(Sender: TObject);
@ -1009,6 +1010,7 @@ begin
LogsDateString := FormatDateTime('DD/MM/YYYY-hh:mm:ss',now);
LogsFileNameDir := HomeDir + '.cameracontrol-' + LogsDateString + '.log';
SavedLogsFilenameDir := '.cameracontrol-' + LogsDateString + '.log';
HasPassword := true;
LogsStringList.Clear;
//Logs.Form3.StringGrid1.Clean;
@ -1259,7 +1261,8 @@ begin
else
begin
AskPassword;
S := FpSystem(Concat('echo ', Password, ' | sudo -S ls /root '));
//S := FpSystem(Concat('echo ', Password, ' | sudo -S ls /root '));
S := FpSystem(Concat('sudo ls /root '));
if S <> 0 then
begin
MessageForm.Form8.Caption := 'Camera Control for Linux';
@ -1320,7 +1323,8 @@ begin
if (HasPassword = false) then
begin
MenuPasswordInputQuery;
S := FpSystem(Concat('echo ', Password, ' | sudo -S sh -c "ls /root"'));
//S := FpSystem(Concat('echo ', Password, ' | sudo -S sh -c "ls /root"'));
S := FpSystem('sudo ls /root');
if S <> 0 then
begin
Form1.MenuItem38.Visible := true;
@ -1531,7 +1535,8 @@ begin
CmdString := Concat(Concat(Concat('echo ', BlackListStr),' >> '), FileString);
S := FpSystem(CmdString);
CmdString := Concat(Concat(Concat(Concat('echo ', Password), ' | sudo -S cp '), FileString), FileDestDir);
//CmdString := Concat(Concat(Concat(Concat('echo ', Password), ' | sudo -S cp '), FileString), FileDestDir);
CmdString := Concat(Concat(Concat('sudo cp '), FileString), FileDestDir);
S := FpSystem(CmdString);
CheckSStatus;
@ -1565,7 +1570,8 @@ begin
begin
AskPassword;
end;
CmdString := Concat(Concat(Concat('echo ', Password), ' | sudo -S rm '), FileDestDir);
//CmdString := Concat(Concat(Concat('echo ', Password), ' | sudo -S rm '), FileDestDir);
CmdString := Concat('sudo rm ', FileDestDir);
S := FpSystem(CmdString);
CheckSStatus;
if (S = 0) then
@ -1624,7 +1630,8 @@ begin
begin
AskPassword;
end;
CmdString := Concat(Concat(Concat(Concat('echo ', Password), ' | sudo -S cp '), FileString), FileDestDir);
//CmdString := Concat(Concat(Concat(Concat('echo ', Password), ' | sudo -S cp '), FileString), FileDestDir);
CmdString := Concat('sudo cp ', FileString, FileDestDir);
S:= FpSystem(CmdString);
CheckSStatus;
if (S = 0) and (HasPassword = true) then
@ -1652,7 +1659,8 @@ begin
CmdString := '';
AskPassword;
FileString := '/etc/modprobe.d/blacklistaudio.conf';
CmdString := Concat(Concat(Concat('echo ', Password), ' | sudo -S rm '), FileString);
//CmdString := Concat(Concat(Concat('echo ', Password), ' | sudo -S rm '), FileString);
CmdString := Concat(Concat('sudo -S rm '), FileString);
if (FileExists(FileString) = true) then
begin
@ -1697,14 +1705,15 @@ end;
procedure CameraOn;
begin
S := FpSystem(Concat('echo ', Password, ' | sudo -S modprobe uvcvideo'));
//S := FpSystem(Concat('echo ', Password, ' | sudo -S modprobe uvcvideo'));
S := FpSystem('sudo -S modprobe uvcvideo');
CheckSStatus;
end;
procedure CameraOff;
begin
S := FpSystem(Concat('echo ', Password, ' | sudo -S rmmod -f uvcvideo'));
//S := FpSystem(Concat('echo ', Password, ' | sudo -S modprobe -rf uvcvideo'));
//S := FpSystem(Concat('echo ', Password, ' | sudo -S rmmod -f uvcvideo'));
S := FpSystem('sudo modprobe -rf uvcvideo');
CheckSStatus;
end;
@ -2254,7 +2263,7 @@ begin
PopUpWebcamHacked;
Logs.Form3.StringGrid1.InsertRowWithValues ( GridLine, [IntToStr(GridLine), FormatDateTime('dd/mm/yyyy, ', HackedTime)
+ RightStr(DateTimeToStr(VPClock1.Time), 8), 'Camera Hacked from Captuting to Off', IntToStr(VideoDevicesNumber)]);
+ RightStr(DateTimeToStr(VPClock1.Time), 8), 'Camera Hacked from Capturing to Off', IntToStr(VideoDevicesNumber)]);
ImageListStatus.GetIcon(1, TrayIcon3.Icon);
ImageListCam1.GetIcon(0, TrayIcon5.Icon);
@ -2405,55 +2414,55 @@ begin
end;
procedure CheckCapturePassword;
begin
//Password2 := RightStr(Password2, Length(Password2) - 1);
//ShowMessage(Password2 + ', ' + IntToStr(Length(Password2)));
S := FpSystem(Concat('echo ', Password2, ' | sudo -S sh -c "ls /root"'));
if S <> 0 then
begin
Form1.MenuItem13.Visible := true;
Form1.MenuItem37.Visible := false;
Form1.MenuItem38.Visible := true;
HasPassword := false;
Password2 := '';
NoCapturePassword;
WantsPassword := true;
Form1.MenuItem13.Visible := true;
end
else
begin
Password := Password2;
Form1.MenuItem13.Visible := false;
Form1.MenuItem37.Visible := true;
Form1.MenuItem38.Visible := false;
HasPassword := true;
MessageForm.Form8.Caption := 'Camera Control for Linux';
MessageForm.Form8.Button1.Caption := 'Ok';
MessageForm.Form8.Label1.Caption := 'Password is Correct' + LineEnding +
' ' + LineEnding +
'Now Kill Capturing (Sudo) is available' + LineEnding +
'on the Camera Indicator Menu' + LineEnding +
' ' + LineEnding +
'Got correct password from startup' + LineEnding +
'parameter';
MessageForm.Form8.ImageList.GetBitmap(7, MessageForm.Form8.Image.Picture.Bitmap);
MessageForm.Form8.ShowModal;
WantsPassword := false;
end;
end;
//procedure CheckCapturePassword;
//begin
// //Password2 := RightStr(Password2, Length(Password2) - 1);
// //ShowMessage(Password2 + ', ' + IntToStr(Length(Password2)));
// S := FpSystem(Concat('echo ', Password2, ' | sudo -S sh -c "ls /root"'));
// if S <> 0 then
// begin
// Form1.MenuItem13.Visible := true;
// Form1.MenuItem37.Visible := false;
// Form1.MenuItem38.Visible := true;
// HasPassword := false;
// Password2 := '';
// NoCapturePassword;
// WantsPassword := true;
// Form1.MenuItem13.Visible := true;
// end
// else
// begin
// Password := Password2;
// Form1.MenuItem13.Visible := false;
// Form1.MenuItem37.Visible := true;
// Form1.MenuItem38.Visible := false;
// HasPassword := true;
//
// MessageForm.Form8.Caption := 'Camera Control for Linux';
// MessageForm.Form8.Button1.Caption := 'Ok';
// MessageForm.Form8.Label1.Caption := 'Password is Correct' + LineEnding +
// ' ' + LineEnding +
// 'Now Kill Capturing (Sudo) is available' + LineEnding +
// 'on the Camera Indicator Menu' + LineEnding +
// ' ' + LineEnding +
// 'Got correct password from startup' + LineEnding +
// 'parameter';
// MessageForm.Form8.ImageList.GetBitmap(7, MessageForm.Form8.Image.Picture.Bitmap);
// MessageForm.Form8.ShowModal;
//
// WantsPassword := false;
// end;
//
//end;
procedure TForm1.VpClock1SecondChange(Sender: TObject);
begin
if (FromMain = true) and (CompareText(RightStr(Password2, Length(Password2) - 1), '') > 0) and (HasPassword = false) then
CheckCapturePassword
else
if (FromMain = true) and (CompareText(RightStr(Password2, Length(Password2) - 1), '') = 0) and (HasPassword = false) then
GetCapturePassword;
//if (FromMain = true) and (CompareText(RightStr(Password2, Length(Password2) - 1), '') > 0) and (HasPassword = false) then
// CheckCapturePassword
//else
// if (FromMain = true) and (CompareText(RightStr(Password2, Length(Password2) - 1), '') = 0) and (HasPassword = false) then
// GetCapturePassword;
CheckEvents;
end;

124
notifier.pas Normal file
View File

@ -0,0 +1,124 @@
unit notifier;
{$mode objfpc}{$H+}
{ Copyright (C) 2017-2020 David Bannon
License:
This code is licensed under BSD 3-Clause Clear License, see file License.txt
or https://spdx.org/licenses/BSD-3-Clause-Clear.html
------------------
A trivial unit that uses libnotify on Linux and a timed out TPopupNotify on other platforms.
Does very little, on linux it just calls libnotify, https://github.com/ik5/libnotify-fpc
On Non-Linux, it calls TPopupNotifier, sets a timer and removes the Popup after the set
time (in mS). In both cases, it then destroys itself !
Yes, you call create but YOU DO NOT FREE it !
To use it, grab libnotify.pas, add it and this unit to your Lazarus project and do
something like this -
procedure TForm1.Button2Click(Sender: TObject);
var
Notifier : TNotifier;
begin
Notifier := TNotifier.Create;
Notifier.ShowTheMessage('This is Title', 'and this is the message', 15000); // 15 seconds
// Note, don't free it, it frees itself.
end;
On Linux, multitheading must be enabled, in the project (lpr) file, add
{$DEFINE UseCThreads} immediatly above the first "uses" line.
On Linux, to compile you need the dev version of libnotify but at run time all
that is needed is libnotify and it appears to be installed on most if not all distros.
On tomboy-ng, my model is that "oh, you might like to know" type notifications take the common
6 seconds. Things the end user might really need to know, such as sync drive not being available
I give 12 seconds. Something, really urgent (I don't have any) might get longer. Its incorrect
to leave messages that really don't need user action there for very long.
}
interface
uses
Classes, SysUtils, fpTimer{$ifdef Linux}, libnotify{$else}, PopupNotifier {$endif} ;
Type
{ TNotifier }
TNotifier = class
private
{$ifdef LINUX}
LNotifier : PNotifyNotification;
{$else}
LocalTimer : TFPTimer;
PopupNotifier: TPopupNotifier;
procedure TimerFinished( Sender : TObject );
{$endif}
public
procedure ShowTheMessage(const Title, Message : string; ShowTime : integer = 6000);
destructor Destroy; Override;
constructor Create();
end;
implementation
procedure TNotifier.ShowTheMessage(const Title, Message : string; ShowTime : integer);
begin
{$ifdef LINUX}
notify_init(argv[0]);
LNotifier := notify_notification_new (pchar(Title), pchar(Message), pchar('dialog-information'));
notify_notification_set_timeout(LNotifier, ShowTime); // figure is mS
notify_notification_show (LNotifier, nil);
notify_uninit;
Destroy;
// Should also check for errors and use TPopupNotifier if Notify won't work
// But that will have to wait until I find a Linux where it does not work .....
{$else}
// Non Linux must use TPopupNotifier
PopupNotifier := TPopupNotifier.Create(nil);
PopupNotifier.Text := Message;
PopupNotifier.Title := Title;
PopupNotifier.show;
LocalTimer := TFPTimer.create(nil);
LocalTimer.Interval := ShowTime;
LocalTimer.OnTimer:= @TimerFinished;
LocalTimer.Enabled := True;
{$endif}
end;
{$ifndef LINUX}
procedure TNotifier.TimerFinished( Sender : TObject );
begin
// writeln('Timer finished');
LocalTimer.Enabled := false;
PopupNotifier.hide;
Destroy;
end;
{$endif}
destructor TNotifier.Destroy;
begin
{$ifndef LINUX}
freeandnil(PopupNotifier);
freeandnil(LocalTimer);
{$endif}
inherited Destroy;
end;
constructor TNotifier.Create();
begin
inherited Create();
end;
end.

View File

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>
<vendor>Camera Control</vendor>
<vendor_url>https://artixlinux.org</vendor_url>
<icon_name>cameracontrol</icon_name>
<action id="org.artixlinux.cameracontrol">
<description>Run Camera Control as root</description>
<description xml:lang="ar">شغّل مُقسِّم‌ج بصلاحية الجذر</description>
<description xml:lang="be">Запусціць Camera Control ад імя суперкарыстальніка</description>
<description xml:lang="cs">Spouštět Camera Control pod uživatelem root</description>
<description xml:lang="da">Kør Camera Control som root</description>
<description xml:lang="de">Camera Control als Root-Benutzer ausführen</description>
<description xml:lang="el">Εκτέλεση Camera Control ως root</description>
<description xml:lang="en_GB">Run Camera Control as root</description>
<description xml:lang="eo">Ruli Camera Control kiel root</description>
<description xml:lang="es">Ejecutar Camera Control como root</description>
<description xml:lang="eu">Exekutatu Camera Control 'root' gisa</description>
<description xml:lang="fi">Suorita Camera Control root-käyttäjänä</description>
<description xml:lang="fr">Lancer Camera Control en tant quutilisateur root</description>
<description xml:lang="fur">Eseguìs Camera Control come root</description>
<description xml:lang="hr">Pokreni Camera Control kao korijenskog korisnika</description>
<description xml:lang="hu">Camera Control futtatása rendszergazdaként</description>
<description xml:lang="id">Jalankan Camera Control sebagai root</description>
<description xml:lang="is">Keyra Camera Control sem kerfisstjóri/root</description>
<description xml:lang="it">Esegui Camera Control come root</description>
<description xml:lang="kk">Camera Control қолданбасын әкімші ретінде жөнелту</description>
<description xml:lang="ko">루트 권한으로 Camera Control 실행</description>
<description xml:lang="lt">Vykdyti Camera Control root teisėmis</description>
<description xml:lang="lv">Palaist Camera Control kā root</description>
<description xml:lang="nl">Camera Control uitvoeren als systeembeheerder (root)</description>
<description xml:lang="pl">Uruchomienie programu Camera Control jako administrator</description>
<description xml:lang="pt_BR">Execute Camera Control como root</description>
<description xml:lang="ro">Rulează Camera Control ca root</description>
<description xml:lang="ru">Запустить Camera Control с правами root</description>
<description xml:lang="sk">Spustiť Camera Control ako správca</description>
<description xml:lang="sr">Покрените Гпартед као администратор</description>
<description xml:lang="sr@latin">Pokrenite Gparted kao administrator</description>
<description xml:lang="sv">Kör Camera Control som root</description>
<description xml:lang="tr">Camera Controlʼi kök olarak çalıştır</description>
<description xml:lang="vi">Chạy Camera Control với tư cách siêu quản trị</description>
<description xml:lang="zh_TW">以 root 執行 Camera Control</description>
<message>Authentication is required to run the Camera Control Partition Editor as root</message>
<message xml:lang="be">Для запуску Camera Control ад імя суперкарыстальніка патрабуецца аўтэнтыфікацыя</message>
<message xml:lang="cs">Ke spuštění editoru oddílů Camera Control pod uživatelem root je vyžadováno ověření</message>
<message xml:lang="da">Godkendelse er krævet for at køre partitioneringsprogrammet Camera Control som root</message>
<message xml:lang="de">Legitimierung ist erforderlich, um Camera Control als Root-Benutzer auszuführen</message>
<message xml:lang="en_GB">Authentication is required to run the Camera Control Partition Editor as root</message>
<message xml:lang="eo">Necesas aŭtentigo por ruli Camera Control Subdiskoredaktilo kiel root</message>
<message xml:lang="es">Se necesita autenticación para ejecutar el editor de particiones Camera Control como root</message>
<message xml:lang="eu">Camera Control partizioen editorea 'root' pribilegiorekin exekutatzeko beharrezkoa da autentifikatzea</message>
<message xml:lang="fi">Tunnistautuminen vaaditaa Camera Control-osiomuokkaimen suorittamiseksi root-käyttäjänä</message>
<message xml:lang="fr">Il est nécessaire de sauthentifier pour lancer léditeur de partitions Camera Control en tant quutilisateur root</message>
<message xml:lang="fur">La autenticazion e je necessarie par eseguî come root l'editôr di partizions Camera Control</message>
<message xml:lang="hr">Potrebna je ovjera za pokretanje Camera Control uređivača particija kao korijenskog korisnika</message>
<message xml:lang="hu">Hitelesítés szükséges a Camera Control partíciószerkesztő rendszergazdaként való futtatásához</message>
<message xml:lang="id">Otentikasi diperlukan untuk menjalankan Penyunting Partisi Camera Control sebagai root</message>
<message xml:lang="is">Auðkenningar er krafist til að keyra Camera Control disksneiðingarstjórann sem kerfisstjóri (root)</message>
<message xml:lang="it">È richiesto autenticarsi per eseguire «Editor di partizioni Camera Control» come root</message>
<message xml:lang="kk">Camera Control бөлімдер түзеткішін әкімші ретінде жөнелту үшін аутентификация керек</message>
<message xml:lang="ko">Camera Control 분할 영역 편집기를 루트 권한으로 실행하려면 인증이 필요합니다</message>
<message xml:lang="lt">Reikia patvirtinti tapatybę norint vykdyti Camera Control skirsnių redaktorių root teisėmis</message>
<message xml:lang="lv">Nepieciešama autentificēšana, lai palaistu Camera Control nodalījumu redaktoru ar root tiesībām</message>
<message xml:lang="nl">Authenticatie is vereist om Camera Control partitiebewerker uit te voeren als systeembeheerder (root)</message>
<message xml:lang="pl">Wymagane jest uwierzytelnienie, aby uruchomić edytora partycji Camera Control jako administrator</message>
<message xml:lang="pt_BR">Autenticação é necessária para executar o Editor de Partições Camera Control como root</message>
<message xml:lang="ro">Autentificarea este necesară pentru a rula Editorul de partiții Camera Control ca root</message>
<message xml:lang="ru">Требуется авторизация для запуска редактора разделов Camera Control с правами root</message>
<message xml:lang="sk">Na spustenie editora oddielov Camera Control ako správca sa vyžaduje overenie totožnosti</message>
<message xml:lang="sr">Потребно је потврђивање идентитета за покретање Гпартеда као администратор</message>
<message xml:lang="sr@latin">Potrebno je potvrđivanje identiteta za pokretanje Gparteda kao administrator</message>
<message xml:lang="sv">Autentisering krävs för att köra Camera Control partitionsredigerare som root</message>
<message xml:lang="tr">Camera Control Disk Bölümü Düzenleyicisiʼni kök olarak çalıştırmak içinyetkilendirme gereklidir</message>
<message xml:lang="vi">Cần xác thực để chạy bộ Sửa phân vùng đĩa Camera Control dưới tư cách siêu quản trị</message>
<message xml:lang="zh_TW">需要驗證才能以 root 執行 Camera Control 分割區編輯器</message>
<defaults>
<allow_any>auth_admin</allow_any>
<allow_inactive>auth_admin</allow_inactive>
<allow_active>auth_admin</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/notify-send</annotate>
<annotate key="org.freedesktop.policykit.exec.path">/opt/CameraControl/cameracontrol.bin</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action>
</policyconfig>